From 50327f1adfefef2cdc07a69186712aa7579fe699 Mon Sep 17 00:00:00 2001 From: Bourgerie Quentin Date: Fri, 19 Oct 2012 18:08:16 +0200 Subject: [PATCH] [fix] compiler, js: Keep also distant identifier (needed for closure serialization) --- compiler/qmljsimp/imp_Compiler.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/qmljsimp/imp_Compiler.ml b/compiler/qmljsimp/imp_Compiler.ml index 65597806..c340ceb5 100644 --- a/compiler/qmljsimp/imp_Compiler.ml +++ b/compiler/qmljsimp/imp_Compiler.ml @@ -256,7 +256,12 @@ let compile # Printf.printf "clean up: %fs\n%!" (_chrono.Chrono.read ()); _chrono.Chrono.restart () #; # ignore (PassTracker.file ~filename:"js_imp_7_cleanup" _outputer js_code) #; let js_code = - let keep = (fun i -> JsIdentSet.mem i exported) in + let keep = (fun i -> JsIdentSet.mem i exported || + match i with + | JsAst.ExprIdent i -> is_distant i + | _ -> false + ) + in Imp_Cleaning.process_code ~keep js_code in