ComputedFieldTypes._computed
— Method_computed(__module__::Module, typeexpr::Expr)
the bulk of the work to compute the AST transform
ComputedFieldTypes.find_struct_decl
— Methodfind_struct_decl(block::Expr)
Locate a :struct decl inside a :block of expressions.
ComputedFieldTypes.fulltype
— Methodfulltype(::Type)
Fill in the computed type parameters for T
(if applicable and possible)
ComputedFieldTypes.getenv!
— Methodgetenv!(expr, tvars, defs)
replace anything that isn't computable by apply_type with a dummy type-variable
ComputedFieldTypes.make_Type_expr
— Methodmake_Type_expr(tname, decl_tvars)
make the ::Type{T}
expression that is equivalent to the original type declaration
ComputedFieldTypes.make_curly
— Methodmake_curly(expr)
given an apply-type expression (T
or T{...}
), return Expr(:curly, T, ...)
ComputedFieldTypes.make_fulltype_expr
— Methodmake_fulltype_expr(tname, decl_tvars, def)
compute the leaf T{def}
expression that is equivalent for the new type declaration
ComputedFieldTypes.make_new_expr
— Methodmake_new_expr(tname, decl_tvars, def)
compute the leaf T{...}
expression that describes the new type declaration
ComputedFieldTypes.rewrite_new!
— Methodrewrite_new!(expr, tname::Symbol, decl_tvars, def)
rewrite the constructors to capture only the intended values
ComputedFieldTypes.@computed
— Macro@computed type
Allows declaration of a type expression where some of the fields types are arbitrary computed functions of other type parameters. It's suggested that those expressions be const
(return the same value for the same inputs), but that is not essential.