Move typedefs to a separate module
This commit is contained in:
parent
fceb124f89
commit
0dc647f139
@ -19,32 +19,15 @@
|
||||
%% Newly exported
|
||||
-export([ infer_const/2
|
||||
]).
|
||||
-export_type([ utype/0
|
||||
, typesig/0
|
||||
-export_type([ typesig/0
|
||||
]).
|
||||
|
||||
-include("aeso_utils.hrl").
|
||||
|
||||
-type env() :: aeso_tc_env:env().
|
||||
|
||||
-type utype() :: {fun_t, aeso_syntax:ann(), named_args_t(), [utype()] | var_args, utype()}
|
||||
| {app_t, aeso_syntax:ann(), utype(), [utype()]}
|
||||
| {tuple_t, aeso_syntax:ann(), [utype()]}
|
||||
| aeso_syntax:id() | aeso_syntax:qid()
|
||||
| aeso_syntax:con() | aeso_syntax:qcon() %% contracts
|
||||
| aeso_syntax:tvar()
|
||||
| {if_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), utype()} %% Can branch on named argument (protected)
|
||||
| uvar().
|
||||
|
||||
-type uvar() :: {uvar, aeso_syntax:ann(), reference()}.
|
||||
|
||||
-type named_args_t() :: uvar() | [{named_arg_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), aeso_syntax:expr()}].
|
||||
|
||||
-type type() :: aeso_syntax:type().
|
||||
-type name() :: string().
|
||||
-type typesig() :: {type_sig, aeso_syntax:ann(), type_constraints(), [aeso_syntax:named_arg_t()], [type()], type()}.
|
||||
|
||||
-type type_constraints() :: none | bytes_concat | bytes_split | address_to_contract | bytecode_hash.
|
||||
|
||||
-type variance() :: invariant | covariant | contravariant | bivariant.
|
||||
|
||||
@ -52,6 +35,12 @@
|
||||
when_option(pp_types, fun () -> io:format(Fmt, Args) end)).
|
||||
-define(CONSTRUCTOR_MOCK_NAME, "#__constructor__#").
|
||||
|
||||
%% -- Duplicated types -------------------------------------------------------
|
||||
|
||||
-type utype() :: aeso_tc_typedefs:utype().
|
||||
-type named_args_t() :: aeso_tc_typedefs:named_args_t().
|
||||
-type typesig() :: aeso_tc_typedefs:typesig().
|
||||
|
||||
%% -- Moved functions --------------------------------------------------------
|
||||
|
||||
name(A) -> aeso_tc_name_manip:name(A).
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
-type uvar() :: {uvar, aeso_syntax:ann(), reference()}.
|
||||
-type named_args_t() :: uvar() | [{named_arg_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), aeso_syntax:expr()}].
|
||||
-type utype() :: aeso_ast_infer_types:utype().
|
||||
-type utype() :: aeso_tc_typedefs:utype().
|
||||
|
||||
%% -- Duplicated macros ------------------------------------------------------
|
||||
|
||||
|
@ -135,8 +135,8 @@ infer_const(A, B) -> aeso_ast_infer_types:infer_const(A, B).
|
||||
-type name() :: string().
|
||||
-type qname() :: [string()].
|
||||
-type type() :: aeso_syntax:type().
|
||||
-type utype() :: aeso_ast_infer_types:utype().
|
||||
-type typesig() :: aeso_ast_infer_types:typesig().
|
||||
-type utype() :: aeso_tc_typedefs:utype().
|
||||
-type typesig() :: aeso_tc_typedefs:typesig().
|
||||
|
||||
%% -- Duplicated macros ------------------------------------------------------
|
||||
|
||||
|
20
src/aeso_tc_typedefs.erl
Normal file
20
src/aeso_tc_typedefs.erl
Normal file
@ -0,0 +1,20 @@
|
||||
-module(aeso_tc_typedefs).
|
||||
|
||||
-export_type([utype/0, named_args_t/0, typesig/0]).
|
||||
|
||||
-type uvar() :: {uvar, aeso_syntax:ann(), reference()}.
|
||||
|
||||
-type named_args_t() :: uvar() | [{named_arg_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), aeso_syntax:expr()}].
|
||||
|
||||
-type utype() :: {fun_t, aeso_syntax:ann(), named_args_t(), [utype()] | var_args, utype()}
|
||||
| {app_t, aeso_syntax:ann(), utype(), [utype()]}
|
||||
| {tuple_t, aeso_syntax:ann(), [utype()]}
|
||||
| aeso_syntax:id() | aeso_syntax:qid()
|
||||
| aeso_syntax:con() | aeso_syntax:qcon() %% contracts
|
||||
| aeso_syntax:tvar()
|
||||
| {if_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), utype()} %% Can branch on named argument (protected)
|
||||
| uvar().
|
||||
|
||||
-type type_constraints() :: none | bytes_concat | bytes_split | address_to_contract | bytecode_hash.
|
||||
|
||||
-type typesig() :: {type_sig, aeso_syntax:ann(), type_constraints(), [aeso_syntax:named_arg_t()], [aeso_syntax:type()], aeso_syntax:type()}.
|
Loading…
x
Reference in New Issue
Block a user