Index: pkg/analyzer/lib/src/generated/element.dart |
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart |
index 7962858113fac3e11d9dcab10b0b13aacef82c9a..5c3d4d035fe1cdbb7858196d3b270a35bfc50e14 100644 |
--- a/pkg/analyzer/lib/src/generated/element.dart |
+++ b/pkg/analyzer/lib/src/generated/element.dart |
@@ -8275,6 +8275,9 @@ class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria |
@override |
bool get isPotentiallyMutatedInScope => hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE); |
+ @override |
+ bool get isUsed => hasModifier(Modifier.IS_USED_VARIABLE); |
+ |
/** |
* Specifies that this variable is potentially mutated somewhere in closure. |
*/ |
@@ -8290,6 +8293,13 @@ class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria |
} |
/** |
+ * Specifies that the value of this variable is used. |
+ */ |
+ void markUsed() { |
+ setModifier(Modifier.IS_USED_VARIABLE, true); |
+ } |
+ |
+ /** |
* Set the toolkit specific information objects attached to this variable. |
* |
* @param toolkitObjects the toolkit objects attached to this variable |
@@ -8750,47 +8760,52 @@ class Modifier extends Enum<Modifier> { |
static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 9); |
/** |
+ * Indicates that the value of a variable is used - read or invoked. |
+ */ |
+ static const Modifier IS_USED_VARIABLE = const Modifier('IS_USED_VARIABLE', 10); |
+ |
+ /** |
* Indicates that a class can validly be used as a mixin. |
*/ |
- static const Modifier MIXIN = const Modifier('MIXIN', 10); |
+ static const Modifier MIXIN = const Modifier('MIXIN', 11); |
/** |
* Indicates that the value of a parameter or local variable might be mutated within the context. |
*/ |
- static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTIALLY_MUTATED_IN_CONTEXT', 11); |
+ static const Modifier POTENTIALLY_MUTATED_IN_CONTEXT = const Modifier('POTENTIALLY_MUTATED_IN_CONTEXT', 12); |
/** |
* Indicates that the value of a parameter or local variable might be mutated within the scope. |
*/ |
- static const Modifier POTENTIALLY_MUTATED_IN_SCOPE = const Modifier('POTENTIALLY_MUTATED_IN_SCOPE', 12); |
+ static const Modifier POTENTIALLY_MUTATED_IN_SCOPE = const Modifier('POTENTIALLY_MUTATED_IN_SCOPE', 13); |
/** |
* Indicates that a class contains an explicit reference to 'super'. |
*/ |
- static const Modifier REFERENCES_SUPER = const Modifier('REFERENCES_SUPER', 13); |
+ static const Modifier REFERENCES_SUPER = const Modifier('REFERENCES_SUPER', 14); |
/** |
* Indicates that the pseudo-modifier 'set' was applied to the element. |
*/ |
- static const Modifier SETTER = const Modifier('SETTER', 14); |
+ static const Modifier SETTER = const Modifier('SETTER', 15); |
/** |
* Indicates that the modifier 'static' was applied to the element. |
*/ |
- static const Modifier STATIC = const Modifier('STATIC', 15); |
+ static const Modifier STATIC = const Modifier('STATIC', 16); |
/** |
* Indicates that the element does not appear in the source code but was implicitly created. For |
* example, if a class does not define any constructors, an implicit zero-argument constructor |
* will be created and it will be marked as being synthetic. |
*/ |
- static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 16); |
+ static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 17); |
/** |
* Indicates that a class was defined using an alias. TODO(brianwilkerson) This should be renamed |
* to 'ALIAS'. |
*/ |
- static const Modifier TYPEDEF = const Modifier('TYPEDEF', 17); |
+ static const Modifier TYPEDEF = const Modifier('TYPEDEF', 18); |
static const List<Modifier> values = const [ |
ABSTRACT, |
@@ -8803,6 +8818,7 @@ class Modifier extends Enum<Modifier> { |
GENERATOR, |
GETTER, |
HAS_EXT_URI, |
+ IS_USED_VARIABLE, |
MIXIN, |
POTENTIALLY_MUTATED_IN_CONTEXT, |
POTENTIALLY_MUTATED_IN_SCOPE, |
@@ -11585,6 +11601,14 @@ abstract class VariableElementImpl extends ElementImpl implements VariableElemen |
bool get isFinal => hasModifier(Modifier.FINAL); |
/** |
+ * Return `true` if this variable is used (i.e. purely read or invoked) |
+ * somewhere in its scope. This information is only available for local |
+ * variables (including parameters) and only after the compilation unit |
+ * containing the variable has been resolved. |
+ */ |
+ bool get isUsed => false; |
+ |
+ /** |
* Return `true` if this variable is potentially mutated somewhere in a closure. This |
* information is only available for local variables (including parameters) and only after the |
* compilation unit containing the variable has been resolved. |