| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 var dart, _js_helper; | 5 var dart, _js_helper; |
| 6 (function (dart) { | 6 (function (dart) { |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 let defineProperty = Object.defineProperty; | 9 let defineProperty = Object.defineProperty; |
| 10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | 10 let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 function dcall(f/*, ...args*/) { | 71 function dcall(f/*, ...args*/) { |
| 72 let args = Array.prototype.slice.call(arguments, 1); | 72 let args = Array.prototype.slice.call(arguments, 1); |
| 73 return checkAndCall(f, void 0, args, 'call'); | 73 return checkAndCall(f, void 0, args, 'call'); |
| 74 } | 74 } |
| 75 dart.dcall = dcall; | 75 dart.dcall = dcall; |
| 76 | 76 |
| 77 function dsend(obj, method/*, ...args*/) { | 77 function dsend(obj, method/*, ...args*/) { |
| 78 let args = Array.prototype.slice.call(arguments, 2); | 78 let args = Array.prototype.slice.call(arguments, 2); |
| 79 return checkAndCall(obj[method], obj, args, method); | 79 return checkAndCall(obj[method], obj, args, method); |
| 80 } | 80 } |
| 81 dart.dinvoke = dsend; | 81 dart.dsend = dsend; |
| 82 | 82 |
| 83 function dindex(obj, index) { | 83 function dindex(obj, index) { |
| 84 return checkAndCall(obj.get, obj, [index], '[]'); | 84 return checkAndCall(obj.get, obj, [index], '[]'); |
| 85 } | 85 } |
| 86 dart.dindex = dindex; | 86 dart.dindex = dindex; |
| 87 | 87 |
| 88 function dsetindex(obj, index, value) { | 88 function dsetindex(obj, index, value) { |
| 89 return checkAndCall(obj.set, obj, [index, value], '[]='); | 89 return checkAndCall(obj.set, obj, [index, value], '[]='); |
| 90 } | 90 } |
| 91 dart.dsetindex = dindex; | 91 dart.dsetindex = dsetindex; |
| 92 | 92 |
| 93 function cast(obj, type) { | 93 function cast(obj, type) { |
| 94 // TODO(vsm): handle non-nullable types | 94 // TODO(vsm): handle non-nullable types |
| 95 if (obj == null) return obj; | 95 if (obj == null) return obj; |
| 96 let actual = getRuntimeType(obj); | 96 let actual = getRuntimeType(obj); |
| 97 if (isSubtype(actual, type)) return obj; | 97 if (isSubtype(actual, type)) return obj; |
| 98 throw new _js_helper.CastErrorImplementation(actual, type); | 98 throw new _js_helper.CastErrorImplementation(actual, type); |
| 99 } | 99 } |
| 100 dart.as = cast; | 100 dart.as = cast; |
| 101 | 101 |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 // TODO(vsm): How should we encode the runtime type? | 751 // TODO(vsm): How should we encode the runtime type? |
| 752 dart.runtimeType = Symbol('runtimeType'); | 752 dart.runtimeType = Symbol('runtimeType'); |
| 753 | 753 |
| 754 dart.JsSymbol = Symbol; | 754 dart.JsSymbol = Symbol; |
| 755 | 755 |
| 756 // TODO(jmesserly): hack to bootstrap the SDK | 756 // TODO(jmesserly): hack to bootstrap the SDK |
| 757 _js_helper = _js_helper || {}; | 757 _js_helper = _js_helper || {}; |
| 758 _js_helper.checkNum = notNull; | 758 _js_helper.checkNum = notNull; |
| 759 | 759 |
| 760 })(dart || (dart = {})); | 760 })(dart || (dart = {})); |
| OLD | NEW |