| 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 library services.src.index.index_contributor; | 5 library services.src.index.index_contributor; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/services/correction/namespace.dart'; | 9 import 'package:analysis_server/src/services/correction/namespace.dart'; |
| 10 import 'package:analysis_server/src/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 return super.visitPostfixExpression(node); | 655 return super.visitPostfixExpression(node); |
| 656 } | 656 } |
| 657 | 657 |
| 658 @override | 658 @override |
| 659 Object visitPrefixExpression(PrefixExpression node) { | 659 Object visitPrefixExpression(PrefixExpression node) { |
| 660 _recordOperatorReference(node.operator, node.bestElement); | 660 _recordOperatorReference(node.operator, node.bestElement); |
| 661 return super.visitPrefixExpression(node); | 661 return super.visitPrefixExpression(node); |
| 662 } | 662 } |
| 663 | 663 |
| 664 @override | 664 @override |
| 665 Object |
| 666 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod
e) { |
| 667 ConstructorElement element = node.staticElement; |
| 668 Location location; |
| 669 if (node.constructorName != null) { |
| 670 int start = node.period.offset; |
| 671 int end = node.constructorName.end; |
| 672 location = _createLocationForOffset(start, end - start); |
| 673 } else { |
| 674 int start = node.keyword.end; |
| 675 location = _createLocationForOffset(start, 0); |
| 676 } |
| 677 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); |
| 678 return super.visitRedirectingConstructorInvocation(node); |
| 679 } |
| 680 |
| 681 @override |
| 665 Object visitSimpleIdentifier(SimpleIdentifier node) { | 682 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 666 Element nameElement = new NameElement(node.name); | 683 Element nameElement = new NameElement(node.name); |
| 667 Location location = _createLocationForNode(node); | 684 Location location = _createLocationForNode(node); |
| 668 // name in declaration | 685 // name in declaration |
| 669 if (node.inDeclarationContext()) { | 686 if (node.inDeclarationContext()) { |
| 670 recordRelationship( | 687 recordRelationship( |
| 671 nameElement, | 688 nameElement, |
| 672 IndexConstants.NAME_IS_DEFINED_BY, | 689 IndexConstants.NAME_IS_DEFINED_BY, |
| 673 location); | 690 location); |
| 674 return null; | 691 return null; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 } | 1062 } |
| 1046 | 1063 |
| 1047 /** | 1064 /** |
| 1048 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". | 1065 * @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node
". |
| 1049 */ | 1066 */ |
| 1050 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { | 1067 static bool _isIdentifierInPrefixedIdentifier(SimpleIdentifier node) { |
| 1051 AstNode parent = node.parent; | 1068 AstNode parent = node.parent; |
| 1052 return parent is PrefixedIdentifier && parent.identifier == node; | 1069 return parent is PrefixedIdentifier && parent.identifier == node; |
| 1053 } | 1070 } |
| 1054 } | 1071 } |
| OLD | NEW |