Skip to content

Commit 03d6e04

Browse files
fishythefishcommit-bot@chromium.org
authored andcommitted
[dart2js] Fix printing of minified closures.
https://dart-review.googlesource.com/c/sdk/+/113904 previously "fixed" printing for the old RTI by only using the new implementation if USE_NEW_RTI was passed. This change fixes the root cause of the printing failures, so we can fully switch to the new implementation. Change-Id: Iaca56566ebebbaaad15d312c3e57204859417a9a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121903 Commit-Queue: Mayank Patke <fishythefish@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
1 parent 8a92058 commit 03d6e04

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

sdk/lib/_internal/js_runtime/lib/js_helper.dart

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,17 +2560,11 @@ abstract class Closure implements Function {
25602560

25612561
String toString() {
25622562
String name;
2563-
if (JS_GET_FLAG('USE_NEW_RTI')) {
2564-
var constructor = JS('', '#.constructor', this);
2565-
name =
2566-
constructor == null ? null : JS('String|Null', '#.name', constructor);
2567-
if (name == null) name = 'unknown';
2568-
} else {
2569-
name = Primitives.objectTypeName(this);
2570-
// Mirrors puts a space in front of some names, so remove it.
2571-
name = JS('String', '#.trim()', name);
2572-
}
2573-
return "Closure '$name'";
2563+
var constructor = JS('', '#.constructor', this);
2564+
name =
2565+
constructor == null ? null : JS('String|Null', '#.name', constructor);
2566+
if (name == null) name = 'unknown';
2567+
return "Closure '${unminifyOrTag(name)}'";
25742568
}
25752569
}
25762570

sdk_nnbd/lib/_internal/js_runtime/lib/js_helper.dart

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,17 +2562,11 @@ abstract class Closure implements Function {
25622562

25632563
String toString() {
25642564
String name;
2565-
if (JS_GET_FLAG('USE_NEW_RTI')) {
2566-
var constructor = JS('', '#.constructor', this);
2567-
name =
2568-
constructor == null ? null : JS('String|Null', '#.name', constructor);
2569-
if (name == null) name = 'unknown';
2570-
} else {
2571-
name = Primitives.objectTypeName(this);
2572-
// Mirrors puts a space in front of some names, so remove it.
2573-
name = JS('String', '#.trim()', name);
2574-
}
2575-
return "Closure '$name'";
2565+
var constructor = JS('', '#.constructor', this);
2566+
name =
2567+
constructor == null ? null : JS('String|Null', '#.name', constructor);
2568+
if (name == null) name = 'unknown';
2569+
return "Closure '${unminifyOrTag(name)}'";
25762570
}
25772571
}
25782572

0 commit comments

Comments
 (0)