From 37836f9512ebc630cd869c66f9ae8a8388a233e4 Mon Sep 17 00:00:00 2001 From: galfour Date: Sun, 22 Sep 2019 22:44:50 +0200 Subject: [PATCH] adding option --- src/main/compile/of_simplified.ml | 4 ++-- src/main/compile/of_typed.ml | 3 ++- src/main/run/of_simplified.ml | 4 ++-- src/{ => test}/contracts/big_map.ligo | 0 4 files changed, 6 insertions(+), 5 deletions(-) rename src/{ => test}/contracts/big_map.ligo (100%) diff --git a/src/main/compile/of_simplified.ml b/src/main/compile/of_simplified.ml index fa27f3d6e..215c908a5 100644 --- a/src/main/compile/of_simplified.ml +++ b/src/main/compile/of_simplified.ml @@ -14,9 +14,9 @@ let compile_expression_as_function_entry (program : program) entry_point : _ res let%bind typed_program = Typer.type_program program in Of_typed.compile_expression_as_function_entry typed_program entry_point -let compile_expression ?(env = Ast_typed.Environment.full_empty) ae : Michelson.t result = +let compile_expression ?(env = Ast_typed.Environment.full_empty) ?value ae : Michelson.t result = let%bind typed = Typer.type_expression env ae in - Of_typed.compile_expression typed + Of_typed.compile_expression ?value typed let uncompile_typed_program_entry_expression_result program entry ex_ty_value = let%bind output_type = diff --git a/src/main/compile/of_typed.ml b/src/main/compile/of_typed.ml index e6a33abd7..ea75960b9 100644 --- a/src/main/compile/of_typed.ml +++ b/src/main/compile/of_typed.ml @@ -3,7 +3,8 @@ open Ast_typed open Tezos_utils -let compile_expression : annotated_expression -> Michelson.t result = fun e -> +let compile_expression ?(value = false) : annotated_expression -> Michelson.t result = fun e -> + let _ = value in let%bind mini_c_expression = Transpiler.transpile_annotated_expression e in let%bind expr = Of_mini_c.compile_expression mini_c_expression in ok expr diff --git a/src/main/run/of_simplified.ml b/src/main/run/of_simplified.ml index 4332ca9e5..e0e3e1a17 100644 --- a/src/main/run/of_simplified.ml +++ b/src/main/run/of_simplified.ml @@ -7,13 +7,13 @@ let get_final_environment program = post_env let run_typed_program - ?options + ?options ?input_to_value (program : Ast_typed.program) (entry : string) (input : expression) : expression result = let%bind code = Compile.Of_typed.compile_function_entry program entry in let%bind input = let env = get_final_environment program in - Compile.Of_simplified.compile_expression ~env input + Compile.Of_simplified.compile_expression ~env ?value:input_to_value input in let%bind ex_ty_value = Of_michelson.run ?options code input in Compile.Of_simplified.uncompile_typed_program_entry_function_result program entry ex_ty_value diff --git a/src/contracts/big_map.ligo b/src/test/contracts/big_map.ligo similarity index 100% rename from src/contracts/big_map.ligo rename to src/test/contracts/big_map.ligo