OLD | NEW |
1 dart_library.library('dart/js', null, /* Imports */[ | 1 dart_library.library('dart/js', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart/_runtime', |
3 'dart/core', | 3 'dart/core', |
4 'dart/collection', | 4 'dart/collection', |
5 'dart/_js_helper' | 5 'dart/_js_helper' |
6 ], /* Lazy imports */[ | 6 ], /* Lazy imports */[ |
7 ], function(exports, dart, core, collection, _js_helper) { | 7 ], function(exports, dart, core, collection, _js_helper) { |
8 'use strict'; | 8 'use strict'; |
9 let dartx = dart.dartx; | 9 let dartx = dart.dartx; |
10 const _global = dart.global; | 10 const _global = dart.global; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (typeof len === "number" && len >>> 0 === len) { | 219 if (typeof len === "number" && len >>> 0 === len) { |
220 return len; | 220 return len; |
221 } | 221 } |
222 dart.throw(new core.StateError('Bad JsArray length')); | 222 dart.throw(new core.StateError('Bad JsArray length')); |
223 } | 223 } |
224 set length(length) { | 224 set length(length) { |
225 super.set('length', length); | 225 super.set('length', length); |
226 } | 226 } |
227 add(value) { | 227 add(value) { |
228 dart.as(value, E); | 228 dart.as(value, E); |
229 this.callMethod('push', [value]); | 229 this.callMethod('push', dart.list([value], E)); |
230 } | 230 } |
231 addAll(iterable) { | 231 addAll(iterable) { |
232 dart.as(iterable, core.Iterable$(E)); | 232 dart.as(iterable, core.Iterable$(E)); |
233 let list = iterable instanceof Array ? iterable : core.List.from(iterabl
e); | 233 let list = iterable instanceof Array ? iterable : core.List.from(iterabl
e); |
234 this.callMethod('push', dart.as(list, core.List)); | 234 this.callMethod('push', dart.as(list, core.List)); |
235 } | 235 } |
236 insert(index, element) { | 236 insert(index, element) { |
237 dart.as(element, E); | 237 dart.as(element, E); |
238 this[_checkInsertIndex](index); | 238 this[_checkInsertIndex](index); |
239 this.callMethod('splice', [index, 0, element]); | 239 this.callMethod('splice', dart.list([index, 0, element], core.Object)); |
240 } | 240 } |
241 removeAt(index) { | 241 removeAt(index) { |
242 this[_checkIndex](index); | 242 this[_checkIndex](index); |
243 return dart.as(dart.dindex(this.callMethod('splice', [index, 1]), 0), E)
; | 243 return dart.as(dart.dindex(this.callMethod('splice', dart.list([index, 1
], core.int)), 0), E); |
244 } | 244 } |
245 removeLast() { | 245 removeLast() { |
246 if (this.length == 0) dart.throw(new core.RangeError(-1)); | 246 if (this.length == 0) dart.throw(new core.RangeError(-1)); |
247 return dart.as(this.callMethod('pop'), E); | 247 return dart.as(this.callMethod('pop'), E); |
248 } | 248 } |
249 removeRange(start, end) { | 249 removeRange(start, end) { |
250 JsArray$()._checkRange(start, end, this.length); | 250 JsArray$()._checkRange(start, end, this.length); |
251 this.callMethod('splice', [start, dart.notNull(end) - dart.notNull(start
)]); | 251 this.callMethod('splice', dart.list([start, dart.notNull(end) - dart.not
Null(start)], core.int)); |
252 } | 252 } |
253 setRange(start, end, iterable, skipCount) { | 253 setRange(start, end, iterable, skipCount) { |
254 dart.as(iterable, core.Iterable$(E)); | 254 dart.as(iterable, core.Iterable$(E)); |
255 if (skipCount === void 0) skipCount = 0; | 255 if (skipCount === void 0) skipCount = 0; |
256 JsArray$()._checkRange(start, end, this.length); | 256 JsArray$()._checkRange(start, end, this.length); |
257 let length = dart.notNull(end) - dart.notNull(start); | 257 let length = dart.notNull(end) - dart.notNull(start); |
258 if (length == 0) return; | 258 if (length == 0) return; |
259 if (dart.notNull(skipCount) < 0) dart.throw(new core.ArgumentError(skipC
ount)); | 259 if (dart.notNull(skipCount) < 0) dart.throw(new core.ArgumentError(skipC
ount)); |
260 let args = [start, length]; | 260 let args = dart.list([start, length], core.int); |
261 args[dartx.addAll](iterable[dartx.skip](skipCount)[dartx.take](length)); | 261 args[dartx.addAll](iterable[dartx.skip](skipCount)[dartx.take](length)); |
262 this.callMethod('splice', args); | 262 this.callMethod('splice', args); |
263 } | 263 } |
264 sort(compare) { | 264 sort(compare) { |
265 if (compare === void 0) compare = null; | 265 if (compare === void 0) compare = null; |
266 dart.as(compare, dart.functionType(core.int, [E, E])); | 266 dart.as(compare, dart.functionType(core.int, [E, E])); |
267 this.callMethod('sort', compare == null ? [] : [compare]); | 267 this.callMethod('sort', dart.as(compare == null ? [] : dart.list([compar
e], dart.functionType(core.int, [E, E])), core.List)); |
268 } | 268 } |
269 } | 269 } |
270 dart.defineNamedConstructor(JsArray, 'from'); | 270 dart.defineNamedConstructor(JsArray, 'from'); |
271 dart.defineNamedConstructor(JsArray, '_fromJs'); | 271 dart.defineNamedConstructor(JsArray, '_fromJs'); |
272 dart.setSignature(JsArray, { | 272 dart.setSignature(JsArray, { |
273 constructors: () => ({ | 273 constructors: () => ({ |
274 JsArray: [JsArray$(E), []], | 274 JsArray: [JsArray$(E), []], |
275 from: [JsArray$(E), [core.Iterable$(E)]], | 275 from: [JsArray$(E), [core.Iterable$(E)]], |
276 _fromJs: [JsArray$(E), [dart.dynamic]] | 276 _fromJs: [JsArray$(E), [dart.dynamic]] |
277 }), | 277 }), |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 404 } |
405 dart.fn(allowInteropCaptureThis, core.Function, [core.Function]); | 405 dart.fn(allowInteropCaptureThis, core.Function, [core.Function]); |
406 // Exports: | 406 // Exports: |
407 exports.JsObject = JsObject; | 407 exports.JsObject = JsObject; |
408 exports.JsFunction = JsFunction; | 408 exports.JsFunction = JsFunction; |
409 exports.JsArray$ = JsArray$; | 409 exports.JsArray$ = JsArray$; |
410 exports.JsArray = JsArray; | 410 exports.JsArray = JsArray; |
411 exports.allowInterop = allowInterop; | 411 exports.allowInterop = allowInterop; |
412 exports.allowInteropCaptureThis = allowInteropCaptureThis; | 412 exports.allowInteropCaptureThis = allowInteropCaptureThis; |
413 }); | 413 }); |
OLD | NEW |