diff --git a/src/aeso_ast_to_fcode.erl b/src/aeso_ast_to_fcode.erl index fc675b6..676d3e0 100644 --- a/src/aeso_ast_to_fcode.erl +++ b/src/aeso_ast_to_fcode.erl @@ -113,6 +113,7 @@ -type fcode() :: #{ contract_name := string(), state_type := ftype(), + state_layout := state_layout(), event_type := ftype() | none, functions := #{ fun_name() => fun_def() }, payable := boolean() }. @@ -1341,6 +1342,7 @@ simpl_switch(Env, E, [{'case', Pat, Body} | Alts]) -> end end. +-spec match_pat(fsplit_pat(), fexpr()) -> false | [{var_name(), fexpr()}]. match_pat({tuple, Xs}, {tuple, Es}) -> lists:zip(Xs, Es); match_pat({con, _, C, Xs}, {con, _, C, Es}) -> lists:zip(Xs, Es); match_pat(L, {lit, L}) -> []; @@ -1369,6 +1371,8 @@ constructor_form(Env, Expr) -> {con, _, _, _} -> Expr; {tuple, _} -> Expr; {lit, _} -> Expr; + nil -> Expr; + {op, '::', _} -> Expr; _ -> false end. @@ -1672,7 +1676,7 @@ bottom_up(F, Env, Expr) -> {funcall, Fun, Es} -> {funcall, bottom_up(F, Env, Fun), [bottom_up(F, Env, E) || E <- Es]}; {set_state, R, E} -> {set_state, R, bottom_up(F, Env, E)}; {get_state, _} -> Expr; - {closure, F, Env} -> {closure, F, bottom_up(F, Env, Env)}; + {closure, F, CEnv} -> {closure, F, bottom_up(F, Env, CEnv)}; {switch, Split} -> {switch, bottom_up(F, Env, Split)}; {lam, Xs, B} -> {lam, Xs, bottom_up(F, Env, B)}; {'let', X, E, Body} -> diff --git a/src/aeso_fcode_to_fate.erl b/src/aeso_fcode_to_fate.erl index 7cab268..2a9f58d 100644 --- a/src/aeso_fcode_to_fate.erl +++ b/src/aeso_fcode_to_fate.erl @@ -304,7 +304,7 @@ to_scode(Env, {remote, ArgsT, RetT, Ct, Fun, [Gas, Value | Args]}) -> to_scode(_Env, {get_state, Reg}) -> [push(?s(Reg))]; to_scode(Env, {set_state, Reg, Val}) -> - call_to_scode(Env, [aeb_fate_ops:store(?s(Reg), ?a), + call_to_scode(Env, [{'STORE', ?s(Reg), ?a}, tuple(0)], [Val]); to_scode(Env, {closure, Fun, FVs}) ->