From 9e955d59585556b196a803743c30485b2c8a8183 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Fri, 30 Aug 2019 13:17:47 +0200 Subject: [PATCH] Remove unused aeso_constants --- src/aeso_ast_infer_types.erl | 9 +------- src/aeso_constants.erl | 42 ------------------------------------ 2 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 src/aeso_constants.erl diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index 24fda40..0bf16e4 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -12,7 +12,7 @@ -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()} | {app_t, aeso_syntax:ann(), utype(), [utype()]} @@ -599,13 +599,6 @@ infer_contract_top(Env, Kind, Defs0, _Options) -> Defs = desugar(Defs0), 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 %% a list of definitions. -spec infer_contract(env(), contract | namespace, [aeso_syntax:decl()]) -> {env(), [aeso_syntax:decl()]}. diff --git a/src/aeso_constants.erl b/src/aeso_constants.erl deleted file mode 100644 index 7475c2a..0000000 --- a/src/aeso_constants.erl +++ /dev/null @@ -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). - - - - -