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

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

Issue 742103003: Update 'nameOffset' for elements during incremental analysis. (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 | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | 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 937f1d042eb83fab3cc6c98553c89a54f7feba34..3f5463e1ad6d309090b9956ff7f348d428ec2725 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -3451,7 +3451,7 @@ abstract class ElementImpl implements Element {
/**
* A cached copy of the calculated hashCode for this element.
*/
- int _cachedHashCode = 0;
+ int _cachedHashCode;
/**
* A cached copy of the calculated location for this element.
@@ -3504,7 +3504,7 @@ abstract class ElementImpl implements Element {
int get hashCode {
// TODO: We might want to re-visit this optimization in the future.
// We cache the hash code value as this is a very frequently called method.
- if (_cachedHashCode == 0) {
+ if (_cachedHashCode == null) {
int hashIdentifier = identifier.hashCode;
Element enclosing = enclosingElement;
if (enclosing != null) {
@@ -8804,7 +8804,12 @@ class LocalVariableElementImpl extends VariableElementImpl implements
LocalVariableElementImpl.forNode(Identifier name) : super.forNode(name);
@override
- String get identifier => "${super.identifier}@$nameOffset";
+ String get identifier {
+ int enclosingOffset =
+ enclosingElement != null ? enclosingElement.nameOffset : 0;
+ int delta = nameOffset - enclosingOffset;
+ return '${super.identifier}@$delta';
+ }
@override
bool get isPotentiallyMutatedInClosure =>
@@ -11562,13 +11567,13 @@ class TypeImpl_TypePair {
final DartType _secondType;
- int _cachedHashCode = 0;
+ int _cachedHashCode;
TypeImpl_TypePair(this._firstType, this._secondType);
@override
int get hashCode {
- if (_cachedHashCode == 0) {
+ if (_cachedHashCode == null) {
int firstHashCode = 0;
if (_firstType != null) {
Element firstElement = _firstType.element;
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698