diff --git a/compiler/opa/s3Passes.ml b/compiler/opa/s3Passes.ml index 9711b14d..57b43f20 100644 --- a/compiler/opa/s3Passes.ml +++ b/compiler/opa/s3Passes.ml @@ -1797,7 +1797,6 @@ let pass_JavascriptCompilation = ) IdentSet.empty (Opa_Roots.roots_for_s3 ~no_server:false) in (* instrumented closure should not be cleaned *) let client_roots = IdentSet.fold (fun id set -> - let id = QmlRenamingMap.new_from_original client_finalenv.P.newFinalCompile_renaming_client id in IdentSet.add id set ) (pass_InstrumentForClosureSerialization_instrumented()) client_roots in diff --git a/compiler/qmlpasses/pass_InstrumentForClosureSerialization.ml b/compiler/qmlpasses/pass_InstrumentForClosureSerialization.ml index 8cb3ff5e..157377c1 100644 --- a/compiler/qmlpasses/pass_InstrumentForClosureSerialization.ml +++ b/compiler/qmlpasses/pass_InstrumentForClosureSerialization.ml @@ -318,9 +318,9 @@ let rewrite_identifiers always_serialize env annotmap code = let process_code gamma annotmap code = let always_serialize, code = detect_candidate_def code in let need_instrumentation, need_rewrite = detect_candidate_call always_serialize code in - if not(need_rewrite) then (*return*) gamma, annotmap, code, IdentSet.empty else + let need_client_code = IdentSet.union need_instrumentation always_serialize in let (gamma, annotmap, env), code = if not(IdentSet.is_empty need_instrumentation) then generate_instrumented_functions need_instrumentation gamma annotmap code else (gamma, annotmap, empty), code in - let annotmap, code = rewrite_identifiers always_serialize env annotmap code in - gamma, annotmap, code, need_instrumentation + let annotmap, code = if need_rewrite then rewrite_identifiers env annotmap code else (annotmap,code) in + gamma, annotmap, code, need_client_code