2
0
Эх сурвалжийг харах

disable `o["s"]` to `o.s` rewrite (see #5724)

Simon Krajewski 9 жил өмнө
parent
commit
77aa32d6c0

+ 2 - 2
src/generators/genjs.ml

@@ -490,9 +490,9 @@ and gen_expr ctx e =
 	(match e.eexpr with
 	| TConst c -> gen_constant ctx e.epos c
 	| TLocal v -> spr ctx (ident v.v_name)
-	| TArray (e1,{ eexpr = TConst (TString s) }) when valid_js_ident s && (match e1.eexpr with TConst (TInt _|TFloat _) -> false | _ -> true) ->
+	(*| TArray (e1,{ eexpr = TConst (TString s) }) when valid_js_ident s && (match e1.eexpr with TConst (TInt _|TFloat _) -> false | _ -> true) ->
 		gen_value ctx (add_objectdecl_parens e1);
-		spr ctx (field s)
+		spr ctx (field s)*)
 	| TArray (e1,e2) ->
 		gen_value ctx (add_objectdecl_parens e1);
 		spr ctx "[";

+ 1 - 1
tests/optimization/src/TestJs.hx

@@ -229,7 +229,7 @@ class TestJs {
 
 	@:js('
 		var map = new haxe_ds_StringMap();
-		if(__map_reserved.some != null) {map.setReserved("some",2);} else {map.h["some"] = 2;}
+		if(__map_reserved["some"] != null) {map.setReserved("some",2);} else {map.h["some"] = 2;}
 		TestJs["use"](2);
 	')
 	static function testIssue4731() {