Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart |
index 6f4236c65a8f00db2fbe669bfa4c72b835f1a026..9cb25382d2a34951a691863874e47e166e7b533d 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart |
@@ -882,6 +882,12 @@ String _toString(obj) { |
return JS('String', '#[dartx.toString]()', obj); |
} |
if (JS('bool', 'typeof # == "function"', obj)) { |
+ // If the function is a Type object, we should just display the type name. |
+ // Regular Dart code should typically get wrapped type objects instead of |
+ // raw type (aka JS constructor) objects however raw type objects can be |
+ // exposed to Dart code via JS interop or debugging tools. |
+ if (isType(obj)) return typeName(obj); |
+ |
return JS( |
'String', r'"Closure: " + # + " from: " + #', getReifiedType(obj), obj); |
} |