| 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 /* This library defines runtime operations on objects used by the code | 5 /* This library defines runtime operations on objects used by the code |
| 6 * generator. | 6 * generator. |
| 7 */ | 7 */ |
| 8 dart_library.library('dart_runtime/_operations', null, /* Imports */[ | 8 dart_library.library('dart_runtime/_operations', null, /* Imports */[ |
| 9 ], /* Lazy Imports */[ | 9 ], /* Lazy Imports */[ |
| 10 'dart/async', | 10 'dart/async', |
| 11 'dart/collection', |
| 11 'dart/core', | 12 'dart/core', |
| 13 'dart/_js_helper', |
| 12 'dart_runtime/_classes', | 14 'dart_runtime/_classes', |
| 13 'dart_runtime/_errors', | 15 'dart_runtime/_errors', |
| 14 'dart_runtime/_rtti', | 16 'dart_runtime/_rtti', |
| 15 'dart_runtime/_types' | 17 'dart_runtime/_types' |
| 16 ], function(exports, async, core, classes, errors, rtti, types) { | 18 ], function(exports, async, collection, core, _js_helper, classes, errors, rtti, |
| 19 types) { |
| 17 'use strict'; | 20 'use strict'; |
| 18 | 21 |
| 19 const getOwnNamesAndSymbols = dart_utils.getOwnNamesAndSymbols; | 22 const getOwnNamesAndSymbols = dart_utils.getOwnNamesAndSymbols; |
| 20 const throwError = dart_utils.throwError; | 23 const throwError = dart_utils.throwError; |
| 21 | 24 |
| 22 const getOwnPropertyNames = Object.getOwnPropertyNames; | 25 const getOwnPropertyNames = Object.getOwnPropertyNames; |
| 23 const hasOwnProperty = Object.prototype.hasOwnProperty; | 26 const hasOwnProperty = Object.prototype.hasOwnProperty; |
| 24 | 27 |
| 25 const slice = [].slice; | 28 const slice = [].slice; |
| 26 | 29 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 throwNoSuchMethod(obj, name, args, f); | 142 throwNoSuchMethod(obj, name, args, f); |
| 140 } | 143 } |
| 141 | 144 |
| 142 function dcall(f/*, ...args*/) { | 145 function dcall(f/*, ...args*/) { |
| 143 let args = slice.call(arguments, 1); | 146 let args = slice.call(arguments, 1); |
| 144 let ftype = rtti.read(f); | 147 let ftype = rtti.read(f); |
| 145 return checkAndCall(f, ftype, void 0, args, 'call'); | 148 return checkAndCall(f, ftype, void 0, args, 'call'); |
| 146 } | 149 } |
| 147 exports.dcall = dcall; | 150 exports.dcall = dcall; |
| 148 | 151 |
| 149 | |
| 150 /** Shared code for dsend, dindex, and dsetindex. */ | 152 /** Shared code for dsend, dindex, and dsetindex. */ |
| 151 function callMethod(obj, name, args, displayName) { | 153 function callMethod(obj, name, args, displayName) { |
| 152 let symbol = _canonicalFieldName(obj, name, args, displayName); | 154 let symbol = _canonicalFieldName(obj, name, args, displayName); |
| 153 let f = obj[symbol]; | 155 let f = obj[symbol]; |
| 154 let ftype = classes.getMethodType(obj, name); | 156 let ftype = classes.getMethodType(obj, name); |
| 155 return checkAndCall(f, ftype, obj, args, displayName); | 157 return checkAndCall(f, ftype, obj, args, displayName); |
| 156 } | 158 } |
| 157 | 159 |
| 158 function dsend(obj, method/*, ...args*/) { | 160 function dsend(obj, method/*, ...args*/) { |
| 159 return callMethod(obj, method, slice.call(arguments, 2)); | 161 return callMethod(obj, method, slice.call(arguments, 2)); |
| 160 } | 162 } |
| 161 exports.dsend = dsend; | 163 exports.dsend = dsend; |
| 162 | 164 |
| 165 function dsendArray(obj, method, args) { |
| 166 return dsend(obj, method, ...args); |
| 167 } |
| 168 exports.dsendArray = dsendArray; |
| 169 |
| 163 function dindex(obj, index) { | 170 function dindex(obj, index) { |
| 164 return callMethod(obj, 'get', [index], '[]'); | 171 return callMethod(obj, 'get', [index], '[]'); |
| 165 } | 172 } |
| 166 exports.dindex = dindex; | 173 exports.dindex = dindex; |
| 167 | 174 |
| 168 function dsetindex(obj, index, value) { | 175 function dsetindex(obj, index, value) { |
| 169 return callMethod(obj, 'set', [index, value], '[]='); | 176 return callMethod(obj, 'set', [index, value], '[]='); |
| 170 } | 177 } |
| 171 exports.dsetindex = dsetindex; | 178 exports.dsetindex = dsetindex; |
| 172 | 179 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 next() { | 394 next() { |
| 388 let i = this.dartIterator; | 395 let i = this.dartIterator; |
| 389 let done = !i.moveNext(); | 396 let done = !i.moveNext(); |
| 390 return { done: done, value: done ? void 0 : i.current }; | 397 return { done: done, value: done ? void 0 : i.current }; |
| 391 } | 398 } |
| 392 } | 399 } |
| 393 exports.JsIterator = JsIterator; | 400 exports.JsIterator = JsIterator; |
| 394 | 401 |
| 395 | 402 |
| 396 }); | 403 }); |
| OLD | NEW |