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

Side by Side Diff: pkg/analyzer/test/generated/parser_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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/standard_ast_factory.dart'; 6 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
7 import 'package:analyzer/dart/ast/token.dart'; 7 import 'package:analyzer/dart/ast/token.dart';
8 import 'package:analyzer/dart/ast/visitor.dart'; 8 import 'package:analyzer/dart/ast/visitor.dart';
9 import 'package:analyzer/error/error.dart'; 9 import 'package:analyzer/error/error.dart';
10 import 'package:analyzer/error/listener.dart'; 10 import 'package:analyzer/error/listener.dart';
(...skipping 14089 matching lines...) Expand 10 before | Expand all | Expand 10 after
14100 } 14100 }
14101 expect(unit.scriptTag, isNull); 14101 expect(unit.scriptTag, isNull);
14102 expect(unit.directives, hasLength(0)); 14102 expect(unit.directives, hasLength(0));
14103 expect(unit.declarations, hasLength(1)); 14103 expect(unit.declarations, hasLength(1));
14104 } 14104 }
14105 14105
14106 void test_parseCompilationUnitMember_abstractAsPrefix() { 14106 void test_parseCompilationUnitMember_abstractAsPrefix() {
14107 createParser('abstract.A _abstract = new abstract.A();'); 14107 createParser('abstract.A _abstract = new abstract.A();');
14108 CompilationUnitMember member = parseFullCompilationUnitMember(); 14108 CompilationUnitMember member = parseFullCompilationUnitMember();
14109 expect(member, isNotNull); 14109 expect(member, isNotNull);
14110 if (usingFastaParser) { 14110 assertNoErrors();
14111 // TODO(danrubel): should not be generating an error
14112 assertErrorsWithCodes([ParserErrorCode.EXPECTED_TYPE_NAME]);
14113 } else {
14114 assertNoErrors();
14115 }
14116 expect(member, new isInstanceOf<TopLevelVariableDeclaration>()); 14111 expect(member, new isInstanceOf<TopLevelVariableDeclaration>());
14117 TopLevelVariableDeclaration declaration = member; 14112 TopLevelVariableDeclaration declaration = member;
14118 expect(declaration.semicolon, isNotNull); 14113 expect(declaration.semicolon, isNotNull);
14119 expect(declaration.variables, isNotNull); 14114 expect(declaration.variables, isNotNull);
14120 } 14115 }
14121 14116
14122 void test_parseCompilationUnitMember_class() { 14117 void test_parseCompilationUnitMember_class() {
14123 createParser('class A {}'); 14118 createParser('class A {}');
14124 CompilationUnitMember member = parseFullCompilationUnitMember(); 14119 CompilationUnitMember member = parseFullCompilationUnitMember();
14125 expect(member, isNotNull); 14120 expect(member, isNotNull);
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
15480 expectCommentText(typeVariable.documentationComment, '/// Doc'); 15475 expectCommentText(typeVariable.documentationComment, '/// Doc');
15481 } 15476 }
15482 15477
15483 /** 15478 /**
15484 * Assert that the given [name] is in declaration context. 15479 * Assert that the given [name] is in declaration context.
15485 */ 15480 */
15486 void _assertIsDeclarationName(SimpleIdentifier name) { 15481 void _assertIsDeclarationName(SimpleIdentifier name) {
15487 expect(name.inDeclarationContext(), isTrue); 15482 expect(name.inDeclarationContext(), isTrue);
15488 } 15483 }
15489 } 15484 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.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