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

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

Issue 1927533002: Handle discrepancy Dart and JS constant expressions. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 909b11361f3492f8eaeef58432a4048e3a82be2b..3bc94e5eb070cbed11303a4f6bf3cbe91b99acca 100644
--- a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
@@ -244,6 +244,21 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
element.node.accept(new ForgetConstantNodeVisitor(this));
}
}
+
+ ConstantValue getConstantValue(ConstantExpression expression) {
+ ConstantValue value = super.getConstantValue(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;
+ }
}
class ForgetConstantElementVisitor
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698