add big_map injection
This commit is contained in:
parent
5d040220c0
commit
cefac0d8e7
@ -490,6 +490,7 @@ and closing =
|
|||||||
and map_expr =
|
and map_expr =
|
||||||
MapLookUp of map_lookup reg
|
MapLookUp of map_lookup reg
|
||||||
| MapInj of binding reg injection reg
|
| MapInj of binding reg injection reg
|
||||||
|
| BigMapInj of binding reg injection reg
|
||||||
|
|
||||||
and map_lookup = {
|
and map_lookup = {
|
||||||
path : path;
|
path : path;
|
||||||
@ -647,6 +648,7 @@ and tuple_expr_to_region {region; _} = region
|
|||||||
and map_expr_to_region = function
|
and map_expr_to_region = function
|
||||||
MapLookUp {region; _}
|
MapLookUp {region; _}
|
||||||
| MapInj {region; _} -> region
|
| MapInj {region; _} -> region
|
||||||
|
| BigMapInj {region; _} -> region
|
||||||
|
|
||||||
and set_expr_to_region = function
|
and set_expr_to_region = function
|
||||||
SetInj {region; _}
|
SetInj {region; _}
|
||||||
|
@ -481,6 +481,7 @@ and closing =
|
|||||||
and map_expr =
|
and map_expr =
|
||||||
MapLookUp of map_lookup reg
|
MapLookUp of map_lookup reg
|
||||||
| MapInj of binding reg injection reg
|
| MapInj of binding reg injection reg
|
||||||
|
| BigMapInj of binding reg injection reg
|
||||||
|
|
||||||
and map_lookup = {
|
and map_lookup = {
|
||||||
path : path;
|
path : path;
|
||||||
|
@ -877,6 +877,7 @@ set_expr:
|
|||||||
map_expr:
|
map_expr:
|
||||||
map_lookup { MapLookUp $1 }
|
map_lookup { MapLookUp $1 }
|
||||||
| injection(Map,binding) { MapInj $1 }
|
| injection(Map,binding) { MapInj $1 }
|
||||||
|
| injection(BigMap,binding) { BigMapInj $1 }
|
||||||
|
|
||||||
map_lookup:
|
map_lookup:
|
||||||
path brackets(expr) {
|
path brackets(expr) {
|
||||||
|
@ -434,6 +434,7 @@ and print_case_clause_expr buffer {value; _} =
|
|||||||
and print_map_expr buffer = function
|
and print_map_expr buffer = function
|
||||||
MapLookUp {value; _} -> print_map_lookup buffer value
|
MapLookUp {value; _} -> print_map_lookup buffer value
|
||||||
| MapInj inj -> print_injection buffer "map" print_binding inj
|
| 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
|
and print_set_expr buffer = function
|
||||||
SetInj inj -> print_injection buffer "set" print_expr inj
|
SetInj inj -> print_injection buffer "set" print_expr inj
|
||||||
@ -1445,7 +1446,7 @@ and pp_map_expr buffer ~pad = function
|
|||||||
MapLookUp {value; _} ->
|
MapLookUp {value; _} ->
|
||||||
pp_node buffer ~pad "MapLookUp";
|
pp_node buffer ~pad "MapLookUp";
|
||||||
pp_map_lookup buffer ~pad value
|
pp_map_lookup buffer ~pad value
|
||||||
| MapInj {value; _} ->
|
| MapInj {value; _} | BigMapInj {value; _} ->
|
||||||
pp_node buffer ~pad "MapInj";
|
pp_node buffer ~pad "MapInj";
|
||||||
pp_injection pp_binding buffer ~pad value
|
pp_injection pp_binding buffer ~pad value
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ let rec simpl_expression (t:Raw.expr) : expr result =
|
|||||||
let%bind cases = simpl_cases lst in
|
let%bind cases = simpl_cases lst in
|
||||||
return @@ e_matching ~loc e cases
|
return @@ e_matching ~loc e cases
|
||||||
)
|
)
|
||||||
| EMap (MapInj mi) -> (
|
| EMap (MapInj mi) -> (
|
||||||
let (mi , loc) = r_split mi in
|
let (mi , loc) = r_split mi in
|
||||||
let%bind lst =
|
let%bind lst =
|
||||||
let lst = List.map get_value @@ pseq_to_list mi.elements in
|
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
|
bind_map_list aux lst in
|
||||||
return @@ e_map ~loc lst
|
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) -> (
|
| EMap (MapLookUp lu) -> (
|
||||||
let (lu , loc) = r_split lu in
|
let (lu , loc) = r_split lu in
|
||||||
let%bind path = match lu.path with
|
let%bind path = match lu.path with
|
||||||
|
Loading…
Reference in New Issue
Block a user