ReasonLIGO: Add support for _ as an argument
This commit is contained in:
parent
24f4364978
commit
62d1a77b3d
@ -445,8 +445,12 @@ fun_expr:
|
|||||||
|
|
||||||
let rec arg_to_pattern = function
|
let rec arg_to_pattern = function
|
||||||
EVar v ->
|
EVar v ->
|
||||||
Scoping.check_reserved_name v;
|
if v.value = "_" then
|
||||||
PVar v
|
PWild v.region
|
||||||
|
else (
|
||||||
|
Scoping.check_reserved_name v;
|
||||||
|
PVar v
|
||||||
|
)
|
||||||
| EAnnot {region; value = {inside = EVar v, colon, typ; _}} ->
|
| EAnnot {region; value = {inside = EVar v, colon, typ; _}} ->
|
||||||
Scoping.check_reserved_name v;
|
Scoping.check_reserved_name v;
|
||||||
let value = {pattern = PVar v; colon; type_expr = typ}
|
let value = {pattern = PVar v; colon; type_expr = typ}
|
||||||
@ -778,6 +782,7 @@ common_expr:
|
|||||||
| "<nat>" { EArith (Nat $1) }
|
| "<nat>" { EArith (Nat $1) }
|
||||||
| "<bytes>" { EBytes $1 }
|
| "<bytes>" { EBytes $1 }
|
||||||
| "<ident>" | module_field { EVar $1 }
|
| "<ident>" | module_field { EVar $1 }
|
||||||
|
| "_" { EVar {value = "_"; region = $1} }
|
||||||
| projection { EProj $1 }
|
| projection { EProj $1 }
|
||||||
| update_record { EUpdate $1 }
|
| update_record { EUpdate $1 }
|
||||||
| "<string>" { EString (String $1) }
|
| "<string>" { EString (String $1) }
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@ type storage = map (int, big_map (nat, big_map (int, string)));
|
|||||||
|
|
||||||
type return = (list (operation), storage);
|
type return = (list (operation), storage);
|
||||||
|
|
||||||
let main = ((ignore, store): (unit, storage)): return => {
|
let main = ((_, store): (unit, storage)): return => {
|
||||||
([]: list(operation), store)
|
([]: list(operation), store)
|
||||||
};
|
};
|
||||||
|
|
@ -15,7 +15,7 @@ let arguments = (b: int, c: int) => { b + c; };
|
|||||||
|
|
||||||
let arguments_type_def = (b: fun_type) => b (5, 3);
|
let arguments_type_def = (b: fun_type) => b (5, 3);
|
||||||
|
|
||||||
let arguments_test = (ignore: int) => arguments_type_def (arguments);
|
let arguments_test = (_: int) => arguments_type_def (arguments);
|
||||||
|
|
||||||
type tuple_type = ((int, int)) => int;
|
type tuple_type = ((int, int)) => int;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ let tuple = ((a, b): (int, int)) => { a + b; };
|
|||||||
|
|
||||||
let tuple_type_def = (b: tuple_type) => b ((5, 3));
|
let tuple_type_def = (b: tuple_type) => b ((5, 3));
|
||||||
|
|
||||||
let tuple_test = (ignore: int) => tuple_type_def (tuple);
|
let tuple_test = (_: int) => tuple_type_def (tuple);
|
||||||
|
|
||||||
|
|
||||||
/* inline */
|
/* inline */
|
||||||
@ -32,12 +32,12 @@ let arguments_inline = (b: int, c: int) => { b + c; };
|
|||||||
|
|
||||||
let arguments_type_def_inline = (b: (int, int) => int) => b (5, 3);
|
let arguments_type_def_inline = (b: (int, int) => int) => b (5, 3);
|
||||||
|
|
||||||
let arguments_test_inline = (ignore: int) =>
|
let arguments_test_inline = (_: int) =>
|
||||||
arguments_type_def_inline (arguments_inline);
|
arguments_type_def_inline (arguments_inline);
|
||||||
|
|
||||||
let tuple_inline = ((a, b): (int, int)) => { a + b; };
|
let tuple_inline = ((a, b): (int, int)) => { a + b; };
|
||||||
|
|
||||||
let tuple_type_def_inline = (b: ((int, int)) => int) => b ((5, 3));
|
let tuple_type_def_inline = (b: ((int, int)) => int) => b ((5, 3));
|
||||||
|
|
||||||
let tuple_test_inline = (ignore: int) =>
|
let tuple_test_inline = (_: int) =>
|
||||||
tuple_type_def_inline(tuple_inline);
|
tuple_type_def_inline(tuple_inline);
|
||||||
|
Loading…
Reference in New Issue
Block a user