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 536ace9a21f84186b87c377aa3e0f3839b0cbe5e..f050cfe99d3e046cf2dfae3bde6e7b88d101dde1 100644 |
--- a/pkg/analyzer/lib/src/summary/index_unit.dart |
+++ b/pkg/analyzer/lib/src/summary/index_unit.dart |
@@ -242,8 +242,10 @@ class _ElementRelationInfo { |
final IndexRelationKind kind; |
final int offset; |
final int length; |
+ final bool isQualified; |
- _ElementRelationInfo(this.elementInfo, this.kind, this.offset, this.length); |
+ _ElementRelationInfo( |
+ this.elementInfo, this.kind, this.offset, this.length, this.isQualified); |
} |
/** |
@@ -290,9 +292,11 @@ class _IndexContributor extends GeneralizingAstVisitor { |
* Record that [element] has a relation of the given [kind] at the location |
* of the given [node]. |
*/ |
- void recordRelation(Element element, IndexRelationKind kind, AstNode node) { |
+ void recordRelation(Element element, IndexRelationKind kind, AstNode node, |
+ {bool isQualified: false}) { |
Paul Berry
2016/03/01 17:06:19
Consider making this a required parameter so that
scheglov
2016/03/01 19:05:34
Done.
|
if (element != null && node != null) { |
- recordRelationOffset(element, kind, node.offset, node.length); |
+ recordRelationOffset(element, kind, node.offset, node.length, |
+ isQualified: isQualified); |
} |
} |
@@ -301,7 +305,8 @@ class _IndexContributor extends GeneralizingAstVisitor { |
* [offset] and [length]. |
*/ |
void recordRelationOffset( |
- Element element, IndexRelationKind kind, int offset, int length) { |
+ Element element, IndexRelationKind kind, int offset, int length, |
+ {bool isQualified: false}) { |
// Ignore elements that can't be referenced outside of the unit. |
if (element == null || |
element is FunctionElement && |
@@ -315,7 +320,7 @@ class _IndexContributor extends GeneralizingAstVisitor { |
return; |
} |
// Add the relation. |
- assembler.addElementRelation(element, kind, offset, length); |
+ assembler.addElementRelation(element, kind, offset, length, isQualified); |
} |
/** |
@@ -440,16 +445,11 @@ class _IndexContributor extends GeneralizingAstVisitor { |
recordNameRelation(name, IndexRelationKind.IS_INVOKED_BY); |
} |
// element invocation |
- if (element is MethodElement || |
- element is PropertyAccessorElement || |
- element is FunctionElement || |
- element is VariableElement) { |
- IndexRelationKind kind = isQualified |
- ? IndexRelationKind.IS_INVOKED_QUALIFIED_BY |
- : IndexRelationKind.IS_INVOKED_BY; |
- recordRelation(element, kind, name); |
- } else if (element is ClassElement) { |
+ if (element is ClassElement) { |
recordRelation(element, IndexRelationKind.IS_REFERENCED_BY, name); |
Paul Berry
2016/03/01 17:06:19
This could also be qualified, e.g.:
foo.dart:
scheglov
2016/03/01 19:05:34
Done.
|
+ } else { |
+ recordRelation(element, IndexRelationKind.IS_INVOKED_BY, name, |
+ isQualified: isQualified); |
} |
node.target?.accept(this); |
node.argumentList?.accept(this); |
@@ -509,10 +509,8 @@ class _IndexContributor extends GeneralizingAstVisitor { |
return; |
} |
// record specific relations |
- IndexRelationKind kind = isQualified |
- ? IndexRelationKind.IS_REFERENCED_QUALIFIED_BY |
- : IndexRelationKind.IS_REFERENCED_BY; |
- recordRelation(element, kind, node); |
+ recordRelation(element, IndexRelationKind.IS_REFERENCED_BY, node, |
+ isQualified: isQualified); |
} |
@override |
@@ -607,12 +605,12 @@ class _UnitIndexAssembler { |
_UnitIndexAssembler(this.pkg, this.unitId); |
- void addElementRelation( |
- Element element, IndexRelationKind kind, int offset, int length) { |
+ void addElementRelation(Element element, IndexRelationKind kind, int offset, |
+ int length, bool isQualified) { |
try { |
_ElementInfo elementInfo = pkg._getElementInfo(element); |
- elementRelations |
- .add(new _ElementRelationInfo(elementInfo, kind, offset, length)); |
+ elementRelations.add(new _ElementRelationInfo( |
+ elementInfo, kind, offset, length, isQualified)); |
} on StateError {} |
} |
@@ -644,6 +642,8 @@ class _UnitIndexAssembler { |
usedElementKinds: elementRelations.map((r) => r.kind).toList(), |
usedElementOffsets: elementRelations.map((r) => r.offset).toList(), |
usedElementLengths: elementRelations.map((r) => r.length).toList(), |
+ usedElementIsQualifiedFlags: |
+ elementRelations.map((r) => r.isQualified).toList(), |
usedNames: nameRelations.map((r) => r.nameId).toList(), |
usedNameKinds: nameRelations.map((r) => r.kind).toList(), |
usedNameOffsets: nameRelations.map((r) => r.offset).toList()); |