Permalink
Browse files

[feature] compiler: Added --backtrace compiler option

  • Loading branch information...
1 parent 5c1b36e commit a31d08096f23c2ebcb08d0b7376fe01a1f92eb07 @BourgerieQuentin BourgerieQuentin committed Oct 11, 2012
Showing with 12 additions and 2 deletions.
  1. +1 −0 compiler/opa/passes.ml
  2. +7 −1 compiler/opalib/opaEnv.ml
  3. +3 −1 compiler/qmlcps/qmlCpsRewriter.ml
  4. +1 −0 compiler/qmlcps/qmlCpsRewriter.mli
@@ -569,6 +569,7 @@ let pass_QmlCpsRewriter client ~(options:opa_options) (env:env_NewFinalCompile)
let options =
{ QmlCpsRewriter.default_options with QmlCpsRewriter.
no_assert = options.OpaEnv.no_assert ;
+ backtrace = options.OpaEnv.backtrace ;
no_server = Option.get options.OpaEnv.no_server;
qml_closure ;
toplevel_concurrency = options.OpaEnv.cps_toplevel_concurrency ;
@@ -209,6 +209,7 @@ type opa_options = {
the package.json file *)
modular_plugins: bool;
js_classic_bypass_syntax: bool;
+ backtrace: bool;
}
let i18n_template option = option.i18n.I18n.template_opa || option.i18n.I18n.template_po
@@ -307,7 +308,7 @@ struct
package_version := version
let modular_plugins = ref false
-
+ let backtrace = ref false
let back_end_wanted = ref ( `qmljs : available_back_end )
let back_end s =
let back_end =
@@ -513,6 +514,10 @@ struct
" set the build directory : default is _build. You must set an absolute path."
;
+ "--backtrace",
+ Arg.Unit (fun () -> backtrace:=true),
+ " Enable backtrace " ;
+
(* c *)
"--ccopt",
Arg.String add_ccopt,
@@ -937,6 +942,7 @@ struct
package_version = !ArgParser.package_version;
modular_plugins = !ArgParser.modular_plugins;
js_classic_bypass_syntax = !js_bypass_syntax = `classic;
+ backtrace = !ArgParser.backtrace;
}
let echo_help () = ArgParser.do_print_help ()
@@ -86,6 +86,7 @@ let error fmt =
type options =
{
+ backtrace : bool ;
no_assert : bool ;
no_server : bool;
qml_closure : bool ;
@@ -97,6 +98,7 @@ type options =
(* please, keep default values synchronized with the documentation *)
let default_options =
{
+ backtrace = false ;
no_assert = false ;
no_server = true;
qml_closure = false ;
@@ -1880,7 +1882,7 @@ let instrument code =
(* utils for backends *)
let cps_pass ~side env qml_code =
- let qml_code = #<If:CPS_STACK_TRACE>instrument qml_code#<Else>qml_code#<End> in
+ let qml_code = if env.options.backtrace then instrument qml_code else qml_code in
let private_env_initial = Package.load_dependencies ~side in
let private_env, r = code env private_env_initial qml_code in
Package.save_current ~side ~private_env_initial ~private_env;
@@ -93,6 +93,7 @@ val cps_id : string
*)
type options =
{
+ backtrace : bool ;
no_assert : bool ;
no_server : bool ;
qml_closure : bool ;

0 comments on commit a31d080

Please sign in to comment.