Merge pull request #33 from aeternity/fix_create_calldata_again
Correctly handle ArgTypes in create_calldata
This commit is contained in:
commit
6fccc902d0
@ -39,11 +39,12 @@
|
||||
%%%===================================================================
|
||||
%%% Handle calldata
|
||||
|
||||
create_calldata(FunName, Args, ArgTypes, RetType) ->
|
||||
{<<TypeHashInt:?HASH_SIZE/unit:8>>, _, _, _} =
|
||||
function_type_info(list_to_binary(FunName), ArgTypes, RetType),
|
||||
create_calldata(FunName, Args, ArgTypes0, RetType) ->
|
||||
ArgTypes = {tuple, ArgTypes0},
|
||||
<<TypeHashInt:?HASH_SIZE/unit:8>> =
|
||||
function_type_hash(list_to_binary(FunName), ArgTypes, RetType),
|
||||
Data = aeso_heap:to_binary({TypeHashInt, list_to_tuple(Args)}),
|
||||
{ok, Data, {tuple, [word, {tuple, ArgTypes}]}, RetType}.
|
||||
{ok, Data, {tuple, [word, ArgTypes]}, RetType}.
|
||||
|
||||
get_type_info_and_hash(#{type_info := TypeInfo}, FunName) ->
|
||||
FunBin = list_to_binary(FunName),
|
||||
@ -90,8 +91,8 @@ get_function_hash_from_calldata(CallData) ->
|
||||
|
||||
-spec function_type_info(function_name(), [typerep()], typerep()) ->
|
||||
function_type_info().
|
||||
function_type_info(Name, Args, OutType) ->
|
||||
ArgType = {tuple, [T || {_, T} <- Args]},
|
||||
function_type_info(Name, ArgTypes, OutType) ->
|
||||
ArgType = {tuple, ArgTypes},
|
||||
{ function_type_hash(Name, ArgType, OutType)
|
||||
, Name
|
||||
, aeso_heap:to_binary(ArgType)
|
||||
|
@ -388,7 +388,9 @@ to_bytecode([Op|Rest], Options) ->
|
||||
to_bytecode([], _) -> [].
|
||||
|
||||
extract_type_info(#{functions := Functions} =_Icode) ->
|
||||
TypeInfo = [aeso_abi:function_type_info(list_to_binary(lists:last(Name)), Args, TypeRep)
|
||||
ArgTypesOnly = fun(As) -> [ T || {_, T} <- As ] end,
|
||||
TypeInfo = [aeso_abi:function_type_info(list_to_binary(lists:last(Name)),
|
||||
ArgTypesOnly(Args), TypeRep)
|
||||
|| {Name, Attrs, Args,_Body, TypeRep} <- Functions,
|
||||
not is_tuple(Name),
|
||||
not lists:member(private, Attrs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user