dmd.initsem
Semantic analysis of initializers.
License
Source: initsem.d
Documentation: https://dlang.org/phobos/dmd_initsem.html
-
Declaration
Expression
toAssocArrayLiteral
(ArrayInitializerai
);If possible, convert array initializer to associative array initializer.
Parameters
ArrayInitializer
ai
array initializer to be converted
Return Value
The converted associative array initializer or ErrorExp if
is not an associative array initializer.ai
-
Declaration
Initializer
initializerSemantic
(Initializerinit
, Scope*sc
, Typet
, NeedInterpretneedInterpret
);Perform semantic analysis on
init
.Parameters
Initializer
init
Initializer AST node
Scope*
sc
context
Type
t
type that the initializer needs to become
NeedInterpret
needInterpret
if CTFE needs to be run on this, such as if it is the initializer for a const declaration
Return Value
Initializer
with completed semantic analysis,ErrorInitializer
if errors were encountered -
Declaration
Initializer
inferType
(Initializerinit
, Scope*sc
);Translate
init
to anExpression
in order to infer the type.Parameters
Initializer
init
Initializer
AST nodeScope*
sc
context
Return Value
an equivalent
ExpInitializer
if successful, orErrorInitializer
if it cannot be translated -
Declaration
Expression
initializerToExpression
(Initializerinit
, Typeitype
= null);Translate
init
to anExpression
.Parameters
Initializer
init
Initializer
AST nodeType
itype
if not
null
, type to coerce expression toReturn Value
Expression
created,null
if cannot,ErrorExp
for other errors