From 42cbabac6995ca7b74f54d8626c116dfb51b6727 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 2 Jan 2020 15:01:55 +0100 Subject: [PATCH] check ast_simplified address literals to be well formatted --- src/passes/3-self_ast_simplified/dune | 1 + src/passes/3-self_ast_simplified/literals.ml | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/passes/3-self_ast_simplified/dune b/src/passes/3-self_ast_simplified/dune index 69dc6b507..aef575249 100644 --- a/src/passes/3-self_ast_simplified/dune +++ b/src/passes/3-self_ast_simplified/dune @@ -4,6 +4,7 @@ (libraries simple-utils ast_simplified + proto-alpha-utils ) (preprocess (pps ppx_let bisect_ppx --conditional) diff --git a/src/passes/3-self_ast_simplified/literals.ml b/src/passes/3-self_ast_simplified/literals.ml index 38116590b..7950aeae2 100644 --- a/src/passes/3-self_ast_simplified/literals.ml +++ b/src/passes/3-self_ast_simplified/literals.ml @@ -1,9 +1,17 @@ open Ast_simplified open Trace +open Proto_alpha_utils let peephole_expression : expression -> expression result = fun e -> let return expression = ok { e with expression } in match e.expression with + | E_literal (Literal_address s) as e -> ( + let open Memory_proto_alpha in + let%bind (_contract:Protocol.Alpha_context.Contract.t) = + Trace.trace_alpha_tzresult (simple_error ("address \""^s^"\" is not a valid address")) @@ + Protocol.Alpha_context.Contract.of_b58check s in + return e + ) | E_constant (C_BIG_MAP_LITERAL , lst) -> ( let%bind elt = trace_option (simple_error "big_map literal expects a single parameter") @@