Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 719223002: Move unused local variables and classes analysis into HintGenerator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
3407 @override 3387 @override
3408 LibraryElement get library => getAncestor((element) => element is LibraryEleme nt); 3388 LibraryElement get library => getAncestor((element) => element is LibraryEleme nt);
3409 3389
3410 @override 3390 @override
3411 ElementLocation get location => new ElementLocationImpl.con1(this); 3391 ElementLocation get location => new ElementLocationImpl.con1(this);
3412 3392
3413 @override 3393 @override
3414 String get name => _name; 3394 String get name => _name;
3415 3395
3416 @override 3396 @override
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3564 3544
3565 /** 3545 /**
3566 * Return `true` if this element has the given modifier associated with it. 3546 * Return `true` if this element has the given modifier associated with it.
3567 * 3547 *
3568 * @param modifier the modifier being tested for 3548 * @param modifier the modifier being tested for
3569 * @return `true` if this element has the given modifier associated with it 3549 * @return `true` if this element has the given modifier associated with it
3570 */ 3550 */
3571 bool hasModifier(Modifier modifier) => BooleanArray.getEnum(_modifiers, modifi er); 3551 bool hasModifier(Modifier modifier) => BooleanArray.getEnum(_modifiers, modifi er);
3572 3552
3573 /** 3553 /**
3574 * Specifies that the element is used.
3575 */
3576 void markUsed() {
3577 setModifier(Modifier.IS_USED_IN_LIBRARY, true);
3578 }
3579
3580 /**
3581 * If the given child is not `null`, use the given visitor to visit it. 3554 * If the given child is not `null`, use the given visitor to visit it.
3582 * 3555 *
3583 * @param child the child to be visited 3556 * @param child the child to be visited
3584 * @param visitor the visitor to be used to visit the child 3557 * @param visitor the visitor to be used to visit the child
3585 */ 3558 */
3586 void safelyVisitChild(Element child, ElementVisitor visitor) { 3559 void safelyVisitChild(Element child, ElementVisitor visitor) {
3587 if (child != null) { 3560 if (child != null) {
3588 child.accept(visitor); 3561 child.accept(visitor);
3589 } 3562 }
3590 } 3563 }
(...skipping 4699 matching lines...) Expand 10 before | Expand all | Expand 10 after
8290 * @param name the name of this element 8263 * @param name the name of this element
8291 * @param nameOffset the offset of the name of this element in the file that c ontains the 8264 * @param nameOffset the offset of the name of this element in the file that c ontains the
8292 * declaration of this element 8265 * declaration of this element
8293 */ 8266 */
8294 LocalVariableElementImpl(String name, int nameOffset) : super(name, nameOffset ); 8267 LocalVariableElementImpl(String name, int nameOffset) : super(name, nameOffset );
8295 8268
8296 @override 8269 @override
8297 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); 8270 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this);
8298 8271
8299 @override 8272 @override
8300 bool get isUsed {
8301 return hasModifier(Modifier.IS_USED_IN_LIBRARY);
8302 }
8303
8304 @override
8305 ElementKind get kind => ElementKind.LOCAL_VARIABLE; 8273 ElementKind get kind => ElementKind.LOCAL_VARIABLE;
8306 8274
8307 @override 8275 @override
8308 List<ToolkitObjectElement> get toolkitObjects { 8276 List<ToolkitObjectElement> get toolkitObjects {
8309 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil ationUnitElementImpl); 8277 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil ationUnitElementImpl);
8310 if (unit == null) { 8278 if (unit == null) {
8311 return ToolkitObjectElement.EMPTY_ARRAY; 8279 return ToolkitObjectElement.EMPTY_ARRAY;
8312 } 8280 }
8313 return unit._getToolkitObjects(this); 8281 return unit._getToolkitObjects(this);
8314 } 8282 }
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
8795 */ 8763 */
8796 static const Modifier GETTER = const Modifier('GETTER', 8); 8764 static const Modifier GETTER = const Modifier('GETTER', 8);
8797 8765
8798 /** 8766 /**
8799 * A flag used for libraries indicating that the defining compilation unit con tains at least one 8767 * A flag used for libraries indicating that the defining compilation unit con tains at least one
8800 * import directive whose URI uses the "dart-ext" scheme. 8768 * import directive whose URI uses the "dart-ext" scheme.
8801 */ 8769 */
8802 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9); 8770 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9);
8803 8771
8804 /** 8772 /**
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.
8813 */
8814 static const Modifier IS_USED_IN_LIBRARY = const Modifier('IS_USED_IN_LIBRARY' , 10);
8815
8816 /**
8817 * Indicates that a class can validly be used as a mixin. 8773 * Indicates that a class can validly be used as a mixin.
8818 */ 8774 */
8819 static const Modifier MIXIN = const Modifier('MIXIN', 11); 8775 static const Modifier MIXIN = const Modifier('MIXIN', 11);
8820 8776
8821 /** 8777 /**
8822 * Indicates that the value of a parameter or local variable might be mutated within the context. 8778 * Indicates that the value of a parameter or local variable might be mutated within the context.
8823 */ 8779 */
8824 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTI ALLY_MUTATED_IN_CONTEXT', 12); 8780 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTI ALLY_MUTATED_IN_CONTEXT', 12);
8825 8781
8826 /** 8782 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
8860 ABSTRACT, 8816 ABSTRACT,
8861 ASYNCHRONOUS, 8817 ASYNCHRONOUS,
8862 CONST, 8818 CONST,
8863 DEFERRED, 8819 DEFERRED,
8864 ENUM, 8820 ENUM,
8865 FACTORY, 8821 FACTORY,
8866 FINAL, 8822 FINAL,
8867 GENERATOR, 8823 GENERATOR,
8868 GETTER, 8824 GETTER,
8869 HAS_EXT_URI, 8825 HAS_EXT_URI,
8870 IS_USED_IN_LIBRARY,
8871 MIXIN, 8826 MIXIN,
8872 POTENTIALLY_MUTATED_IN_CONTEXT, 8827 POTENTIALLY_MUTATED_IN_CONTEXT,
8873 POTENTIALLY_MUTATED_IN_SCOPE, 8828 POTENTIALLY_MUTATED_IN_SCOPE,
8874 REFERENCES_SUPER, 8829 REFERENCES_SUPER,
8875 SETTER, 8830 SETTER,
8876 STATIC, 8831 STATIC,
8877 SYNTHETIC, 8832 SYNTHETIC,
8878 TYPEDEF]; 8833 TYPEDEF];
8879 8834
8880 const Modifier(String name, int ordinal) : super(name, ordinal); 8835 const Modifier(String name, int ordinal) : super(name, ordinal);
(...skipping 2941 matching lines...) Expand 10 before | Expand all | Expand 10 after
11822 if (type is UnionType) { 11777 if (type is UnionType) {
11823 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs); 11778 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs);
11824 } 11779 }
11825 // The only subtype relations that pertain to void are therefore: 11780 // The only subtype relations that pertain to void are therefore:
11826 // void <: void (by reflexivity) 11781 // void <: void (by reflexivity)
11827 // bottom <: void (as bottom is a subtype of all types). 11782 // bottom <: void (as bottom is a subtype of all types).
11828 // void <: dynamic (as dynamic is a supertype of all types) 11783 // void <: dynamic (as dynamic is a supertype of all types)
11829 return identical(type, this) || type.isDynamic; 11784 return identical(type, this) || type.isDynamic;
11830 } 11785 }
11831 } 11786 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698