Permalink
Browse files

[cleanup] blender: reduce dependency to the Blender

 * Jscompiler takes now env_typer + code instead of old blender type
 * flattening env_blender in qmlcompilers (qmljs command line tool)
 * inline the part about typing from the blender in qmlcompilers
   The blender was still used only by qmljs which does not support
   db constructions (used only for debug and tests of pure client code)
   so it does not need to treat db constructions anymore.
  • Loading branch information...
1 parent fd49b14 commit 1a910b2906b85eca9548ab9da1314606d52ea976 Mathieu Barbin committed Jun 22, 2011
Showing with 183 additions and 114 deletions.
  1. +13 −1 opa/pass_JavascriptCompilation.ml
  2. +7 −6 opa/passes.ml
  3. +6 −8 opa/s3Passes.ml
  4. +4 −3 qml2js/qml2js.ml
  5. +1 −1 qml2js/qml2jsOptions.ml
  6. +147 −89 qmlcompilers/qmlCompilers.ml
  7. +5 −6 qmljsimp/imp_Compiler.ml
@@ -304,7 +304,19 @@ let full_serialize
OpaMapToIdent.val_ ~side:`client name
with Not_found ->
OManager.error "Function %S not registered in Opacapi@\n" name in
- let env_js_input = Qml2js.Sugar.for_opa ~bsl:bsl_and_plugin_ast ~val_:env_js_input_val_ ~closure_map ~renaming_server ~renaming_client back_end jsoptions bsl_client client in
+ let env_js_input =
+ Qml2js.Sugar.for_opa
+ ~bsl:bsl_and_plugin_ast
+ ~val_:env_js_input_val_
+ ~closure_map
+ ~renaming_server
+ ~renaming_client
+ back_end
+ jsoptions
+ bsl_client
+ client.QmlBlender.env
+ client.QmlBlender.code
+ in
let rev_code : JsSerializer.jsast_code = [] in
let rev_code = List.fold_left
View
@@ -381,9 +381,10 @@ let extract_env_NewFinalCompile (env:env_NewFinalCompile) =
let rebuild_env_NewFinalCompile (env:env_NewFinalCompile) typerEnv code : env_NewFinalCompile =
let milkshake =
- { env.newFinalCompile_qml_milkshake with
- QmlBlender.env = typerEnv;
- QmlBlender.code = code }
+ { QmlBlender.
+ env = typerEnv ;
+ code ;
+ }
in
{ env with
newFinalCompile_qml_milkshake = milkshake }
@@ -443,9 +444,9 @@ let pass_QmlUncurry2 ~typed ~side ~options:_ env =
Pass_Uncurry.process_code ~side ~typed ~can_be_cleaned gamma annotmap code in
let typerEnv = {typerEnv with QmlTypes.gamma; annotmap} in
let newFinalCompile_qml_milkshake =
- { env.newFinalCompile_qml_milkshake with QmlBlender.
- env = typerEnv;
- code = code;
+ { QmlBlender.
+ env = typerEnv ;
+ code ;
} in
{ env with newFinalCompile_qml_milkshake; newFinalCompile_closure_map }
let pass_QmlClosure2 ~typed ~side ~options env =
View
@@ -1574,8 +1574,6 @@ let pass_SlicedToFinal =
let mk_blender typerEnv sliced_aux =
let blender_milkshake : QmlBlender.qml_milkshake =
{ QmlBlender.env = typerEnv;
- QmlBlender.alphaconv = None;
- QmlBlender.code_typedefs = [];
QmlBlender.code = sliced_aux.P.code;
} in
{ P.
@@ -1705,9 +1703,9 @@ let pass_ResolveJsIdent =
let env =
{ env with P.
newFinalCompile_qml_milkshake =
- { env.P.newFinalCompile_qml_milkshake with
- QmlBlender.code = code;
- QmlBlender.env =
+ { QmlBlender.
+ code = code ;
+ env =
{ env.P.newFinalCompile_qml_milkshake.QmlBlender.env with
QmlTypes.annotmap = annotmap;
}
@@ -1734,8 +1732,8 @@ let pass_GenerateServerAst generate =
let env =
{ env with P.
newFinalCompile_qml_milkshake =
- { env.P.newFinalCompile_qml_milkshake with QmlBlender.
- code;
+ { QmlBlender.
+ code ;
env =
{ env.P.newFinalCompile_qml_milkshake.QmlBlender.env with QmlTypes.
annotmap;
@@ -1775,7 +1773,7 @@ let pass_InitializeBslValues =
let annotmap, code = extract_final_ac env in
let gamma = extract_final_gamma env in
let gamma, annotmap, code = Pass_InitializeBslValues.process_code bypass_typer gamma annotmap code in
- let milkshake = {env.P.newFinalCompile_qml_milkshake with QmlBlender.
+ let milkshake = { QmlBlender.
code = code;
env = {env.P.newFinalCompile_qml_milkshake.QmlBlender.env with QmlTypes.
annotmap = annotmap;
View
@@ -254,15 +254,16 @@ sig
(module Qml2jsOptions.JsBackend) ->
Qml2jsOptions.t ->
BslLib.env_bsl ->
- Qml2ocaml.env_blender ->
+ QmlTyper.env ->
+ QmlAst.code ->
J.env_js_input
val dummy_for_opa : (module Qml2jsOptions.JsBackend) -> unit
end
=
struct
- let for_opa ~val_ ?bsl:bsl_code ~closure_map ~renaming_server ~renaming_client back_end argv bsl blender =
+ let for_opa ~val_ ?bsl:bsl_code ~closure_map ~renaming_server ~renaming_client back_end argv env_bsl env_typer code =
let module M = (val back_end : Qml2jsOptions.JsBackend) in
- let env_js_input = M.compile ~val_ ?bsl:bsl_code ~closure_map ~renaming_server ~renaming_client argv bsl blender in
+ let env_js_input = M.compile ~val_ ?bsl:bsl_code ~closure_map ~renaming_server ~renaming_client argv env_bsl env_typer code in
env_js_input
let dummy_for_opa backend =
let module M = (val backend : Qml2jsOptions.JsBackend) in
@@ -94,7 +94,7 @@ module type JsBackend = sig
?closure_map:Ident.t IdentMap.t ->
renaming_server:QmlRenamingMap.t ->
renaming_client:QmlRenamingMap.t ->
- t -> BslLib.env_bsl -> Qml2ocaml.env_blender -> env_js_input
+ t -> BslLib.env_bsl -> QmlTyper.env -> QmlAst.code -> env_js_input
val name : string
val runtime_libs : cps:bool -> (string * BslJsConf.conf) list
val dummy_compile : unit -> unit (* if the back end is not called because the input code is empty
Oops, something went wrong.

0 comments on commit 1a910b2

Please sign in to comment.