OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of _js_helper; | 5 part of _js_helper; |
6 | 6 |
7 | 7 |
8 // TODO(ngeoffray): stop using this method once our optimizers can | 8 // TODO(ngeoffray): stop using this method once our optimizers can |
9 // change str1.contains(str2) into str1.indexOf(str2) != -1. | 9 // change str1.contains(str2) into str1.indexOf(str2) != -1. |
10 bool contains(String userAgent, String name) { | 10 bool contains(String userAgent, String name) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 '{value: #, enumerable: false, writable: true, configurable: true})', | 84 '{value: #, enumerable: false, writable: true, configurable: true})', |
85 obj, | 85 obj, |
86 property, | 86 property, |
87 value); | 87 value); |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 // Is [obj] an instance of a Dart-defined class? | 91 // Is [obj] an instance of a Dart-defined class? |
92 bool isDartObject(obj) { | 92 bool isDartObject(obj) { |
93 // Some of the extra parens here are necessary. | 93 // Some of the extra parens here are necessary. |
94 return JS('bool', '((#) instanceof (#))', obj, JS_DART_OBJECT_CONSTRUCTOR()); | 94 return JS('bool', '((#) instanceof (#))', |
| 95 obj, |
| 96 JS_BUILTIN('depends:none;effects:none;', |
| 97 JsBuiltin.dartObjectConstructor)); |
95 } | 98 } |
96 | 99 |
97 /** | 100 /** |
98 * A JavaScript object mapping tags to the constructors of interceptors. | 101 * A JavaScript object mapping tags to the constructors of interceptors. |
99 * This is a JavaScript object with no prototype. | 102 * This is a JavaScript object with no prototype. |
100 * | 103 * |
101 * Example: 'HTMLImageElement' maps to the ImageElement class constructor. | 104 * Example: 'HTMLImageElement' maps to the ImageElement class constructor. |
102 */ | 105 */ |
103 get interceptorsByTag => JS_EMBEDDED_GLOBAL('=Object', INTERCEPTORS_BY_TAG); | 106 get interceptorsByTag => JS_EMBEDDED_GLOBAL('=Object', INTERCEPTORS_BY_TAG); |
104 | 107 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 const _safariHooksTransformer = const JS_CONST(r''' | 646 const _safariHooksTransformer = const JS_CONST(r''' |
644 function(hooks) { return hooks; } | 647 function(hooks) { return hooks; } |
645 '''); | 648 '''); |
646 | 649 |
647 | 650 |
648 const _dartExperimentalFixupGetTagHooksTransformer = const JS_CONST(r''' | 651 const _dartExperimentalFixupGetTagHooksTransformer = const JS_CONST(r''' |
649 function(hooks) { | 652 function(hooks) { |
650 if (typeof dartExperimentalFixupGetTag != "function") return hooks; | 653 if (typeof dartExperimentalFixupGetTag != "function") return hooks; |
651 hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag); | 654 hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag); |
652 }'''); | 655 }'''); |
OLD | NEW |