Allow var declaration element to be just a string or ID node

This commit is contained in:
Patrick Steele-Idem 2015-12-15 14:56:29 -07:00
parent 1533325034
commit 43211edb09

View File

@ -1,6 +1,7 @@
'use strict';
var Node = require('./Node');
var Identifier = require('./Identifier');
class Vars extends Node {
constructor(def) {
@ -29,6 +30,11 @@ class Vars extends Node {
for (let i=0; i<declarations.length; i++) {
var declaration = declarations[i];
if (typeof declaration === 'string' || declaration instanceof Identifier) {
declaration = {
id: declaration
};
}
if (i === 0) {
generator.write(kind + ' ');