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