Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix] compiler: Add skipped idents of exported ones

  • Loading branch information...
commit da8f83bd4d8e17c50f573f36a2100f617b779ac6 1 parent e2f71ea
@BourgerieQuentin BourgerieQuentin authored
View
22 compiler/opa/passes.ml
@@ -601,7 +601,7 @@ Please use a bsl plugin@\n" (BslKey.to_string key)
~typing:(env.newFinalCompile_qml_milkshake.QmlBlender.env)
() in
let code = env.newFinalCompile_qml_milkshake.QmlBlender.code in
- let code =
+ let private_env, code =
let side = if client then `client else `server in
try
(if opaoptions.OpaEnv.cps then QmlCpsRewriter.cps_pass ~side
@@ -612,8 +612,26 @@ Please use a bsl plugin@\n" (BslKey.to_string key)
OManager.printf "During CPS transformation :@\n%s@\n" (QmlCpsRewriter.error_message error) ;
raise e (** plus + : very usefull to see the backtrace *)
in
+ let update_exported exported =
+ IdentSet.fold
+ (fun i exported ->
+ match QmlCpsRewriter.private_env_get_skipped_ident private_env i with
+ | Some skip_id -> IdentSet.add skip_id exported
+ | None -> match QmlRenamingMap.new_from_original_opt
+ env.newFinalCompile_renaming_server i with
+ | None -> exported
+ | Some i2 -> match QmlCpsRewriter.private_env_get_skipped_ident private_env i2 with
+ | Some skip_id -> IdentSet.add skip_id exported
+ | None -> exported
+ ) exported exported
+ in
+ let exported = update_exported env.newFinalCompile_exported in
+ (* ignore (PassTracker.print ~passname:"CPSEXPORTED" ~printer_id:"js_exported" (IdentSet.pp ", " QmlPrint.pp#ident) exported); *)
let qml_milkshake = { env.newFinalCompile_qml_milkshake with QmlBlender.code = code } in
- { env with newFinalCompile_qml_milkshake = qml_milkshake }
+ { env with
+ newFinalCompile_qml_milkshake = qml_milkshake;
+ newFinalCompile_exported = exported;
+ }
type env_BinaryGeneration = {
View
3  compiler/qmlcompilers/qmlCompilers.ml
@@ -626,7 +626,7 @@ struct
~typing:env_typer
()
in
- let code =
+ let _, code =
let fct () =
(if options.cps then QmlCpsRewriter.cps_pass ~side:`server else QmlCpsRewriter.no_cps_pass)
env_cps code
@@ -748,6 +748,7 @@ struct
let renaming = QmlRenamingMap.empty in
let is_distant _ = false in
let env_js_input = B.compile options ~is_distant ~renaming
+ ~exported:IdentSet.empty
~bsl:generated_ast env_bsl env_typer code
~bsl_lang:BslLanguage.js in
PassHandler.make_env options (loaded_bsl, env_bsl, env_js_input)
View
7 compiler/qmlcps/qmlCpsRewriter.ml
@@ -156,6 +156,11 @@ let private_binding (private_env:private_env) =
let private_env_get_skipped_fun id private_env =
IdentMap.find_opt id private_env.skipped_functions
+let private_env_get_skipped_ident private_env id =
+ Option.map
+ (fun (_, skip_id, _) -> skip_id)
+ (IdentMap.find_opt id private_env.skipped_functions)
+
module S =
struct
@@ -1883,6 +1888,7 @@ let cps_pass ~side env qml_code =
debug "il substitution global time : %f s." (Factorize.chrono_subst ())
#<End> in
+ private_env,
match private_binding private_env with
| [] -> r
| bindings ->
@@ -1934,6 +1940,7 @@ let no_cps_pass env code =
else expr
| _ -> expr
in
+ private_env,
QmlAstWalk.CodeExpr.map
(QmlAstWalk.Expr.map_up rewrite)
code
View
8 compiler/qmlcps/qmlCpsRewriter.mli
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.
@@ -154,6 +154,8 @@ type private_env
*)
val private_env_initial : unit -> private_env
+val private_env_get_skipped_ident : private_env -> Ident.t -> Ident.t option
+
(** {6 Internal traduction} *)
(**
Exported in this interface for interaction and debugging with
@@ -218,9 +220,9 @@ val code : env -> private_env -> QmlAst.code -> private_env * QmlAst.code
+ qmflat use only a very small part of gamma.
+ maybe we can add some directives for record access optimization.
*)
-val cps_pass : side:[`server|`client] -> env -> QmlAst.code -> QmlAst.code
+val cps_pass : side:[`server|`client] -> env -> QmlAst.code -> private_env * QmlAst.code
-val no_cps_pass : env -> QmlAst.code -> QmlAst.code
+val no_cps_pass : env -> QmlAst.code -> private_env * QmlAst.code
(** {6 Common tools for back-ends} *)
Please sign in to comment.
Something went wrong with that request. Please try again.