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

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

Issue 686113007: Report HintCode.UNUSED_LOCAL_VARIABLE for local variables whose value is never used. (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
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 8257 matching lines...) Expand 10 before | Expand all | Expand 10 after
8268 } 8268 }
8269 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 8269 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
8270 } 8270 }
8271 8271
8272 @override 8272 @override
8273 bool get isPotentiallyMutatedInClosure => hasModifier(Modifier.POTENTIALLY_MUT ATED_IN_CONTEXT); 8273 bool get isPotentiallyMutatedInClosure => hasModifier(Modifier.POTENTIALLY_MUT ATED_IN_CONTEXT);
8274 8274
8275 @override 8275 @override
8276 bool get isPotentiallyMutatedInScope => hasModifier(Modifier.POTENTIALLY_MUTAT ED_IN_SCOPE); 8276 bool get isPotentiallyMutatedInScope => hasModifier(Modifier.POTENTIALLY_MUTAT ED_IN_SCOPE);
8277 8277
8278 @override
8279 bool get isUsed => hasModifier(Modifier.IS_USED_VARIABLE);
8280
8278 /** 8281 /**
8279 * Specifies that this variable is potentially mutated somewhere in closure. 8282 * Specifies that this variable is potentially mutated somewhere in closure.
8280 */ 8283 */
8281 void markPotentiallyMutatedInClosure() { 8284 void markPotentiallyMutatedInClosure() {
8282 setModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT, true); 8285 setModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT, true);
8283 } 8286 }
8284 8287
8285 /** 8288 /**
8286 * Specifies that this variable is potentially mutated somewhere in its scope. 8289 * Specifies that this variable is potentially mutated somewhere in its scope.
8287 */ 8290 */
8288 void markPotentiallyMutatedInScope() { 8291 void markPotentiallyMutatedInScope() {
8289 setModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE, true); 8292 setModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE, true);
8290 } 8293 }
8291 8294
8292 /** 8295 /**
8296 * Specifies that the value of this variable is used.
8297 */
8298 void markUsed() {
8299 setModifier(Modifier.IS_USED_VARIABLE, true);
8300 }
8301
8302 /**
8293 * Set the toolkit specific information objects attached to this variable. 8303 * Set the toolkit specific information objects attached to this variable.
8294 * 8304 *
8295 * @param toolkitObjects the toolkit objects attached to this variable 8305 * @param toolkitObjects the toolkit objects attached to this variable
8296 */ 8306 */
8297 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) { 8307 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) {
8298 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil ationUnitElementImpl); 8308 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil ationUnitElementImpl);
8299 if (unit == null) { 8309 if (unit == null) {
8300 return; 8310 return;
8301 } 8311 }
8302 unit._setToolkitObjects(this, toolkitObjects); 8312 unit._setToolkitObjects(this, toolkitObjects);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
8743 */ 8753 */
8744 static const Modifier GETTER = const Modifier('GETTER', 8); 8754 static const Modifier GETTER = const Modifier('GETTER', 8);
8745 8755
8746 /** 8756 /**
8747 * A flag used for libraries indicating that the defining compilation unit con tains at least one 8757 * A flag used for libraries indicating that the defining compilation unit con tains at least one
8748 * import directive whose URI uses the "dart-ext" scheme. 8758 * import directive whose URI uses the "dart-ext" scheme.
8749 */ 8759 */
8750 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9); 8760 static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9);
8751 8761
8752 /** 8762 /**
8763 * Indicates that the value of a variable is used - read or invoked.
8764 */
8765 static const Modifier IS_USED_VARIABLE = const Modifier('IS_USED_VARIABLE', 10 );
8766
8767 /**
8753 * Indicates that a class can validly be used as a mixin. 8768 * Indicates that a class can validly be used as a mixin.
8754 */ 8769 */
8755 static const Modifier MIXIN = const Modifier('MIXIN', 10); 8770 static const Modifier MIXIN = const Modifier('MIXIN', 11);
8756 8771
8757 /** 8772 /**
8758 * Indicates that the value of a parameter or local variable might be mutated within the context. 8773 * Indicates that the value of a parameter or local variable might be mutated within the context.
8759 */ 8774 */
8760 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTI ALLY_MUTATED_IN_CONTEXT', 11); 8775 static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTI ALLY_MUTATED_IN_CONTEXT', 12);
8761 8776
8762 /** 8777 /**
8763 * Indicates that the value of a parameter or local variable might be mutated within the scope. 8778 * Indicates that the value of a parameter or local variable might be mutated within the scope.
8764 */ 8779 */
8765 static const Modifier POTENTIALLY_MUTATED_IN_SCOPE = const Modifier('POTENTIAL LY_MUTATED_IN_SCOPE', 12); 8780 static const Modifier POTENTIALLY_MUTATED_IN_SCOPE = const Modifier('POTENTIAL LY_MUTATED_IN_SCOPE', 13);
8766 8781
8767 /** 8782 /**
8768 * Indicates that a class contains an explicit reference to 'super'. 8783 * Indicates that a class contains an explicit reference to 'super'.
8769 */ 8784 */
8770 static const Modifier REFERENCES_SUPER = const Modifier('REFERENCES_SUPER', 13 ); 8785 static const Modifier REFERENCES_SUPER = const Modifier('REFERENCES_SUPER', 14 );
8771 8786
8772 /** 8787 /**
8773 * Indicates that the pseudo-modifier 'set' was applied to the element. 8788 * Indicates that the pseudo-modifier 'set' was applied to the element.
8774 */ 8789 */
8775 static const Modifier SETTER = const Modifier('SETTER', 14); 8790 static const Modifier SETTER = const Modifier('SETTER', 15);
8776 8791
8777 /** 8792 /**
8778 * Indicates that the modifier 'static' was applied to the element. 8793 * Indicates that the modifier 'static' was applied to the element.
8779 */ 8794 */
8780 static const Modifier STATIC = const Modifier('STATIC', 15); 8795 static const Modifier STATIC = const Modifier('STATIC', 16);
8781 8796
8782 /** 8797 /**
8783 * Indicates that the element does not appear in the source code but was impli citly created. For 8798 * Indicates that the element does not appear in the source code but was impli citly created. For
8784 * example, if a class does not define any constructors, an implicit zero-argu ment constructor 8799 * example, if a class does not define any constructors, an implicit zero-argu ment constructor
8785 * will be created and it will be marked as being synthetic. 8800 * will be created and it will be marked as being synthetic.
8786 */ 8801 */
8787 static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 16); 8802 static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 17);
8788 8803
8789 /** 8804 /**
8790 * Indicates that a class was defined using an alias. TODO(brianwilkerson) Thi s should be renamed 8805 * Indicates that a class was defined using an alias. TODO(brianwilkerson) Thi s should be renamed
8791 * to 'ALIAS'. 8806 * to 'ALIAS'.
8792 */ 8807 */
8793 static const Modifier TYPEDEF = const Modifier('TYPEDEF', 17); 8808 static const Modifier TYPEDEF = const Modifier('TYPEDEF', 18);
8794 8809
8795 static const List<Modifier> values = const [ 8810 static const List<Modifier> values = const [
8796 ABSTRACT, 8811 ABSTRACT,
8797 ASYNCHRONOUS, 8812 ASYNCHRONOUS,
8798 CONST, 8813 CONST,
8799 DEFERRED, 8814 DEFERRED,
8800 ENUM, 8815 ENUM,
8801 FACTORY, 8816 FACTORY,
8802 FINAL, 8817 FINAL,
8803 GENERATOR, 8818 GENERATOR,
8804 GETTER, 8819 GETTER,
8805 HAS_EXT_URI, 8820 HAS_EXT_URI,
8821 IS_USED_VARIABLE,
8806 MIXIN, 8822 MIXIN,
8807 POTENTIALLY_MUTATED_IN_CONTEXT, 8823 POTENTIALLY_MUTATED_IN_CONTEXT,
8808 POTENTIALLY_MUTATED_IN_SCOPE, 8824 POTENTIALLY_MUTATED_IN_SCOPE,
8809 REFERENCES_SUPER, 8825 REFERENCES_SUPER,
8810 SETTER, 8826 SETTER,
8811 STATIC, 8827 STATIC,
8812 SYNTHETIC, 8828 SYNTHETIC,
8813 TYPEDEF]; 8829 TYPEDEF];
8814 8830
8815 const Modifier(String name, int ordinal) : super(name, ordinal); 8831 const Modifier(String name, int ordinal) : super(name, ordinal);
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after
11578 @override 11594 @override
11579 VariableDeclaration get node => getNodeMatching((node) => node is VariableDecl aration); 11595 VariableDeclaration get node => getNodeMatching((node) => node is VariableDecl aration);
11580 11596
11581 @override 11597 @override
11582 bool get isConst => hasModifier(Modifier.CONST); 11598 bool get isConst => hasModifier(Modifier.CONST);
11583 11599
11584 @override 11600 @override
11585 bool get isFinal => hasModifier(Modifier.FINAL); 11601 bool get isFinal => hasModifier(Modifier.FINAL);
11586 11602
11587 /** 11603 /**
11604 * Return `true` if this variable is used (i.e. purely read or invoked)
11605 * somewhere in its scope. This information is only available for local
11606 * variables (including parameters) and only after the compilation unit
11607 * containing the variable has been resolved.
11608 */
11609 bool get isUsed => false;
11610
11611 /**
11588 * Return `true` if this variable is potentially mutated somewhere in a closur e. This 11612 * Return `true` if this variable is potentially mutated somewhere in a closur e. This
11589 * information is only available for local variables (including parameters) an d only after the 11613 * information is only available for local variables (including parameters) an d only after the
11590 * compilation unit containing the variable has been resolved. 11614 * compilation unit containing the variable has been resolved.
11591 * 11615 *
11592 * @return `true` if this variable is potentially mutated somewhere in closure 11616 * @return `true` if this variable is potentially mutated somewhere in closure
11593 */ 11617 */
11594 bool get isPotentiallyMutatedInClosure => false; 11618 bool get isPotentiallyMutatedInClosure => false;
11595 11619
11596 /** 11620 /**
11597 * Return `true` if this variable is potentially mutated somewhere in its scop e. This 11621 * 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
11757 if (type is UnionType) { 11781 if (type is UnionType) {
11758 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs); 11782 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs);
11759 } 11783 }
11760 // The only subtype relations that pertain to void are therefore: 11784 // The only subtype relations that pertain to void are therefore:
11761 // void <: void (by reflexivity) 11785 // void <: void (by reflexivity)
11762 // bottom <: void (as bottom is a subtype of all types). 11786 // bottom <: void (as bottom is a subtype of all types).
11763 // void <: dynamic (as dynamic is a supertype of all types) 11787 // void <: dynamic (as dynamic is a supertype of all types)
11764 return identical(type, this) || type.isDynamic; 11788 return identical(type, this) || type.isDynamic;
11765 } 11789 }
11766 } 11790 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/correction/fix_test.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698