Add fann type and to_fann fun

This commit is contained in:
Gaith Hallak 2022-11-01 13:55:01 +03:00
parent 7bac15949c
commit a4d1479cc5

View File

@ -58,6 +58,8 @@
| {contract_code, string()} %% for CREATE, by name | {contract_code, string()} %% for CREATE, by name
| {typerep, ftype()}. | {typerep, ftype()}.
-type fann() :: [ {line, aeso_syntax:ann_line()} ].
-type fexpr() :: {lit, flit()} -type fexpr() :: {lit, flit()}
| nil | nil
| {var, var_name()} | {var, var_name()}
@ -374,6 +376,10 @@ to_fcode(Env, [{namespace, _, {con, _, Con}, Decls} | Code]) ->
Env1 = decls_to_fcode(Env#{ context => {namespace, Con} }, Decls), Env1 = decls_to_fcode(Env#{ context => {namespace, Con} }, Decls),
to_fcode(Env1, Code). to_fcode(Env1, Code).
-spec to_fann(aeso_syntax:ann()) -> fann().
to_fann(Ann) ->
proplists:lookup_all(line, Ann).
-spec decls_to_fcode(env(), [aeso_syntax:decl()]) -> env(). -spec decls_to_fcode(env(), [aeso_syntax:decl()]) -> env().
decls_to_fcode(Env, Decls) -> decls_to_fcode(Env, Decls) ->
%% First compute mapping from Sophia names to fun_names and add it to the %% First compute mapping from Sophia names to fun_names and add it to the