Index: pkg/compiler/lib/src/deferred_load.dart |
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart |
index db578393ae246abbb7b22cbb40dfd0d1994d48ec..b5a2cc5bb84fa7ae5bb7b0031636435df6218a2d 100644 |
--- a/pkg/compiler/lib/src/deferred_load.dart |
+++ b/pkg/compiler/lib/src/deferred_load.dart |
@@ -8,6 +8,10 @@ import 'common/backend_api.dart' show Backend; |
import 'common/tasks.dart' show CompilerTask; |
import 'common.dart'; |
import 'compiler.dart' show Compiler; |
+import 'constants/expressions.dart' |
+ show |
+ ConstantExpression, |
+ ConstantExpressionKind; |
import 'constants/values.dart' |
show |
ConstantValue, |
@@ -334,15 +338,13 @@ class DeferredLoadTask extends CompilerTask { |
TreeElements treeElements = analyzableElement.resolvedAst.elements; |
assert(treeElements != null); |
- treeElements.forEachConstantNode((Node node, _) { |
+ treeElements.forEachConstantNode( |
+ (Node node, ConstantExpression expression) { |
// Explicitly depend on the backend constants. |
- ConstantValue value = |
- backend.constants.getConstantValueForNode(node, treeElements); |
- if (value != null) { |
- // TODO(johnniwinther): Assert that all constants have values when |
- // these are directly evaluated. |
- constants.add(value); |
- } |
+ ConstantValue value = backend.constants.getConstantValue(expression); |
+ assert(invariant(node, value != null, |
+ message: "No constant value for ${expression.toStructuredText()}.")); |
+ constants.add(value); |
}); |
} |
} |