type:added
closes #1405 (closed)
- function parameter destructuring taken from !1575 (closed) (unfortunately wasn't merged before..)
- I did not really understand the code (
nested_match_repr
,nestrec
,fold_nested_z
..) so I cleaned it up a bit (it would be nice to review those deletions)
Changelog details:
- JSLIGO patterns in function parameters are now compiled to pattern matching, which improves the generated code in general
- JSLIGO "let-destructuring" will now work on objects (record type) and arrays (tuple type) as in:
let destruct_tuple = (x : [ int , [int , nat] ]) : nat => {
let [a,[b,c]] = x ;
c
};
let destruct_record = (x : { a : int , b : string }) : int => {
let { a , b } = x ; (* Note: nested pattern in record are not yet available *)
a
};