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

Side by Side Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 1709013004: Improve error message (issue 25113) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/error.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | 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.src.generated.parser; 5 library analyzer.src.generated.parser;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 5441 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 if (factoryKeyword != null && 5452 if (factoryKeyword != null &&
5453 externalKeyword == null && 5453 externalKeyword == null &&
5454 _parseFunctionBodies) { 5454 _parseFunctionBodies) {
5455 _reportErrorForToken( 5455 _reportErrorForToken(
5456 ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword); 5456 ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword);
5457 } 5457 }
5458 } else { 5458 } else {
5459 if (constKeyword != null) { 5459 if (constKeyword != null) {
5460 _reportErrorForNode( 5460 _reportErrorForNode(
5461 ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body); 5461 ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body);
5462 } else if (externalKeyword != null) {
5463 _reportErrorForNode(
5464 ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body);
5462 } else if (!bodyAllowed) { 5465 } else if (!bodyAllowed) {
5463 _reportErrorForNode( 5466 _reportErrorForNode(
5464 ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body); 5467 ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, body);
5465 } 5468 }
5466 } 5469 }
5467 } 5470 }
5468 return new ConstructorDeclaration( 5471 return new ConstructorDeclaration(
5469 commentAndMetadata.comment, 5472 commentAndMetadata.comment,
5470 commentAndMetadata.metadata, 5473 commentAndMetadata.metadata,
5471 externalKeyword, 5474 externalKeyword,
5472 constKeyword, 5475 constKeyword,
5473 factoryKeyword, 5476 factoryKeyword,
5474 returnType, 5477 returnType,
(...skipping 4347 matching lines...) Expand 10 before | Expand all | Expand 10 after
9822 "Normal parameters must occur before optional parameters"); 9825 "Normal parameters must occur before optional parameters");
9823 9826
9824 static const ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = 9827 static const ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT =
9825 const ParserErrorCode('POSITIONAL_AFTER_NAMED_ARGUMENT', 9828 const ParserErrorCode('POSITIONAL_AFTER_NAMED_ARGUMENT',
9826 "Positional arguments must occur before named arguments"); 9829 "Positional arguments must occur before named arguments");
9827 9830
9828 static const ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = 9831 static const ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP =
9829 const ParserErrorCode('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 9832 const ParserErrorCode('POSITIONAL_PARAMETER_OUTSIDE_GROUP',
9830 "Positional parameters must be enclosed in square brackets ('[' and '] ')"); 9833 "Positional parameters must be enclosed in square brackets ('[' and '] ')");
9831 9834
9835 static const ParserErrorCode REDIRECTING_CONSTRUCTOR_WITH_BODY =
9836 const ParserErrorCode('REDIRECTING_CONSTRUCTOR_WITH_BODY',
9837 "Redirecting constructors cannot have a body");
9838
9832 static const ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = 9839 static const ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR =
9833 const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 9840 const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR',
9834 "Only factory constructor can specify '=' redirection."); 9841 "Only factory constructor can specify '=' redirection.");
9835 9842
9836 static const ParserErrorCode SETTER_IN_FUNCTION = const ParserErrorCode( 9843 static const ParserErrorCode SETTER_IN_FUNCTION = const ParserErrorCode(
9837 'SETTER_IN_FUNCTION', 9844 'SETTER_IN_FUNCTION',
9838 "Setters cannot be defined within methods or functions"); 9845 "Setters cannot be defined within methods or functions");
9839 9846
9840 static const ParserErrorCode STATIC_AFTER_CONST = const ParserErrorCode( 9847 static const ParserErrorCode STATIC_AFTER_CONST = const ParserErrorCode(
9841 'STATIC_AFTER_CONST', 9848 'STATIC_AFTER_CONST',
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
11353 } 11360 }
11354 11361
11355 /** 11362 /**
11356 * Copy resolution data from the [fromNode] to the [toNode]. 11363 * Copy resolution data from the [fromNode] to the [toNode].
11357 */ 11364 */
11358 static void copyResolutionData(AstNode fromNode, AstNode toNode) { 11365 static void copyResolutionData(AstNode fromNode, AstNode toNode) {
11359 ResolutionCopier copier = new ResolutionCopier(); 11366 ResolutionCopier copier = new ResolutionCopier();
11360 copier._isEqualNodes(fromNode, toNode); 11367 copier._isEqualNodes(fromNode, toNode);
11361 } 11368 }
11362 } 11369 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698