diff --git a/src/passes/1-parser/pascaligo/AST.ml b/src/passes/1-parser/pascaligo/AST.ml index 97eab1c20..985ae277e 100644 --- a/src/passes/1-parser/pascaligo/AST.ml +++ b/src/passes/1-parser/pascaligo/AST.ml @@ -490,6 +490,7 @@ and closing = and map_expr = MapLookUp of map_lookup reg | MapInj of binding reg injection reg +| BigMapInj of binding reg injection reg and map_lookup = { path : path; @@ -647,6 +648,7 @@ and tuple_expr_to_region {region; _} = region and map_expr_to_region = function MapLookUp {region; _} | MapInj {region; _} -> region +| BigMapInj {region; _} -> region and set_expr_to_region = function SetInj {region; _} diff --git a/src/passes/1-parser/pascaligo/AST.mli b/src/passes/1-parser/pascaligo/AST.mli index a41fb005f..cf8fa3321 100644 --- a/src/passes/1-parser/pascaligo/AST.mli +++ b/src/passes/1-parser/pascaligo/AST.mli @@ -481,6 +481,7 @@ and closing = and map_expr = MapLookUp of map_lookup reg | MapInj of binding reg injection reg +| BigMapInj of binding reg injection reg and map_lookup = { path : path; diff --git a/src/passes/1-parser/pascaligo/Parser.mly b/src/passes/1-parser/pascaligo/Parser.mly index 38b86357b..d3dc32568 100644 --- a/src/passes/1-parser/pascaligo/Parser.mly +++ b/src/passes/1-parser/pascaligo/Parser.mly @@ -877,6 +877,7 @@ set_expr: map_expr: map_lookup { MapLookUp $1 } | injection(Map,binding) { MapInj $1 } +| injection(BigMap,binding) { BigMapInj $1 } map_lookup: path brackets(expr) { diff --git a/src/passes/1-parser/pascaligo/ParserLog.ml b/src/passes/1-parser/pascaligo/ParserLog.ml index e09149bce..2f0fe6268 100644 --- a/src/passes/1-parser/pascaligo/ParserLog.ml +++ b/src/passes/1-parser/pascaligo/ParserLog.ml @@ -434,6 +434,7 @@ and print_case_clause_expr buffer {value; _} = and print_map_expr buffer = function MapLookUp {value; _} -> print_map_lookup buffer value | MapInj inj -> print_injection buffer "map" print_binding inj +| BigMapInj inj -> print_injection buffer "big_map" print_binding inj and print_set_expr buffer = function SetInj inj -> print_injection buffer "set" print_expr inj @@ -1445,7 +1446,7 @@ and pp_map_expr buffer ~pad = function MapLookUp {value; _} -> pp_node buffer ~pad "MapLookUp"; pp_map_lookup buffer ~pad value -| MapInj {value; _} -> +| MapInj {value; _} | BigMapInj {value; _} -> pp_node buffer ~pad "MapInj"; pp_injection pp_binding buffer ~pad value diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index d094f3819..3928d8b5f 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -399,7 +399,7 @@ let rec simpl_expression (t:Raw.expr) : expr result = let%bind cases = simpl_cases lst in return @@ e_matching ~loc e cases ) - | EMap (MapInj mi) -> ( + | EMap (MapInj mi) -> ( let (mi , loc) = r_split mi in let%bind lst = let lst = List.map get_value @@ pseq_to_list mi.elements in @@ -411,6 +411,18 @@ let rec simpl_expression (t:Raw.expr) : expr result = bind_map_list aux lst in return @@ e_map ~loc lst ) + | EMap (BigMapInj mi) -> ( + let (mi , loc) = r_split mi in + let%bind lst = + let lst = List.map get_value @@ pseq_to_list mi.elements in + let aux : Raw.binding -> (expression * expression) result = + fun b -> + let%bind src = simpl_expression b.source in + let%bind dst = simpl_expression b.image in + ok (src, dst) in + bind_map_list aux lst in + return @@ e_big_map ~loc lst + ) | EMap (MapLookUp lu) -> ( let (lu , loc) = r_split lu in let%bind path = match lu.path with