Skip to content

Commit 1d2ce7c

Browse files
committed
glayzzle#73 add a curly boolean on variable node
1 parent b283867 commit 1d2ce7c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/ast/variable.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,25 @@ var KIND = 'variable';
1212
* be any expression in general, an expression can also be a pattern.
1313
* @constructor Variable
1414
* @extends {Expression}
15-
* @property {String|Node} name
16-
* @property {boolean} byref
15+
* @example
16+
* // PHP code :
17+
* &$foo
18+
* // AST output
19+
* {
20+
* "kind": "variable",
21+
* "name": "foo",
22+
* "byref": true,
23+
* "curly": false
24+
* }
25+
* @property {String|Node} name The variable name (can be a complex expression when the name is resolved dynamically)
26+
* @property {boolean} byref Indicate if the variable reference is used, ex `&$foo`
27+
* @property {boolean} curly Indicate if the name is defined between curlies, ex `${foo}`
1728
*/
18-
var Variable = Expr.extends(function Variable(name, byref, location) {
29+
var Variable = Expr.extends(function Variable(name, byref, curly, location) {
1930
Expr.apply(this, [KIND, location]);
2031
this.name = name;
2132
this.byref = byref || false;
33+
this.curly = curly || false;
2234
});
2335

2436
module.exports = Variable;

0 commit comments

Comments
 (0)