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

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 1416873003: Rework handling of potentially-constant variables. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
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 8a5d55a2a14fdc5094e2c10e53d6995d35f2c201..2c3e830ab95f03df9bbbc4cce2f35acc0d26fc1f 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -2137,7 +2137,7 @@ class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl
*
* This class is not intended to be part of the public API for analyzer.
*/
-abstract class ConstVariableElement implements PotentiallyConstVariableElement {
+abstract class ConstVariableElement {
/**
* If this element represents a constant variable, and it has an initializer,
* a copy of the initializer for the constant. Otherwise `null`.
@@ -4183,7 +4183,6 @@ abstract class FieldElement
* A concrete implementation of a [FieldElement].
*/
class FieldElementImpl extends PropertyInducingElementImpl
- with PotentiallyConstVariableElement
implements FieldElement {
/**
* An empty list of field elements.
@@ -7939,7 +7938,6 @@ abstract class LocalVariableElement implements LocalElement, VariableElement {
* A concrete implementation of a [LocalVariableElement].
*/
class LocalVariableElementImpl extends VariableElementImpl
- with PotentiallyConstVariableElement
implements LocalVariableElement {
/**
* An empty list of field elements.
@@ -8876,7 +8874,7 @@ abstract class ParameterElement
* A concrete implementation of a [ParameterElement].
*/
class ParameterElementImpl extends VariableElementImpl
- with ParameterElementMixin, PotentiallyConstVariableElement
+ with ParameterElementMixin
implements ParameterElement {
/**
* An empty list of parameter elements.
@@ -9235,28 +9233,6 @@ class ParameterMember extends VariableMember
}
/**
- * Interface used by elements that might represent constant variables.
- *
- * This class may be used as a mixin in the case where [constInitializer] is
- * known to return null.
- *
- * This class is not intended to be part of the public API for analyzer.
- */
-abstract class PotentiallyConstVariableElement
- implements VariableElementImpl, ConstantEvaluationTarget {
- /**
- * If this element represents a constant variable, and it has an initializer,
- * a copy of the initializer for the constant. Otherwise `null`.
- *
- * Note that in correct Dart code, all constant variables must have
- * initializers. However, analyzer also needs to handle incorrect Dart code,
- * in which case there might be some constant variables that lack
- * initializers.
- */
- Expression get constantInitializer => null;
-}
-
-/**
* A prefix used to import one or more libraries into another library.
*/
abstract class PrefixElement implements Element {
@@ -10065,7 +10041,6 @@ abstract class TopLevelVariableElement implements PropertyInducingElement {
* A concrete implementation of a [TopLevelVariableElement].
*/
class TopLevelVariableElementImpl extends PropertyInducingElementImpl
- with PotentiallyConstVariableElement
implements TopLevelVariableElement {
/**
* An empty list of top-level variable elements.
@@ -10770,6 +10745,17 @@ abstract class VariableElementImpl extends ElementImpl
setModifier(Modifier.CONST, isConst);
}
+ /**
+ * If this element represents a constant variable, and it has an initializer,
+ * a copy of the initializer for the constant. Otherwise `null`.
+ *
+ * Note that in correct Dart code, all constant variables must have
+ * initializers. However, analyzer also needs to handle incorrect Dart code,
+ * in which case there might be some constant variables that lack
+ * initializers.
+ */
+ Expression get constantInitializer => null;
+
@override
DartObject get constantValue => null;
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698