Remove unused aeso_constants
This commit is contained in:
parent
f8cd3b87f3
commit
9e955d5958
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
-module(aeso_ast_infer_types).
|
-module(aeso_ast_infer_types).
|
||||||
|
|
||||||
-export([infer/1, infer/2, infer_constant/1, unfold_types_in_type/3]).
|
-export([infer/1, infer/2, unfold_types_in_type/3]).
|
||||||
|
|
||||||
-type utype() :: {fun_t, aeso_syntax:ann(), named_args_t(), [utype()], utype()}
|
-type utype() :: {fun_t, aeso_syntax:ann(), named_args_t(), [utype()], utype()}
|
||||||
| {app_t, aeso_syntax:ann(), utype(), [utype()]}
|
| {app_t, aeso_syntax:ann(), utype(), [utype()]}
|
||||||
@ -599,13 +599,6 @@ infer_contract_top(Env, Kind, Defs0, _Options) ->
|
|||||||
Defs = desugar(Defs0),
|
Defs = desugar(Defs0),
|
||||||
infer_contract(Env, Kind, Defs).
|
infer_contract(Env, Kind, Defs).
|
||||||
|
|
||||||
%% TODO: revisit
|
|
||||||
infer_constant({letval, Attrs,_Pattern, Type, E}) ->
|
|
||||||
ets_init(), %% Init the ETS table state
|
|
||||||
{typed, _, _, PatType} =
|
|
||||||
infer_expr(global_env(), {typed, Attrs, E, arg_type(Type)}),
|
|
||||||
instantiate(PatType).
|
|
||||||
|
|
||||||
%% infer_contract takes a proplist mapping global names to types, and
|
%% infer_contract takes a proplist mapping global names to types, and
|
||||||
%% a list of definitions.
|
%% a list of definitions.
|
||||||
-spec infer_contract(env(), contract | namespace, [aeso_syntax:decl()]) -> {env(), [aeso_syntax:decl()]}.
|
-spec infer_contract(env(), contract | namespace, [aeso_syntax:decl()]) -> {env(), [aeso_syntax:decl()]}.
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
-module(aeso_constants).
|
|
||||||
|
|
||||||
-export([string/1, get_type/1]).
|
|
||||||
|
|
||||||
string(Str) ->
|
|
||||||
case aeso_parser:string("let _ = " ++ Str) of
|
|
||||||
{ok, [{letval, _, _, _, E}]} -> {ok, E};
|
|
||||||
{ok, Other} -> error({internal_error, should_be_letval, Other});
|
|
||||||
Err -> Err
|
|
||||||
end.
|
|
||||||
|
|
||||||
get_type(Str) ->
|
|
||||||
case aeso_parser:string("let _ = " ++ Str) of
|
|
||||||
{ok, [Ast]} ->
|
|
||||||
AstT = aeso_ast_infer_types:infer_constant(Ast),
|
|
||||||
T = ast_to_type(AstT),
|
|
||||||
{ok, T};
|
|
||||||
{ok, Other} -> error({internal_error, should_be_letval, Other});
|
|
||||||
Err -> Err
|
|
||||||
end.
|
|
||||||
|
|
||||||
ast_to_type({id, _, T}) ->
|
|
||||||
T;
|
|
||||||
ast_to_type({tuple_t, _, []}) -> "()";
|
|
||||||
ast_to_type({tuple_t, _, Ts}) ->
|
|
||||||
"(" ++ list_ast_to_type(Ts) ++ ")";
|
|
||||||
ast_to_type({app_t,_, {id, _, "list"}, [T]}) ->
|
|
||||||
lists:flatten("list(" ++ ast_to_type(T) ++ ")");
|
|
||||||
ast_to_type({app_t,_, {id, _, "option"}, [T]}) ->
|
|
||||||
lists:flatten("option(" ++ ast_to_type(T) ++ ")").
|
|
||||||
|
|
||||||
list_ast_to_type([T]) ->
|
|
||||||
ast_to_type(T);
|
|
||||||
list_ast_to_type([T|Ts]) ->
|
|
||||||
ast_to_type(T)
|
|
||||||
++ ", "
|
|
||||||
++ list_ast_to_type(Ts).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user