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

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

Issue 2837033003: Fix exception when parsing broken code (issue 29447) (Closed)
Patch Set: Created 3 years, 7 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 | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | 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) 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 library analyzer.test.generated.parser_test; 5 library analyzer.test.generated.parser_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after
3939 } 3939 }
3940 3940
3941 void test_topLevelVariable_withMetadata() { 3941 void test_topLevelVariable_withMetadata() {
3942 parseCompilationUnit("String @A string;", [ 3942 parseCompilationUnit("String @A string;", [
3943 ParserErrorCode.MISSING_IDENTIFIER, 3943 ParserErrorCode.MISSING_IDENTIFIER,
3944 ParserErrorCode.EXPECTED_TOKEN, 3944 ParserErrorCode.EXPECTED_TOKEN,
3945 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE 3945 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
3946 ]); 3946 ]);
3947 } 3947 }
3948 3948
3949 void test_typedef_incomplete() {
3950 // TODO(brianwilkerson) Improve recovery for this case.
3951 parseCompilationUnit(
3952 '''
3953 class A {}
3954 class B extends A {}
3955
3956 typedef T
3957
3958 main() {
3959 Function<
3960 }
3961 ''',
3962 [
3963 ParserErrorCode.EXPECTED_TOKEN,
3964 ParserErrorCode.UNEXPECTED_TOKEN,
3965 ParserErrorCode.EXPECTED_EXECUTABLE
3966 ]);
3967 }
3968
3949 void test_typedef_namedFunction() { 3969 void test_typedef_namedFunction() {
3950 // TODO(brianwilkerson) Improve recovery for this case. 3970 // TODO(brianwilkerson) Improve recovery for this case.
3951 parseCompilationUnit('typedef void Function();', [ 3971 parseCompilationUnit('typedef void Function();', [
3952 ParserErrorCode.UNEXPECTED_TOKEN, 3972 ParserErrorCode.UNEXPECTED_TOKEN,
3953 ParserErrorCode.MISSING_IDENTIFIER, 3973 ParserErrorCode.MISSING_IDENTIFIER,
3954 ParserErrorCode.EXPECTED_EXECUTABLE, 3974 ParserErrorCode.EXPECTED_EXECUTABLE,
3955 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS 3975 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS
3956 ]); 3976 ]);
3957 } 3977 }
3958 3978
(...skipping 10997 matching lines...) Expand 10 before | Expand all | Expand 10 after
14956 expectCommentText(typeVariable.documentationComment, '/// Doc'); 14976 expectCommentText(typeVariable.documentationComment, '/// Doc');
14957 } 14977 }
14958 14978
14959 /** 14979 /**
14960 * Assert that the given [name] is in declaration context. 14980 * Assert that the given [name] is in declaration context.
14961 */ 14981 */
14962 void _assertIsDeclarationName(SimpleIdentifier name) { 14982 void _assertIsDeclarationName(SimpleIdentifier name) {
14963 expect(name.inDeclarationContext(), isTrue); 14983 expect(name.inDeclarationContext(), isTrue);
14964 } 14984 }
14965 } 14985 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698