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..f494983558e7d36edd0d9f02b8c3c324ac9fbbe4 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,8 +882,16 @@ String _toString(obj) { |
return JS('String', '#[dartx.toString]()', obj); |
} |
if (JS('bool', 'typeof # == "function"', obj)) { |
- return JS( |
- 'String', r'"Closure: " + # + " from: " + #', getReifiedType(obj), obj); |
+ var type = getReifiedType(obj); |
Jacob
2017/02/20 22:48:54
this is the most questionable part of the CL. Perh
vsm
2017/02/21 14:33:00
I don't think this *if* clause was intended to han
Jacob
2017/02/21 17:41:15
That is much better.
Added an isType method and re
|
+ var sourceCode = JS('String', 'Object.toString.call(#)', obj); |
+ if (sourceCode.startsWith('class ')) { |
+ // Display "class Foo" instead of claiming that we have a closure where from |
+ // is the entire source code of the class which is overly verbose and very |
+ // confusing. |
+ // TODO(jacobr): getReifiedType appears to be completely bogus in this case. |
+ return sourceCode.split(' ').take(2).join(' '); |
+ } |
+ return JS('String', r'"Closure: " + # + " from: " + #', type, obj); |
} |
// TODO(jmesserly): restore this faster path once ES Symbol is treated as |
// an extension type (and thus hits the above code path). |