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
, ref Typetx
, NeedInterpretneedInterpret
);Perform semantic analysis on
init
.Parameters
Initializer
init
Initializer AST node
Scope*
sc
context
Type
tx
type that the initializer needs to become. If
tx
is an incomplete type and the initializer completes it, it is updated to be the complete type. ImportC has incomplete typesNeedInterpret
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, const boolisCfile
= false);Translate
init
to anExpression
.Parameters
Initializer
init
Initializer
AST nodeType
itype
if not
null
, type to coerce expression tobool
isCfile
default initializers are different with C
Return Value
Expression
created,null
if cannot,ErrorExp
for other errors