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

Unified Diff: pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart

Issue 1148343004: Remove ConstantExpression.value (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update comments. Created 5 years, 7 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/compiler/lib/src/js_backend/constant_handler_javascript.dart
diff --git a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
index a9d83e5bf543ff7252ec35191205015c1473468f..d6fdc1b154be6d64db43c4be302e8df838cfefeb 100644
--- a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
@@ -23,10 +23,25 @@ class JavaScriptConstantTask extends ConstantCompilerTask {
String get name => 'ConstantHandler';
+ @override
+ ConstantSystem get constantSystem => dartConstantCompiler.constantSystem;
+
+ @override
+ ConstantValue getConstantValue(ConstantExpression expression) {
+ return dartConstantCompiler.getConstantValue(expression);
+ }
+
+ @override
+ ConstantValue getConstantValueForVariable(VariableElement element) {
+ return dartConstantCompiler.getConstantValueForVariable(element);
+ }
+
+ @override
ConstantExpression getConstantForVariable(VariableElement element) {
return dartConstantCompiler.getConstantForVariable(element);
}
+ @override
ConstantExpression compileConstant(VariableElement element) {
return measure(() {
ConstantExpression result = dartConstantCompiler.compileConstant(element);
@@ -63,6 +78,16 @@ class JavaScriptConstantTask extends ConstantCompilerTask {
return constant;
});
}
+
+ // TODO(johnniwinther): Remove this when values are computed from the
+ // expressions.
+ @override
+ void copyConstantValues(JavaScriptConstantTask task) {
+ jsConstantCompiler.constantValueMap.addAll(
+ task.jsConstantCompiler.constantValueMap);
+ dartConstantCompiler.constantValueMap.addAll(
+ task.dartConstantCompiler.constantValueMap);
+ }
}
/**
@@ -157,13 +182,13 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
return result;
}
- ConstantExpression getInitialValueFor(VariableElement element) {
+ ConstantValue getInitialValueFor(VariableElement element) {
ConstantExpression initialValue =
initialVariableValues[element.declaration];
if (initialValue == null) {
compiler.internalError(element, "No initial value for given element.");
}
- return initialValue;
+ return getConstantValue(initialValue);
}
ConstantExpression compileNode(Node node, TreeElements elements,
@@ -186,6 +211,10 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
return constant;
}
+ ConstantValue getConstantValueForNode(Node node, TreeElements definitions) {
+ return getConstantValue(getConstantForNode(node, definitions));
+ }
+
ConstantExpression getConstantForNode(Node node, TreeElements definitions) {
ConstantExpression constant = nodeConstantMap[node];
if (constant != null) {
@@ -194,13 +223,14 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
return definitions.getConstant(node);
}
- ConstantExpression getConstantForMetadata(MetadataAnnotation metadata) {
- return metadataConstantMap[metadata];
+ ConstantValue getConstantValueForMetadata(MetadataAnnotation metadata) {
+ return getConstantValue(metadataConstantMap[metadata]);
}
- ConstantExpression compileMetadata(MetadataAnnotation metadata,
- Node node,
- TreeElements elements) {
+ ConstantExpression compileMetadata(
+ MetadataAnnotation metadata,
+ Node node,
+ TreeElements elements) {
ConstantExpression constant =
super.compileMetadata(metadata, node, elements);
metadataConstantMap[metadata] = constant;
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/unsugar.dart ('k') | pkg/compiler/lib/src/js_backend/type_variable_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698