| 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 /** | 5 /** |
| 6 * Support for interoperating with JavaScript. | 6 * Support for interoperating with JavaScript. |
| 7 * | 7 * |
| 8 * This library provides access to JavaScript objects from Dart, allowing | 8 * This library provides access to JavaScript objects from Dart, allowing |
| 9 * Dart code to get and set properties, and call methods of JavaScript objects | 9 * Dart code to get and set properties, and call methods of JavaScript objects |
| 10 * and invoke JavaScript functions. The library takes care of converting | 10 * and invoke JavaScript functions. The library takes care of converting |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 String _escapeString(String str) { | 243 String _escapeString(String str) { |
| 244 StringBuffer output = new StringBuffer(); | 244 StringBuffer output = new StringBuffer(); |
| 245 new _StringLiteralEscape(output)..writeStringLiteral(str); | 245 new _StringLiteralEscape(output)..writeStringLiteral(str); |
| 246 return output.toString(); | 246 return output.toString(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 /// A collection of methods where all methods have the same name. | 249 /// A collection of methods where all methods have the same name. |
| 250 /// This class is intended to optimize whether a specific invocation is | 250 /// This class is intended to optimize whether a specific invocation is |
| 251 /// appropritate for at least some of the methods in the collection. | 251 /// appropriate for at least some of the methods in the collection. |
| 252 class _DeclarationSet { | 252 class _DeclarationSet { |
| 253 _DeclarationSet() : _members = <mirrors.DeclarationMirror>[]; | 253 _DeclarationSet() : _members = <mirrors.DeclarationMirror>[]; |
| 254 | 254 |
| 255 static bool _checkType(obj, mirrors.TypeMirror type) { | 255 static bool _checkType(obj, mirrors.TypeMirror type) { |
| 256 if (obj == null) return true; | 256 if (obj == null) return true; |
| 257 return mirrors.reflectType(obj.runtimeType).isSubtypeOf(type); | 257 return mirrors.reflectType(obj.runtimeType).isSubtypeOf(type); |
| 258 } | 258 } |
| 259 | 259 |
| 260 /// Returns whether the return [value] has a type is consistent with the | 260 /// Returns whether the return [value] has a type is consistent with the |
| 261 /// return type from at least one of the members matching the DeclarationSet. | 261 /// return type from at least one of the members matching the DeclarationSet. |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 } else { | 1694 } else { |
| 1695 var ret = _interopCaptureThisExpando[f]; | 1695 var ret = _interopCaptureThisExpando[f]; |
| 1696 if (ret == null) { | 1696 if (ret == null) { |
| 1697 // TODO(jacobr): we could optimize this. | 1697 // TODO(jacobr): we could optimize this. |
| 1698 ret = JSFunction._createWithThis(f); | 1698 ret = JSFunction._createWithThis(f); |
| 1699 _interopCaptureThisExpando[f] = ret; | 1699 _interopCaptureThisExpando[f] = ret; |
| 1700 } | 1700 } |
| 1701 return ret; | 1701 return ret; |
| 1702 } | 1702 } |
| 1703 } | 1703 } |
| OLD | NEW |