summaryrefslogtreecommitdiff
path: root/src/constant_fold.ml
diff options
context:
space:
mode:
authorJon French2018-12-27 12:14:32 +0000
committerJon French2018-12-27 12:14:32 +0000
commit13169ab85604d926e5dae44202622ec445697793 (patch)
tree3871b08da2fbc518402814bcd94bcb9da7093ade /src/constant_fold.ml
parent9d2c973d97f10060344f623d8392f56a437b2d04 (diff)
pass typechecking environment around interpreter and rewriters
Diffstat (limited to 'src/constant_fold.ml')
-rw-r--r--src/constant_fold.ml10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/constant_fold.ml b/src/constant_fold.ml
index 407bd69a..d5fffbbe 100644
--- a/src/constant_fold.ml
+++ b/src/constant_fold.ml
@@ -141,13 +141,13 @@ let rec run frame =
- Throws an exception that isn't caught.
*)
-let rec rewrite_constant_function_calls' ast =
+let rec rewrite_constant_function_calls' env ast =
let rewrite_count = ref 0 in
let ok () = incr rewrite_count in
let not_ok () = decr rewrite_count in
let lstate, gstate =
- Interpreter.initial_state ast safe_primops
+ Interpreter.initial_state ast env safe_primops
in
let gstate = { gstate with Interpreter.allow_registers = false } in
@@ -202,11 +202,11 @@ let rec rewrite_constant_function_calls' ast =
let ast = rewrite_defs_base rw_defs ast in
(* We keep iterating until we have no more re-writes to do *)
if !rewrite_count > 0
- then rewrite_constant_function_calls' ast
+ then rewrite_constant_function_calls' env ast
else ast
-let rewrite_constant_function_calls ast =
+let rewrite_constant_function_calls env ast =
if !optimize_constant_fold then
- rewrite_constant_function_calls' ast
+ rewrite_constant_function_calls' env ast
else
ast