Skip to content

Commit ecf1f8c

Browse files
committed
migrate variable
1 parent b3eb158 commit ecf1f8c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/variable.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ var node = require('./node');
99

1010
/**
1111
* **Extends from {@link NODE.md|:link: node}**
12-
*
12+
*
1313
* Reprensents a variable declaration
14-
*
15-
* @public
14+
*
15+
* @public
1616
* @constructor variable
1717
* @property {String} name
1818
*/
@@ -22,9 +22,11 @@ var variable = node.extends('variable');
2222
* @protected Consumes the current ast node
2323
*/
2424
variable.prototype.consume = function(ast) {
25-
this.name = ast[1][1];
25+
if (ast.kind === 'assign') {
26+
this.name = ast.left.name;
27+
} else {
28+
this.name = ast.name;
29+
}
2630
};
2731

2832
module.exports = variable;
29-
30-

0 commit comments

Comments
 (0)