Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1007)

Unified Diff: pkg/front_end/lib/src/fasta/parser/listener.dart

Issue 2930673002: Implement initializer asserts. (Closed)
Patch Set: Address comments and tweak error recovery. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/parser/listener.dart
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index 1ac2b7f3dc52e791634f59ab7670d7c8fcf7a2e4..fb84787c65466e0b63a34cbc9d7e3446845da7bf 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -10,7 +10,7 @@ import '../../scanner/token.dart' show BeginToken, Token, TokenType;
import '../util/link.dart' show Link;
-import 'parser.dart' show FormalParameterType, MemberKind;
+import 'parser.dart' show Assert, FormalParameterType, MemberKind;
import 'identifier_context.dart' show IdentifierContext;
@@ -168,11 +168,19 @@ class Listener {
void beginExpressionStatement(Token token) {}
/// Called by [ClassMemberParser] after skipping an expression as error
- /// recovery.
- void handleRecoverExpression(Token token) {
+ /// recovery. For a stack-based listener, the suggested action is to push
+ /// `null` or a synthetic erroneous expression.
+ void handleRecoverExpression(Token token, FastaMessage message) {
logEvent("RecoverExpression");
}
+ /// Called by [Parser] after parsing an extraneous expression as error
+ /// recovery. For a stack-based listener, the suggested action is to discard
+ /// an expression from the stack.
+ void handleExtraneousExpression(Token token, FastaMessage message) {
+ logEvent("ExtraneousExpression");
+ }
+
void endExpressionStatement(Token token) {
logEvent("ExpressionStatement");
}
@@ -857,9 +865,11 @@ class Listener {
logEvent("EmptyStatement");
}
- void handleAssertStatement(Token assertKeyword, Token leftParenthesis,
+ void beginAssert(Token assertKeyword, Assert kind) {}
+
+ void endAssert(Token assertKeyword, Assert kind, Token leftParenthesis,
Token commaToken, Token rightParenthesis, Token semicolonToken) {
- logEvent("AssertStatement");
+ logEvent("Assert");
}
/** Called with either the token containing a double literal, or
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/class_member_parser.dart ('k') | pkg/front_end/lib/src/fasta/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698