parseExpressionOrLabeledStatement method
Statement
parseExpressionOrLabeledStatement(
)
Implementation
Statement parseExpressionOrLabeledStatement() {
int start = token?.startOffset??0; // Note: not the same as exp.start due to removal of parentheses
Expression exp = parseExpression();
if (token?.type == Token.COLON &&
exp is NameExpression &&
exp.start == start) {
Name name = exp.name;
next(); // skip the colon
Statement inner = parseStatement();
return new LabeledStatement(name, inner);
} else {
consumeSemicolon();
return new ExpressionStatement(exp)
..start = start
..end = endOffset
..line = exp.line;
}
}