dmd.typesem
Semantic analysis for D types.
License
Source: typesem.d
Documentation: https://dlang.org/phobos/dmd_typesem.html
-
Declaration
Expression
typeToExpression
(Typet
);We've mistakenly parsed
as a type. Redot
as an Expression only if there are no type modifiers.t
Parameters
Type
t
mistaken type
Return Value
t
redone as Expression,null
if cannot -
Declaration
Type
typeSemantic
(Typetype
, const ref Locloc
, Scope*sc
);Perform semantic analysis on a
type
.Parameters
Type
type
Type AST node
Loc
loc
the location of the
type
Scope*
sc
context
Return Value
Type
with completed semantic analysis,Terror
if errors were encountered -
Declaration
Type
merge
(Typetype
);If an identical
type
to
is intype
, return the latter one. Otherwise, add it totype
.stringtable
. Some types don't get merged and are returned as-is.type
.stringtableParameters
Type
type
Type to check against existing types
Return Value
the
type
that was merged -
Declaration
Expression
getProperty
(Typet
, Scope*scope_
, const ref Locloc
, Identifierident
, intflag
, Expressionsrc
= null);Calculate built-in properties which just the type is necessary.
Parameters
Type
t
the type for which the property is calculated
Scope*
scope_
the scope from which the property is being accessed. Used for visibility checks only.
Loc
loc
the location where the property is encountered
Identifier
ident
the identifier of the property
int
flag
if
flag
& 1, don't
report "not a property" error and just return NULL.Expression
src
expression for type
ort
null
.Return Value
expression representing the property, or
null
if not a property and (flag
& 1) -
Declaration
void
resolve
(Typemt
, const ref Locloc
, Scope*sc
, out Expressionpe
, out Typept
, out Dsymbolps
, boolintypeid
= false);Resolve type '
mt
' to either type, symbol, or expression. If errors happened, resolved to Type.terror.Parameters
Type
mt
type to be resolved
Loc
loc
the location where the type is encountered
Scope*
sc
the scope of the type
Expression
pe
is set if t is an expression
Type
pt
is set if t is a type
Dsymbol
ps
is set if t is a symbol
bool
intypeid
true
if in type id -
Declaration
Expression
dotExp
(Typemt
, Scope*sc
, Expressione
, Identifierident
, DotExpFlagflag
);Access the members of the object
e
. This type is same ase
.type.Parameters
Type
mt
type for which the dot expression is used
Scope*
sc
instantiating scope
Expression
e
expression to convert
Identifier
ident
identifier being used
DotExpFlag
flag
DotExpFlag bit flags
Return Value
resulting expression with
e
.ident
resolved -
Declaration
Expression
defaultInit
(Typemt
, const ref Locloc
, const boolisCfile
= false);Get the default initialization expression for a type.
Parameters
Type
mt
the type for which the init expression is returned
Loc
loc
the location where the expression needs to be evaluated
bool
isCfile
default initializers are different with C
Return Value
The initialization expression for the type.
-
Declaration
Type
getComplexLibraryType
(const ref Locloc
, Scope*sc
, TYty
);Extract complex type from core.stdc.config
Parameters
Loc
loc
for error messages
Scope*
sc
context
TY
ty
a complex or imaginary type
Return Value
Complex!float, Complex!double, Complex!real or
null
for error