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

Unified Diff: pkg/analyzer/test/generated/parser_fasta_test.dart

Issue 2993833002: fasta listener assert enclosing event (Closed)
Patch Set: update comment Created 3 years, 4 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
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_listener.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_fasta_test.dart
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 61508ae31f3c5ab29507acfa8ad3fc4a503a045a..81d6fc71c9fb6a5274bd02aa34375574f208c6f7 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -467,12 +467,12 @@ class FastaParserTestCase extends Object
@override
CompilationUnitMember parseFullCompilationUnitMember() {
- return _parserProxy._run((parser) => parser.parseTopLevelDeclaration);
+ return _parserProxy.parseTopLevelDeclaration();
}
@override
Directive parseFullDirective() {
- return _parserProxy._run((parser) => parser.parseTopLevelDeclaration);
+ return _parserProxy.parseTopLevelDeclaration();
}
@override
@@ -792,6 +792,8 @@ class ParserProxy implements analyzer.Parser {
*/
final GatheringErrorListener _errorListener;
+ final ForwardingTestListener _eventListener;
+
/**
* Creates a [ParserProxy] which is prepared to begin parsing at the given
* Fasta token.
@@ -807,28 +809,40 @@ class ParserProxy implements analyzer.Parser {
var astBuilder =
new AstBuilder(errorReporter, library, member, scope, true);
astBuilder.parseGenericMethodComments = enableGenericMethodComments;
- var fastaParser = new fasta.Parser(new ForwardingTestListener(astBuilder));
+ var eventListener = new ForwardingTestListener(astBuilder);
+ var fastaParser = new fasta.Parser(eventListener);
astBuilder.parser = fastaParser;
return new ParserProxy._(
- startingToken, fastaParser, astBuilder, errorListener);
+ startingToken, fastaParser, astBuilder, errorListener, eventListener);
}
ParserProxy._(this._currentFastaToken, this._fastaParser, this._astBuilder,
- this._errorListener);
+ this._errorListener, this._eventListener);
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
@override
ClassMember parseClassMember(String className) {
_astBuilder.className = className;
+ _eventListener.begin('CompilationUnit');
var result = _run((parser) => parser.parseMember) as ClassMember;
+ _eventListener.end('CompilationUnit');
_astBuilder.className = null;
return result;
}
@override
CompilationUnit parseCompilationUnit2() {
- return _run((parser) => parser.parseUnit) as CompilationUnit;
+ var result = _run((parser) => parser.parseUnit) as CompilationUnit;
+ _eventListener.expectEmpty();
+ return result;
+ }
+
+ AnnotatedNode parseTopLevelDeclaration() {
+ _eventListener.begin('CompilationUnit');
+ var result = _run((parser) => parser.parseTopLevelDeclaration);
+ _eventListener.end('CompilationUnit');
+ return result;
}
/**
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698