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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 12092020: Revert "Fix VariableDefinitions.endToken for formal parameters." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 6a150e446f094dbd1720dcdb8b122eaf282e2f3f..2f13eb6a1bae1f4f4a4990c9d2b29f0c895fad29 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -695,16 +695,13 @@ class ResolverTask extends CompilerTask {
if (value == null) return;
if (!(isUserDefinableOperator(value) || identical(value, 'unary-'))) return;
- bool isMinus = false;
int requiredParameterCount;
MessageKind messageKind;
FunctionSignature signature = function.computeSignature(compiler);
if (identical(value, 'unary-')) {
- isMinus = true;
messageKind = MessageKind.MINUS_OPERATOR_BAD_ARITY;
requiredParameterCount = 0;
} else if (isMinusOperator(value)) {
- isMinus = true;
messageKind = MessageKind.MINUS_OPERATOR_BAD_ARITY;
requiredParameterCount = 1;
} else if (isUnaryOperator(value)) {
@@ -720,40 +717,17 @@ class ResolverTask extends CompilerTask {
compiler.internalErrorOnElement(function,
'Unexpected user defined operator $value');
}
- checkArity(function, requiredParameterCount, messageKind, isMinus);
+ checkArity(function, requiredParameterCount, messageKind);
}
void checkArity(FunctionElement function,
- int requiredParameterCount, MessageKind messageKind,
- bool isMinus) {
+ int requiredParameterCount, MessageKind messageKind) {
FunctionExpression node = function.parseNode(compiler);
FunctionSignature signature = function.computeSignature(compiler);
if (signature.requiredParameterCount != requiredParameterCount) {
Node errorNode = node;
if (node.parameters != null) {
- if (isMinus ||
- signature.requiredParameterCount < requiredParameterCount) {
- // If there are too few parameters, point to the whole parameter list.
- // For instance
- //
- // int operator +() {}
- // ^^
- //
- // int operator []=(value) {}
- // ^^^^^^^
- //
- // For operator -, always point the whole parameter list, like
- //
- // int operator -(a, b) {}
- // ^^^^^^
- //
- // instead of
- //
- // int operator -(a, b) {}
- // ^
- //
- // since the correction might not be to remove 'b' but instead to
- // remove 'a, b'.
+ if (signature.requiredParameterCount < requiredParameterCount) {
errorNode = node.parameters;
} else {
errorNode = node.parameters.nodes.skip(requiredParameterCount).head;

Powered by Google App Engine
This is Rietveld 408576698