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

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

Issue 2744043002: Improve recovery in argument lists when missing a comma before a named argument (issue 29005) (Closed)
Patch Set: Created 3 years, 9 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 9138 matching lines...) Expand 10 before | Expand all | Expand 10 after
9149 ParserErrorCode.MISSING_IDENTIFIER 9149 ParserErrorCode.MISSING_IDENTIFIER
9150 ]); 9150 ]);
9151 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression, 9151 EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
9152 BinaryExpression, expression.rightOperand); 9152 BinaryExpression, expression.rightOperand);
9153 } 9153 }
9154 9154
9155 void test_missing_commaInArgumentList() { 9155 void test_missing_commaInArgumentList() {
9156 parseExpression("f(x: 1 y: 2)", [ParserErrorCode.EXPECTED_TOKEN]); 9156 parseExpression("f(x: 1 y: 2)", [ParserErrorCode.EXPECTED_TOKEN]);
9157 } 9157 }
9158 9158
9159 void test_missingComma_beforeNamedArgument() {
9160 createParser('(a b: c)');
9161 ArgumentList argumentList = parser.parseArgumentList();
9162 expectNotNullIfNoErrors(argumentList);
9163 listener.assertErrorsWithCodes([ParserErrorCode.EXPECTED_TOKEN]);
9164 expect(argumentList.arguments, hasLength(2));
9165 }
9166
9159 void test_missingGet() { 9167 void test_missingGet() {
9160 CompilationUnit unit = parseCompilationUnit( 9168 CompilationUnit unit = parseCompilationUnit(
9161 r''' 9169 r'''
9162 class C { 9170 class C {
9163 int length {} 9171 int length {}
9164 void foo() {} 9172 void foo() {}
9165 }''', 9173 }''',
9166 [ParserErrorCode.MISSING_GET]); 9174 [ParserErrorCode.MISSING_GET]);
9167 expect(unit, isNotNull); 9175 expect(unit, isNotNull);
9168 ClassDeclaration classDeclaration = 9176 ClassDeclaration classDeclaration =
(...skipping 5555 matching lines...) Expand 10 before | Expand all | Expand 10 after
14724 expect(functionType.returnType, isNotNull); 14732 expect(functionType.returnType, isNotNull);
14725 expect(functionType.typeParameters, isNull); 14733 expect(functionType.typeParameters, isNull);
14726 } 14734 }
14727 14735
14728 void test_parseTypeAlias_genericFunction_withDocComment() { 14736 void test_parseTypeAlias_genericFunction_withDocComment() {
14729 createParser('/// Doc\ntypedef F = bool Function();'); 14737 createParser('/// Doc\ntypedef F = bool Function();');
14730 var typeAlias = parseFullCompilationUnitMember() as GenericTypeAlias; 14738 var typeAlias = parseFullCompilationUnitMember() as GenericTypeAlias;
14731 expectCommentText(typeAlias.documentationComment, '/// Doc'); 14739 expectCommentText(typeAlias.documentationComment, '/// Doc');
14732 } 14740 }
14733 } 14741 }
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