Sfoglia il codice sorgente

[js] generate array literal for "new Array<T>()" expressions as it still seems to be the fastest way (see http://stackoverflow.com/questions/7375120/why-is-arr-faster-than-arr-new-array)

Dan Korostelev 11 anni fa
parent
commit
964c344784
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      genjs.ml

+ 2 - 0
genjs.ml

@@ -579,6 +579,8 @@ and gen_expr ctx e =
 				spr ctx " = ";
 				gen_value ctx e
 		end
+	| TNew ({ cl_path = [],"Array" },_,[]) ->
+		print ctx "[]"
 	| TNew (c,_,el) ->
 		print ctx "new %s(" (ctx.type_accessor (TClassDecl c));
 		concat ctx "," (gen_value ctx) el;