# 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

- `checkFrameAccess`

  #### Declaration

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

- `modifyFieldVar`

  #### Declaration

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

- `ObjectNotFound`

  #### Declaration

  `void `ObjectNotFound`(Identifier `id`);`

- `Declaration`

  #### Declaration

  `abstract class `Declaration`: dmd.dsymbol.Dsymbol;`

  - `checkDisabled`

    #### Declaration

    `final bool `checkDisabled`(Loc `loc`, Scope* `sc`, bool `isAliasedDeclaration` = false);`

    Issue an error if an attempt to call a disabled method is made

    #### Discussion

    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

    #### Return Value

    `true` if this `Declaration` is `@disable`d, `false` otherwise.

  - `checkModify`

    #### Declaration

    `final Modifiable `checkModify`(Loc `loc`, Scope* `sc`, Expression `e1`, ModifyFlags `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
    `ModifyFlags `flag`` | if the first bit is set it means do not issue error message for invalid modification; if the second bit is set, it means that this declaration is a field and a subfield of it is modified.

    #### Return Value

    Modifiable.yes or Modifiable.initialization

  - `resolvedLinkage`

    #### Declaration

    `final const LINK `resolvedLinkage`();`

    Returns the linkage, resolving the target-specific `System` one.

  - `isReference`

    #### Declaration

    `final const pure nothrow @nogc @safe bool `isReference`();`

    #### Return Value

    Whether the variable is a reference, annotated with `out` or `ref`

- `TupleDeclaration`

  #### Declaration

  `class `TupleDeclaration`: dmd.declaration.Declaration;`

- `AliasDeclaration`

  #### Declaration

  `class `AliasDeclaration`: dmd.declaration.Declaration;`

  https://dlang.org/spec/declaration.html#AliasDeclaration

  - `isAliasedTemplateParameter`

    #### Declaration

    `const bool `isAliasedTemplateParameter`();`

    #### Return Value

    `true` if this instance was created to make a template parameter visible in the scope of a template body, `false` otherwise

- `OverDeclaration`

  #### Declaration

  `class `OverDeclaration`: dmd.declaration.Declaration;`

- `VarDeclaration`

  #### Declaration

  `class `VarDeclaration`: dmd.declaration.Declaration;`

  - `isDataseg`

    #### Declaration

    `final bool `isDataseg`();`

    Does symbol go into data segment? Includes extern variables.

  - `isThreadlocal`

    #### Declaration

    `final bool `isThreadlocal`();`

    Does symbol go into thread local storage?

  - `isCTFE`

    #### Declaration

    `final bool `isCTFE`();`

    Can variable be read and written by CTFE?

  - `canTakeAddressOf`

    #### Declaration

    `final bool `canTakeAddressOf`();`

    Return `true` if we can take the address of this variable.

  - `needsScopeDtor`

    #### Declaration

    `final bool `needsScopeDtor`();`

    Return `true` if variable needs to call the destructor.

  - `callScopeDtor`

    #### Declaration

    `final Expression `callScopeDtor`(Scope* `sc`);`

    If a variable has a scope destructor call, return call for it. Otherwise, return NULL.

  - `getConstInitializer`

    #### Declaration

    `final Expression `getConstInitializer`(bool `needFullType` = true);`

    If variable has a constant expression initializer, get it. Otherwise, return `null`.

  - `expandInitializer`

    #### Declaration

    `final Expression `expandInitializer`(Loc `loc`);`

    Helper function for the expansion of manifest constant.

  - `checkNestedReference`

    #### Declaration

    `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[].

    #### Return Value

    `true` if error occurs.

- `BitFieldDeclaration`

  #### Declaration

  `class `BitFieldDeclaration`: dmd.declaration.VarDeclaration;`

  C11 6.7.2.1-4 bit fields

- `SymbolDeclaration`

  #### Declaration

  `class `SymbolDeclaration`: dmd.declaration.Declaration;`

  This is a shell around a back end symbol

- `TypeInfoDeclaration`

  #### Declaration

  `class `TypeInfoDeclaration`: dmd.declaration.VarDeclaration;`

- `TypeInfoStructDeclaration`

  #### Declaration

  `class `TypeInfoStructDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoClassDeclaration`

  #### Declaration

  `class `TypeInfoClassDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoInterfaceDeclaration`

  #### Declaration

  `class `TypeInfoInterfaceDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoPointerDeclaration`

  #### Declaration

  `class `TypeInfoPointerDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoArrayDeclaration`

  #### Declaration

  `class `TypeInfoArrayDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoStaticArrayDeclaration`

  #### Declaration

  `class `TypeInfoStaticArrayDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoAssociativeArrayDeclaration`

  #### Declaration

  `class `TypeInfoAssociativeArrayDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoEnumDeclaration`

  #### Declaration

  `class `TypeInfoEnumDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoFunctionDeclaration`

  #### Declaration

  `class `TypeInfoFunctionDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoDelegateDeclaration`

  #### Declaration

  `class `TypeInfoDelegateDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoTupleDeclaration`

  #### Declaration

  `class `TypeInfoTupleDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoConstDeclaration`

  #### Declaration

  `class `TypeInfoConstDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoInvariantDeclaration`

  #### Declaration

  `class `TypeInfoInvariantDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoSharedDeclaration`

  #### Declaration

  `class `TypeInfoSharedDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoWildDeclaration`

  #### Declaration

  `class `TypeInfoWildDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `TypeInfoVectorDeclaration`

  #### Declaration

  `class `TypeInfoVectorDeclaration`: dmd.declaration.TypeInfoDeclaration;`

- `ThisDeclaration`

  #### Declaration

  `class `ThisDeclaration`: dmd.declaration.VarDeclaration;`

  For the "this" parameter to member functions