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 9e7aeb4825871cb6b0c974897742ebf56df78838..af7d2291dbcf5980a027201dcd98528ba8a4aca6 100644 |
--- a/pkg/analyzer/lib/src/generated/element.dart |
+++ b/pkg/analyzer/lib/src/generated/element.dart |
@@ -13,7 +13,7 @@ import 'package:analyzer/task/model.dart' |
show AnalysisTarget, ConstantEvaluationTarget; |
import 'ast.dart'; |
-import 'constant.dart' show EvaluationResultImpl; |
+import 'constant.dart' show DartObject, EvaluationResultImpl; |
import 'engine.dart' show AnalysisContext, AnalysisEngine, AnalysisException; |
import 'html.dart' show XmlAttributeNode, XmlTagNode; |
import 'java_core.dart'; |
@@ -1760,6 +1760,9 @@ class ConstFieldElementImpl extends FieldElementImpl with ConstVariableElement { |
ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name); |
@override |
+ DartObject get constantValue => _result.value; |
+ |
+ @override |
EvaluationResultImpl get evaluationResult => _result; |
@override |
@@ -1791,6 +1794,9 @@ class ConstLocalVariableElementImpl extends LocalVariableElementImpl |
ConstLocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); |
@override |
+ DartObject get constantValue => _result.value; |
+ |
+ @override |
EvaluationResultImpl get evaluationResult => _result; |
@override |
@@ -2109,6 +2115,9 @@ class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl |
ConstTopLevelVariableElementImpl(Identifier name) : super.forNode(name); |
@override |
+ DartObject get constantValue => _result.value; |
+ |
+ @override |
EvaluationResultImpl get evaluationResult => _result; |
@override |
@@ -2273,6 +2282,9 @@ class DefaultFieldFormalParameterElementImpl |
DefaultFieldFormalParameterElementImpl(Identifier name) : super(name); |
@override |
+ DartObject get constantValue => _result.value; |
+ |
+ @override |
EvaluationResultImpl get evaluationResult => _result; |
@override |
@@ -2297,6 +2309,9 @@ class DefaultParameterElementImpl extends ParameterElementImpl |
DefaultParameterElementImpl(Identifier name) : super.forNode(name); |
@override |
+ DartObject get constantValue => _result.value; |
+ |
+ @override |
EvaluationResultImpl get evaluationResult => _result; |
@override |
@@ -2659,6 +2674,14 @@ abstract class ElementAnnotation { |
static const List<ElementAnnotation> EMPTY_LIST = const <ElementAnnotation>[]; |
/** |
+ * Return a representation of the value of this annotation. |
+ * |
+ * Return `null` if the value of this annotation could not be computed because |
+ * of errors. |
+ */ |
+ DartObject get constantValue; |
+ |
+ /** |
* Return the element representing the field, variable, or const constructor |
* being used as an annotation. |
*/ |
@@ -2738,6 +2761,9 @@ class ElementAnnotationImpl implements ElementAnnotation { |
ElementAnnotationImpl(this.element); |
@override |
+ DartObject get constantValue => evaluationResult.value; |
+ |
+ @override |
bool get isDeprecated { |
if (element != null) { |
LibraryElement library = element.library; |
@@ -10610,6 +10636,15 @@ abstract class VariableElement implements Element, ConstantEvaluationTarget { |
static const List<VariableElement> EMPTY_LIST = const <VariableElement>[]; |
/** |
+ * Return a representation of the value of this variable. |
+ * |
+ * Return `null` if either this variable was not declared with the 'const' |
+ * modifier or if the value of this variable could not be computed because of |
+ * errors. |
+ */ |
+ DartObject get constantValue; |
+ |
+ /** |
* Return `true` if this variable element did not have an explicit type |
* specified for it. |
*/ |
@@ -10712,6 +10747,9 @@ abstract class VariableElementImpl extends ElementImpl |
setModifier(Modifier.CONST, isConst); |
} |
+ @override |
+ DartObject get constantValue => null; |
+ |
/** |
* Return the result of evaluating this variable's initializer as a |
* compile-time constant expression, or `null` if this variable is not a |