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

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

Issue 2477183002: When DefaultFormalParameter, don't use ParameterKind.REQUIRED. (Closed)
Patch Set: Created 4 years, 1 month 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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 listener.assertErrorsWithCodes([ParserErrorCode.NAMED_FUNCTION_EXPRESSION]); 2159 listener.assertErrorsWithCodes([ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
2160 expect(expression, new isInstanceOf<FunctionExpression>()); 2160 expect(expression, new isInstanceOf<FunctionExpression>());
2161 } 2161 }
2162 2162
2163 void test_namedParameterOutsideGroup() { 2163 void test_namedParameterOutsideGroup() {
2164 createParser('(a, b : 0)'); 2164 createParser('(a, b : 0)');
2165 FormalParameterList list = parser.parseFormalParameterList(); 2165 FormalParameterList list = parser.parseFormalParameterList();
2166 expectNotNullIfNoErrors(list); 2166 expectNotNullIfNoErrors(list);
2167 listener 2167 listener
2168 .assertErrorsWithCodes([ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP]); 2168 .assertErrorsWithCodes([ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP]);
2169 expect(list.parameters[0].kind, ParameterKind.REQUIRED);
2170 expect(list.parameters[1].kind, ParameterKind.NAMED);
2169 } 2171 }
2170 2172
2171 void test_nonConstructorFactory_field() { 2173 void test_nonConstructorFactory_field() {
2172 createParser('factory int x;'); 2174 createParser('factory int x;');
2173 ClassMember member = parser.parseClassMember('C'); 2175 ClassMember member = parser.parseClassMember('C');
2174 expectNotNullIfNoErrors(member); 2176 expectNotNullIfNoErrors(member);
2175 listener.assertErrorsWithCodes([ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 2177 listener.assertErrorsWithCodes([ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
2176 } 2178 }
2177 2179
2178 void test_nonConstructorFactory_method() { 2180 void test_nonConstructorFactory_method() {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 listener.assertErrorsWithCodes( 2287 listener.assertErrorsWithCodes(
2286 [ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT]); 2288 [ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT]);
2287 } 2289 }
2288 2290
2289 void test_positionalParameterOutsideGroup() { 2291 void test_positionalParameterOutsideGroup() {
2290 createParser('(a, b = 0)'); 2292 createParser('(a, b = 0)');
2291 FormalParameterList list = parser.parseFormalParameterList(); 2293 FormalParameterList list = parser.parseFormalParameterList();
2292 expectNotNullIfNoErrors(list); 2294 expectNotNullIfNoErrors(list);
2293 listener.assertErrorsWithCodes( 2295 listener.assertErrorsWithCodes(
2294 [ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP]); 2296 [ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
2297 expect(list.parameters[0].kind, ParameterKind.REQUIRED);
2298 expect(list.parameters[1].kind, ParameterKind.POSITIONAL);
2295 } 2299 }
2296 2300
2297 void test_redirectingConstructorWithBody_named() { 2301 void test_redirectingConstructorWithBody_named() {
2298 createParser('C.x() : this() {}'); 2302 createParser('C.x() : this() {}');
2299 ClassMember member = parser.parseClassMember('C'); 2303 ClassMember member = parser.parseClassMember('C');
2300 expectNotNullIfNoErrors(member); 2304 expectNotNullIfNoErrors(member);
2301 listener.assertErrorsWithCodes( 2305 listener.assertErrorsWithCodes(
2302 [ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY]); 2306 [ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY]);
2303 } 2307 }
2304 2308
(...skipping 11165 matching lines...) Expand 10 before | Expand all | Expand 10 after
13470 CompilationUnit _parseDirectives(String source, 13474 CompilationUnit _parseDirectives(String source,
13471 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) { 13475 [List<ErrorCode> errorCodes = ErrorCode.EMPTY_LIST]) {
13472 createParser(source); 13476 createParser(source);
13473 CompilationUnit unit = parser.parseDirectives2(); 13477 CompilationUnit unit = parser.parseDirectives2();
13474 expect(unit, isNotNull); 13478 expect(unit, isNotNull);
13475 expect(unit.declarations, hasLength(0)); 13479 expect(unit.declarations, hasLength(0));
13476 listener.assertErrorsWithCodes(errorCodes); 13480 listener.assertErrorsWithCodes(errorCodes);
13477 return unit; 13481 return unit;
13478 } 13482 }
13479 } 13483 }
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