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 services.src.index.index_contributor; | 8 library services.src.index.index_contributor; |
9 | 9 |
10 import 'dart:collection' show Queue; | 10 import 'dart:collection' show Queue; |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 Object visitSimpleIdentifier(SimpleIdentifier node) { | 649 Object visitSimpleIdentifier(SimpleIdentifier node) { |
650 Element nameElement = new NameElement(node.name); | 650 Element nameElement = new NameElement(node.name); |
651 Location location = _createLocationFromNode(node); | 651 Location location = _createLocationFromNode(node); |
652 // name in declaration | 652 // name in declaration |
653 if (node.inDeclarationContext()) { | 653 if (node.inDeclarationContext()) { |
654 recordRelationship(nameElement, IndexConstants.IS_DEFINED_BY, location); | 654 recordRelationship(nameElement, IndexConstants.IS_DEFINED_BY, location); |
655 return null; | 655 return null; |
656 } | 656 } |
657 // prepare information | 657 // prepare information |
658 Element element = node.bestElement; | 658 Element element = node.bestElement; |
| 659 // TODO(scheglov) fix resolver to resolve to Field, not an accessor |
| 660 if (node.parent is Combinator && element is PropertyAccessorElement) { |
| 661 element = (element as PropertyAccessorElement).variable; |
| 662 } |
659 // qualified name reference | 663 // qualified name reference |
660 _recordQualifiedMemberReference(node, element, nameElement, location); | 664 _recordQualifiedMemberReference(node, element, nameElement, location); |
661 // stop if already handled | 665 // stop if already handled |
662 if (_isAlreadyHandledName(node)) { | 666 if (_isAlreadyHandledName(node)) { |
663 return null; | 667 return null; |
664 } | 668 } |
665 // record name read/write | 669 // record name read/write |
666 { | 670 { |
667 bool inGetterContext = node.inGetterContext(); | 671 bool inGetterContext = node.inGetterContext(); |
668 bool inSetterContext = node.inSetterContext(); | 672 bool inSetterContext = node.inSetterContext(); |
(...skipping 12 matching lines...) Expand all Loading... |
681 IndexConstants.NAME_IS_WRITTEN_BY_RESOLVED : | 685 IndexConstants.NAME_IS_WRITTEN_BY_RESOLVED : |
682 IndexConstants.NAME_IS_WRITTEN_BY_UNRESOLVED; | 686 IndexConstants.NAME_IS_WRITTEN_BY_UNRESOLVED; |
683 _store.recordRelationship(nameElement, kind, location); | 687 _store.recordRelationship(nameElement, kind, location); |
684 } | 688 } |
685 } | 689 } |
686 // record specific relations | 690 // record specific relations |
687 if (element is ClassElement || element is FunctionElement || element is | 691 if (element is ClassElement || element is FunctionElement || element is |
688 FunctionTypeAliasElement || element is LabelElement || element is | 692 FunctionTypeAliasElement || element is LabelElement || element is |
689 TypeParameterElement) { | 693 TypeParameterElement) { |
690 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); | 694 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); |
691 } else if (element is FieldElement) { | 695 } else if (element is PropertyInducingElement) { |
692 location = _getLocationWithInitializerType(node, location); | 696 location = _getLocationWithInitializerType(node, location); |
693 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); | 697 recordRelationship(element, |
| 698 IndexConstants.IS_REFERENCED_BY_QUALIFIED, |
| 699 location); |
694 } else if (element is FieldFormalParameterElement) { | 700 } else if (element is FieldFormalParameterElement) { |
695 FieldFormalParameterElement fieldParameter = element; | 701 FieldFormalParameterElement fieldParameter = element; |
696 FieldElement field = fieldParameter.field; | 702 FieldElement field = fieldParameter.field; |
697 recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, | 703 recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, |
698 location); | 704 location); |
699 } else if (element is PrefixElement) { | 705 } else if (element is PrefixElement) { |
700 _recordImportElementReferenceWithPrefix(node); | 706 _recordImportElementReferenceWithPrefix(node); |
701 } else if (element is PropertyAccessorElement || element is MethodElement) { | 707 } else if (element is PropertyAccessorElement || element is MethodElement) { |
702 location = _getLocationWithTypeAssignedToField(node, element, location); | 708 location = _getLocationWithTypeAssignedToField(node, element, location); |
703 if (node.isQualified) { | 709 if (node.isQualified) { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 } | 1211 } |
1206 | 1212 |
1207 /** | 1213 /** |
1208 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 1214 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
1209 */ | 1215 */ |
1210 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 1216 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
1211 AstNode parent = node.parent; | 1217 AstNode parent = node.parent; |
1212 return parent is PrefixedIdentifier && identical(parent.identifier, node); | 1218 return parent is PrefixedIdentifier && identical(parent.identifier, node); |
1213 } | 1219 } |
1214 } | 1220 } |
OLD | NEW |