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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/codemanipulation/StubUtility.java

Issue 10915031: Issue 4796. Support for renaming named parameters in invocations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/codemanipulation/StubUtility.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/codemanipulation/StubUtility.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/codemanipulation/StubUtility.java
index b5e6a28c9c8d9a99b28edcfe11cb0756bb3a2641..10f41973ae6f0ec93b685cea15ba23efb08222e3 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/codemanipulation/StubUtility.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/codemanipulation/StubUtility.java
@@ -23,13 +23,11 @@ import com.google.common.collect.Sets;
import com.google.dart.compiler.ast.DartBinaryExpression;
import com.google.dart.compiler.ast.DartExpression;
import com.google.dart.compiler.ast.DartIdentifier;
-import com.google.dart.compiler.ast.DartInvocation;
import com.google.dart.compiler.ast.DartMethodInvocation;
import com.google.dart.compiler.ast.DartNamedExpression;
import com.google.dart.compiler.ast.DartPropertyAccess;
import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
import com.google.dart.compiler.parser.Token;
-import com.google.dart.compiler.resolver.MethodElement;
import com.google.dart.compiler.resolver.VariableElement;
import com.google.dart.compiler.type.Type;
import com.google.dart.compiler.type.TypeKind;
@@ -155,15 +153,9 @@ public class StubUtility {
}
// positional argument
if (location == DART_INVOCATION_ARGS) {
- DartInvocation invocation = (DartInvocation) expression.getParent();
- MethodElement invocationElement = (MethodElement) invocation.getElement();
- Object parameterId = expression.getInvocationParameterId();
- if (parameterId instanceof Integer) {
- int index = ((Integer) parameterId).intValue();
- List<VariableElement> parameters = invocationElement.getParameters();
- if (index < parameters.size()) {
- return parameters.get(index).getName();
- }
+ if (expression.getInvocationParameterId() instanceof VariableElement) {
+ VariableElement parameter = (VariableElement) expression.getInvocationParameterId();
+ return parameter.getName();
}
}
// unknown

Powered by Google App Engine
This is Rietveld 408576698