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

Unified Diff: pkg/compiler/lib/src/kernel/element_map.dart

Issue 2924803002: Avoid using FunctionSignature in builder_kernel (Closed)
Patch Set: Created 3 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/closure.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/element_map.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index 59aeb59e8224d14fdb8b521392a91dbcd62a3638..13e11413a824ef232e09e5eb942836d3c2e2af73 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -148,7 +148,7 @@ abstract class KernelToElementMap {
/// Computes the [ConstantValue] for the constant [expression].
ConstantValue getConstantValue(ir.Expression expression,
- {bool requireConstant: true});
+ {bool requireConstant: true, bool implicitNull: false});
/// Returns the `noSuchMethod` [FunctionEntity] call from a
/// `super.noSuchMethod` invocation within [cls].
@@ -243,9 +243,18 @@ abstract class KernelToElementMapMixin implements KernelToElementMap {
}
ConstantValue getConstantValue(ir.Expression node,
- {bool requireConstant: true}) {
- ConstantExpression constant =
- new Constantifier(this, requireConstant: requireConstant).visit(node);
+ {bool requireConstant: true, bool implicitNull: false}) {
+ ConstantExpression constant;
+ if (node == null) {
+ if (!implicitNull) {
+ throw new SpannableAssertionFailure(
+ CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.');
+ }
+ constant = new NullConstantExpression();
+ } else {
+ constant =
+ new Constantifier(this, requireConstant: requireConstant).visit(node);
+ }
if (constant == null) {
if (requireConstant) {
throw new UnsupportedError(
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698