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

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 770333003: First step to resolving simple API changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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: pkg/analyzer/lib/src/generated/element.dart
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index 6fef2d8e20c2a1d263419f4b3e251bfe6b54bdea..2dd8ad40da217aee4ef3091c0d6d6fa7a7135900 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -3104,6 +3104,11 @@ abstract class Element {
Element get enclosingElement;
/**
+ * The unique integer identifier of this element.
+ */
+ int get id;
+
+ /**
* Return `true` if this element has an annotation of the form '@deprecated' or
* '@Deprecated('..')'.
*
@@ -3224,6 +3229,11 @@ abstract class Element {
CompilationUnit get unit;
/**
+ * Identifies of the elements that use this elements.
+ */
+ IntSet get users;
Brian Wilkerson 2014/12/05 23:05:57 I'm concerned about keeping around unnecessary emp
scheglov 2014/12/05 23:49:05 Acknowledged.
+
+ /**
* Use the given visitor to visit this element.
*
* @param visitor the visitor that will visit this element
@@ -3232,6 +3242,11 @@ abstract class Element {
accept(ElementVisitor visitor);
/**
+ * Remember the given [element] as a user of this element.
+ */
+ void addUser(Element element);
+
+ /**
* Return the documentation comment for this element as it appears in the original source
* (complete with the beginning and ending delimiters), or `null` if this element does not
* have a documentation comment associated with it. This can be a long-running operation if the
@@ -3429,6 +3444,10 @@ class ElementAnnotationImpl implements ElementAnnotation {
* an [Element].
*/
abstract class ElementImpl implements Element {
+ static int _NEXT_ID = 0;
+
+ final int id = _NEXT_ID++;
+
/**
* The enclosing element of this element, or `null` if this element is at the root of the
* element structure.
@@ -3467,6 +3486,11 @@ abstract class ElementImpl implements Element {
ElementLocation _cachedLocation;
/**
+ * Identifies of the elements that use this elements.
+ */
+ final IntSet users = new IntSet();
+
+ /**
* Initialize a newly created element to have the given name.
*
* @param name the name of this element
@@ -3506,6 +3530,8 @@ abstract class ElementImpl implements Element {
*/
void set enclosingElement(Element element) {
_enclosingElement = element as ElementImpl;
+ _cachedLocation = null;
+ _cachedHashCode = null;
}
@override
@@ -3623,6 +3649,11 @@ abstract class ElementImpl implements Element {
(object as Element).location == location;
}
+ @override
+ void addUser(Element element) {
+ users.add(element.id);
+ }
+
/**
* Append a textual representation of this element to the given [buffer].
*/
@@ -8952,6 +8983,8 @@ abstract class Member implements Element {
@override
String get displayName => _baseElement.displayName;
+ int get id => _baseElement.id;
+
@override
bool get isDeprecated => _baseElement.isDeprecated;
@@ -8994,6 +9027,13 @@ abstract class Member implements Element {
@override
CompilationUnit get unit => _baseElement.unit;
+ IntSet get users => _baseElement.users;
+
+ @override
+ void addUser(Element element) {
+ _baseElement.addUser(element);
+ }
+
@override
String computeDocumentationComment() =>
_baseElement.computeDocumentationComment();
@@ -9452,6 +9492,11 @@ abstract class MultiplyDefinedElement implements Element {
*/
class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
/**
+ * The unique integer identifier of this element.
+ */
+ final int id = ElementImpl._NEXT_ID++;
+
+ /**
* The analysis context in which the multiply defined elements are defined.
*/
final AnalysisContext context;
@@ -9534,8 +9579,14 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
CompilationUnit get unit => null;
@override
+ IntSet get users => new IntSet();
+
+ @override
accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this);
+ void addUser(Element element) {
+ }
+
@override
String computeDocumentationComment() => null;

Powered by Google App Engine
This is Rietveld 408576698