Crash with a nicer error on r.address

Fate doesn't have a contract to address instruction yet
This commit is contained in:
Ulf Norell 2019-06-05 11:54:47 +02:00
parent 3b352d8093
commit 6236b33115
2 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,7 @@
map_get | map_get_d | map_set | map_from_list | map_to_list | map_get | map_get_d | map_set | map_from_list | map_to_list |
map_delete | map_member | map_size | string_length | map_delete | map_member | map_size | string_length |
string_concat | bits_set | bits_clear | bits_test | bits_sum | string_concat | bits_set | bits_clear | bits_test | bits_sum |
bits_intersection | bits_union | bits_difference. bits_intersection | bits_union | bits_difference | contract_address.
-type flit() :: {int, integer()} -type flit() :: {int, integer()}
| {string, binary()} | {string, binary()}
@ -385,6 +385,8 @@ expr_to_fcode(Env, _Type, {tuple, _, Es}) ->
%% Records %% Records
expr_to_fcode(Env, Type, {proj, _Ann, Rec = {typed, _, _, RecType}, {id, _, X}}) -> expr_to_fcode(Env, Type, {proj, _Ann, Rec = {typed, _, _, RecType}, {id, _, X}}) ->
case RecType of case RecType of
{con, _, _} when X == "address" ->
{op, contract_address, [expr_to_fcode(Env, Rec)]};
{con, _, _} -> {con, _, _} ->
{fun_t, _, Named, Args, _} = Type, {fun_t, _, Named, Args, _} = Type,
Arity = length(Named) + length(Args), Arity = length(Named) + length(Args),

View File

@ -539,7 +539,8 @@ op_to_scode(bits_intersection) -> aeb_fate_ops:bits_and(?a, ?a, ?a);
op_to_scode(bits_union) -> aeb_fate_ops:bits_or(?a, ?a, ?a); op_to_scode(bits_union) -> aeb_fate_ops:bits_or(?a, ?a, ?a);
op_to_scode(bits_difference) -> aeb_fate_ops:bits_diff(?a, ?a, ?a); op_to_scode(bits_difference) -> aeb_fate_ops:bits_diff(?a, ?a, ?a);
op_to_scode(address_to_str) -> aeb_fate_ops:addr_to_str(?a, ?a); op_to_scode(address_to_str) -> aeb_fate_ops:addr_to_str(?a, ?a);
op_to_scode(int_to_str) -> aeb_fate_ops:int_to_str(?a, ?a). op_to_scode(int_to_str) -> aeb_fate_ops:int_to_str(?a, ?a);
op_to_scode(contract_address) -> ?TODO(fate_contract_to_address_conversion).
%% PUSH and STORE ?a are the same, so we use STORE to make optimizations %% PUSH and STORE ?a are the same, so we use STORE to make optimizations
%% easier, and specialize to PUSH (which is cheaper) at the end. %% easier, and specialize to PUSH (which is cheaper) at the end.