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

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

Issue 739643003: Cache ElementLocation instance and index key/location ids. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/store/codec.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a1fc144dbf098860bb539023d658610914e67a6a..937f1d042eb83fab3cc6c98553c89a54f7feba34 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -3454,6 +3454,11 @@ abstract class ElementImpl implements Element {
int _cachedHashCode = 0;
/**
+ * A cached copy of the calculated location for this element.
+ */
+ ElementLocation _cachedLocation;
+
+ /**
* Initialize a newly created element to have the given name.
*
* @param name the name of this element
@@ -3559,7 +3564,12 @@ abstract class ElementImpl implements Element {
getAncestor((element) => element is LibraryElement);
@override
- ElementLocation get location => new ElementLocationImpl.con1(this);
+ ElementLocation get location {
+ if (_cachedLocation == null) {
+ _cachedLocation = new ElementLocationImpl.con1(this);
+ }
+ return _cachedLocation;
+ }
@override
String get name => _name;
@@ -3949,6 +3959,21 @@ class ElementLocationImpl implements ElementLocation {
List<String> _components;
/**
+ * The object managing [indexKeyId] and [indexLocationId].
+ */
+ Object indexOwner;
+
+ /**
+ * A cached id of this location in index.
+ */
+ int indexKeyId;
+
+ /**
+ * A cached id of this location in index.
+ */
+ int indexLocationId;
+
+ /**
* Initialize a newly created location to represent the given element.
*
* @param element the element whose location is being represented
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/store/codec.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698