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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.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.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
index e6f7d5ec9a2bbc444f43a9b690ba6c6013522bf8..dff859c7b2e5b783723555975f3ac084e1c8237b 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/contributor/IndexContributor.java
@@ -29,9 +29,11 @@ import com.google.dart.compiler.ast.DartFunctionObjectInvocation;
import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartImportDirective;
+import com.google.dart.compiler.ast.DartInvocation;
import com.google.dart.compiler.ast.DartLabel;
import com.google.dart.compiler.ast.DartMethodDefinition;
import com.google.dart.compiler.ast.DartMethodInvocation;
+import com.google.dart.compiler.ast.DartNamedExpression;
import com.google.dart.compiler.ast.DartNewExpression;
import com.google.dart.compiler.ast.DartNode;
import com.google.dart.compiler.ast.DartParameterizedTypeNode;
@@ -484,6 +486,25 @@ public class IndexContributor extends ASTVisitor<Void> {
}
@Override
+ public Void visitNamedExpression(DartNamedExpression node) {
+ if (node.getParent() instanceof DartInvocation
+ && node.getParent().getElement() instanceof MethodElement) {
+ MethodElement methodElement = (MethodElement) node.getParent().getElement();
+ Object parameterId = node.getInvocationParameterId();
+ if (parameterId instanceof VariableElement) {
+ String name = ((VariableElement) parameterId).getName();
+ try {
+ Element indexElement = ElementFactory.getParameterElement(methodElement, name);
+ Location location = createLocation(node.getName());
+ recordRelationship(indexElement, IndexConstants.IS_REFERENCED_BY, location);
+ } catch (DartModelException exception) {
+ }
+ }
+ }
+ return super.visitNamedExpression(node);
+ }
+
+ @Override
public Void visitNewExpression(DartNewExpression node) {
com.google.dart.compiler.resolver.Element element = node.getElement();
if (element instanceof MethodElement) {

Powered by Google App Engine
This is Rietveld 408576698