Index: pkg/analyzer/lib/src/summary/index_unit.dart |
diff --git a/pkg/analyzer/lib/src/summary/index_unit.dart b/pkg/analyzer/lib/src/summary/index_unit.dart |
index 569dddd8a29bedbea33ea373124511da34d136cc..0bf1f0b839f6a53e5b78217134357b2ab7014e4a 100644 |
--- a/pkg/analyzer/lib/src/summary/index_unit.dart |
+++ b/pkg/analyzer/lib/src/summary/index_unit.dart |
@@ -43,6 +43,9 @@ class ElementInfo { |
int id; |
ElementInfo(this.unitId, this.offset, this.kind) { |
+ if (offset < 0) { |
+ print(offset); |
Brian Wilkerson
2016/03/11 22:50:06
Debugging code?
|
+ } |
assert(offset >= 0); |
} |
} |
@@ -304,9 +307,10 @@ class _IndexContributor extends GeneralizingAstVisitor { |
/** |
* Record that the name [node] has a relation of the given [kind]. |
*/ |
- void recordNameRelation(SimpleIdentifier node, IndexRelationKind kind) { |
+ void recordNameRelation( |
+ SimpleIdentifier node, IndexRelationKind kind, bool isQualified) { |
if (node != null) { |
- assembler.addNameRelation(node.name, kind, node.offset); |
+ assembler.addNameRelation(node.name, kind, node.offset, isQualified); |
} |
} |
@@ -491,10 +495,10 @@ class _IndexContributor extends GeneralizingAstVisitor { |
visitMethodInvocation(MethodInvocation node) { |
SimpleIdentifier name = node.methodName; |
Element element = name.bestElement; |
- // qualified unresolved name invocation |
+ // unresolved name invocation |
bool isQualified = node.realTarget != null; |
- if (isQualified && element == null) { |
- recordNameRelation(name, IndexRelationKind.IS_INVOKED_BY); |
+ if (element == null) { |
+ recordNameRelation(name, IndexRelationKind.IS_INVOKED_BY, isQualified); |
} |
// element invocation |
IndexRelationKind kind = element is ClassElement |
@@ -548,9 +552,9 @@ class _IndexContributor extends GeneralizingAstVisitor { |
recordDefinedElement(element); |
return; |
} |
- // record qualified unresolved name reference |
+ // record unresolved name reference |
bool isQualified = _isQualified(node); |
- if (isQualified && element == null) { |
+ if (element == null) { |
bool inGetterContext = node.inGetterContext(); |
bool inSetterContext = node.inSetterContext(); |
IndexRelationKind kind; |
@@ -561,7 +565,7 @@ class _IndexContributor extends GeneralizingAstVisitor { |
} else { |
kind = IndexRelationKind.IS_WRITTEN_BY; |
} |
- recordNameRelation(node, kind); |
+ recordNameRelation(node, kind, isQualified); |
} |
// this.field parameter |
if (element is FieldFormalParameterElement) { |
@@ -692,8 +696,9 @@ class _NameRelationInfo { |
final _StringInfo nameInfo; |
final IndexRelationKind kind; |
final int offset; |
+ final bool isQualified; |
- _NameRelationInfo(this.nameInfo, this.kind, this.offset); |
+ _NameRelationInfo(this.nameInfo, this.kind, this.offset, this.isQualified); |
} |
/** |
@@ -744,9 +749,10 @@ class _UnitIndexAssembler { |
} on StateError {} |
} |
- void addNameRelation(String name, IndexRelationKind kind, int offset) { |
+ void addNameRelation( |
+ String name, IndexRelationKind kind, int offset, bool isQualified) { |
_StringInfo nameId = pkg._getStringInfo(name); |
- nameRelations.add(new _NameRelationInfo(nameId, kind, offset)); |
+ nameRelations.add(new _NameRelationInfo(nameId, kind, offset, isQualified)); |
} |
/** |
@@ -776,7 +782,9 @@ class _UnitIndexAssembler { |
elementRelations.map((r) => r.isQualified).toList(), |
usedNames: nameRelations.map((r) => r.nameInfo.id).toList(), |
usedNameKinds: nameRelations.map((r) => r.kind).toList(), |
- usedNameOffsets: nameRelations.map((r) => r.offset).toList()); |
+ usedNameOffsets: nameRelations.map((r) => r.offset).toList(), |
+ usedNameIsQualifiedFlags: |
+ nameRelations.map((r) => r.isQualified).toList()); |
} |
void defineName(String name, IndexNameKind kind, int offset) { |