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

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

Issue 11312081: Issue 6251. Resolve and rename [id] references in documentation comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 8a95f0d499adbcf3ac8b6ad1a5b413162521e3ed..1240c715d46206b6918ed112c5d213a943e1b854 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
@@ -51,13 +51,13 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
/**
- * Instances of the class <code>DartElementLocator</code> locate the {@link DartElement Dart element(s)} associated
- * with a source range, given the AST structure built from the source.
+ * Instances of the class <code>DartElementLocator</code> locate the {@link DartElement Dart
+ * element(s)} associated with a source range, given the AST structure built from the source.
*/
public class DartElementLocator extends ASTVisitor<Void> {
/**
- * Instances of the class <code>DartElementFoundException</code> are used to cancel visiting after an element has been
- * found.
+ * Instances of the class <code>DartElementFoundException</code> are used to cancel visiting after
+ * an element has been found.
*/
private class DartElementFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
@@ -97,8 +97,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
private IRegion wordRegion;
/**
- * The region within the element's compilation unit that needs to be highlighted, or <code>null</code>
- * if there is no element.
+ * The region within the element's compilation unit that needs to be highlighted, or
+ * <code>null</code> if there is no element.
*/
private IRegion candidateRegion;
@@ -136,8 +136,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
*
* @param input the compilation unit containing the element to be found
* @param offset the offset used to identify the element
- * @param includeDeclarations <code>true</code> if elements should be returned for declaration sites
- * as well as for reference sites
+ * @param includeDeclarations <code>true</code> if elements should be returned for declaration
+ * sites as well as for reference sites
*/
public DartElementLocator(CompilationUnit input, int offset, boolean includeDeclarations) {
this(input, offset, offset, includeDeclarations);
@@ -164,11 +164,10 @@ public class DartElementLocator extends ASTVisitor<Void> {
* @param input the compilation unit containing the element to be found
* @param start the start offset of the range used to identify the element
* @param end the end offset of the range used to identify the element
- * @param includeDeclarations <code>true</code> if elements should be returned for declaration sites
- * as well as for reference sites
+ * @param includeDeclarations <code>true</code> if elements should be returned for declaration
+ * sites as well as for reference sites
*/
- public DartElementLocator(
- CompilationUnit input, int start, int end, boolean includeDeclarations) {
+ public DartElementLocator(CompilationUnit input, int start, int end, boolean includeDeclarations) {
this.compilationUnit = input;
this.startOffset = start;
this.endOffset = end;
@@ -176,7 +175,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
}
/**
- * Return the region within the element's compilation unit that needs to be highlighted, or <code>null
+ * Return the region within the element's compilation unit that needs to be highlighted, or
+ * <code>null
* </code> if either there is no element or if the element can be used to determine the region.
*
* @return the region within the element's compilation unit that needs to be highlighted
@@ -186,8 +186,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
}
/**
- * Return the element that was found that corresponds to the given source range, or <code>null</code>
- * if there is no such element.
+ * Return the element that was found that corresponds to the given source range, or
+ * <code>null</code> if there is no such element.
*
* @return the element that was found
*/
@@ -196,7 +196,7 @@ public class DartElementLocator extends ASTVisitor<Void> {
}
/**
- * Return the resolved element that was found that corresponds to the given source range, or
+ * Return the resolved element that was found that corresponds to the given source range, or
* <code>null</code> if there is no such element.
*
* @return the element that was found
@@ -218,8 +218,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
/**
* Search within the given AST node for an identifier representing a {@link DartElement Dart
- * element} in the specified source range. Return the element that was found, or <code>null</code> if
- * no element was found.
+ * element} in the specified source range. Return the element that was found, or <code>null</code>
+ * if no element was found.
*
* @param node the AST node within which to search
* @return the element that was found
@@ -230,10 +230,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
} catch (DartElementFoundException exception) {
// A node with the right source position was found.
} catch (Exception exception) {
- DartCore.logInformation(
- "Unable to locate element at offset (" + startOffset + " - " + endOffset + ") in "
- + compilationUnit.getElementName(),
- exception);
+ DartCore.logInformation("Unable to locate element at offset (" + startOffset + " - "
+ + endOffset + ") in " + compilationUnit.getElementName(), exception);
return null;
}
return foundElement;
@@ -247,9 +245,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
int end = start + node.getSourceInfo().getLength();
if (start <= startOffset && endOffset <= end) {
DartExpression target = node.getRealTarget();
- wordRegion = new Region(
- target.getSourceInfo().getOffset() + target.getSourceInfo().getLength(),
- end);
+ wordRegion = new Region(target.getSourceInfo().getOffset()
+ + target.getSourceInfo().getLength(), end);
Element targetElement = node.getElement();
findElementFor(targetElement);
throw new DartElementFoundException();
@@ -267,9 +264,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
if (start <= startOffset && endOffset <= end) {
DartExpression leftOperand = node.getArg1();
DartExpression rightOperand = node.getArg2();
- wordRegion = computeOperatorRegion(
- leftOperand.getSourceInfo().getOffset() + leftOperand.getSourceInfo().getLength(),
- rightOperand.getSourceInfo().getOffset() - 1);
+ wordRegion = computeOperatorRegion(leftOperand.getSourceInfo().getOffset()
+ + leftOperand.getSourceInfo().getLength(), rightOperand.getSourceInfo().getOffset() - 1);
Element targetElement = node.getElement();
findElementFor(targetElement);
throw new DartElementFoundException();
@@ -329,9 +325,8 @@ public class DartElementLocator extends ASTVisitor<Void> {
try {
DartImport[] imports = compilationUnit.getLibrary().getImports();
for (DartImport imprt : imports) {
- if (Objects.equal(imprt.getLibrary(), foundElement) && Objects.equal(
- imprt.getPrefix(),
- node.getName())) {
+ if (Objects.equal(imprt.getLibrary(), foundElement)
+ && Objects.equal(imprt.getPrefix(), node.getName())) {
foundElement = imprt;
SourceRange range = imprt.getNameRange();
candidateRegion = new Region(range.getOffset(), range.getLength());

Powered by Google App Engine
This is Rietveld 408576698