Permalink
Browse files

[fix] qmljs_Serializer: side-effect bug with assignement (introduce by

  • Loading branch information...
1 parent 1c08854 commit c33cbe8be48262798e81c00a481a9ce198c673da @OpaOnWindowsNow OpaOnWindowsNow committed Sep 21, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 qml2js/qmljs_Serializer.ml
@@ -235,11 +235,12 @@ struct
we need to handle this *)
let rec is_side_effect_expr ~local_vars expr =
JsWalk.OnlyExpr.exists (function
- | J.Je_unop (_, unop, e) ->
- JsAst.is_side_effect_unop unop && not(is_in_local_vars local_vars e)
+ | J.Je_unop (_, unop, e) when JsAst.is_side_effect_unop unop ->
+ is_side_effect_expr ~local_vars e || not(is_in_local_vars local_vars e)
- | J.Je_binop (_, binop, e, _) ->
- JsAst.is_side_effect_binop binop && not(is_in_local_vars local_vars e)
+ | J.Je_binop (_, binop, e1, e2) when JsAst.is_side_effect_binop binop ->
+ is_side_effect_expr ~local_vars e1 || is_side_effect_expr ~local_vars e1
+ || not(is_in_local_vars local_vars e2)
| J.Je_call (_, f, args, pure) ->
let side_effect_fun = match f with

0 comments on commit c33cbe8

Please sign in to comment.