Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[enhance] pass_rewrite: added a debug var to disable async rewrite

  • Loading branch information...
commit cf0673112a4c566dae1e45355126477fe57f4ca2 1 parent 7d7736a
@Aqua-Ye Aqua-Ye authored BourgerieQuentin committed
View
1  libbase/debugVariables.ml
@@ -112,6 +112,7 @@ let no_access_log = var "no_access_log"
let no_database_upgrade = var "no_database_upgrade"
let no_flood_prevention = var "no_flood_prevention"
let no_server_info = var "no_server_info"
+let no_async = var "no_async"
let nocache = var "nocache"
let object_debug = var "object_debug"
let ocamldep_show_logs = var "ocamldep_show_logs"
View
2  libbase/debugVariables.mli
@@ -861,6 +861,8 @@ val slicer_cond : debug_var (** checks slicer precondition and postcondition *)
val slicer_debug : debug_var (** ?? *)
val slicer_time : debug_var (** shows where the time of the slicing pass is spent *)
+val no_async : debug_var (** no async rewriting *)
+
(**
{b MLSTATE_SSL_DEBUG}
*)
View
1  qmlpasses/_tags
@@ -12,3 +12,4 @@
<pass_ConstantSharing.ml>: with_mlstate_debug
<pass_GenerateServerAst.ml>: with_mlstate_debug, use_jslang
<pass_DbSchemaGeneration.ml> : with_mlstate_debug
+<pass_RewriteAsyncLambda.ml> : with_mlstate_debug
View
29 qmlpasses/pass_RewriteAsyncLambda.ml
@@ -1,3 +1,21 @@
+(*
+ Copyright © 2011, 2012 MLstate
+
+ This file is part of OPA.
+
+ OPA is free software: you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License, version 3, as published by
+ the Free Software Foundation.
+
+ OPA is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with OPA. If not, see <http://www.gnu.org/licenses/>.
+*)
+
module Q = QmlAst
(* keep in sync with the slicer *)
@@ -47,9 +65,14 @@ let process_code ~val_ gamma annotmap code =
let annotmap = QmlAnnotMap.add_tsc_opt (Q.QAnnot.expr e) tsc_gen_opt annotmap in
(* leaving the directive so that the slicer that see the 'async' *)
- let annotmap, e = try rewrite_lambda ~gamma ~val_ annotmap e with Exit -> annotmap, e in
- let expr = Q.Directive (label, `async, [e], []) in
- tra annotmap expr
+ let annotmap, expr =
+ #<If:NO_ASYNC> (annotmap, e)
+ #<Else>
+ let annotmap, e = try rewrite_lambda ~gamma ~val_ annotmap e with Exit -> annotmap, e in
+ let expr = Q.Directive (label, `async, [e], []) in
+ (annotmap, expr)
+ #<End>
+ in tra annotmap expr
| _ -> tra annotmap expr
)
) annotmap code
Please sign in to comment.
Something went wrong with that request. Please try again.