adding option

This commit is contained in:
galfour 2019-09-22 22:44:50 +02:00
parent 720ef99c69
commit 37836f9512
4 changed files with 6 additions and 5 deletions

View File

@ -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 =

View File

@ -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

View File

@ -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