dmd.typesem
Semantic analysis for D types.
License
Source: typesem.d
Documentation: https://dlang.org/phobos/dmd_typesem.html
-
Declaration
ExpressiontypeToExpression(Typet);We've mistakenly parsed
as a type. Redotas an Expression only if there are no type modifiers.tParameters
Typetmistaken type
Return Value
tredone as Expression,nullif cannot -
Declaration
TypetypeSemantic(Typetype, ref const Locloc, Scope*sc);Perform semantic analysis on a
type.Parameters
TypetypeType AST node
Loclocthe location of the
typeScope*sccontext
Return Value
Typewith completed semantic analysis,Terrorif errors were encountered -
Declaration
RootObjectcompileTypeMixin(TypeMixintm, Locloc, Scope*sc);Compile the MixinType, returning the type or expression AST.
Discussion
Doesn't run semantic() on the returned object.
Parameters
TypeMixintmmixin to compile as a type or expression
Locloclocation for error messages
Scope*sccontext
Return:
nullif error, else RootObject AST as parsed -
Declaration
Typemerge(Typetype);If an identical
typetois intype, return the latter one. Otherwise, add it totype.stringtable. Some types don't get merged and are returned as-is.type.stringtableParameters
TypetypeType to check against existing types
Return Value
the
typethat was merged -
Declaration
ExpressiongetProperty(Typet, Scope*scope_, ref const Locloc, Identifierident, intflag);Calculate built-in properties which just the type is necessary.
Parameters
Typetthe type for which the property is calculated
Scope*scope_the scope from which the property is being accessed. Used for visibility checks only.
Loclocthe location where the property is encountered
Identifieridentthe identifier of the property
intflagif
flag& 1, don'treport "not a property" error and just return NULL.Return Value
expression representing the property, or
nullif not a property and (flag& 1) -
Declaration
voidresolve(Typemt, ref const Locloc, Scope*sc, Expression*pe, Type*pt, Dsymbol*ps, boolintypeid= false);Resolve type '
mt' to either type, symbol, or expression. If errors happened, resolved to Type.terror.Parameters
Typemttype to be resolved
Loclocthe location where the type is encountered
Scope*scthe scope of the type
Expression*peis set if t is an expression
Type*ptis set if t is a type
Dsymbol*psis set if t is a symbol
boolintypeidtrueif in type id -
Declaration
ExpressiondotExp(Typemt, Scope*sc, Expressione, Identifierident, intflag);Access the members of the object
e. This type is same ase.type.Parameters
Typemttype for which the dot expression is used
Scope*scinstantiating scope
Expressioneexpression to convert
Identifieridentidentifier being used
intflagDotExpFlag bit flags
Return Value
resulting expression with
e.identresolved -
Declaration
ExpressiondefaultInit(Typemt, ref const Locloc);Get the the default initialization expression for a type.
Parameters
Typemtthe type for which the init expression is returned
Loclocthe location where the expression needs to be evaluated
Return Value
The initialization expression for the type.