Make fate-backend also return a Map
This commit is contained in:
parent
7b5db76c13
commit
3e2281a834
@ -111,10 +111,18 @@ from_string1(aevm, ContractString, Options) ->
|
||||
type_info => TypeInfo
|
||||
}};
|
||||
from_string1(fate, ContractString, Options) ->
|
||||
Ast = parse(ContractString, Options),
|
||||
TypedAst = aeso_ast_infer_types:infer(Ast, Options),
|
||||
FCode = aeso_ast_to_fcode:ast_to_fcode(TypedAst, Options),
|
||||
{ok, aeso_fcode_to_fate:compile(FCode, Options)}.
|
||||
Ast = parse(ContractString, Options),
|
||||
TypedAst = aeso_ast_infer_types:infer(Ast, Options),
|
||||
FCode = aeso_ast_to_fcode:ast_to_fcode(TypedAst, Options),
|
||||
FateCode = aeso_fcode_to_fate:compile(FCode, Options),
|
||||
ByteCode = aeb_fate_code:serialize(FateCode, []),
|
||||
{ok, Version} = version(),
|
||||
{ok, #{byte_code => ByteCode,
|
||||
compiler_version => Version,
|
||||
contract_source => ContractString,
|
||||
type_info => [],
|
||||
fate_code => FateCode
|
||||
}}.
|
||||
|
||||
-spec string_to_icode(string(), [option()]) -> map().
|
||||
string_to_icode(ContractString, Options) ->
|
||||
|
@ -23,7 +23,7 @@ simple_compile_test_() ->
|
||||
contract_source := _,
|
||||
type_info := _} when Backend == aevm ->
|
||||
?assertMatch(Code when is_binary(Code), ByteCode);
|
||||
Code when Backend == fate, is_tuple(Code) ->
|
||||
#{fate_code := Code} when Backend == fate ->
|
||||
Code1 = aeb_fate_code:deserialize(aeb_fate_code:serialize(Code)),
|
||||
?assertMatch({X, X}, {Code1, Code});
|
||||
ErrBin ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user