[dart2js] Revert to old Closure.toString() implementation for old RTI.

TBR=sra@google.com

Change-Id: Ie23953c6aa3c3b4e286eeb2d23889bc4357c098f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113904
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
This commit is contained in:
Mayank Patke 2019-08-20 21:26:10 +00:00 committed by commit-bot@chromium.org
parent f842b03de5
commit 293eee940b

View file

@ -2558,10 +2558,17 @@ abstract class Closure implements Function {
// to be visible to resolution and the generation of extra stubs.
String toString() {
var constructor = JS('', '#.constructor', this);
String name =
constructor == null ? null : JS('String|Null', '#.name', constructor);
if (name == null) name = 'unknown';
String name;
if (JS_GET_FLAG('USE_NEW_RTI')) {
var constructor = JS('', '#.constructor', this);
name =
constructor == null ? null : JS('String|Null', '#.name', constructor);
if (name == null) name = 'unknown';
} else {
name = Primitives.objectTypeName(this);
// Mirrors puts a space in front of some names, so remove it.
name = JS('String', '#.trim()', name);
}
return "Closure '$name'";
}
}