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

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

Issue 2944383002: translate fasta parser error to analyzer error (Closed)
Patch Set: 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/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 4a60a8ab63ac6210a56d76d75359d7e9f9f9a5f0..cb2e50cef9ee9d256bfa5ca3922ef18bc833e0c4 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -62,6 +62,11 @@ abstract class AbstractParserTestCase implements ParserTestHelpers {
*/
Parser get parser;
+ /**
+ * Flag indicating whether the fasta parser is being used.
+ */
+ bool get usingFasta;
+
/**
* Assert that the number and codes of errors occurred during parsing is the
* same as the [expectedErrorCodes].
@@ -8132,6 +8137,9 @@ class ParserTestCase extends EngineTestCase
*/
Parser parser;
+ @override
+ bool get usingFasta => Parser.useFasta;
+
@override
void assertErrorsWithCodes(List<ErrorCode> expectedErrorCodes) {
listener.assertErrorsWithCodes(expectedErrorCodes);
@@ -13651,10 +13659,13 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
}
void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
- createParser('abstract<dynamic> _abstract = new abstract.A();');
- CompilationUnit unit = parser.parseCompilationUnit2();
- expect(unit, isNotNull);
- assertNoErrors();
+ var errorCodes = <ErrorCode>[];
+ if (usingFasta) {
+ // built-in "abstract" cannot be used as a type
+ errorCodes.add(ParserErrorCode.EXPECTED_TYPE_NAME);
+ }
+ CompilationUnit unit = parseCompilationUnit(
+ 'abstract<dynamic> _abstract = new abstract.A();', errorCodes);
expect(unit.scriptTag, isNull);
expect(unit.directives, hasLength(0));
expect(unit.declarations, hasLength(1));
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/front_end/lib/src/fasta/fasta_codes_generated.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698