[js_runtime] Avoid crash printing tear-off on `null`
TEST: https://dart-review.googlesource.com/c/sdk/+/231845
Fixed: 48322
Change-Id: I8a89e7b771f63905bb25594a7e2721d4a7e3ee62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231847
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 7e44673..f0ecaa5 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -397,7 +397,7 @@
/// In minified mode, uses the unminified names if available, otherwise tags
/// them with 'minified:'.
@pragma('dart2js:noInline')
- static String objectTypeName(Object object) {
+ static String objectTypeName(Object? object) {
return _objectTypeNameNewRti(object);
}
@@ -406,7 +406,7 @@
///
/// In minified mode, uses the unminified names if available, otherwise tags
/// them with 'minified:'.
- static String _objectTypeNameNewRti(Object object) {
+ static String _objectTypeNameNewRti(Object? object) {
var dartObjectConstructor = JS_BUILTIN(
'depends:none;effects:none;', JsBuiltin.dartObjectConstructor);
if (JS('bool', '# instanceof #', object, dartObjectConstructor)) {
@@ -452,7 +452,7 @@
name != null && name != 'Object' && name != '';
/// In minified mode, uses the unminified names if available.
- static String objectToHumanReadableString(Object object) {
+ static String objectToHumanReadableString(Object? object) {
String name = objectTypeName(object);
return "Instance of '$name'";
}