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.element; | 8 library engine.element; |
9 | 9 |
10 import 'dart:collection'; | 10 import 'dart:collection'; |
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3377 if (shortName == null) { | 3377 if (shortName == null) { |
3378 shortName = displayName; | 3378 shortName = displayName; |
3379 } | 3379 } |
3380 Source source = this.source; | 3380 Source source = this.source; |
3381 if (source != null) { | 3381 if (source != null) { |
3382 return "$shortName (${source.fullName})"; | 3382 return "$shortName (${source.fullName})"; |
3383 } | 3383 } |
3384 return shortName; | 3384 return shortName; |
3385 } | 3385 } |
3386 | 3386 |
| 3387 /** |
| 3388 * Return `true` if this element is used or potentially can be used. |
| 3389 * |
| 3390 * For a top-level element: it is public, or it is private and used in the |
| 3391 * defining library. |
| 3392 * |
| 3393 * For a local variable: its value is used (i.e. purely read or invoked) |
| 3394 * somewhere in its scope. |
| 3395 * |
| 3396 * This information is only available for local variables (including |
| 3397 * parameters) and only after the compilation unit containing the element |
| 3398 * has been resolved. |
| 3399 */ |
| 3400 bool get isUsed { |
| 3401 if (isPublic) { |
| 3402 return true; |
| 3403 } |
| 3404 return hasModifier(Modifier.IS_USED_IN_LIBRARY); |
| 3405 } |
| 3406 |
3387 @override | 3407 @override |
3388 LibraryElement get library => getAncestor((element) => element is LibraryEleme
nt); | 3408 LibraryElement get library => getAncestor((element) => element is LibraryEleme
nt); |
3389 | 3409 |
3390 @override | 3410 @override |
3391 ElementLocation get location => new ElementLocationImpl.con1(this); | 3411 ElementLocation get location => new ElementLocationImpl.con1(this); |
3392 | 3412 |
3393 @override | 3413 @override |
3394 String get name => _name; | 3414 String get name => _name; |
3395 | 3415 |
3396 @override | 3416 @override |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3544 | 3564 |
3545 /** | 3565 /** |
3546 * Return `true` if this element has the given modifier associated with it. | 3566 * Return `true` if this element has the given modifier associated with it. |
3547 * | 3567 * |
3548 * @param modifier the modifier being tested for | 3568 * @param modifier the modifier being tested for |
3549 * @return `true` if this element has the given modifier associated with it | 3569 * @return `true` if this element has the given modifier associated with it |
3550 */ | 3570 */ |
3551 bool hasModifier(Modifier modifier) => BooleanArray.getEnum(_modifiers, modifi
er); | 3571 bool hasModifier(Modifier modifier) => BooleanArray.getEnum(_modifiers, modifi
er); |
3552 | 3572 |
3553 /** | 3573 /** |
| 3574 * Specifies that the element is used. |
| 3575 */ |
| 3576 void markUsed() { |
| 3577 setModifier(Modifier.IS_USED_IN_LIBRARY, true); |
| 3578 } |
| 3579 |
| 3580 /** |
3554 * If the given child is not `null`, use the given visitor to visit it. | 3581 * If the given child is not `null`, use the given visitor to visit it. |
3555 * | 3582 * |
3556 * @param child the child to be visited | 3583 * @param child the child to be visited |
3557 * @param visitor the visitor to be used to visit the child | 3584 * @param visitor the visitor to be used to visit the child |
3558 */ | 3585 */ |
3559 void safelyVisitChild(Element child, ElementVisitor visitor) { | 3586 void safelyVisitChild(Element child, ElementVisitor visitor) { |
3560 if (child != null) { | 3587 if (child != null) { |
3561 child.accept(visitor); | 3588 child.accept(visitor); |
3562 } | 3589 } |
3563 } | 3590 } |
(...skipping 4699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8263 * @param name the name of this element | 8290 * @param name the name of this element |
8264 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 8291 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
8265 * declaration of this element | 8292 * declaration of this element |
8266 */ | 8293 */ |
8267 LocalVariableElementImpl(String name, int nameOffset) : super(name, nameOffset
); | 8294 LocalVariableElementImpl(String name, int nameOffset) : super(name, nameOffset
); |
8268 | 8295 |
8269 @override | 8296 @override |
8270 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); | 8297 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); |
8271 | 8298 |
8272 @override | 8299 @override |
| 8300 bool get isUsed { |
| 8301 return hasModifier(Modifier.IS_USED_IN_LIBRARY); |
| 8302 } |
| 8303 |
| 8304 @override |
8273 ElementKind get kind => ElementKind.LOCAL_VARIABLE; | 8305 ElementKind get kind => ElementKind.LOCAL_VARIABLE; |
8274 | 8306 |
8275 @override | 8307 @override |
8276 List<ToolkitObjectElement> get toolkitObjects { | 8308 List<ToolkitObjectElement> get toolkitObjects { |
8277 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil
ationUnitElementImpl); | 8309 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil
ationUnitElementImpl); |
8278 if (unit == null) { | 8310 if (unit == null) { |
8279 return ToolkitObjectElement.EMPTY_ARRAY; | 8311 return ToolkitObjectElement.EMPTY_ARRAY; |
8280 } | 8312 } |
8281 return unit._getToolkitObjects(this); | 8313 return unit._getToolkitObjects(this); |
8282 } | 8314 } |
8283 | 8315 |
8284 @override | 8316 @override |
8285 SourceRange get visibleRange { | 8317 SourceRange get visibleRange { |
8286 if (_visibleRangeLength < 0) { | 8318 if (_visibleRangeLength < 0) { |
8287 return null; | 8319 return null; |
8288 } | 8320 } |
8289 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 8321 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
8290 } | 8322 } |
8291 | 8323 |
8292 @override | 8324 @override |
8293 bool get isPotentiallyMutatedInClosure => hasModifier(Modifier.POTENTIALLY_MUT
ATED_IN_CONTEXT); | 8325 bool get isPotentiallyMutatedInClosure => hasModifier(Modifier.POTENTIALLY_MUT
ATED_IN_CONTEXT); |
8294 | 8326 |
8295 @override | 8327 @override |
8296 bool get isPotentiallyMutatedInScope => hasModifier(Modifier.POTENTIALLY_MUTAT
ED_IN_SCOPE); | 8328 bool get isPotentiallyMutatedInScope => hasModifier(Modifier.POTENTIALLY_MUTAT
ED_IN_SCOPE); |
8297 | 8329 |
8298 @override | |
8299 bool get isUsed => hasModifier(Modifier.IS_USED_VARIABLE); | |
8300 | |
8301 /** | 8330 /** |
8302 * Specifies that this variable is potentially mutated somewhere in closure. | 8331 * Specifies that this variable is potentially mutated somewhere in closure. |
8303 */ | 8332 */ |
8304 void markPotentiallyMutatedInClosure() { | 8333 void markPotentiallyMutatedInClosure() { |
8305 setModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT, true); | 8334 setModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT, true); |
8306 } | 8335 } |
8307 | 8336 |
8308 /** | 8337 /** |
8309 * Specifies that this variable is potentially mutated somewhere in its scope. | 8338 * Specifies that this variable is potentially mutated somewhere in its scope. |
8310 */ | 8339 */ |
8311 void markPotentiallyMutatedInScope() { | 8340 void markPotentiallyMutatedInScope() { |
8312 setModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE, true); | 8341 setModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE, true); |
8313 } | 8342 } |
8314 | 8343 |
8315 /** | 8344 /** |
8316 * Specifies that the value of this variable is used. | |
8317 */ | |
8318 void markUsed() { | |
8319 setModifier(Modifier.IS_USED_VARIABLE, true); | |
8320 } | |
8321 | |
8322 /** | |
8323 * Set the toolkit specific information objects attached to this variable. | 8345 * Set the toolkit specific information objects attached to this variable. |
8324 * | 8346 * |
8325 * @param toolkitObjects the toolkit objects attached to this variable | 8347 * @param toolkitObjects the toolkit objects attached to this variable |
8326 */ | 8348 */ |
8327 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) { | 8349 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) { |
8328 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil
ationUnitElementImpl); | 8350 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil
ationUnitElementImpl); |
8329 if (unit == null) { | 8351 if (unit == null) { |
8330 return; | 8352 return; |
8331 } | 8353 } |
8332 unit._setToolkitObjects(this, toolkitObjects); | 8354 unit._setToolkitObjects(this, toolkitObjects); |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8773 */ | 8795 */ |
8774 static const Modifier GETTER = const Modifier('GETTER', 8); | 8796 static const Modifier GETTER = const Modifier('GETTER', 8); |
8775 | 8797 |
8776 /** | 8798 /** |
8777 * A flag used for libraries indicating that the defining compilation unit con
tains at least one | 8799 * A flag used for libraries indicating that the defining compilation unit con
tains at least one |
8778 * import directive whose URI uses the "dart-ext" scheme. | 8800 * import directive whose URI uses the "dart-ext" scheme. |
8779 */ | 8801 */ |
8780 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9); | 8802 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9); |
8781 | 8803 |
8782 /** | 8804 /** |
8783 * Indicates that the value of a variable is used - read or invoked. | 8805 * Indicates that the element is used in the declaring library. |
| 8806 * |
| 8807 * |
| 8808 * For a top-level element: it is public, or it is private and used in the |
| 8809 * defining library. |
| 8810 * |
| 8811 * For a local variable: its value is used (i.e. purely read or invoked) |
| 8812 * somewhere in its scope. |
8784 */ | 8813 */ |
8785 static const Modifier IS_USED_VARIABLE = const Modifier('IS_USED_VARIABLE', 10
); | 8814 static const Modifier IS_USED_IN_LIBRARY = const Modifier('IS_USED_IN_LIBRARY'
, 10); |
8786 | 8815 |
8787 /** | 8816 /** |
8788 * Indicates that a class can validly be used as a mixin. | 8817 * Indicates that a class can validly be used as a mixin. |
8789 */ | 8818 */ |
8790 static const Modifier MIXIN = const Modifier('MIXIN', 11); | 8819 static const Modifier MIXIN = const Modifier('MIXIN', 11); |
8791 | 8820 |
8792 /** | 8821 /** |
8793 * Indicates that the value of a parameter or local variable might be mutated
within the context. | 8822 * Indicates that the value of a parameter or local variable might be mutated
within the context. |
8794 */ | 8823 */ |
8795 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTI
ALLY_MUTATED_IN_CONTEXT', 12); | 8824 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTI
ALLY_MUTATED_IN_CONTEXT', 12); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8831 ABSTRACT, | 8860 ABSTRACT, |
8832 ASYNCHRONOUS, | 8861 ASYNCHRONOUS, |
8833 CONST, | 8862 CONST, |
8834 DEFERRED, | 8863 DEFERRED, |
8835 ENUM, | 8864 ENUM, |
8836 FACTORY, | 8865 FACTORY, |
8837 FINAL, | 8866 FINAL, |
8838 GENERATOR, | 8867 GENERATOR, |
8839 GETTER, | 8868 GETTER, |
8840 HAS_EXT_URI, | 8869 HAS_EXT_URI, |
8841 IS_USED_VARIABLE, | 8870 IS_USED_IN_LIBRARY, |
8842 MIXIN, | 8871 MIXIN, |
8843 POTENTIALLY_MUTATED_IN_CONTEXT, | 8872 POTENTIALLY_MUTATED_IN_CONTEXT, |
8844 POTENTIALLY_MUTATED_IN_SCOPE, | 8873 POTENTIALLY_MUTATED_IN_SCOPE, |
8845 REFERENCES_SUPER, | 8874 REFERENCES_SUPER, |
8846 SETTER, | 8875 SETTER, |
8847 STATIC, | 8876 STATIC, |
8848 SYNTHETIC, | 8877 SYNTHETIC, |
8849 TYPEDEF]; | 8878 TYPEDEF]; |
8850 | 8879 |
8851 const Modifier(String name, int ordinal) : super(name, ordinal); | 8880 const Modifier(String name, int ordinal) : super(name, ordinal); |
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11614 @override | 11643 @override |
11615 VariableDeclaration get node => getNodeMatching((node) => node is VariableDecl
aration); | 11644 VariableDeclaration get node => getNodeMatching((node) => node is VariableDecl
aration); |
11616 | 11645 |
11617 @override | 11646 @override |
11618 bool get isConst => hasModifier(Modifier.CONST); | 11647 bool get isConst => hasModifier(Modifier.CONST); |
11619 | 11648 |
11620 @override | 11649 @override |
11621 bool get isFinal => hasModifier(Modifier.FINAL); | 11650 bool get isFinal => hasModifier(Modifier.FINAL); |
11622 | 11651 |
11623 /** | 11652 /** |
11624 * Return `true` if this variable is used (i.e. purely read or invoked) | |
11625 * somewhere in its scope. This information is only available for local | |
11626 * variables (including parameters) and only after the compilation unit | |
11627 * containing the variable has been resolved. | |
11628 */ | |
11629 bool get isUsed => false; | |
11630 | |
11631 /** | |
11632 * Return `true` if this variable is potentially mutated somewhere in a closur
e. This | 11653 * Return `true` if this variable is potentially mutated somewhere in a closur
e. This |
11633 * information is only available for local variables (including parameters) an
d only after the | 11654 * information is only available for local variables (including parameters) an
d only after the |
11634 * compilation unit containing the variable has been resolved. | 11655 * compilation unit containing the variable has been resolved. |
11635 * | 11656 * |
11636 * @return `true` if this variable is potentially mutated somewhere in closure | 11657 * @return `true` if this variable is potentially mutated somewhere in closure |
11637 */ | 11658 */ |
11638 bool get isPotentiallyMutatedInClosure => false; | 11659 bool get isPotentiallyMutatedInClosure => false; |
11639 | 11660 |
11640 /** | 11661 /** |
11641 * Return `true` if this variable is potentially mutated somewhere in its scop
e. This | 11662 * Return `true` if this variable is potentially mutated somewhere in its scop
e. This |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11801 if (type is UnionType) { | 11822 if (type is UnionType) { |
11802 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite
dTypePairs); | 11823 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite
dTypePairs); |
11803 } | 11824 } |
11804 // The only subtype relations that pertain to void are therefore: | 11825 // The only subtype relations that pertain to void are therefore: |
11805 // void <: void (by reflexivity) | 11826 // void <: void (by reflexivity) |
11806 // bottom <: void (as bottom is a subtype of all types). | 11827 // bottom <: void (as bottom is a subtype of all types). |
11807 // void <: dynamic (as dynamic is a supertype of all types) | 11828 // void <: dynamic (as dynamic is a supertype of all types) |
11808 return identical(type, this) || type.isDynamic; | 11829 return identical(type, this) || type.isDynamic; |
11809 } | 11830 } |
11810 } | 11831 } |
OLD | NEW |