Merge pull request #342 from aeternity/fix_aci_rendering
Don't forget stateful when rendering the ACI
This commit is contained in:
commit
24c579a5d3
@ -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
|
||||
|
@ -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 ->
|
||||
|
@ -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) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user