Variable

Variable

new Variable()

Any expression node. Since the left-hand side of an assignment may be any expression in general, an expression can also be a pattern.

Properties:
Name Type Description
name String | Node

The variable name (can be a complex expression when the name is resolved dynamically)

byref boolean

Indicate if the variable reference is used, ex &$foo

curly boolean

Indicate if the name is defined between curlies, ex ${foo}

Source:
Example
// PHP code :
&$foo
// AST output
{
 "kind": "variable",
 "name": "foo",
 "byref": true,
 "curly": false
}

Extends

Methods

destroy()

Destroying an unused node

Inherited From:
Source:

includeToken(parser)

Includes current token position of the parser

Parameters:
Name Type Description
parser *
Inherited From:
Source:

setTrailingComments(docs)

Attach comments to current node

Parameters:
Name Type Description
docs *
Inherited From:
Source: