Class VariableDeclaration

Hierarchy (view full)

Constructors

Properties

constant: boolean

Set if the variable can not be assigned a new value after declaration

context?: ASTContext

Current tree context of the node

documentation?: string | StructuredDocumentation

Optional documentation appearing above the variable declaration:

  • Is undefined when not specified.
  • Is type of string for compatibility reasons.
  • Is instance of StructuredDocumentation when specified and compiler version is 0.6.9 or newer.
id: number

Unique identifier number for the node in the tree context

indexed: boolean

Set if variable declaration is marked as indexed. Indexed variable declarations may appear in parameter list of event definitions.

mutability: Mutability

Variable mutability, for example mutable, immutable or constant.

name: string

Identifier of the variable

nameLocation?: string

The source range for name string

parent?: ASTNode

The AST node that is containing current node

raw?: any

Raw original Solc AST node that was used to create current node.

scope: number

Id of scoped node

src: string

Source mapping data corresponting to the AST node.

The value has format start:length:sourceIndex:

  • start is the starting index of the corresponding code fragment substring in the source string;
  • length is the length of corresponding code fragment substring;
  • sourceIndex is the index number of the source unit (file), that contains the AST node.

To get parsed values, use sourceInfo accessor.

stateVariable: boolean

Set if variable is a state variable. Not set is variable is local.

storageLocation: DataLocation

Data storage location. For example: storage, memory or calldata. If it's not set, then the value is default.

typeString: string

Type string

vOverrideSpecifier?: OverrideSpecifier

Override specifier if provided

vType?: TypeName

Variable type. Can be empty for Solidity 0.4.x declarations with var keyword.

vValue?: Expression

The expression that is assigned in place as part of the declaration.

In common, it is set for state variables that have initializers in place. Also, it is not set for declarations, that are children of VariableDeclarationStatement, as such statements have own initial value property and may have tuple assignments.

State variable visibility, for example public, internal or private.

Accessors

  • get firstChild(): undefined | ASTNode
  • Returns the first immediate child of the node, or undefined if the node has no children.

    Returns undefined | ASTNode

  • get lastChild(): undefined | ASTNode
  • Returns the last immediate child of the node, or undefined if the node has no children.

    Returns undefined | ASTNode

  • get nextSibling(): undefined | ASTNode
  • Returns the node immediately following the current one in its parent's children.

    Returns undefined if the current node is the last child in its parent's children.

    Returns undefined | ASTNode

  • get previousSibling(): undefined | ASTNode
  • Returns the node immediately preceding the current one in its parent's children.

    Returns undefined if the current node is the first child in its parent's children.

    Returns undefined | ASTNode

  • get type(): string
  • Type of the AST node

    Returns string

Methods

  • Extracts and returns substring from source, that corresponds to src property value of the current node.

    In other words, returns corresponding code fragment substring.

    Parameters

    • source: Uint8Array

    Returns Uint8Array

  • Returns string representation of the node properties.

    Parameters

    • depth: number = 0

      The number of children node levels to output

    Returns string

Generated using TypeDoc