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

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

Issue 2444453002: Improve error recovery (issue 27646) (Closed)
Patch Set: Created 4 years, 2 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/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/error/error.dart'; 10 import 'package:analyzer/error/error.dart';
(...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 3116
3117 void test_additiveExpression_super() { 3117 void test_additiveExpression_super() {
3118 BinaryExpression expression = parseExpression("super + +", [ 3118 BinaryExpression expression = parseExpression("super + +", [
3119 ParserErrorCode.MISSING_IDENTIFIER, 3119 ParserErrorCode.MISSING_IDENTIFIER,
3120 ParserErrorCode.MISSING_IDENTIFIER 3120 ParserErrorCode.MISSING_IDENTIFIER
3121 ]); 3121 ]);
3122 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, 3122 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
3123 BinaryExpression, expression.leftOperand); 3123 BinaryExpression, expression.leftOperand);
3124 } 3124 }
3125 3125
3126 void test_assignableSelector() {
3127 IndexExpression expression =
3128 parseExpression("a.b[]", [ParserErrorCode.MISSING_IDENTIFIER]);
3129 Expression index = expression.index;
3130 expect(index, new isInstanceOf<SimpleIdentifier>());
3131 expect(index.isSynthetic, isTrue);
3132 }
3133
3126 void test_assignmentExpression_missing_compound1() { 3134 void test_assignmentExpression_missing_compound1() {
3127 AssignmentExpression expression = 3135 AssignmentExpression expression =
3128 parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 3136 parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
3129 Expression syntheticExpression = expression.leftHandSide; 3137 Expression syntheticExpression = expression.leftHandSide;
3130 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, 3138 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier,
3131 SimpleIdentifier, syntheticExpression); 3139 SimpleIdentifier, syntheticExpression);
3132 expect(syntheticExpression.isSynthetic, isTrue); 3140 expect(syntheticExpression.isSynthetic, isTrue);
3133 } 3141 }
3134 3142
3135 void test_assignmentExpression_missing_compound2() { 3143 void test_assignmentExpression_missing_compound2() {
(...skipping 10315 matching lines...) Expand 10 before | Expand all | Expand 10 after
13451 CompilationUnit _parseDirectives(String source, 13459 CompilationUnit _parseDirectives(String source,
13452 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { 13460 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
13453 createParser(source); 13461 createParser(source);
13454 CompilationUnit unit = parser.parseDirectives2(); 13462 CompilationUnit unit = parser.parseDirectives2();
13455 expect(unit, isNotNull); 13463 expect(unit, isNotNull);
13456 expect(unit.declarations, hasLength(0)); 13464 expect(unit.declarations, hasLength(0));
13457 listener.assertErrorsWithCodes(errorCodes); 13465 listener.assertErrorsWithCodes(errorCodes);
13458 return unit; 13466 return unit;
13459 } 13467 }
13460 } 13468 }
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