Merge pull request #342 from aeternity/fix_aci_rendering

Don't forget stateful when rendering the ACI
This commit is contained in:
Hans Svensson 2021-09-24 14:21:42 +02:00 committed by GitHub
commit 24c579a5d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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 ->

View File

@ -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) ->