Chromium Code Reviews| Index: tool/input_sdk/private/ddc_runtime/operations.dart |
| diff --git a/tool/input_sdk/private/ddc_runtime/operations.dart b/tool/input_sdk/private/ddc_runtime/operations.dart |
| index 9f14816f5d2d1966a8eeec78930087a2a290b1ca..92f62e2ba2a968c8ec46fb76989d01db13f42f22 100644 |
| --- a/tool/input_sdk/private/ddc_runtime/operations.dart |
| +++ b/tool/input_sdk/private/ddc_runtime/operations.dart |
| @@ -253,8 +253,7 @@ instanceOf(obj, type) => JS('', '''(() => { |
| @JSExportName('as') |
| cast(obj, type) { |
| - if (obj == null) return obj; |
| - |
| + if (JS('bool', '# == #', type, dynamic) || obj == null) return obj; |
|
Jennifer Messerly
2016/05/26 18:14:51
super trivial but: wouldn't null be more common th
Leaf
2016/05/26 18:16:37
Maybe, but I doubt it. By far the majority of the
|
| bool result = strongInstanceOf(obj, type, true); |
| if (JS('bool', '#', result)) return obj; |
| _throwCastError(obj, type, result); |