[loose parser] Make sure VariableDeclaration nodes have at least one decl
Closes marijnh/tern#255
This commit is contained in:
@@ -484,6 +484,11 @@
|
||||
node.declarations.push(finishNode(decl, "VariableDeclarator"));
|
||||
if (!eat(tt.comma)) break;
|
||||
}
|
||||
if (!node.declarations.length) {
|
||||
var decl = startNode();
|
||||
decl.id = dummyIdent();
|
||||
node.declarations.push(finishNode(decl, "VariableDeclarator"));
|
||||
}
|
||||
return finishNode(node, "VariableDeclaration");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user