Permalink
Browse files

[enhance] printers: Add stdlib gamma to the qml printers

  • Loading branch information...
1 parent 9f31a35 commit 77daeb8fcd9e664f888595ae949799a227b119d5 @BourgerieQuentin BourgerieQuentin committed Dec 5, 2011
Showing with 21 additions and 8 deletions.
  1. +6 −1 libqmlcompil/qmlTracker.ml
  2. +1 −1 libqmlcompil/qmlTracker.mli
  3. +14 −6 opa/s3Passes.ml
@@ -122,6 +122,7 @@ let annotation_id = define "annotation"
let position_id = define "position"
let tracked_id = define "tracked"
let gamma_id = define "gamma"
+let stdlib_gamma_id = define "stdlib_gamma"
let printers extract _ =
let make_code fct fmt env =
@@ -131,8 +132,11 @@ let printers extract _ =
let annotmap, _, code = extract env in
fct fmt annotmap code in
let make_gamma fct fmt env =
- let _, gamma, _ = extract env in
+ let _, (gamma, _), _ = extract env in
fct fmt gamma in
+ let make_stdlib_gamma fct fmt env =
+ let _, (_, stdlib_gamma), _ = extract env in
+ fct fmt stdlib_gamma in
[
code_id, make_code Printer.code ;
light_ident_id, make_code Printer.light_ident ;
@@ -145,6 +149,7 @@ let printers extract _ =
with_type_id, make_ac Printer.code_with_type;
for_ei_id, make_ac Printer.code_for_ei;
gamma_id, make_gamma Printer.gamma;
+ gamma_id, make_stdlib_gamma Printer.gamma;
(* waiting for flexibility in passhander options *)
(* tracked_id, make Printer.tracked ; *)
]
@@ -50,7 +50,7 @@ val contains_tracker : QmlAst.expr -> bool
in this list douzen of specific printers without risking that they will
all be printed with a --print-all.
*)
-val printers : ('env -> QmlAst.annotmap * QmlTypes.gamma * QmlAst.code) -> 'opt -> (PassHandler.printer_id * 'env PassHandler.printer) list
+val printers : ('env -> QmlAst.annotmap * (QmlTypes.gamma * QmlTypes.gamma) * QmlAst.code) -> 'opt -> (PassHandler.printer_id * 'env PassHandler.printer) list
module Printer :
sig
View
@@ -91,10 +91,11 @@ module Extract = struct
let code env = env.P.qmlAst
let annotmap env = env.P.typerEnv.QmlTypes.annotmap
let gamma env = env.P.typerEnv.QmlTypes.gamma
+ let stdlib_gamma env = env.P.stdlib_gamma
(** Return (annotmap, code).*)
let ac env = (annotmap env, code env)
- let agc env = (annotmap env, gamma env, code env)
+ let agc env = (annotmap env, (gamma env, stdlib_gamma env), code env)
let bymap env = env.P.bsl.BslLib.bymap
let bypass_typer env s = BslLib.BSL.ByPassMap.bypass_typer (bymap env) s
@@ -109,14 +110,15 @@ module Extract = struct
let code_server env = env.P.sliced_env.P.server.P.code
let annotmap env = EnvGen.annotmap (get_env_gen env)
let gamma env = EnvGen.gamma (get_env_gen env)
+ let stdlib_gamma env = EnvGen.stdlib_gamma (get_env_gen env)
(** Return (annotmap, code) for client *)
let a_client env = (annotmap env, code_client env)
- let ag_client env = (annotmap env, gamma env, code_client env)
+ let ag_client env = (annotmap env, (gamma env, stdlib_gamma env), code_client env)
(** Return (annotmap, server) for server *)
let a_server env = (annotmap env, code_server env)
- let ag_server env = (annotmap env, gamma env, code_server env)
+ let ag_server env = (annotmap env, (gamma env, stdlib_gamma env), code_server env)
let bymap env = EnvGen.bymap (get_env_gen env)
let bypass_typer env = EnvGen.bypass_typer (get_env_gen env)
let gamma env = EnvGen.gamma (get_env_gen env)
@@ -1682,11 +1684,13 @@ let pass_FunActionJsCallGeneration =
let extract_client_agc (_, cenv) =
(cenv.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.annotmap,
- cenv.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.gamma,
+ (cenv.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.gamma,
+ QmlTypes.Env.empty),
cenv.P.newFinalCompile_qml_milkshake.QmlBlender.code)
let extract_server_agc (senv, _) =
(senv.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.annotmap,
- senv.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.gamma,
+ (senv.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.gamma,
+ QmlTypes.Env.empty),
senv.P.newFinalCompile_qml_milkshake.QmlBlender.code)
let extract_client (_, cenv) = cenv.P.newFinalCompile_qml_milkshake.QmlBlender.code
let extract_server (senv, _) = senv.P.newFinalCompile_qml_milkshake.QmlBlender.code
@@ -1745,7 +1749,11 @@ let pass_JavascriptCompilation =
env.P.newFinalCompile_qml_milkshake.QmlBlender.code) in
let make_extract_agc make env =
let env = make env in
- let gamma = env.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.gamma in
+ let gamma = (
+ env.P.newFinalCompile_qml_milkshake.QmlBlender.env.QmlTypes.gamma,
+ QmlTypes.Env.empty
+ )
+ in
let annotmap, code = make_extract_ac make env in
annotmap, gamma, code in
let pass pass_env =

0 comments on commit 77daeb8

Please sign in to comment.