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/core', | 11 'dart/core', |
12 'dart/collection', | |
Leaf
2015/06/15 17:53:09
Nit: Alphabetize?
vsm
2015/06/15 20:59:46
Done.
| |
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, core, collection, _js_helper, classes, errors, rtti, types) { |
Leaf
2015/06/15 17:53:09
Nit: line length.
vsm
2015/06/15 20:59:46
Done.
| |
17 'use strict'; | 19 'use strict'; |
18 | 20 |
19 const getOwnNamesAndSymbols = dart_utils.getOwnNamesAndSymbols; | 21 const getOwnNamesAndSymbols = dart_utils.getOwnNamesAndSymbols; |
20 const throwError = dart_utils.throwError; | 22 const throwError = dart_utils.throwError; |
21 | 23 |
22 const getOwnPropertyNames = Object.getOwnPropertyNames; | 24 const getOwnPropertyNames = Object.getOwnPropertyNames; |
23 const hasOwnProperty = Object.prototype.hasOwnProperty; | 25 const hasOwnProperty = Object.prototype.hasOwnProperty; |
24 | 26 |
25 const slice = [].slice; | 27 const slice = [].slice; |
26 | 28 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 throwNoSuchMethod(obj, name, args, f); | 141 throwNoSuchMethod(obj, name, args, f); |
140 } | 142 } |
141 | 143 |
142 function dcall(f/*, ...args*/) { | 144 function dcall(f/*, ...args*/) { |
143 let args = slice.call(arguments, 1); | 145 let args = slice.call(arguments, 1); |
144 let ftype = rtti.read(f); | 146 let ftype = rtti.read(f); |
145 return checkAndCall(f, ftype, void 0, args, 'call'); | 147 return checkAndCall(f, ftype, void 0, args, 'call'); |
146 } | 148 } |
147 exports.dcall = dcall; | 149 exports.dcall = dcall; |
148 | 150 |
149 | |
150 /** Shared code for dsend, dindex, and dsetindex. */ | 151 /** Shared code for dsend, dindex, and dsetindex. */ |
151 function callMethod(obj, name, args, displayName) { | 152 function callMethod(obj, name, args, displayName) { |
152 let symbol = _canonicalFieldName(obj, name, args, displayName); | 153 let symbol = _canonicalFieldName(obj, name, args, displayName); |
153 let f = obj[symbol]; | 154 let f = obj[symbol]; |
154 let ftype = classes.getMethodType(obj, name); | 155 let ftype = classes.getMethodType(obj, name); |
155 return checkAndCall(f, ftype, obj, args, displayName); | 156 return checkAndCall(f, ftype, obj, args, displayName); |
156 } | 157 } |
157 | 158 |
158 function dsend(obj, method/*, ...args*/) { | 159 function dsend(obj, method/*, ...args*/) { |
159 return callMethod(obj, method, slice.call(arguments, 2)); | 160 return callMethod(obj, method, slice.call(arguments, 2)); |
160 } | 161 } |
161 exports.dsend = dsend; | 162 exports.dsend = dsend; |
162 | 163 |
164 function dsendArray(obj, method, args) { | |
165 return dsend(obj, method, ...args); | |
166 } | |
167 exports.dsendArray = dsendArray; | |
168 | |
163 function dindex(obj, index) { | 169 function dindex(obj, index) { |
164 return callMethod(obj, 'get', [index], '[]'); | 170 return callMethod(obj, 'get', [index], '[]'); |
165 } | 171 } |
166 exports.dindex = dindex; | 172 exports.dindex = dindex; |
167 | 173 |
168 function dsetindex(obj, index, value) { | 174 function dsetindex(obj, index, value) { |
169 return callMethod(obj, 'set', [index, value], '[]='); | 175 return callMethod(obj, 'set', [index, value], '[]='); |
170 } | 176 } |
171 exports.dsetindex = dsetindex; | 177 exports.dsetindex = dsetindex; |
172 | 178 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 next() { | 393 next() { |
388 let i = this.dartIterator; | 394 let i = this.dartIterator; |
389 let done = !i.moveNext(); | 395 let done = !i.moveNext(); |
390 return { done: done, value: done ? void 0 : i.current }; | 396 return { done: done, value: done ? void 0 : i.current }; |
391 } | 397 } |
392 } | 398 } |
393 exports.JsIterator = JsIterator; | 399 exports.JsIterator = JsIterator; |
394 | 400 |
395 | 401 |
396 }); | 402 }); |
OLD | NEW |