[PT-167805291] Add opcode for ecrecover #613
@ -83,7 +83,7 @@
|
||||
|
||||
-type fun_info() :: {aeso_syntax:ann(), typesig() | type()}.
|
||||
-type type_info() :: {aeso_syntax:ann(), typedef()}.
|
||||
-type var_info() :: {aeso_syntax:ann(), type()}.
|
||||
-type var_info() :: {aeso_syntax:ann(), utype()}.
|
||||
|
||||
-type fun_env() :: [{name(), fun_info()}].
|
||||
-type type_env() :: [{name(), type_info()}].
|
||||
@ -139,11 +139,11 @@ on_current_scope(Env = #env{ namespace = NS, scopes = Scopes }, Fun) ->
|
||||
on_scopes(Env = #env{ scopes = Scopes }, Fun) ->
|
||||
Env#env{ scopes = maps:map(fun(_, Scope) -> Fun(Scope) end, Scopes) }.
|
||||
|
||||
-spec bind_var(aeso_syntax:id(), type(), env()) -> env().
|
||||
-spec bind_var(aeso_syntax:id(), utype(), env()) -> env().
|
||||
bind_var({id, Ann, X}, T, Env) ->
|
||||
Env#env{ vars = [{X, {Ann, T}} | Env#env.vars] }.
|
||||
|
||||
-spec bind_vars([{aeso_syntax:id(), type()}], env()) -> env().
|
||||
-spec bind_vars([{aeso_syntax:id(), utype()}], env()) -> env().
|
||||
bind_vars([], Env) -> Env;
|
||||
bind_vars([{X, T} | Vars], Env) ->
|
||||
bind_vars(Vars, bind_var(X, T, Env)).
|
||||
|
@ -578,6 +578,7 @@ pp(Code, Options, Option, PPFun) ->
|
||||
%% -------------------------------------------------------------------
|
||||
%% TODO: Tempoary parser hook below...
|
||||
|
||||
-spec parse_stdlib() -> none() | [aeso_syntax:ast()].
|
||||
parse_stdlib() ->
|
||||
lists:foldr(
|
||||
fun ({Lib, LibCode}, Acc) ->
|
||||
@ -593,8 +594,11 @@ sophia_type_to_typerep(String) ->
|
||||
catch _:_ -> {error, bad_type}
|
||||
end.
|
||||
|
||||
-spec parse(string(), aeso_compiler:options()) -> none() | aeso_syntax:ast().
|
||||
parse(Text, Options) ->
|
||||
parse(Text, sets:new(), Options).
|
||||
|
||||
-spec parse(string(), sets:set(), aeso_compiler:options()) -> none() | aeso_syntax:ast().
|
||||
parse(Text, Included, Options) ->
|
||||
%% Try and return something sensible here!
|
||||
case aeso_parser:string(Text, Included, Options) of
|
||||
@ -616,6 +620,7 @@ parse(Text, Included, Options) ->
|
||||
parse_error(Pos, io_lib:format("could not find include file '~s'", [File]))
|
||||
end.
|
||||
|
||||
-spec parse_error(aeso_parse_lib:pos(), string()) -> none().
|
||||
parse_error(Pos, ErrorString) ->
|
||||
Error = io_lib:format("~s: ~s", [pos_error(Pos), ErrorString]),
|
||||
error({parse_errors, [Error]}).
|
||||
|
@ -22,8 +22,7 @@
|
||||
string(String) ->
|
||||
string(String, sets:new(), []).
|
||||
|
||||
|
||||
-spec string(string(), compiler:options()) -> parse_result().
|
||||
-spec string(string(), aeso_compiler:options()) -> parse_result().
|
||||
string(String, Opts) ->
|
||||
case lists:keyfind(src_file, 1, Opts) of
|
||||
{src_file, File} -> string(String, sets:add_element(File, sets:new()), Opts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user