| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library _js_helper; | 5 library _js_helper; |
| 6 | 6 |
| 7 import 'dart:_async_await_error_codes' as async_error_codes; | 7 import 'dart:_async_await_error_codes' as async_error_codes; |
| 8 | 8 |
| 9 import 'dart:_js_embedded_names' show | 9 import 'dart:_js_embedded_names' show |
| 10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 /// Returns the type of [object] as a string (including type arguments). | 719 /// Returns the type of [object] as a string (including type arguments). |
| 720 /// | 720 /// |
| 721 /// In minified mode, uses the unminified names if available. | 721 /// In minified mode, uses the unminified names if available. |
| 722 static String objectTypeName(Object object) { | 722 static String objectTypeName(Object object) { |
| 723 String name = constructorNameFallback(getInterceptor(object)); | 723 String name = constructorNameFallback(getInterceptor(object)); |
| 724 if (name == 'Object') { | 724 if (name == 'Object') { |
| 725 // Try to decompile the constructor by turning it into a string and get | 725 // Try to decompile the constructor by turning it into a string and get |
| 726 // the name out of that. If the decompiled name is a string containing an | 726 // the name out of that. If the decompiled name is a string containing an |
| 727 // identifier, we use that instead of the very generic 'Object'. | 727 // identifier, we use that instead of the very generic 'Object'. |
| 728 var decompiled = | 728 var decompiled = |
| 729 JS('var', r'#.match(/^\s*function\s*(\S*)\s*\(/)[1]', | 729 JS('var', r'#.match(/^\s*function\s*([\w$]*)\s*\(/)[1]', |
| 730 JS('var', r'String(#.constructor)', object)); | 730 JS('var', r'String(#.constructor)', object)); |
| 731 if (decompiled is String) | 731 if (decompiled is String) |
| 732 if (JS('bool', r'/^\w+$/.test(#)', decompiled)) | 732 if (JS('bool', r'/^\w+$/.test(#)', decompiled)) |
| 733 name = decompiled; | 733 name = decompiled; |
| 734 } | 734 } |
| 735 // TODO(kasperl): If the namer gave us a fresh global name, we may | 735 // TODO(kasperl): If the namer gave us a fresh global name, we may |
| 736 // want to remove the numeric suffix that makes it unique too. | 736 // want to remove the numeric suffix that makes it unique too. |
| 737 if (name.length > 1 && identical(name.codeUnitAt(0), DOLLAR_CHAR_VALUE)) { | 737 if (name.length > 1 && identical(name.codeUnitAt(0), DOLLAR_CHAR_VALUE)) { |
| 738 name = name.substring(1); | 738 name = name.substring(1); |
| 739 } | 739 } |
| (...skipping 3236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3976 // This is a function that will return a helper function that does the | 3976 // This is a function that will return a helper function that does the |
| 3977 // iteration of the sync*. | 3977 // iteration of the sync*. |
| 3978 // | 3978 // |
| 3979 // Each invocation should give a body with fresh state. | 3979 // Each invocation should give a body with fresh state. |
| 3980 final dynamic /* js function */ _outerHelper; | 3980 final dynamic /* js function */ _outerHelper; |
| 3981 | 3981 |
| 3982 SyncStarIterable(this._outerHelper); | 3982 SyncStarIterable(this._outerHelper); |
| 3983 | 3983 |
| 3984 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); | 3984 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); |
| 3985 } | 3985 } |
| OLD | NEW |