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

Side by Side Diff: pkg/analyzer/test/generated/parser_fasta_test.dart

Issue 3010713002: improve recovery of invalid top level abstract modifier usage (Closed)
Patch Set: rebase Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/token.dart' as analyzer; 6 import 'package:analyzer/dart/ast/token.dart' as analyzer;
7 import 'package:analyzer/dart/ast/token.dart' show TokenType; 7 import 'package:analyzer/dart/ast/token.dart' show TokenType;
8 import 'package:analyzer/error/error.dart'; 8 import 'package:analyzer/error/error.dart';
9 import 'package:analyzer/error/listener.dart' show ErrorReporter; 9 import 'package:analyzer/error/listener.dart' show ErrorReporter;
10 import 'package:analyzer/src/dart/scanner/scanner.dart'; 10 import 'package:analyzer/src/dart/scanner/scanner.dart';
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 /** 136 /**
137 * Tests of the fasta parser based on [ErrorParserTest]. 137 * Tests of the fasta parser based on [ErrorParserTest].
138 */ 138 */
139 @reflectiveTest 139 @reflectiveTest
140 class ErrorParserTest_Fasta extends FastaParserTestCase 140 class ErrorParserTest_Fasta extends FastaParserTestCase
141 with ErrorParserTestMixin { 141 with ErrorParserTestMixin {
142 @override 142 @override
143 @failingTest 143 @failingTest
144 void test_abstractEnum() {
145 super.test_abstractEnum();
146 }
147
148 @override
149 @failingTest
150 void test_abstractTypeDef() {
151 super.test_abstractTypeDef();
152 }
153
154 @override
155 @failingTest
156 void test_annotationOnEnumConstant_first() { 144 void test_annotationOnEnumConstant_first() {
157 super.test_annotationOnEnumConstant_first(); 145 super.test_annotationOnEnumConstant_first();
158 } 146 }
159 147
160 @override 148 @override
161 @failingTest 149 @failingTest
162 void test_annotationOnEnumConstant_middle() { 150 void test_annotationOnEnumConstant_middle() {
163 super.test_annotationOnEnumConstant_middle(); 151 super.test_annotationOnEnumConstant_middle();
164 } 152 }
165 153
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 createParser(source); 2554 createParser(source);
2567 Object result = _parserProxy._run(getParseFunction); 2555 Object result = _parserProxy._run(getParseFunction);
2568 assertErrorsWithCodes(errorCodes); 2556 assertErrorsWithCodes(errorCodes);
2569 return result; 2557 return result;
2570 } 2558 }
2571 2559
2572 List<ErrorCode> _toFastaGeneratedAnalyzerErrorCodes( 2560 List<ErrorCode> _toFastaGeneratedAnalyzerErrorCodes(
2573 List<ErrorCode> expectedErrorCodes) => 2561 List<ErrorCode> expectedErrorCodes) =>
2574 expectedErrorCodes.map((code) { 2562 expectedErrorCodes.map((code) {
2575 if (code == ParserErrorCode.ABSTRACT_CLASS_MEMBER || 2563 if (code == ParserErrorCode.ABSTRACT_CLASS_MEMBER ||
2564 code == ParserErrorCode.ABSTRACT_ENUM ||
2576 code == ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION || 2565 code == ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION ||
2577 code == ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE) 2566 code == ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE ||
2567 code == ParserErrorCode.ABSTRACT_TYPEDEF)
2578 return ParserErrorCode.EXTRANEOUS_MODIFIER; 2568 return ParserErrorCode.EXTRANEOUS_MODIFIER;
2579 return code; 2569 return code;
2580 }).toList(); 2570 }).toList();
2581 } 2571 }
2582 2572
2583 /** 2573 /**
2584 * Tests of the fasta parser based on [FormalParameterParserTestMixin]. 2574 * Tests of the fasta parser based on [FormalParameterParserTestMixin].
2585 */ 2575 */
2586 @reflectiveTest 2576 @reflectiveTest
2587 class FormalParameterParserTest_Fasta extends FastaParserTestCase 2577 class FormalParameterParserTest_Fasta extends FastaParserTestCase
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
4606 test_parseClassDeclaration_native_missing_literal(); 4596 test_parseClassDeclaration_native_missing_literal();
4607 } 4597 }
4608 4598
4609 void test_parseClassDeclaration_native_not_allowed() { 4599 void test_parseClassDeclaration_native_not_allowed() {
4610 allowNativeClause = false; 4600 allowNativeClause = false;
4611 test_parseClassDeclaration_native(); 4601 test_parseClassDeclaration_native();
4612 } 4602 }
4613 4603
4614 @override 4604 @override
4615 @failingTest 4605 @failingTest
4606 void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
4607 // TODO(danrubel): built-in "abstract" cannot be used as a type
4608 super.test_parseCompilationUnit_abstractAsPrefix_parameterized();
4609 }
4610
4611 @override
4612 @failingTest
4616 void test_parseCompilationUnit_builtIn_asFunctionName() { 4613 void test_parseCompilationUnit_builtIn_asFunctionName() {
4617 // TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in 4614 // TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in
4618 // identifiers `export`, `import`, `library`, `part`, or `typedef` appears 4615 // identifiers `export`, `import`, `library`, `part`, or `typedef` appears
4619 // as the name of a top level function with an implicit return type. 4616 // as the name of a top level function with an implicit return type.
4620 super.test_parseCompilationUnit_builtIn_asFunctionName(); 4617 super.test_parseCompilationUnit_builtIn_asFunctionName();
4621 } 4618 }
4622 4619
4623 @override 4620 @override
4624 @failingTest 4621 @failingTest
4625 void test_parseCompilationUnit_exportAsPrefix() { 4622 void test_parseCompilationUnit_exportAsPrefix() {
(...skipping 15 matching lines...) Expand all
4641 assertNoErrors(); 4638 assertNoErrors();
4642 } 4639 }
4643 4640
4644 @failingTest 4641 @failingTest
4645 void test_parseCompilationUnit_typedefAsPrefix2() { 4642 void test_parseCompilationUnit_typedefAsPrefix2() {
4646 // TODO(danrubel): should not be generating an error 4643 // TODO(danrubel): should not be generating an error
4647 super.test_parseCompilationUnit_typedefAsPrefix(); 4644 super.test_parseCompilationUnit_typedefAsPrefix();
4648 assertNoErrors(); 4645 assertNoErrors();
4649 } 4646 }
4650 4647
4648 @override
4649 @failingTest
4650 void test_parseCompilationUnitMember_abstractAsPrefix() {
4651 // TODO(danrubel): built-in "abstract" cannot be used as a prefix
4652 super.test_parseCompilationUnitMember_abstractAsPrefix();
4653 }
4654
4651 @failingTest 4655 @failingTest
4652 void test_parseCompilationUnitMember_abstractAsPrefix2() { 4656 void test_parseCompilationUnitMember_abstractAsPrefix2() {
4653 // TODO(danrubel): should not be generating an error 4657 // TODO(danrubel): should not be generating an error
4654 super.test_parseCompilationUnitMember_abstractAsPrefix(); 4658 super.test_parseCompilationUnitMember_abstractAsPrefix();
4655 assertNoErrors(); 4659 assertNoErrors();
4656 } 4660 }
4657 4661
4658 @override 4662 @override
4659 @failingTest 4663 @failingTest
4660 void test_parseDirectives_mixed() { 4664 void test_parseDirectives_mixed() {
4661 // TODO(paulberry,ahe): This test verifies the analyzer parser's ability to 4665 // TODO(paulberry,ahe): This test verifies the analyzer parser's ability to
4662 // stop parsing as soon as the first non-directive is encountered; this is 4666 // stop parsing as soon as the first non-directive is encountered; this is
4663 // useful for quickly traversing an import graph. Consider adding a similar 4667 // useful for quickly traversing an import graph. Consider adding a similar
4664 // ability to Fasta's parser. 4668 // ability to Fasta's parser.
4665 super.test_parseDirectives_mixed(); 4669 super.test_parseDirectives_mixed();
4666 } 4670 }
4667 } 4671 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698