Skip to content

Commit

Permalink
[fix] closure serialisation: fix a bug introduced in 62b1c37
Browse files Browse the repository at this point in the history
  • Loading branch information
OpaOnWindowsNow committed Nov 22, 2011
1 parent 0cc06ad commit 592098e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions qmlpasses/pass_InstrumentForClosureSerialization.ml
Expand Up @@ -284,10 +284,12 @@ let rewrite_identifiers always_serialize env annotmap code =
| _ -> None
in
let identity annotmap e = (annotmap,e) in
let rec rw_call_site ~has_public_env e = match e with
let rm_public_env e = match e with
| Q.Directive (_, `public_env, ([]|_::_::_) , _ ) -> assert false (* see detect_candidate_call *)
| Q.Directive (_, `public_env, [e], _ ) -> rw_call_site ~has_public_env:true e

| Q.Directive (_, `public_env, [e], _ ) -> true,e
| _ -> false,e
in
let rec rw_call_site ~has_public_env e = match e with
| Q.Ident _ as id
| Q.Directive (_, `partial_apply (_,false), [Q.Apply (_, id , _ )], _)
-> begin match get_ident id with
Expand All @@ -300,7 +302,10 @@ let rewrite_identifiers always_serialize env annotmap code =

| _ -> identity
in
let rw annotmap e = (rw_call_site ~has_public_env:false e) annotmap e in
let rw annotmap e =
let has_public_env, e = rm_public_env e in
(rw_call_site ~has_public_env e) annotmap e
in
QmlAstWalk.CodeExpr.fold_map
(QmlAstWalk.Expr.foldmap
rw
Expand Down

0 comments on commit 592098e

Please sign in to comment.