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

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

Issue 2000153002: Handle constant function references. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add invariant from previous CL. Created 4 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/serialization/test_data.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 9a52c3ec1154f6b0ca83ba5f8ddbca372869ec7c..0eae100e16965ba51a8319f337e922c3fea1c520 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -189,9 +189,13 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
return result;
}
if (element.hasConstant) {
- if (element.constant != null &&
- compiler.serialization.supportsDeserialization) {
- evaluate(element.constant);
+ if (element.constant != null) {
+ if (compiler.serialization.supportsDeserialization) {
+ evaluate(element.constant);
+ }
+ assert(invariant(element, hasConstantValue(element.constant),
+ message: "Constant expression has not been evaluated: "
+ "${element.constant.toStructuredText()}."));
}
return element.constant;
}
@@ -592,7 +596,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (send.isPropertyAccess) {
AstConstant result;
if (Elements.isStaticOrTopLevelFunction(element)) {
- FunctionElementX function = element;
+ FunctionElement function = element;
function.computeType(resolution);
result = new AstConstant(
context,
« no previous file with comments | « no previous file | tests/compiler/dart2js/serialization/test_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698