diff --git a/CHANGELOG.md b/CHANGELOG.md index d5c1d31..ba8f031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Loading namespaces into the current scope (e.g. `using Pair`) - Assign patterns to variables (e.g. `let x::(t = y::_) = [1, 2, 3, 4]` where `t == [2, 3, 4]`) ### Changed +- Fixed the ACI renderer, it shouldn't drop the `stateful` modifier ### Removed ## [6.0.2] 2021-07-05 diff --git a/src/aeso_aci.erl b/src/aeso_aci.erl index 5a1a509..0382593 100644 --- a/src/aeso_aci.erl +++ b/src/aeso_aci.erl @@ -254,8 +254,8 @@ decode_contract(_) -> []. decode_funcs(Fs) -> [ decode_func(F) || F <- Fs ]. %% decode_func(#{name := init}) -> []; -decode_func(#{name := Name, payable := Payable, arguments := As, returns := T}) -> - [" ", payable(Payable), "entrypoint ", io_lib:format("~s", [Name]), " : ", +decode_func(#{name := Name, stateful:= Stateful, payable := Payable, arguments := As, returns := T}) -> + [" ", payable(Payable), stateful(Stateful), "entrypoint ", io_lib:format("~s", [Name]), " : ", decode_args(As), " => ", decode_type(T), $\n]. decode_args(As) -> @@ -336,6 +336,9 @@ decode_tvar(#{name := N}) -> io_lib:format("~s", [N]). payable(true) -> "payable "; payable(false) -> "". +stateful(true) -> "stateful "; +stateful(false) -> "". + %% #contract{Ann, Con, [Declarations]}. contract_funcs({C, _, _, Decls}) when ?IS_CONTRACT_HEAD(C); C == namespace -> diff --git a/test/aeso_aci_tests.erl b/test/aeso_aci_tests.erl index 46db9e8..fe71638 100644 --- a/test/aeso_aci_tests.erl +++ b/test/aeso_aci_tests.erl @@ -33,7 +33,7 @@ test_cases(1) -> stateful => true, payable => true}]}}, DecACI = <<"payable main contract C =\n" - " payable entrypoint a : (int) => int\n">>, + " payable stateful entrypoint a : (int) => int\n">>, {Contract,MapACI,DecACI}; test_cases(2) ->