Correct error type + new aebytecode
This commit is contained in:
parent
5a1acd9d18
commit
47b3b9bcca
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
|
|
||||||
{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref,"5e16b85"}}}
|
{deps, [ {aebytecode, {git, "https://github.com/aeternity/aebytecode.git", {ref,"a533fd5"}}}
|
||||||
, {getopt, "1.0.1"}
|
, {getopt, "1.0.1"}
|
||||||
, {eblake2, "1.0.0"}
|
, {eblake2, "1.0.0"}
|
||||||
, {jsx, {git, "https://github.com/talentdeficit/jsx.git",
|
, {jsx, {git, "https://github.com/talentdeficit/jsx.git",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{"1.1.0",
|
{"1.1.0",
|
||||||
[{<<"aebytecode">>,
|
[{<<"aebytecode">>,
|
||||||
{git,"https://github.com/aeternity/aebytecode.git",
|
{git,"https://github.com/aeternity/aebytecode.git",
|
||||||
{ref,"5e16b85ae2385bdc010f319e2f2717c09cac3621"}},
|
{ref,"a533fd5fcb25d369caeef4dac95d79941c51620f"}},
|
||||||
0},
|
0},
|
||||||
{<<"aeserialization">>,
|
{<<"aeserialization">>,
|
||||||
{git,"https://github.com/aeternity/aeserialization.git",
|
{git,"https://github.com/aeternity/aeserialization.git",
|
||||||
|
@ -65,11 +65,11 @@ version() ->
|
|||||||
{ok, list_to_binary(VsnString)}
|
{ok, list_to_binary(VsnString)}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec file(string()) -> {ok, map()} | {error, binary()}.
|
-spec file(string()) -> {ok, map()} | {error, [aeso_errors:error()]}.
|
||||||
file(Filename) ->
|
file(Filename) ->
|
||||||
file(Filename, []).
|
file(Filename, []).
|
||||||
|
|
||||||
-spec file(string(), options()) -> {ok, map()} | {error, binary()}.
|
-spec file(string(), options()) -> {ok, map()} | {error, [aeso_errors:error()]}.
|
||||||
file(File, Options0) ->
|
file(File, Options0) ->
|
||||||
Options = add_include_path(File, Options0),
|
Options = add_include_path(File, Options0),
|
||||||
case read_contract(File) of
|
case read_contract(File) of
|
||||||
@ -89,7 +89,7 @@ add_include_path(File, Options) ->
|
|||||||
[{include, {file_system, [Cwd, Dir]}} | Options]
|
[{include, {file_system, [Cwd, Dir]}} | Options]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec from_string(binary() | string(), options()) -> {ok, map()} | {error, binary()}.
|
-spec from_string(binary() | string(), options()) -> {ok, map()} | {error, [aeso_errors:error()]}.
|
||||||
from_string(Contract, Options) ->
|
from_string(Contract, Options) ->
|
||||||
from_string(proplists:get_value(backend, Options, aevm), Contract, Options).
|
from_string(proplists:get_value(backend, Options, aevm), Contract, Options).
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ string_to_code(ContractString, Options) ->
|
|||||||
%% a special return type (typerep, T)
|
%% a special return type (typerep, T)
|
||||||
-spec check_call(string(), string(), [string()], options()) -> {ok, string(), {[Type], Type}, [term()]}
|
-spec check_call(string(), string(), [string()], options()) -> {ok, string(), {[Type], Type}, [term()]}
|
||||||
| {ok, string(), [term()]}
|
| {ok, string(), [term()]}
|
||||||
| {error, term()}
|
| {error, [aeso_errors:error()]}
|
||||||
when Type :: term().
|
when Type :: term().
|
||||||
check_call(Source, "init" = FunName, Args, Options) ->
|
check_call(Source, "init" = FunName, Args, Options) ->
|
||||||
case check_call1(Source, FunName, Args, Options) of
|
case check_call1(Source, FunName, Args, Options) of
|
||||||
@ -267,12 +267,12 @@ last_contract_indent(Decls) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
-spec to_sophia_value(string(), string(), ok | error | revert, aeb_aevm_data:data()) ->
|
-spec to_sophia_value(string(), string(), ok | error | revert, aeb_aevm_data:data()) ->
|
||||||
{ok, aeso_syntax:expr()} | {error, term()}.
|
{ok, aeso_syntax:expr()} | {error, [aeso_errors:error()]}.
|
||||||
to_sophia_value(ContractString, Fun, ResType, Data) ->
|
to_sophia_value(ContractString, Fun, ResType, Data) ->
|
||||||
to_sophia_value(ContractString, Fun, ResType, Data, [{backend, aevm}]).
|
to_sophia_value(ContractString, Fun, ResType, Data, [{backend, aevm}]).
|
||||||
|
|
||||||
-spec to_sophia_value(string(), string(), ok | error | revert, binary(), options()) ->
|
-spec to_sophia_value(string(), string(), ok | error | revert, binary(), options()) ->
|
||||||
{ok, aeso_syntax:expr()} | {error, term()}.
|
{ok, aeso_syntax:expr()} | {error, [aeso_errors:error()]}.
|
||||||
to_sophia_value(_, _, error, Err, _Options) ->
|
to_sophia_value(_, _, error, Err, _Options) ->
|
||||||
{ok, {app, [], {id, [], "error"}, [{string, [], Err}]}};
|
{ok, {app, [], {id, [], "error"}, [{string, [], Err}]}};
|
||||||
to_sophia_value(_, _, revert, Data, Options) ->
|
to_sophia_value(_, _, revert, Data, Options) ->
|
||||||
@ -340,13 +340,12 @@ to_sophia_value(ContractString, FunName, ok, Data, Options0) ->
|
|||||||
|
|
||||||
-spec create_calldata(string(), string(), [string()]) ->
|
-spec create_calldata(string(), string(), [string()]) ->
|
||||||
{ok, binary(), aeb_aevm_data:type(), aeb_aevm_data:type()}
|
{ok, binary(), aeb_aevm_data:type(), aeb_aevm_data:type()}
|
||||||
| {error, term()}.
|
| {error, [aeso_errors:error()]}.
|
||||||
create_calldata(Code, Fun, Args) ->
|
create_calldata(Code, Fun, Args) ->
|
||||||
create_calldata(Code, Fun, Args, [{backend, aevm}]).
|
create_calldata(Code, Fun, Args, [{backend, aevm}]).
|
||||||
|
|
||||||
-spec create_calldata(string(), string(), [string()], [{atom(), any()}]) ->
|
-spec create_calldata(string(), string(), [string()], [{atom(), any()}]) ->
|
||||||
{ok, binary()}
|
{ok, binary()} | {error, [aeso_errors:error()]}.
|
||||||
| {error, term()}.
|
|
||||||
create_calldata(Code, Fun, Args, Options0) ->
|
create_calldata(Code, Fun, Args, Options0) ->
|
||||||
Options = [no_code | Options0],
|
Options = [no_code | Options0],
|
||||||
case proplists:get_value(backend, Options, aevm) of
|
case proplists:get_value(backend, Options, aevm) of
|
||||||
@ -366,7 +365,7 @@ create_calldata(Code, Fun, Args, Options0) ->
|
|||||||
|
|
||||||
-spec decode_calldata(string(), string(), binary()) ->
|
-spec decode_calldata(string(), string(), binary()) ->
|
||||||
{ok, [aeso_syntax:type()], [aeso_syntax:expr()]}
|
{ok, [aeso_syntax:type()], [aeso_syntax:expr()]}
|
||||||
| {error, term()}.
|
| {error, [aeso_errors:error()]}.
|
||||||
decode_calldata(ContractString, FunName, Calldata) ->
|
decode_calldata(ContractString, FunName, Calldata) ->
|
||||||
decode_calldata(ContractString, FunName, Calldata, [{backend, aevm}]).
|
decode_calldata(ContractString, FunName, Calldata, [{backend, aevm}]).
|
||||||
|
|
||||||
@ -431,6 +430,7 @@ get_arg_icode(Funs) ->
|
|||||||
[] -> error_missing_call_function()
|
[] -> error_missing_call_function()
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-dialyzer({nowarn_function, error_missing_call_function/0}).
|
||||||
error_missing_call_function() ->
|
error_missing_call_function() ->
|
||||||
Msg = "Internal error: missing '__call'-function",
|
Msg = "Internal error: missing '__call'-function",
|
||||||
Pos = aeso_errors:pos(0, 0),
|
Pos = aeso_errors:pos(0, 0),
|
||||||
@ -449,6 +449,7 @@ get_call_type([_ | Contracts]) ->
|
|||||||
%% The __call should be in the final contract
|
%% The __call should be in the final contract
|
||||||
get_call_type(Contracts).
|
get_call_type(Contracts).
|
||||||
|
|
||||||
|
-dialyzer({nowarn_function, get_decode_type/2}).
|
||||||
get_decode_type(FunName, [{contract, Ann, _, Defs}]) ->
|
get_decode_type(FunName, [{contract, Ann, _, Defs}]) ->
|
||||||
GetType = fun({letfun, _, {id, _, Name}, Args, Ret, _}) when Name == FunName -> [{Args, Ret}];
|
GetType = fun({letfun, _, {id, _, Name}, Args, Ret, _}) when Name == FunName -> [{Args, Ret}];
|
||||||
({fun_decl, _, {id, _, Name}, {fun_t, _, _, Args, Ret}}) when Name == FunName -> [{Args, Ret}];
|
({fun_decl, _, {id, _, Name}, {fun_t, _, _, Args, Ret}}) when Name == FunName -> [{Args, Ret}];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user