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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 * [IS_REFERENCED_BY_UNQUALIFIED], [IS_READ_BY], [IS_WRITTEN_BY] or | 433 * [IS_REFERENCED_BY_UNQUALIFIED], [IS_READ_BY], [IS_WRITTEN_BY] or |
434 * [IS_READ_WRITTEN_BY], as appropriate. | 434 * [IS_READ_WRITTEN_BY], as appropriate. |
435 */ | 435 */ |
436 static final Relationship IS_REFERENCED_BY = Relationship.getRelationship("is-
referenced-by"); | 436 static final Relationship IS_REFERENCED_BY = Relationship.getRelationship("is-
referenced-by"); |
437 | 437 |
438 /** | 438 /** |
439 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is | 439 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is |
440 * referenced at a specific location (the right operand). This is used for qua
lified resolved | 440 * referenced at a specific location (the right operand). This is used for qua
lified resolved |
441 * references to methods and fields. | 441 * references to methods and fields. |
442 */ | 442 */ |
443 static final Relationship IS_REFERENCED_BY_QUALIFIED_RESOLVED = Relationship.g
etRelationship("is-referenced-by_qualified-resolved"); | 443 static final Relationship IS_REFERENCED_BY_QUALIFIED_RESOLVED = Relationship.g
etRelationship("is-referenced-by-qualified-resolved"); |
444 | 444 |
445 /** | 445 /** |
446 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is | 446 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is |
447 * referenced at a specific location (the right operand). This is used for qua
lified unresolved | 447 * referenced at a specific location (the right operand). This is used for qua
lified unresolved |
448 * references to methods and fields. | 448 * references to methods and fields. |
449 */ | 449 */ |
450 static final Relationship IS_REFERENCED_BY_QUALIFIED_UNRESOLVED = Relationship
.getRelationship("is-referenced-by_qualified-unresolved"); | 450 static final Relationship IS_REFERENCED_BY_QUALIFIED_UNRESOLVED = Relationship
.getRelationship("is-referenced-by-qualified-unresolved"); |
451 | 451 |
452 /** | 452 /** |
453 * The relationship used to indicate that an element (the left-operand) is ref
erenced at a | 453 * The relationship used to indicate that an element (the left-operand) is ref
erenced at a |
454 * specific location (the right operand). This is used for field accessors and
methods. | 454 * specific location (the right operand). This is used for field accessors and
methods. |
455 */ | 455 */ |
456 static final Relationship IS_REFERENCED_BY_QUALIFIED = Relationship.getRelatio
nship("is-referenced-by-qualified"); | 456 static final Relationship IS_REFERENCED_BY_QUALIFIED = Relationship.getRelatio
nship("is-referenced-by-qualified"); |
457 | 457 |
458 /** | 458 /** |
459 * The relationship used to indicate that an element (the left-operand) is ref
erenced at a | 459 * The relationship used to indicate that an element (the left-operand) is ref
erenced at a |
460 * specific location (the right operand). This is used for field accessors and
methods. | 460 * specific location (the right operand). This is used for field accessors and
methods. |
(...skipping 12 matching lines...) Expand all Loading... |
473 */ | 473 */ |
474 static final Relationship IS_INVOKED_BY_QUALIFIED = Relationship.getRelationsh
ip("is-invoked-by-qualified"); | 474 static final Relationship IS_INVOKED_BY_QUALIFIED = Relationship.getRelationsh
ip("is-invoked-by-qualified"); |
475 | 475 |
476 /** | 476 /** |
477 * The relationship used to indicate that an element (the left-operand) is inv
oked at a specific | 477 * The relationship used to indicate that an element (the left-operand) is inv
oked at a specific |
478 * location (the right operand). This is used for methods. | 478 * location (the right operand). This is used for methods. |
479 */ | 479 */ |
480 static final Relationship IS_INVOKED_BY_UNQUALIFIED = Relationship.getRelation
ship("is-invoked-by-unqualified"); | 480 static final Relationship IS_INVOKED_BY_UNQUALIFIED = Relationship.getRelation
ship("is-invoked-by-unqualified"); |
481 | 481 |
482 /** | 482 /** |
| 483 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is invoked |
| 484 * at a specific location (the right operand). This is used for resolved invoc
ations. |
| 485 */ |
| 486 static final Relationship NAME_IS_INVOKED_BY_RESOLVED = Relationship.getRelati
onship("name-is-invoked-by-resolved"); |
| 487 |
| 488 /** |
| 489 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is read at |
| 490 * a specific location (the right operand). |
| 491 */ |
| 492 static final Relationship NAME_IS_READ_BY_RESOLVED = Relationship.getRelations
hip("name-is-read-by-resolved"); |
| 493 |
| 494 /** |
| 495 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is both |
| 496 * read and written at a specific location (the right operand). |
| 497 */ |
| 498 static final Relationship NAME_IS_READ_WRITTEN_BY_RESOLVED = Relationship.getR
elationship("name-is-read-written-by-resolved"); |
| 499 |
| 500 /** |
| 501 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is written |
| 502 * at a specific location (the right operand). |
| 503 */ |
| 504 static final Relationship NAME_IS_WRITTEN_BY_RESOLVED = Relationship.getRelati
onship("name-is-written-by-resolved"); |
| 505 |
| 506 /** |
| 507 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is invoked |
| 508 * at a specific location (the right operand). This is used for unresolved inv
ocations. |
| 509 */ |
| 510 static final Relationship NAME_IS_INVOKED_BY_UNRESOLVED = Relationship.getRela
tionship("name-is-invoked-by-unresolved"); |
| 511 |
| 512 /** |
| 513 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is read at |
| 514 * a specific location (the right operand). |
| 515 */ |
| 516 static final Relationship NAME_IS_READ_BY_UNRESOLVED = Relationship.getRelatio
nship("name-is-read-by-unresolved"); |
| 517 |
| 518 /** |
| 519 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is both |
| 520 * read and written at a specific location (the right operand). |
| 521 */ |
| 522 static final Relationship NAME_IS_READ_WRITTEN_BY_UNRESOLVED = Relationship.ge
tRelationship("name-is-read-written-by-unresolved"); |
| 523 |
| 524 /** |
| 525 * The relationship used to indicate that an [NameElementImpl] (the left-opera
nd) is written |
| 526 * at a specific location (the right operand). |
| 527 */ |
| 528 static final Relationship NAME_IS_WRITTEN_BY_UNRESOLVED = Relationship.getRela
tionship("name-is-written-by-unresolved"); |
| 529 |
| 530 /** |
483 * Reference to some [AngularElement]. | 531 * Reference to some [AngularElement]. |
484 */ | 532 */ |
485 static final Relationship ANGULAR_REFERENCE = Relationship.getRelationship("an
gular-reference"); | 533 static final Relationship ANGULAR_REFERENCE = Relationship.getRelationship("an
gular-reference"); |
486 | 534 |
487 /** | 535 /** |
488 * Reference to some closing tag of an XML element. | 536 * Reference to some closing tag of an XML element. |
489 */ | 537 */ |
490 static final Relationship ANGULAR_CLOSING_TAG_REFERENCE = Relationship.getRela
tionship("angular-closing-tag-reference"); | 538 static final Relationship ANGULAR_CLOSING_TAG_REFERENCE = Relationship.getRela
tionship("angular-closing-tag-reference"); |
491 } | 539 } |
492 | 540 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 if (element is MethodElement) { | 1051 if (element is MethodElement) { |
1004 Location location = _createLocationFromNode(name); | 1052 Location location = _createLocationFromNode(name); |
1005 Relationship relationship; | 1053 Relationship relationship; |
1006 if (node.target != null) { | 1054 if (node.target != null) { |
1007 relationship = IndexConstants.IS_INVOKED_BY_QUALIFIED; | 1055 relationship = IndexConstants.IS_INVOKED_BY_QUALIFIED; |
1008 } else { | 1056 } else { |
1009 relationship = IndexConstants.IS_INVOKED_BY_UNQUALIFIED; | 1057 relationship = IndexConstants.IS_INVOKED_BY_UNQUALIFIED; |
1010 } | 1058 } |
1011 recordRelationship(element, relationship, location); | 1059 recordRelationship(element, relationship, location); |
1012 } | 1060 } |
1013 if (element is FunctionElement) { | 1061 if (element is FunctionElement || element is VariableElement) { |
1014 Location location = _createLocationFromNode(name); | 1062 Location location = _createLocationFromNode(name); |
1015 recordRelationship(element, IndexConstants.IS_INVOKED_BY, location); | 1063 recordRelationship(element, IndexConstants.IS_INVOKED_BY, location); |
1016 } | 1064 } |
| 1065 // name invocation |
| 1066 { |
| 1067 Element nameElement = new NameElementImpl(name.name); |
| 1068 Location location = _createLocationFromNode(name); |
| 1069 Relationship kind = element != null ? IndexConstants.NAME_IS_INVOKED_BY_RE
SOLVED : IndexConstants.NAME_IS_INVOKED_BY_UNRESOLVED; |
| 1070 _store.recordRelationship(nameElement, kind, location); |
| 1071 } |
1017 _recordImportElementReferenceWithoutPrefix(name); | 1072 _recordImportElementReferenceWithoutPrefix(name); |
1018 return super.visitMethodInvocation(node); | 1073 return super.visitMethodInvocation(node); |
1019 } | 1074 } |
1020 | 1075 |
1021 @override | 1076 @override |
1022 Object visitPartDirective(PartDirective node) { | 1077 Object visitPartDirective(PartDirective node) { |
1023 Element element = node.element; | 1078 Element element = node.element; |
1024 Location location = _createLocationFromNode(node.uri); | 1079 Location location = _createLocationFromNode(node.uri); |
1025 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); | 1080 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); |
1026 return super.visitPartDirective(node); | 1081 return super.visitPartDirective(node); |
(...skipping 28 matching lines...) Expand all Loading... |
1055 return null; | 1110 return null; |
1056 } | 1111 } |
1057 // prepare information | 1112 // prepare information |
1058 Element element = node.bestElement; | 1113 Element element = node.bestElement; |
1059 // qualified name reference | 1114 // qualified name reference |
1060 _recordQualifiedMemberReference(node, element, nameElement, location); | 1115 _recordQualifiedMemberReference(node, element, nameElement, location); |
1061 // stop if already handled | 1116 // stop if already handled |
1062 if (_isAlreadyHandledName(node)) { | 1117 if (_isAlreadyHandledName(node)) { |
1063 return null; | 1118 return null; |
1064 } | 1119 } |
| 1120 // record name read/write |
| 1121 { |
| 1122 bool inGetterContext = node.inGetterContext(); |
| 1123 bool inSetterContext = node.inSetterContext(); |
| 1124 if (inGetterContext && inSetterContext) { |
| 1125 Relationship kind = element != null ? IndexConstants.NAME_IS_READ_WRITTE
N_BY_RESOLVED : IndexConstants.NAME_IS_READ_WRITTEN_BY_UNRESOLVED; |
| 1126 _store.recordRelationship(nameElement, kind, location); |
| 1127 } else if (inGetterContext) { |
| 1128 Relationship kind = element != null ? IndexConstants.NAME_IS_READ_BY_RES
OLVED : IndexConstants.NAME_IS_READ_BY_UNRESOLVED; |
| 1129 _store.recordRelationship(nameElement, kind, location); |
| 1130 } else if (inSetterContext) { |
| 1131 Relationship kind = element != null ? IndexConstants.NAME_IS_WRITTEN_BY_
RESOLVED : IndexConstants.NAME_IS_WRITTEN_BY_UNRESOLVED; |
| 1132 _store.recordRelationship(nameElement, kind, location); |
| 1133 } |
| 1134 } |
1065 // record specific relations | 1135 // record specific relations |
1066 if (element is ClassElement || element is FunctionElement || element is Func
tionTypeAliasElement || element is LabelElement || element is TypeParameterEleme
nt) { | 1136 if (element is ClassElement || element is FunctionElement || element is Func
tionTypeAliasElement || element is LabelElement || element is TypeParameterEleme
nt) { |
1067 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); | 1137 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); |
1068 } else if (element is FieldElement) { | 1138 } else if (element is FieldElement) { |
1069 location = _getLocationWithInitializerType(node, location); | 1139 location = _getLocationWithInitializerType(node, location); |
1070 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); | 1140 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); |
1071 } else if (element is FieldFormalParameterElement) { | 1141 } else if (element is FieldFormalParameterElement) { |
1072 FieldFormalParameterElement fieldParameter = element; | 1142 FieldFormalParameterElement fieldParameter = element; |
1073 FieldElement field = fieldParameter.field; | 1143 FieldElement field = fieldParameter.field; |
1074 recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, locat
ion); | 1144 recordRelationship(field, IndexConstants.IS_REFERENCED_BY_QUALIFIED, locat
ion); |
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 static UniverseElementImpl INSTANCE = new UniverseElementImpl(); | 2535 static UniverseElementImpl INSTANCE = new UniverseElementImpl(); |
2466 | 2536 |
2467 UniverseElementImpl() : super("--universe--", -1); | 2537 UniverseElementImpl() : super("--universe--", -1); |
2468 | 2538 |
2469 @override | 2539 @override |
2470 accept(ElementVisitor visitor) => null; | 2540 accept(ElementVisitor visitor) => null; |
2471 | 2541 |
2472 @override | 2542 @override |
2473 ElementKind get kind => ElementKind.UNIVERSE; | 2543 ElementKind get kind => ElementKind.UNIVERSE; |
2474 } | 2544 } |
OLD | NEW |