Explorar o código

[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 %!s(int64=11) %!d(string=hai) anos
pai
achega
964c344784
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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;