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

try to get eval order right

Why is this always giving me so much trouble?
Simon Krajewski 9 жил өмнө
parent
commit
37c8e0c390
1 өөрчлөгдсөн 10 нэмэгдсэн , 0 устгасан
  1. 10 0
      analyzer.ml

+ 10 - 0
analyzer.ml

@@ -446,6 +446,16 @@ module TexprFilter = struct
 						| TLocal v2 when v1 == v2 && not !affected ->
 							found := true;
 							e1
+						| TBinop((OpAssign | OpAssignOp _ as op),({eexpr = TArray(e1,e2)} as ea),e3) ->
+							let e1 = replace e1 in
+							let e2 = replace e2 in
+							let ea = {ea with eexpr = TArray(e1,e2)} in
+							let e3 = replace e3 in
+							{e with eexpr = TBinop(op,ea,e3)}
+						| TBinop((OpAssign | OpAssignOp _ as op),e1,e2) ->
+							let e2 = replace e2 in
+							let e1 = replace e1 in
+							{e with eexpr = TBinop(op,e1,e2)}
 						| TCall({eexpr = TLocal v},_) when is_unbound v ->
 							e
 						| _ ->