Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# dmd.initsem

Semantic analysis of initializers.
Authors:
Walter Bright
License:
Boost License 1.0

Source initsem.d

Documentation https://dlang.org/phobos/dmd_initsem.html

Coverage https://codecov.io/gh/dlang/dmd/src/master/src/dmd/initsem.d

Expression `toAssocArrayLiteral`(ArrayInitializer `ai`);
  If possible, convert array initializer to associative array initializer.
  Parameters:

  ArrayInitializer `ai` | array initializer to be converted

  Returns:
  The converted associative array initializer or ErrorExp if `ai` is not an associative array initializer.
Initializer `initializerSemantic`(Initializer `init`, Scope* `sc`, Type `t`, NeedInterpret `needInterpret`);
  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

  Returns:
  Initializer with completed semantic analysis, ErrorInitializer if errors were encountered
Initializer `inferType`(Initializer `init`, Scope* `sc`);
  Translate init to an Expression in order to infer the type.
  Parameters:

  Initializer `init` | Initializer AST node
  Scope* `sc` | context

  Returns:
  an equivalent ExpInitializer if successful, or ErrorInitializer if it cannot be translated
Expression `initializerToExpression`(Initializer `init`, Type `itype` = null);
  Translate init to an Expression.
  Parameters:

  Initializer `init` | Initializer AST node
  Type `itype` | if not null, type to coerce expression to

  Returns:
  Expression created, null if cannot, ErrorExp for other errors

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Mon May 11 10:58:06 2020