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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java

Issue 10582003: Issue 1355. Support for call(). Tweaks for element locator and rename refactoring (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check target range Created 8 years, 6 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/utilities/ast/DartElementLocator.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java
index a9a2efb27af7c0fdc7a079ed24931887e9293e5e..2f73f232c1a5e647ebd14b1846693b839a95afab 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/ast/DartElementLocator.java
@@ -27,9 +27,11 @@ import com.google.dart.compiler.ast.DartResourceDirective;
import com.google.dart.compiler.ast.DartSourceDirective;
import com.google.dart.compiler.ast.DartStringLiteral;
import com.google.dart.compiler.ast.DartUnaryExpression;
+import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
import com.google.dart.compiler.resolver.Element;
import com.google.dart.compiler.resolver.ElementKind;
import com.google.dart.compiler.resolver.LibraryElement;
+import com.google.dart.compiler.resolver.NodeElement;
import com.google.dart.compiler.resolver.VariableElement;
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.internal.util.SourceRangeUtils;
@@ -432,6 +434,25 @@ public class DartElementLocator extends ASTVisitor<Void> {
return null;
}
+ @Override
+ public Void visitUnqualifiedInvocation(DartUnqualifiedInvocation node) {
+ super.visitUnqualifiedInvocation(node);
+ if (foundElement == null) {
+ int start = node.getSourceInfo().getOffset();
+ int length = node.getSourceInfo().getLength();
+ int end = start + length;
+ if (start <= startOffset && endOffset <= end) {
+ wordRegion = new Region(start, length);
+ NodeElement invocationElement = node.getElement();
+ if (invocationElement != null && node.getTarget() != null
+ && node.getTarget().getElement() != invocationElement) {
+ findElementFor(invocationElement);
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Compute a region that represents the portion of the string literal between the opening and
* closing quotes.

Powered by Google App Engine
This is Rietveld 408576698