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

Unified Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 2070493003: Revert "Remove Registry from registerMetadataConstant" and "Serialize metadata" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compile_time_constants.dart
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index 71962e88957bcc163fdc0d7df455753022b6ab8c..bbabcf9f9aaf521a67cad7c5d96b3117f4471026 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -165,9 +165,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
@override
@deprecated
ConstantValue getConstantValueForVariable(VariableElement element) {
- ConstantExpression constant = initialVariableValues[element.declaration];
- // TODO(johnniwinther): Support eager evaluation of the constant.
- return constant != null ? getConstantValue(constant) : null;
+ return getConstantValue(initialVariableValues[element.declaration]);
}
ConstantExpression compileConstant(VariableElement element) {
@@ -322,27 +320,8 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
return constantValueMap.containsKey(expression);
}
- @override
ConstantValue getConstantValue(ConstantExpression expression) {
- assert(invariant(CURRENT_ELEMENT_SPANNABLE, expression != null,
- message: "ConstantExpression is null in getConstantValue."));
- // TODO(johnniwinther): ensure expressions have been evaluated at this
- // point. This can't be enabled today due to dartbug.com/26406.
- if (compiler.serialization.supportsDeserialization) {
- evaluate(expression);
- }
- ConstantValue value = constantValueMap[expression];
- if (value == null &&
- expression != null &&
- expression.kind == ConstantExpressionKind.ERRONEOUS) {
- // TODO(johnniwinther): When the Dart constant system sees a constant
- // expression as erroneous but the JavaScript constant system finds it ok
- // we have store a constant value for the erroneous constant expression.
- // Ensure the computed constant expressions are always the same; that only
- // the constant values may be different.
- value = new NullConstantValue();
- }
- return value;
+ return constantValueMap[expression];
}
ConstantExpression compileNode(Node node, TreeElements elements,
@@ -380,7 +359,7 @@ class DartConstantCompiler extends ConstantCompilerBase {
Node node, TreeElements definitions,
{bool isConst: true}) {
ConstantExpression constant = definitions.getConstant(node);
- if (constant != null && hasConstantValue(constant)) {
+ if (constant != null && getConstantValue(constant) != null) {
return constant;
}
constant =
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698