dmd.initsem
Semantic analysis of initializers.
License
Source: initsem.d
Documentation: https://dlang.org/phobos/dmd_initsem.html
-
Declaration
ExpressiontoAssocArrayLiteral(ArrayInitializerai);If possible, convert array initializer to associative array initializer.
Parameters
ArrayInitializeraiarray initializer to be converted
Return Value
The converted associative array initializer or ErrorExp if
is not an associative array initializer.ai -
Declaration
InitializerinitializerSemantic(Initializerinit, Scope*sc, ref Typetx, NeedInterpretneedInterpret);Perform semantic analysis on
init.Parameters
InitializerinitInitializer AST node
Scope*sccontext
Typetxtype that the initializer needs to become. If
txis an incomplete type and the initializer completes it, it is updated to be the complete type. ImportC has incomplete typesNeedInterpretneedInterpretif CTFE needs to be run on this, such as if it is the initializer for a const declaration
Return Value
Initializerwith completed semantic analysis,ErrorInitializerif errors were encountered -
Declaration
InitializerinferType(Initializerinit, Scope*sc);Translate
initto anExpressionin order to infer the type.Parameters
InitializerinitInitializerAST nodeScope*sccontext
Return Value
an equivalent
ExpInitializerif successful, orErrorInitializerif it cannot be translated -
Declaration
ExpressioninitializerToExpression(Initializerinit, Typeitype= null, const boolisCfile= false);Translate
initto anExpression.Parameters
InitializerinitInitializerAST nodeTypeitypeif not
null, type to coerce expression toboolisCfiledefault initializers are different with C
Return Value
Expressioncreated,nullif cannot,ErrorExpfor other errors