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.declaration

Miscellaneous declarations, including typedef, alias, variable declarations including the implicit this declaration, type tuples, ClassInfo, ModuleInfo and various TypeInfos.
Authors:
Walter Bright
License:
Boost License 1.0

Source declaration.d

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

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

bool `checkFrameAccess`(Loc `loc`, Scope* `sc`, AggregateDeclaration `ad`, size_t `iStart` = 0);
  Check to see the aggregate type is nested and its context pointer is accessible from the current scope. Returns true if error occurs.
bool `modifyFieldVar`(Loc `loc`, Scope* `sc`, VarDeclaration `var`, Expression `e1`);
  Mark variable v as modified if it is inside a constructor that var is a field in.
void `ObjectNotFound`(Identifier `id`);
enum STC `STCFlowThruAggregate`;
  for an AggregateDeclaration
enum STC `STCFlowThruFunction`;
  for a FuncDeclaration
abstract class `Declaration`: dmd.dsymbol.Dsymbol;
  final bool `checkDisabled`(Loc `loc`, Scope* `sc`, bool `isAliasedDeclaration` = false);
    Issue an error if an attempt to call a disabled method is made
    If the declaration is disabled but inside a disabled function, returns true but do not issue an error message.
    Parameters:

    Loc `loc` | Location information of the call
    Scope* `sc` | Scope in which the call occurs
    bool `isAliasedDeclaration` | if true searches overload set

    Returns:
    true if this Declaration is @disabled, false otherwise.
  final Modifiable `checkModify`(Loc `loc`, Scope* `sc`, Expression `e1`, int `flag`);
    Check to see if declaration can be modified in this context (sc). Issue error if not.
    Parameters:

    Loc `loc` | location for error messages
    Expression `e1` | null or this expression when this declaration is a field
    Scope* `sc` | context
    int `flag` | !=0 means do not issue error message for invalid modification

    Returns:
    Modifiable.yes or Modifiable.initialization
class `TupleDeclaration`: dmd.declaration.Declaration;
class `AliasDeclaration`: dmd.declaration.Declaration;
  bool `wasTemplateParameter`;
    indicates wether the alias was created to make a template parameter visible in the scope, i.e as a member.
class `OverDeclaration`: dmd.declaration.Declaration;
class `VarDeclaration`: dmd.declaration.Declaration;
  final bool `isDataseg`();
    Does symbol go into data segment? Includes extern variables.
  final bool `isThreadlocal`();
    Does symbol go into thread local storage?
  final bool `isCTFE`();
    Can variable be read and written by CTFE?
  final bool `canTakeAddressOf`();
    Return true if we can take the address of this variable.
  final bool `needsScopeDtor`();
    Return true if variable needs to call the destructor.
  final Expression `callScopeDtor`(Scope* `sc`);
    If a variable has a scope destructor call, return call for it. Otherwise, return NULL.
  final Expression `getConstInitializer`(bool `needFullType` = true);
    If variable has a constant expression initializer, get it. Otherwise, return null.
  final Expression `expandInitializer`(Loc `loc`);
    Helper function for the expansion of manifest constant.
  final bool `checkNestedReference`(Scope* `sc`, Loc `loc`);
    Check to see if this variable is actually in an enclosing function rather than the current one. Update nestedrefs[], closureVars[] and outerVars[].
    Returns:
    true if error occurs.
  final const pure bool `enclosesLifetimeOf`(VarDeclaration `v`);
    Determine if this has a lifetime that lasts past the destruction of `v`
    Parameters:

    VarDeclaration `v` | variable to test against

    Returns:
    true if it does
  final void `addMaybe`(VarDeclaration `v`);
    Add variable to maybes[]. When a maybescope variable `v` is assigned to a maybescope variable this, we cannot determine if this is actually scope until the semantic analysis for the function is completed. Thus, we save the data until then.
    Parameters:

    VarDeclaration `v` | an STC.maybescope variable that was assigned to this

class `SymbolDeclaration`: dmd.declaration.Declaration;
  This is a shell around a back end symbol
class `TypeInfoDeclaration`: dmd.declaration.VarDeclaration;
class `TypeInfoStructDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoClassDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoInterfaceDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoPointerDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoArrayDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoStaticArrayDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoAssociativeArrayDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoEnumDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoFunctionDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoDelegateDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoTupleDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoConstDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoInvariantDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoSharedDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoWildDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `TypeInfoVectorDeclaration`: dmd.declaration.TypeInfoDeclaration;
class `ThisDeclaration`: dmd.declaration.VarDeclaration;
  For the "this" parameter to member functions

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