parseVariableDeclarationList method
Implementation
VariableDeclaration parseVariableDeclarationList({bool allowIn = true}) {
int start = token?.startOffset??0;
int line = token?.line??0;
assert(token?.text == 'var'||token?.text == 'let'||token?.text == 'const');
consume(Token.NAME);
List<VariableDeclarator> list = <VariableDeclarator>[];
while (true) {
Name name = parseName();
Expression? init = null;
if (token?.type == Token.ASSIGN) {
if (token?.text != '=') {
fail(message: 'Compound assignment in initializer');
}
next();
init = parseAssignment(allowIn: allowIn);
}
list.add(new VariableDeclarator(name, init)
..start = name.start
..end = endOffset
..line = name.line);
if (token?.type != Token.COMMA) break;
next();
}
return new VariableDeclaration(list)
..start = start
..end = endOffset
..line = line;
}