| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.index; | 8 library engine.index; |
| 9 | 9 |
| 10 import 'dart:collection' show Queue; | 10 import 'dart:collection' show Queue; |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 } | 798 } |
| 799 | 799 |
| 800 /** | 800 /** |
| 801 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 801 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
| 802 */ | 802 */ |
| 803 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 803 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
| 804 AstNode parent = node.parent; | 804 AstNode parent = node.parent; |
| 805 return parent is PrefixedIdentifier && identical(parent.identifier, node); | 805 return parent is PrefixedIdentifier && identical(parent.identifier, node); |
| 806 } | 806 } |
| 807 | 807 |
| 808 /** | |
| 809 * @return `true` if given [SimpleIdentifier] is "name" part of prefixed ident
ifier or | |
| 810 * method invocation. | |
| 811 */ | |
| 812 static bool _isQualified(SimpleIdentifier node) { | |
| 813 AstNode parent = node.parent; | |
| 814 if (parent is PrefixedIdentifier) { | |
| 815 return identical(parent.identifier, node); | |
| 816 } | |
| 817 if (parent is PropertyAccess) { | |
| 818 return identical(parent.propertyName, node); | |
| 819 } | |
| 820 if (parent is MethodInvocation) { | |
| 821 MethodInvocation invocation = parent; | |
| 822 return invocation.realTarget != null && identical(invocation.methodName, n
ode); | |
| 823 } | |
| 824 return false; | |
| 825 } | |
| 826 | |
| 827 final IndexStore _store; | 808 final IndexStore _store; |
| 828 | 809 |
| 829 LibraryElement _libraryElement; | 810 LibraryElement _libraryElement; |
| 830 | 811 |
| 831 Map<ImportElement, Set<Element>> _importElementsMap = {}; | 812 Map<ImportElement, Set<Element>> _importElementsMap = {}; |
| 832 | 813 |
| 833 /** | 814 /** |
| 834 * A stack whose top element (the element with the largest index) is an elemen
t representing the | 815 * A stack whose top element (the element with the largest index) is an elemen
t representing the |
| 835 * inner-most enclosing scope. | 816 * inner-most enclosing scope. |
| 836 */ | 817 */ |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 location = _getLocationWithInitializerType(node, location); | 1152 location = _getLocationWithInitializerType(node, location); |
| 1172 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); | 1153 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); |
| 1173 } else if (element is FieldFormalParameterElement) { | 1154 } else if (element is FieldFormalParameterElement) { |
| 1174 FieldFormalParameterElement fieldParameter = element; | 1155 FieldFormalParameterElement fieldParameter = element; |
| 1175 FieldElement field = fieldParameter.field; | 1156 FieldElement field = fieldParameter.field; |
| 1176 recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, locat
ion); | 1157 recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, locat
ion); |
| 1177 } else if (element is PrefixElement) { | 1158 } else if (element is PrefixElement) { |
| 1178 _recordImportElementReferenceWithPrefix(node); | 1159 _recordImportElementReferenceWithPrefix(node); |
| 1179 } else if (element is PropertyAccessorElement || element is MethodElement) { | 1160 } else if (element is PropertyAccessorElement || element is MethodElement) { |
| 1180 location = _getLocationWithTypeAssignedToField(node, element, location); | 1161 location = _getLocationWithTypeAssignedToField(node, element, location); |
| 1181 if (_isQualified(node)) { | 1162 if (node.isQualified) { |
| 1182 recordRelationship(element, IndexConstants.IS_REFERENCED_BY_QUALIFIED, l
ocation); | 1163 recordRelationship(element, IndexConstants.IS_REFERENCED_BY_QUALIFIED, l
ocation); |
| 1183 } else { | 1164 } else { |
| 1184 recordRelationship(element, IndexConstants.IS_REFERENCED_BY_UNQUALIFIED,
location); | 1165 recordRelationship(element, IndexConstants.IS_REFERENCED_BY_UNQUALIFIED,
location); |
| 1185 } | 1166 } |
| 1186 } else if (element is ParameterElement || element is LocalVariableElement) { | 1167 } else if (element is ParameterElement || element is LocalVariableElement) { |
| 1187 bool inGetterContext = node.inGetterContext(); | 1168 bool inGetterContext = node.inGetterContext(); |
| 1188 bool inSetterContext = node.inSetterContext(); | 1169 bool inSetterContext = node.inSetterContext(); |
| 1189 if (inGetterContext && inSetterContext) { | 1170 if (inGetterContext && inSetterContext) { |
| 1190 recordRelationship(element, IndexConstants.IS_READ_WRITTEN_BY, location)
; | 1171 recordRelationship(element, IndexConstants.IS_READ_WRITTEN_BY, location)
; |
| 1191 } else if (inGetterContext) { | 1172 } else if (inGetterContext) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 if (element != null) { | 1391 if (element != null) { |
| 1411 recordRelationship(element, IndexConstants.IS_INVOKED_BY_QUALIFIED, locati
on); | 1392 recordRelationship(element, IndexConstants.IS_INVOKED_BY_QUALIFIED, locati
on); |
| 1412 } | 1393 } |
| 1413 } | 1394 } |
| 1414 | 1395 |
| 1415 /** | 1396 /** |
| 1416 * Records reference if the given [SimpleIdentifier] looks like a qualified pr
operty access | 1397 * Records reference if the given [SimpleIdentifier] looks like a qualified pr
operty access |
| 1417 * or method invocation. | 1398 * or method invocation. |
| 1418 */ | 1399 */ |
| 1419 void _recordQualifiedMemberReference(SimpleIdentifier node, Element element, E
lement nameElement, Location location) { | 1400 void _recordQualifiedMemberReference(SimpleIdentifier node, Element element, E
lement nameElement, Location location) { |
| 1420 if (_isQualified(node)) { | 1401 if (node.isQualified) { |
| 1421 Relationship relationship = element != null ? IndexConstants.IS_REFERENCED
_BY_QUALIFIED_RESOLVED : IndexConstants.IS_REFERENCED_BY_QUALIFIED_UNRESOLVED; | 1402 Relationship relationship = element != null ? IndexConstants.IS_REFERENCED
_BY_QUALIFIED_RESOLVED : IndexConstants.IS_REFERENCED_BY_QUALIFIED_UNRESOLVED; |
| 1422 recordRelationship(nameElement, relationship, location); | 1403 recordRelationship(nameElement, relationship, location); |
| 1423 } | 1404 } |
| 1424 } | 1405 } |
| 1425 | 1406 |
| 1426 /** | 1407 /** |
| 1427 * Records extends/implements relationships between given [ClassElement] and [
Type] of | 1408 * Records extends/implements relationships between given [ClassElement] and [
Type] of |
| 1428 * "superNode". | 1409 * "superNode". |
| 1429 */ | 1410 */ |
| 1430 void _recordSuperType(TypeName superNode, Relationship relationship) { | 1411 void _recordSuperType(TypeName superNode, Relationship relationship) { |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 static UniverseElementImpl INSTANCE = new UniverseElementImpl(); | 2577 static UniverseElementImpl INSTANCE = new UniverseElementImpl(); |
| 2597 | 2578 |
| 2598 UniverseElementImpl() : super("--universe--", -1); | 2579 UniverseElementImpl() : super("--universe--", -1); |
| 2599 | 2580 |
| 2600 @override | 2581 @override |
| 2601 accept(ElementVisitor visitor) => null; | 2582 accept(ElementVisitor visitor) => null; |
| 2602 | 2583 |
| 2603 @override | 2584 @override |
| 2604 ElementKind get kind => ElementKind.UNIVERSE; | 2585 ElementKind get kind => ElementKind.UNIVERSE; |
| 2605 } | 2586 } |
| OLD | NEW |