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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1564423002: Copy all fields of NullCheck (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | pkg/compiler/lib/src/cps_ir/inline.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index 08754637f4c187a307689a56a18f6276804c1566..8b26626b11624ed18dcc87e5a65ead46de322b37 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -850,10 +850,13 @@ class BoundsCheck extends Primitive {
///
/// In the simplest form this compiles to `value.toString;`.
///
-/// If [selector] is set, `toString` is replaced with the (possibly minified)
-/// invocation name of the selector. This can be shorter and generate a more
-/// meaningful error message, but is expensive if [value] is non-null and does
-/// not have that property at runtime.
+/// [selector] holds the selector that is the cause of the null check. This is
+/// usually a method that was inlined where [value] the receiver.
+///
+/// If [selector] is set and [useSelector] is true, `toString` is replaced with
+/// the (possibly minified) invocation name of the selector. This can be
+/// shorter and generate a more meaningful error message, but is expensive if
+/// [value] is non-null and does not have that property at runtime.
///
/// If [condition] is set, it is assumed that [condition] is true if and only
/// if [value] is null. The check then compiles to:
@@ -864,17 +867,24 @@ class BoundsCheck extends Primitive {
/// runtime, such as a `typeof` test.
class NullCheck extends Primitive {
final Reference<Primitive> value;
- Selector selector;
- Reference<Primitive> condition;
+ final Selector selector;
+ final bool useSelector;
+ final Reference<Primitive> condition;
final SourceInformation sourceInformation;
- NullCheck(Primitive value, this.sourceInformation)
- : this.value = new Reference<Primitive>(value);
+ NullCheck(Primitive value, this.sourceInformation,
+ {Primitive condition,
+ this.selector,
+ this.useSelector: false})
+ : this.value = new Reference<Primitive>(value),
+ this.condition =
+ condition == null ? null : new Reference<Primitive>(condition);
NullCheck.guarded(Primitive condition, Primitive value, this.selector,
this.sourceInformation)
: this.condition = new Reference<Primitive>(condition),
- this.value = new Reference<Primitive>(value);
+ this.value = new Reference<Primitive>(value),
+ this.useSelector = true;
bool get isSafeForElimination => false;
bool get isSafeForReordering => false;
@@ -2696,7 +2706,10 @@ class DefinitionCopyingVisitor extends Visitor<Definition> {
}
Definition visitNullCheck(NullCheck node) {
- return new NullCheck(getCopy(node.value), node.sourceInformation);
+ return new NullCheck(getCopy(node.value), node.sourceInformation,
+ condition: node.condition == null ? null : getCopy(node.condition),
+ selector: node.selector,
+ useSelector: node.useSelector);
}
Definition visitForeignCode(ForeignCode node) {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/inline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698