New parser event needed to check case expressions.

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2900993002 .
This commit is contained in:
Peter von der Ahé 2017-05-24 11:48:41 +02:00
parent 1cfb242321
commit f5012090f9
2 changed files with 8 additions and 0 deletions

View file

@ -65,6 +65,12 @@ class Listener {
logEvent("Cascade");
}
void beginCaseExpression(Token caseKeyword) {}
void endCaseExpression(Token colon) {
logEvent("CaseExpression");
}
void beginClassBody(Token token) {}
/// Handle the end of the body of a class declaration. The only substructures

View file

@ -3722,7 +3722,9 @@ class Parser {
labelCount++;
}
Token caseKeyword = token;
listener.beginCaseExpression(token);
token = parseExpression(token.next);
listener.endCaseExpression(token);
Token colonToken = token;
token = expect(':', token);
listener.handleCaseMatch(caseKeyword, colonToken);