OLD | NEW |
1 dart_library.library('dart/_interceptors', null, /* Imports */[ | 1 dart_library.library('dart/_interceptors', null, /* Imports */[ |
2 "dart/_runtime", | 2 "dart/_runtime", |
3 'dart/core', | 3 'dart/core', |
4 'dart/_internal', | 4 'dart/_internal', |
5 'dart/collection', | 5 'dart/collection', |
6 'dart/math' | 6 'dart/math' |
7 ], /* Lazy imports */[ | 7 ], /* Lazy imports */[ |
8 'dart/_js_helper' | 8 'dart/_js_helper' |
9 ], function(exports, dart, core, _internal, collection, math, _js_helper) { | 9 ], function(exports, dart, core, _internal, collection, math, _js_helper) { |
10 'use strict'; | 10 'use strict'; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (this.fixed$length) { | 88 if (this.fixed$length) { |
89 dart.throw(new core.UnsupportedError(dart.as(reason, core.String))); | 89 dart.throw(new core.UnsupportedError(dart.as(reason, core.String))); |
90 } | 90 } |
91 } | 91 } |
92 [dartx.add](value) { | 92 [dartx.add](value) { |
93 dart.as(value, E); | 93 dart.as(value, E); |
94 this[dartx.checkGrowable]('add'); | 94 this[dartx.checkGrowable]('add'); |
95 this.push(value); | 95 this.push(value); |
96 } | 96 } |
97 [dartx.removeAt](index) { | 97 [dartx.removeAt](index) { |
98 if (!(typeof index == 'number')) | 98 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); |
99 dart.throw(new core.ArgumentError(index)); | |
100 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[
dartx.length])) { | 99 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[
dartx.length])) { |
101 dart.throw(new core.RangeError.value(index)); | 100 dart.throw(new core.RangeError.value(index)); |
102 } | 101 } |
103 this[dartx.checkGrowable]('removeAt'); | 102 this[dartx.checkGrowable]('removeAt'); |
104 return this.splice(index, 1)[0]; | 103 return this.splice(index, 1)[0]; |
105 } | 104 } |
106 [dartx.insert](index, value) { | 105 [dartx.insert](index, value) { |
107 dart.as(value, E); | 106 dart.as(value, E); |
108 if (!(typeof index == 'number')) | 107 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); |
109 dart.throw(new core.ArgumentError(index)); | |
110 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[d
artx.length])) { | 108 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[d
artx.length])) { |
111 dart.throw(new core.RangeError.value(index)); | 109 dart.throw(new core.RangeError.value(index)); |
112 } | 110 } |
113 this[dartx.checkGrowable]('insert'); | 111 this[dartx.checkGrowable]('insert'); |
114 this.splice(index, 0, value); | 112 this.splice(index, 0, value); |
115 } | 113 } |
116 [dartx.insertAll](index, iterable) { | 114 [dartx.insertAll](index, iterable) { |
117 dart.as(iterable, core.Iterable$(E)); | 115 dart.as(iterable, core.Iterable$(E)); |
118 this[dartx.checkGrowable]('insertAll'); | 116 this[dartx.checkGrowable]('insertAll'); |
119 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); | 117 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); |
120 } | 118 } |
121 [dartx.setAll](index, iterable) { | 119 [dartx.setAll](index, iterable) { |
122 dart.as(iterable, core.Iterable$(E)); | 120 dart.as(iterable, core.Iterable$(E)); |
123 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); | 121 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); |
124 } | 122 } |
125 [dartx.removeLast]() { | 123 [dartx.removeLast]() { |
126 this[dartx.checkGrowable]('removeLast'); | 124 this[dartx.checkGrowable]('removeLast'); |
127 if (this[dartx.length] == 0) | 125 if (this[dartx.length] == 0) dart.throw(new core.RangeError.value(-1)); |
128 dart.throw(new core.RangeError.value(-1)); | |
129 return dart.as(this.pop(), E); | 126 return dart.as(this.pop(), E); |
130 } | 127 } |
131 [dartx.remove](element) { | 128 [dartx.remove](element) { |
132 this[dartx.checkGrowable]('remove'); | 129 this[dartx.checkGrowable]('remove'); |
133 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { | 130 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { |
134 if (dart.equals(this[dartx.get](i), element)) { | 131 if (dart.equals(this[dartx.get](i), element)) { |
135 this.splice(i, 1); | 132 this.splice(i, 1); |
136 return true; | 133 return true; |
137 } | 134 } |
138 } | 135 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (length != this[dartx.length]) { | 168 if (length != this[dartx.length]) { |
172 dart.throw(new core.ConcurrentModificationError(this)); | 169 dart.throw(new core.ConcurrentModificationError(this)); |
173 } | 170 } |
174 } | 171 } |
175 } | 172 } |
176 [dartx.map](f) { | 173 [dartx.map](f) { |
177 dart.as(f, dart.functionType(dart.dynamic, [E])); | 174 dart.as(f, dart.functionType(dart.dynamic, [E])); |
178 return _internal.IterableMixinWorkaround.mapList(this, f); | 175 return _internal.IterableMixinWorkaround.mapList(this, f); |
179 } | 176 } |
180 [dartx.join](separator) { | 177 [dartx.join](separator) { |
181 if (separator === void 0) | 178 if (separator === void 0) separator = ""; |
182 separator = ""; | |
183 let list = core.List.new(this[dartx.length]); | 179 let list = core.List.new(this[dartx.length]); |
184 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { | 180 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { |
185 list[dartx.set](i, `${this[dartx.get](i)}`); | 181 list[dartx.set](i, `${this[dartx.get](i)}`); |
186 } | 182 } |
187 return list.join(separator); | 183 return list.join(separator); |
188 } | 184 } |
189 [dartx.take](n) { | 185 [dartx.take](n) { |
190 return new (_internal.IterableMixinWorkaround$(E))().takeList(this, n); | 186 return new (_internal.IterableMixinWorkaround$(E))().takeList(this, n); |
191 } | 187 } |
192 [dartx.takeWhile](test) { | 188 [dartx.takeWhile](test) { |
(...skipping 28 matching lines...) Expand all Loading... |
221 return dart.as(_internal.IterableMixinWorkaround.lastWhereList(this, tes
t, orElse), E); | 217 return dart.as(_internal.IterableMixinWorkaround.lastWhereList(this, tes
t, orElse), E); |
222 } | 218 } |
223 [dartx.singleWhere](test) { | 219 [dartx.singleWhere](test) { |
224 dart.as(test, dart.functionType(core.bool, [E])); | 220 dart.as(test, dart.functionType(core.bool, [E])); |
225 return dart.as(_internal.IterableMixinWorkaround.singleWhere(this, test)
, E); | 221 return dart.as(_internal.IterableMixinWorkaround.singleWhere(this, test)
, E); |
226 } | 222 } |
227 [dartx.elementAt](index) { | 223 [dartx.elementAt](index) { |
228 return this[dartx.get](index); | 224 return this[dartx.get](index); |
229 } | 225 } |
230 [dartx.sublist](start, end) { | 226 [dartx.sublist](start, end) { |
231 if (end === void 0) | 227 if (end === void 0) end = null; |
232 end = null; | |
233 _js_helper.checkNull(start); | 228 _js_helper.checkNull(start); |
234 if (!(typeof start == 'number')) | 229 if (!(typeof start == 'number')) dart.throw(new core.ArgumentError(start
)); |
235 dart.throw(new core.ArgumentError(start)); | |
236 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[d
artx.length])) { | 230 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[d
artx.length])) { |
237 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); | 231 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); |
238 } | 232 } |
239 if (end == null) { | 233 if (end == null) { |
240 end = this[dartx.length]; | 234 end = this[dartx.length]; |
241 } else { | 235 } else { |
242 if (!(typeof end == 'number')) | 236 if (!(typeof end == 'number')) dart.throw(new core.ArgumentError(end))
; |
243 dart.throw(new core.ArgumentError(end)); | |
244 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar
t.notNull(this[dartx.length])) { | 237 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar
t.notNull(this[dartx.length])) { |
245 dart.throw(new core.RangeError.range(end, start, this[dartx.length])
); | 238 dart.throw(new core.RangeError.range(end, start, this[dartx.length])
); |
246 } | 239 } |
247 } | 240 } |
248 if (start == end) | 241 if (start == end) return dart.list([], E); |
249 return dart.list([], E); | |
250 return JSArray$(E).typed(this.slice(start, end)); | 242 return JSArray$(E).typed(this.slice(start, end)); |
251 } | 243 } |
252 [dartx.getRange](start, end) { | 244 [dartx.getRange](start, end) { |
253 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this,
start, end); | 245 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this,
start, end); |
254 } | 246 } |
255 get [dartx.first]() { | 247 get [dartx.first]() { |
256 if (dart.notNull(this[dartx.length]) > 0) | 248 if (dart.notNull(this[dartx.length]) > 0) return this[dartx.get](0); |
257 return this[dartx.get](0); | |
258 dart.throw(new core.StateError("No elements")); | 249 dart.throw(new core.StateError("No elements")); |
259 } | 250 } |
260 get [dartx.last]() { | 251 get [dartx.last]() { |
261 if (dart.notNull(this[dartx.length]) > 0) | 252 if (dart.notNull(this[dartx.length]) > 0) return this[dartx.get](dart.no
tNull(this[dartx.length]) - 1); |
262 return this[dartx.get](dart.notNull(this[dartx.length]) - 1); | |
263 dart.throw(new core.StateError("No elements")); | 253 dart.throw(new core.StateError("No elements")); |
264 } | 254 } |
265 get [dartx.single]() { | 255 get [dartx.single]() { |
266 if (this[dartx.length] == 1) | 256 if (this[dartx.length] == 1) return this[dartx.get](0); |
267 return this[dartx.get](0); | 257 if (this[dartx.length] == 0) dart.throw(new core.StateError("No elements
")); |
268 if (this[dartx.length] == 0) | |
269 dart.throw(new core.StateError("No elements")); | |
270 dart.throw(new core.StateError("More than one element")); | 258 dart.throw(new core.StateError("More than one element")); |
271 } | 259 } |
272 [dartx.removeRange](start, end) { | 260 [dartx.removeRange](start, end) { |
273 this[dartx.checkGrowable]('removeRange'); | 261 this[dartx.checkGrowable]('removeRange'); |
274 let receiverLength = this[dartx.length]; | 262 let receiverLength = this[dartx.length]; |
275 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv
erLength)) { | 263 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv
erLength)) { |
276 dart.throw(new core.RangeError.range(start, 0, receiverLength)); | 264 dart.throw(new core.RangeError.range(start, 0, receiverLength)); |
277 } | 265 } |
278 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(receiverLength)) { | 266 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(receiverLength)) { |
279 dart.throw(new core.RangeError.range(end, start, receiverLength)); | 267 dart.throw(new core.RangeError.range(end, start, receiverLength)); |
280 } | 268 } |
281 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength
) - dart.notNull(end)); | 269 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength
) - dart.notNull(end)); |
282 this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) -
dart.notNull(start)); | 270 this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) -
dart.notNull(start)); |
283 } | 271 } |
284 [dartx.setRange](start, end, iterable, skipCount) { | 272 [dartx.setRange](start, end, iterable, skipCount) { |
285 dart.as(iterable, core.Iterable$(E)); | 273 dart.as(iterable, core.Iterable$(E)); |
286 if (skipCount === void 0) | 274 if (skipCount === void 0) skipCount = 0; |
287 skipCount = 0; | |
288 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl
e, skipCount); | 275 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl
e, skipCount); |
289 } | 276 } |
290 [dartx.fillRange](start, end, fillValue) { | 277 [dartx.fillRange](start, end, fillValue) { |
291 if (fillValue === void 0) | 278 if (fillValue === void 0) fillValue = null; |
292 fillValue = null; | |
293 dart.as(fillValue, E); | 279 dart.as(fillValue, E); |
294 _internal.IterableMixinWorkaround.fillRangeList(this, start, end, fillVa
lue); | 280 _internal.IterableMixinWorkaround.fillRangeList(this, start, end, fillVa
lue); |
295 } | 281 } |
296 [dartx.replaceRange](start, end, iterable) { | 282 [dartx.replaceRange](start, end, iterable) { |
297 dart.as(iterable, core.Iterable$(E)); | 283 dart.as(iterable, core.Iterable$(E)); |
298 _internal.IterableMixinWorkaround.replaceRangeList(this, start, end, ite
rable); | 284 _internal.IterableMixinWorkaround.replaceRangeList(this, start, end, ite
rable); |
299 } | 285 } |
300 [dartx.any](f) { | 286 [dartx.any](f) { |
301 dart.as(f, dart.functionType(core.bool, [E])); | 287 dart.as(f, dart.functionType(core.bool, [E])); |
302 return _internal.IterableMixinWorkaround.any(this, f); | 288 return _internal.IterableMixinWorkaround.any(this, f); |
303 } | 289 } |
304 [dartx.every](f) { | 290 [dartx.every](f) { |
305 dart.as(f, dart.functionType(core.bool, [E])); | 291 dart.as(f, dart.functionType(core.bool, [E])); |
306 return _internal.IterableMixinWorkaround.every(this, f); | 292 return _internal.IterableMixinWorkaround.every(this, f); |
307 } | 293 } |
308 get [dartx.reversed]() { | 294 get [dartx.reversed]() { |
309 return new (_internal.IterableMixinWorkaround$(E))().reversedList(this); | 295 return new (_internal.IterableMixinWorkaround$(E))().reversedList(this); |
310 } | 296 } |
311 [dartx.sort](compare) { | 297 [dartx.sort](compare) { |
312 if (compare === void 0) | 298 if (compare === void 0) compare = null; |
313 compare = null; | |
314 dart.as(compare, dart.functionType(core.int, [E, E])); | 299 dart.as(compare, dart.functionType(core.int, [E, E])); |
315 _internal.IterableMixinWorkaround.sortList(this, compare); | 300 _internal.IterableMixinWorkaround.sortList(this, compare); |
316 } | 301 } |
317 [dartx.shuffle](random) { | 302 [dartx.shuffle](random) { |
318 if (random === void 0) | 303 if (random === void 0) random = null; |
319 random = null; | |
320 _internal.IterableMixinWorkaround.shuffleList(this, random); | 304 _internal.IterableMixinWorkaround.shuffleList(this, random); |
321 } | 305 } |
322 [dartx.indexOf](element, start) { | 306 [dartx.indexOf](element, start) { |
323 if (start === void 0) | 307 if (start === void 0) start = 0; |
324 start = 0; | |
325 return _internal.IterableMixinWorkaround.indexOfList(this, element, star
t); | 308 return _internal.IterableMixinWorkaround.indexOfList(this, element, star
t); |
326 } | 309 } |
327 [dartx.lastIndexOf](element, start) { | 310 [dartx.lastIndexOf](element, start) { |
328 if (start === void 0) | 311 if (start === void 0) start = null; |
329 start = null; | |
330 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element,
start); | 312 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element,
start); |
331 } | 313 } |
332 [dartx.contains](other) { | 314 [dartx.contains](other) { |
333 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { | 315 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { |
334 if (dart.equals(this[dartx.get](i), other)) | 316 if (dart.equals(this[dartx.get](i), other)) return true; |
335 return true; | |
336 } | 317 } |
337 return false; | 318 return false; |
338 } | 319 } |
339 get [dartx.isEmpty]() { | 320 get [dartx.isEmpty]() { |
340 return this[dartx.length] == 0; | 321 return this[dartx.length] == 0; |
341 } | 322 } |
342 get [dartx.isNotEmpty]() { | 323 get [dartx.isNotEmpty]() { |
343 return !dart.notNull(this[dartx.isEmpty]); | 324 return !dart.notNull(this[dartx.isEmpty]); |
344 } | 325 } |
345 toString() { | 326 toString() { |
346 return collection.ListBase.listToString(this); | 327 return collection.ListBase.listToString(this); |
347 } | 328 } |
348 [dartx.toList](opts) { | 329 [dartx.toList](opts) { |
349 let growable = opts && 'growable' in opts ? opts.growable : true; | 330 let growable = opts && 'growable' in opts ? opts.growable : true; |
350 let list = this.slice(); | 331 let list = this.slice(); |
351 if (!dart.notNull(growable)) | 332 if (!dart.notNull(growable)) JSArray$().markFixedList(dart.as(list, core
.List)); |
352 JSArray$().markFixedList(dart.as(list, core.List)); | |
353 return JSArray$(E).typed(list); | 333 return JSArray$(E).typed(list); |
354 } | 334 } |
355 [dartx.toSet]() { | 335 [dartx.toSet]() { |
356 return core.Set$(E).from(this); | 336 return core.Set$(E).from(this); |
357 } | 337 } |
358 get [dartx.iterator]() { | 338 get [dartx.iterator]() { |
359 return new (_internal.ListIterator$(E))(this); | 339 return new (_internal.ListIterator$(E))(this); |
360 } | 340 } |
361 get hashCode() { | 341 get hashCode() { |
362 return _js_helper.Primitives.objectHashCode(this); | 342 return _js_helper.Primitives.objectHashCode(this); |
363 } | 343 } |
364 get [dartx.length]() { | 344 get [dartx.length]() { |
365 return this.length; | 345 return this.length; |
366 } | 346 } |
367 set [dartx.length](newLength) { | 347 set [dartx.length](newLength) { |
368 if (!(typeof newLength == 'number')) | 348 if (!(typeof newLength == 'number')) dart.throw(new core.ArgumentError(n
ewLength)); |
369 dart.throw(new core.ArgumentError(newLength)); | 349 if (dart.notNull(newLength) < 0) dart.throw(new core.RangeError.value(ne
wLength)); |
370 if (dart.notNull(newLength) < 0) | |
371 dart.throw(new core.RangeError.value(newLength)); | |
372 this[dartx.checkGrowable]('set length'); | 350 this[dartx.checkGrowable]('set length'); |
373 this.length = newLength; | 351 this.length = newLength; |
374 } | 352 } |
375 [dartx.get](index) { | 353 [dartx.get](index) { |
376 if (!(typeof index == 'number')) | 354 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); |
377 dart.throw(new core.ArgumentError(index)); | 355 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) dart.throw(new core.RangeError.value(index)); |
378 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) | |
379 dart.throw(new core.RangeError.value(index)); | |
380 return dart.as(this[index], E); | 356 return dart.as(this[index], E); |
381 } | 357 } |
382 [dartx.set](index, value) { | 358 [dartx.set](index, value) { |
383 dart.as(value, E); | 359 dart.as(value, E); |
384 if (!(typeof index == 'number')) | 360 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index
)); |
385 dart.throw(new core.ArgumentError(index)); | 361 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) dart.throw(new core.RangeError.value(index)); |
386 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) | |
387 dart.throw(new core.RangeError.value(index)); | |
388 this[index] = value; | 362 this[index] = value; |
389 return value; | 363 return value; |
390 } | 364 } |
391 [dartx.asMap]() { | 365 [dartx.asMap]() { |
392 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this); | 366 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this); |
393 } | 367 } |
394 } | 368 } |
395 dart.setBaseClass(JSArray, dart.global.Array); | 369 dart.setBaseClass(JSArray, dart.global.Array); |
396 JSArray[dart.implements] = () => [core.List$(E), JSIndexable]; | 370 JSArray[dart.implements] = () => [core.List$(E), JSIndexable]; |
397 dart.setSignature(JSArray, { | 371 dart.setSignature(JSArray, { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 super.Interceptor(); | 516 super.Interceptor(); |
543 } | 517 } |
544 [dartx.compareTo](b) { | 518 [dartx.compareTo](b) { |
545 if (this < dart.notNull(b)) { | 519 if (this < dart.notNull(b)) { |
546 return -1; | 520 return -1; |
547 } else if (this > dart.notNull(b)) { | 521 } else if (this > dart.notNull(b)) { |
548 return 1; | 522 return 1; |
549 } else if (dart.equals(this, b)) { | 523 } else if (dart.equals(this, b)) { |
550 if (dart.equals(this, 0)) { | 524 if (dart.equals(this, 0)) { |
551 let bIsNegative = b[dartx.isNegative]; | 525 let bIsNegative = b[dartx.isNegative]; |
552 if (this[dartx.isNegative] == bIsNegative) | 526 if (this[dartx.isNegative] == bIsNegative) return 0; |
553 return 0; | 527 if (dart.notNull(this[dartx.isNegative])) return -1; |
554 if (dart.notNull(this[dartx.isNegative])) | |
555 return -1; | |
556 return 1; | 528 return 1; |
557 } | 529 } |
558 return 0; | 530 return 0; |
559 } else if (dart.notNull(this[dartx.isNaN])) { | 531 } else if (dart.notNull(this[dartx.isNaN])) { |
560 if (dart.notNull(b[dartx.isNaN])) { | 532 if (dart.notNull(b[dartx.isNaN])) { |
561 return 0; | 533 return 0; |
562 } | 534 } |
563 return 1; | 535 return 1; |
564 } else { | 536 } else { |
565 return -1; | 537 return -1; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 return Math.round(this); | 593 return Math.round(this); |
622 } | 594 } |
623 } | 595 } |
624 [dartx.truncateToDouble]() { | 596 [dartx.truncateToDouble]() { |
625 return this < 0 ? this[dartx.ceilToDouble]() : this[dartx.floorToDouble]()
; | 597 return this < 0 ? this[dartx.ceilToDouble]() : this[dartx.floorToDouble]()
; |
626 } | 598 } |
627 [dartx.clamp](lowerLimit, upperLimit) { | 599 [dartx.clamp](lowerLimit, upperLimit) { |
628 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) { | 600 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) { |
629 dart.throw(new core.ArgumentError(lowerLimit)); | 601 dart.throw(new core.ArgumentError(lowerLimit)); |
630 } | 602 } |
631 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0) | 603 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0) return lowerLimit
; |
632 return lowerLimit; | 604 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0) return upperLimit
; |
633 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0) | |
634 return upperLimit; | |
635 return this; | 605 return this; |
636 } | 606 } |
637 [dartx.toDouble]() { | 607 [dartx.toDouble]() { |
638 return this; | 608 return this; |
639 } | 609 } |
640 [dartx.toStringAsFixed](fractionDigits) { | 610 [dartx.toStringAsFixed](fractionDigits) { |
641 _js_helper.checkInt(fractionDigits); | 611 _js_helper.checkInt(fractionDigits); |
642 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20)
{ | 612 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20)
{ |
643 dart.throw(new core.RangeError(fractionDigits)); | 613 dart.throw(new core.RangeError(fractionDigits)); |
644 } | 614 } |
645 let result = this.toFixed(fractionDigits); | 615 let result = this.toFixed(fractionDigits); |
646 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) | 616 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) return `
-${result}`; |
647 return `-${result}`; | |
648 return result; | 617 return result; |
649 } | 618 } |
650 [dartx.toStringAsExponential](fractionDigits) { | 619 [dartx.toStringAsExponential](fractionDigits) { |
651 if (fractionDigits === void 0) | 620 if (fractionDigits === void 0) fractionDigits = null; |
652 fractionDigits = null; | |
653 let result = null; | 621 let result = null; |
654 if (fractionDigits != null) { | 622 if (fractionDigits != null) { |
655 _js_helper.checkInt(fractionDigits); | 623 _js_helper.checkInt(fractionDigits); |
656 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2
0) { | 624 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2
0) { |
657 dart.throw(new core.RangeError(fractionDigits)); | 625 dart.throw(new core.RangeError(fractionDigits)); |
658 } | 626 } |
659 result = this.toExponential(fractionDigits); | 627 result = this.toExponential(fractionDigits); |
660 } else { | 628 } else { |
661 result = this.toExponential(); | 629 result = this.toExponential(); |
662 } | 630 } |
663 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) | 631 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) return `
-${result}`; |
664 return `-${result}`; | |
665 return result; | 632 return result; |
666 } | 633 } |
667 [dartx.toStringAsPrecision](precision) { | 634 [dartx.toStringAsPrecision](precision) { |
668 _js_helper.checkInt(precision); | 635 _js_helper.checkInt(precision); |
669 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { | 636 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { |
670 dart.throw(new core.RangeError(precision)); | 637 dart.throw(new core.RangeError(precision)); |
671 } | 638 } |
672 let result = this.toPrecision(precision); | 639 let result = this.toPrecision(precision); |
673 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) | 640 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) return `
-${result}`; |
674 return `-${result}`; | |
675 return result; | 641 return result; |
676 } | 642 } |
677 [dartx.toRadixString](radix) { | 643 [dartx.toRadixString](radix) { |
678 _js_helper.checkInt(radix); | 644 _js_helper.checkInt(radix); |
679 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) | 645 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) dart.throw(new co
re.RangeError(radix)); |
680 dart.throw(new core.RangeError(radix)); | |
681 let result = this.toString(radix); | 646 let result = this.toString(radix); |
682 let rightParenCode = 41; | 647 let rightParenCode = 41; |
683 if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != ri
ghtParenCode) { | 648 if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != ri
ghtParenCode) { |
684 return result; | 649 return result; |
685 } | 650 } |
686 return JSNumber._handleIEtoString(result); | 651 return JSNumber._handleIEtoString(result); |
687 } | 652 } |
688 static _handleIEtoString(result) { | 653 static _handleIEtoString(result) { |
689 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); | 654 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); |
690 if (match == null) { | 655 if (match == null) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 _js_helper.checkNull(other); | 688 _js_helper.checkNull(other); |
724 return this / other; | 689 return this / other; |
725 } | 690 } |
726 [dartx['*']](other) { | 691 [dartx['*']](other) { |
727 _js_helper.checkNull(other); | 692 _js_helper.checkNull(other); |
728 return this * other; | 693 return this * other; |
729 } | 694 } |
730 [dartx['%']](other) { | 695 [dartx['%']](other) { |
731 _js_helper.checkNull(other); | 696 _js_helper.checkNull(other); |
732 let result = this % other; | 697 let result = this % other; |
733 if (result == 0) | 698 if (result == 0) return 0; |
734 return 0; | 699 if (dart.notNull(result) > 0) return result; |
735 if (dart.notNull(result) > 0) | |
736 return result; | |
737 if (other < 0) { | 700 if (other < 0) { |
738 return dart.notNull(result) - other; | 701 return dart.notNull(result) - other; |
739 } else { | 702 } else { |
740 return dart.notNull(result) + other; | 703 return dart.notNull(result) + other; |
741 } | 704 } |
742 } | 705 } |
743 [_isInt32](value) { | 706 [_isInt32](value) { |
744 return (value | 0) === value; | 707 return (value | 0) === value; |
745 } | 708 } |
746 [dartx['~/']](other) { | 709 [dartx['~/']](other) { |
747 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe
r)) && 0 != other && -1 != other) { | 710 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe
r)) && 0 != other && -1 != other) { |
748 return this / other | 0; | 711 return this / other | 0; |
749 } else { | 712 } else { |
750 return this[_tdivSlow](other); | 713 return this[_tdivSlow](other); |
751 } | 714 } |
752 } | 715 } |
753 [_tdivSlow](other) { | 716 [_tdivSlow](other) { |
754 _js_helper.checkNull(other); | 717 _js_helper.checkNull(other); |
755 return (this / other)[dartx.toInt](); | 718 return (this / other)[dartx.toInt](); |
756 } | 719 } |
757 [dartx['<<']](other) { | 720 [dartx['<<']](other) { |
758 if (dart.notNull(other) < 0) | 721 if (dart.notNull(other) < 0) dart.throw(new core.ArgumentError(other)); |
759 dart.throw(new core.ArgumentError(other)); | |
760 return this[_shlPositive](other); | 722 return this[_shlPositive](other); |
761 } | 723 } |
762 [_shlPositive](other) { | 724 [_shlPositive](other) { |
763 return other > 31 ? 0 : this << other >>> 0; | 725 return other > 31 ? 0 : this << other >>> 0; |
764 } | 726 } |
765 [dartx['>>']](other) { | 727 [dartx['>>']](other) { |
766 if (dart.notNull(other) < 0) | 728 if (dart.notNull(other) < 0) dart.throw(new core.ArgumentError(other)); |
767 dart.throw(new core.ArgumentError(other)); | |
768 return this[_shrOtherPositive](other); | 729 return this[_shrOtherPositive](other); |
769 } | 730 } |
770 [_shrOtherPositive](other) { | 731 [_shrOtherPositive](other) { |
771 return this > 0 ? this[_shrBothPositive](other) : this >> (dart.notNull(ot
her) > 31 ? 31 : other) >>> 0; | 732 return this > 0 ? this[_shrBothPositive](other) : this >> (dart.notNull(ot
her) > 31 ? 31 : other) >>> 0; |
772 } | 733 } |
773 [_shrBothPositive](other) { | 734 [_shrBothPositive](other) { |
774 return other > 31 ? 0 : this >>> other; | 735 return other > 31 ? 0 : this >>> other; |
775 } | 736 } |
776 [dartx['&']](other) { | 737 [dartx['&']](other) { |
777 _js_helper.checkNull(other); | 738 _js_helper.checkNull(other); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 'hashCode', | 907 'hashCode', |
947 'runtimeType', | 908 'runtimeType', |
948 'length', | 909 'length', |
949 'get' | 910 'get' |
950 ]); | 911 ]); |
951 class JSString extends Interceptor { | 912 class JSString extends Interceptor { |
952 JSString() { | 913 JSString() { |
953 super.Interceptor(); | 914 super.Interceptor(); |
954 } | 915 } |
955 [dartx.codeUnitAt](index) { | 916 [dartx.codeUnitAt](index) { |
956 if (!(typeof index == 'number')) | 917 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index))
; |
957 dart.throw(new core.ArgumentError(index)); | 918 if (dart.notNull(index) < 0) dart.throw(new core.RangeError.value(index)); |
958 if (dart.notNull(index) < 0) | 919 if (dart.notNull(index) >= dart.notNull(this[dartx.length])) dart.throw(ne
w core.RangeError.value(index)); |
959 dart.throw(new core.RangeError.value(index)); | |
960 if (dart.notNull(index) >= dart.notNull(this[dartx.length])) | |
961 dart.throw(new core.RangeError.value(index)); | |
962 return this.charCodeAt(index); | 920 return this.charCodeAt(index); |
963 } | 921 } |
964 [dartx.allMatches](string, start) { | 922 [dartx.allMatches](string, start) { |
965 if (start === void 0) | 923 if (start === void 0) start = 0; |
966 start = 0; | |
967 _js_helper.checkString(string); | 924 _js_helper.checkString(string); |
968 _js_helper.checkInt(start); | 925 _js_helper.checkInt(start); |
969 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[d
artx.length])) { | 926 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[d
artx.length])) { |
970 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); | 927 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); |
971 } | 928 } |
972 return _js_helper.allMatchesInStringUnchecked(this, string, start); | 929 return _js_helper.allMatchesInStringUnchecked(this, string, start); |
973 } | 930 } |
974 [dartx.matchAsPrefix](string, start) { | 931 [dartx.matchAsPrefix](string, start) { |
975 if (start === void 0) | 932 if (start === void 0) start = 0; |
976 start = 0; | |
977 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d
artx.length])) { | 933 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d
artx.length])) { |
978 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); | 934 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); |
979 } | 935 } |
980 if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull(
string[dartx.length])) | 936 if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull(
string[dartx.length])) return null; |
981 return null; | |
982 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da
rt.notNull(i) + 1) { | 937 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da
rt.notNull(i) + 1) { |
983 if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != t
his[dartx.codeUnitAt](i)) { | 938 if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != t
his[dartx.codeUnitAt](i)) { |
984 return null; | 939 return null; |
985 } | 940 } |
986 } | 941 } |
987 return new _js_helper.StringMatch(start, string, this); | 942 return new _js_helper.StringMatch(start, string, this); |
988 } | 943 } |
989 [dartx['+']](other) { | 944 [dartx['+']](other) { |
990 if (!(typeof other == 'string')) | 945 if (!(typeof other == 'string')) dart.throw(new core.ArgumentError(other))
; |
991 dart.throw(new core.ArgumentError(other)); | |
992 return this + other; | 946 return this + other; |
993 } | 947 } |
994 [dartx.endsWith](other) { | 948 [dartx.endsWith](other) { |
995 _js_helper.checkString(other); | 949 _js_helper.checkString(other); |
996 let otherLength = other[dartx.length]; | 950 let otherLength = other[dartx.length]; |
997 if (dart.notNull(otherLength) > dart.notNull(this[dartx.length])) | 951 if (dart.notNull(otherLength) > dart.notNull(this[dartx.length])) return f
alse; |
998 return false; | |
999 return other == this[dartx.substring](dart.notNull(this[dartx.length]) - d
art.notNull(otherLength)); | 952 return other == this[dartx.substring](dart.notNull(this[dartx.length]) - d
art.notNull(otherLength)); |
1000 } | 953 } |
1001 [dartx.replaceAll](from, to) { | 954 [dartx.replaceAll](from, to) { |
1002 _js_helper.checkString(to); | 955 _js_helper.checkString(to); |
1003 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core.
String); | 956 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core.
String); |
1004 } | 957 } |
1005 [dartx.replaceAllMapped](from, convert) { | 958 [dartx.replaceAllMapped](from, convert) { |
1006 return this[dartx.splitMapJoin](from, {onMatch: convert}); | 959 return this[dartx.splitMapJoin](from, {onMatch: convert}); |
1007 } | 960 } |
1008 [dartx.splitMapJoin](from, opts) { | 961 [dartx.splitMapJoin](from, opts) { |
1009 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null; | 962 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null; |
1010 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null; | 963 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null; |
1011 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc
h, onNonMatch), core.String); | 964 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc
h, onNonMatch), core.String); |
1012 } | 965 } |
1013 [dartx.replaceFirst](from, to, startIndex) { | 966 [dartx.replaceFirst](from, to, startIndex) { |
1014 if (startIndex === void 0) | 967 if (startIndex === void 0) startIndex = 0; |
1015 startIndex = 0; | |
1016 _js_helper.checkString(to); | 968 _js_helper.checkString(to); |
1017 _js_helper.checkInt(startIndex); | 969 _js_helper.checkInt(startIndex); |
1018 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { | 970 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { |
1019 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length]))
; | 971 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length]))
; |
1020 } | 972 } |
1021 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); | 973 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); |
1022 } | 974 } |
1023 [dartx.split](pattern) { | 975 [dartx.split](pattern) { |
1024 _js_helper.checkNull(pattern); | 976 _js_helper.checkNull(pattern); |
1025 if (typeof pattern == 'string') { | 977 if (typeof pattern == 'string') { |
(...skipping 19 matching lines...) Expand all Loading... |
1045 let end = matchStart; | 997 let end = matchStart; |
1046 result[dartx.add](this[dartx.substring](start, end)); | 998 result[dartx.add](this[dartx.substring](start, end)); |
1047 start = matchEnd; | 999 start = matchEnd; |
1048 } | 1000 } |
1049 if (dart.notNull(start) < dart.notNull(this[dartx.length]) || dart.notNull
(length) > 0) { | 1001 if (dart.notNull(start) < dart.notNull(this[dartx.length]) || dart.notNull
(length) > 0) { |
1050 result[dartx.add](this[dartx.substring](start)); | 1002 result[dartx.add](this[dartx.substring](start)); |
1051 } | 1003 } |
1052 return result; | 1004 return result; |
1053 } | 1005 } |
1054 [dartx.startsWith](pattern, index) { | 1006 [dartx.startsWith](pattern, index) { |
1055 if (index === void 0) | 1007 if (index === void 0) index = 0; |
1056 index = 0; | |
1057 _js_helper.checkInt(index); | 1008 _js_helper.checkInt(index); |
1058 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dar
tx.length])) { | 1009 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dar
tx.length])) { |
1059 dart.throw(new core.RangeError.range(index, 0, this[dartx.length])); | 1010 dart.throw(new core.RangeError.range(index, 0, this[dartx.length])); |
1060 } | 1011 } |
1061 if (typeof pattern == 'string') { | 1012 if (typeof pattern == 'string') { |
1062 let other = pattern; | 1013 let other = pattern; |
1063 let otherLength = other[dartx.length]; | 1014 let otherLength = other[dartx.length]; |
1064 let endIndex = dart.notNull(index) + dart.notNull(otherLength); | 1015 let endIndex = dart.notNull(index) + dart.notNull(otherLength); |
1065 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) | 1016 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) return fa
lse; |
1066 return false; | |
1067 return other == this.substring(index, endIndex); | 1017 return other == this.substring(index, endIndex); |
1068 } | 1018 } |
1069 return pattern[dartx.matchAsPrefix](this, index) != null; | 1019 return pattern[dartx.matchAsPrefix](this, index) != null; |
1070 } | 1020 } |
1071 [dartx.substring](startIndex, endIndex) { | 1021 [dartx.substring](startIndex, endIndex) { |
1072 if (endIndex === void 0) | 1022 if (endIndex === void 0) endIndex = null; |
1073 endIndex = null; | |
1074 _js_helper.checkInt(startIndex); | 1023 _js_helper.checkInt(startIndex); |
1075 if (endIndex == null) | 1024 if (endIndex == null) endIndex = this[dartx.length]; |
1076 endIndex = this[dartx.length]; | |
1077 _js_helper.checkInt(endIndex); | 1025 _js_helper.checkInt(endIndex); |
1078 if (dart.notNull(startIndex) < 0) | 1026 if (dart.notNull(startIndex) < 0) dart.throw(new core.RangeError.value(sta
rtIndex)); |
1079 dart.throw(new core.RangeError.value(startIndex)); | 1027 if (dart.notNull(startIndex) > dart.notNull(endIndex)) dart.throw(new core
.RangeError.value(startIndex)); |
1080 if (dart.notNull(startIndex) > dart.notNull(endIndex)) | 1028 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) dart.throw(
new core.RangeError.value(endIndex)); |
1081 dart.throw(new core.RangeError.value(startIndex)); | |
1082 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) | |
1083 dart.throw(new core.RangeError.value(endIndex)); | |
1084 return this.substring(startIndex, endIndex); | 1029 return this.substring(startIndex, endIndex); |
1085 } | 1030 } |
1086 [dartx.toLowerCase]() { | 1031 [dartx.toLowerCase]() { |
1087 return this.toLowerCase(); | 1032 return this.toLowerCase(); |
1088 } | 1033 } |
1089 [dartx.toUpperCase]() { | 1034 [dartx.toUpperCase]() { |
1090 return this.toUpperCase(); | 1035 return this.toUpperCase(); |
1091 } | 1036 } |
1092 static _isWhitespace(codeUnit) { | 1037 static _isWhitespace(codeUnit) { |
1093 if (dart.notNull(codeUnit) < 256) { | 1038 if (dart.notNull(codeUnit) < 256) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { | 1103 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { |
1159 break; | 1104 break; |
1160 } | 1105 } |
1161 index = dart.notNull(index) - 1; | 1106 index = dart.notNull(index) - 1; |
1162 } | 1107 } |
1163 return index; | 1108 return index; |
1164 } | 1109 } |
1165 [dartx.trim]() { | 1110 [dartx.trim]() { |
1166 let NEL = 133; | 1111 let NEL = 133; |
1167 let result = this.trim(); | 1112 let result = this.trim(); |
1168 if (result[dartx.length] == 0) | 1113 if (result[dartx.length] == 0) return result; |
1169 return result; | |
1170 let firstCode = result[dartx.codeUnitAt](0); | 1114 let firstCode = result[dartx.codeUnitAt](0); |
1171 let startIndex = 0; | 1115 let startIndex = 0; |
1172 if (firstCode == NEL) { | 1116 if (firstCode == NEL) { |
1173 startIndex = JSString._skipLeadingWhitespace(result, 1); | 1117 startIndex = JSString._skipLeadingWhitespace(result, 1); |
1174 if (startIndex == result[dartx.length]) | 1118 if (startIndex == result[dartx.length]) return ""; |
1175 return ""; | |
1176 } | 1119 } |
1177 let endIndex = result[dartx.length]; | 1120 let endIndex = result[dartx.length]; |
1178 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); | 1121 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); |
1179 if (lastCode == NEL) { | 1122 if (lastCode == NEL) { |
1180 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endInde
x) - 1); | 1123 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endInde
x) - 1); |
1181 } | 1124 } |
1182 if (startIndex == 0 && endIndex == result[dartx.length]) | 1125 if (startIndex == 0 && endIndex == result[dartx.length]) return result; |
1183 return result; | |
1184 return result.substring(startIndex, endIndex); | 1126 return result.substring(startIndex, endIndex); |
1185 } | 1127 } |
1186 [dartx.trimLeft]() { | 1128 [dartx.trimLeft]() { |
1187 let NEL = 133; | 1129 let NEL = 133; |
1188 let result = null; | 1130 let result = null; |
1189 let startIndex = 0; | 1131 let startIndex = 0; |
1190 if (typeof this.trimLeft != "undefined") { | 1132 if (typeof this.trimLeft != "undefined") { |
1191 result = this.trimLeft(); | 1133 result = this.trimLeft(); |
1192 if (result[dartx.length] == 0) | 1134 if (result[dartx.length] == 0) return result; |
1193 return result; | |
1194 let firstCode = result[dartx.codeUnitAt](0); | 1135 let firstCode = result[dartx.codeUnitAt](0); |
1195 if (firstCode == NEL) { | 1136 if (firstCode == NEL) { |
1196 startIndex = JSString._skipLeadingWhitespace(result, 1); | 1137 startIndex = JSString._skipLeadingWhitespace(result, 1); |
1197 } | 1138 } |
1198 } else { | 1139 } else { |
1199 result = this; | 1140 result = this; |
1200 startIndex = JSString._skipLeadingWhitespace(this, 0); | 1141 startIndex = JSString._skipLeadingWhitespace(this, 0); |
1201 } | 1142 } |
1202 if (startIndex == 0) | 1143 if (startIndex == 0) return result; |
1203 return result; | 1144 if (startIndex == result[dartx.length]) return ""; |
1204 if (startIndex == result[dartx.length]) | |
1205 return ""; | |
1206 return result.substring(startIndex); | 1145 return result.substring(startIndex); |
1207 } | 1146 } |
1208 [dartx.trimRight]() { | 1147 [dartx.trimRight]() { |
1209 let NEL = 133; | 1148 let NEL = 133; |
1210 let result = null; | 1149 let result = null; |
1211 let endIndex = null; | 1150 let endIndex = null; |
1212 if (typeof this.trimRight != "undefined") { | 1151 if (typeof this.trimRight != "undefined") { |
1213 result = this.trimRight(); | 1152 result = this.trimRight(); |
1214 endIndex = result[dartx.length]; | 1153 endIndex = result[dartx.length]; |
1215 if (endIndex == 0) | 1154 if (endIndex == 0) return result; |
1216 return result; | |
1217 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); | 1155 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); |
1218 if (lastCode == NEL) { | 1156 if (lastCode == NEL) { |
1219 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endIn
dex) - 1); | 1157 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endIn
dex) - 1); |
1220 } | 1158 } |
1221 } else { | 1159 } else { |
1222 result = this; | 1160 result = this; |
1223 endIndex = JSString._skipTrailingWhitespace(this, this[dartx.length]); | 1161 endIndex = JSString._skipTrailingWhitespace(this, this[dartx.length]); |
1224 } | 1162 } |
1225 if (endIndex == result[dartx.length]) | 1163 if (endIndex == result[dartx.length]) return result; |
1226 return result; | 1164 if (endIndex == 0) return ""; |
1227 if (endIndex == 0) | |
1228 return ""; | |
1229 return result.substring(0, endIndex); | 1165 return result.substring(0, endIndex); |
1230 } | 1166 } |
1231 [dartx['*']](times) { | 1167 [dartx['*']](times) { |
1232 if (0 >= dart.notNull(times)) | 1168 if (0 >= dart.notNull(times)) return ''; |
1233 return ''; | 1169 if (times == 1 || this[dartx.length] == 0) return this; |
1234 if (times == 1 || this[dartx.length] == 0) | |
1235 return this; | |
1236 if (times != times >>> 0) { | 1170 if (times != times >>> 0) { |
1237 dart.throw(dart.const(new core.OutOfMemoryError())); | 1171 dart.throw(dart.const(new core.OutOfMemoryError())); |
1238 } | 1172 } |
1239 let result = ''; | 1173 let result = ''; |
1240 let s = this; | 1174 let s = this; |
1241 while (true) { | 1175 while (true) { |
1242 if ((dart.notNull(times) & 1) == 1) | 1176 if ((dart.notNull(times) & 1) == 1) result = dart.notNull(s) + dart.notN
ull(result); |
1243 result = dart.notNull(s) + dart.notNull(result); | |
1244 times = times >>> 1; | 1177 times = times >>> 1; |
1245 if (times == 0) | 1178 if (times == 0) break; |
1246 break; | |
1247 s = dart.notNull(s) + dart.notNull(s); | 1179 s = dart.notNull(s) + dart.notNull(s); |
1248 } | 1180 } |
1249 return result; | 1181 return result; |
1250 } | 1182 } |
1251 [dartx.padLeft](width, padding) { | 1183 [dartx.padLeft](width, padding) { |
1252 if (padding === void 0) | 1184 if (padding === void 0) padding = ' '; |
1253 padding = ' '; | |
1254 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); | 1185 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); |
1255 if (dart.notNull(delta) <= 0) | 1186 if (dart.notNull(delta) <= 0) return this; |
1256 return this; | |
1257 return padding[dartx['*']](delta) + this; | 1187 return padding[dartx['*']](delta) + this; |
1258 } | 1188 } |
1259 [dartx.padRight](width, padding) { | 1189 [dartx.padRight](width, padding) { |
1260 if (padding === void 0) | 1190 if (padding === void 0) padding = ' '; |
1261 padding = ' '; | |
1262 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); | 1191 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); |
1263 if (dart.notNull(delta) <= 0) | 1192 if (dart.notNull(delta) <= 0) return this; |
1264 return this; | |
1265 return this[dartx['+']](padding[dartx['*']](delta)); | 1193 return this[dartx['+']](padding[dartx['*']](delta)); |
1266 } | 1194 } |
1267 get [dartx.codeUnits]() { | 1195 get [dartx.codeUnits]() { |
1268 return new _CodeUnits(this); | 1196 return new _CodeUnits(this); |
1269 } | 1197 } |
1270 get [dartx.runes]() { | 1198 get [dartx.runes]() { |
1271 return new core.Runes(this); | 1199 return new core.Runes(this); |
1272 } | 1200 } |
1273 [dartx.indexOf](pattern, start) { | 1201 [dartx.indexOf](pattern, start) { |
1274 if (start === void 0) | 1202 if (start === void 0) start = 0; |
1275 start = 0; | |
1276 _js_helper.checkNull(pattern); | 1203 _js_helper.checkNull(pattern); |
1277 if (!(typeof start == 'number')) | 1204 if (!(typeof start == 'number')) dart.throw(new core.ArgumentError(start))
; |
1278 dart.throw(new core.ArgumentError(start)); | |
1279 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dar
tx.length])) { | 1205 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dar
tx.length])) { |
1280 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); | 1206 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); |
1281 } | 1207 } |
1282 if (typeof pattern == 'string') { | 1208 if (typeof pattern == 'string') { |
1283 return this.indexOf(pattern, start); | 1209 return this.indexOf(pattern, start); |
1284 } | 1210 } |
1285 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { | 1211 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { |
1286 let re = pattern; | 1212 let re = pattern; |
1287 let match = _js_helper.firstMatchAfter(re, this, start); | 1213 let match = _js_helper.firstMatchAfter(re, this, start); |
1288 return match == null ? -1 : match.start; | 1214 return match == null ? -1 : match.start; |
1289 } | 1215 } |
1290 for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i
= dart.notNull(i) + 1) { | 1216 for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i
= dart.notNull(i) + 1) { |
1291 if (pattern[dartx.matchAsPrefix](this, i) != null) | 1217 if (pattern[dartx.matchAsPrefix](this, i) != null) return i; |
1292 return i; | |
1293 } | 1218 } |
1294 return -1; | 1219 return -1; |
1295 } | 1220 } |
1296 [dartx.lastIndexOf](pattern, start) { | 1221 [dartx.lastIndexOf](pattern, start) { |
1297 if (start === void 0) | 1222 if (start === void 0) start = null; |
1298 start = null; | |
1299 _js_helper.checkNull(pattern); | 1223 _js_helper.checkNull(pattern); |
1300 if (start == null) { | 1224 if (start == null) { |
1301 start = this[dartx.length]; | 1225 start = this[dartx.length]; |
1302 } else if (!(typeof start == 'number')) { | 1226 } else if (!(typeof start == 'number')) { |
1303 dart.throw(new core.ArgumentError(start)); | 1227 dart.throw(new core.ArgumentError(start)); |
1304 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t
his[dartx.length])) { | 1228 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t
his[dartx.length])) { |
1305 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); | 1229 dart.throw(new core.RangeError.range(start, 0, this[dartx.length])); |
1306 } | 1230 } |
1307 if (typeof pattern == 'string') { | 1231 if (typeof pattern == 'string') { |
1308 let other = pattern; | 1232 let other = pattern; |
1309 if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNu
ll(this[dartx.length])) { | 1233 if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNu
ll(this[dartx.length])) { |
1310 start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.le
ngth]); | 1234 start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.le
ngth]); |
1311 } | 1235 } |
1312 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start)
, core.int); | 1236 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start)
, core.int); |
1313 } | 1237 } |
1314 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { | 1238 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { |
1315 if (pattern[dartx.matchAsPrefix](this, i) != null) | 1239 if (pattern[dartx.matchAsPrefix](this, i) != null) return i; |
1316 return i; | |
1317 } | 1240 } |
1318 return -1; | 1241 return -1; |
1319 } | 1242 } |
1320 [dartx.contains](other, startIndex) { | 1243 [dartx.contains](other, startIndex) { |
1321 if (startIndex === void 0) | 1244 if (startIndex === void 0) startIndex = 0; |
1322 startIndex = 0; | |
1323 _js_helper.checkNull(other); | 1245 _js_helper.checkNull(other); |
1324 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { | 1246 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { |
1325 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length]))
; | 1247 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length]))
; |
1326 } | 1248 } |
1327 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex)
, core.bool); | 1249 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex)
, core.bool); |
1328 } | 1250 } |
1329 get [dartx.isEmpty]() { | 1251 get [dartx.isEmpty]() { |
1330 return this[dartx.length] == 0; | 1252 return this[dartx.length] == 0; |
1331 } | 1253 } |
1332 get [dartx.isNotEmpty]() { | 1254 get [dartx.isNotEmpty]() { |
1333 return !dart.notNull(this[dartx.isEmpty]); | 1255 return !dart.notNull(this[dartx.isEmpty]); |
1334 } | 1256 } |
1335 [dartx.compareTo](other) { | 1257 [dartx.compareTo](other) { |
1336 if (!(typeof other == 'string')) | 1258 if (!(typeof other == 'string')) dart.throw(new core.ArgumentError(other))
; |
1337 dart.throw(new core.ArgumentError(other)); | |
1338 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; | 1259 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; |
1339 } | 1260 } |
1340 toString() { | 1261 toString() { |
1341 return this; | 1262 return this; |
1342 } | 1263 } |
1343 get hashCode() { | 1264 get hashCode() { |
1344 let hash = 0; | 1265 let hash = 0; |
1345 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da
rt.notNull(i) + 1) { | 1266 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da
rt.notNull(i) + 1) { |
1346 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); | 1267 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); |
1347 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <
< 10); | 1268 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <
< 10); |
1348 hash = hash ^ hash >> 6; | 1269 hash = hash ^ hash >> 6; |
1349 } | 1270 } |
1350 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); | 1271 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); |
1351 hash = hash ^ hash >> 11; | 1272 hash = hash ^ hash >> 11; |
1352 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); | 1273 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); |
1353 } | 1274 } |
1354 get runtimeType() { | 1275 get runtimeType() { |
1355 return core.String; | 1276 return core.String; |
1356 } | 1277 } |
1357 get [dartx.length]() { | 1278 get [dartx.length]() { |
1358 return this.length; | 1279 return this.length; |
1359 } | 1280 } |
1360 [dartx.get](index) { | 1281 [dartx.get](index) { |
1361 if (!(typeof index == 'number')) | 1282 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index))
; |
1362 dart.throw(new core.ArgumentError(index)); | 1283 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNul
l(index) < 0) dart.throw(new core.RangeError.value(index)); |
1363 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNul
l(index) < 0) | |
1364 dart.throw(new core.RangeError.value(index)); | |
1365 return this[index]; | 1284 return this[index]; |
1366 } | 1285 } |
1367 } | 1286 } |
1368 JSString[dart.implements] = () => [core.String, JSIndexable]; | 1287 JSString[dart.implements] = () => [core.String, JSIndexable]; |
1369 dart.setSignature(JSString, { | 1288 dart.setSignature(JSString, { |
1370 constructors: () => ({JSString: [JSString, []]}), | 1289 constructors: () => ({JSString: [JSString, []]}), |
1371 methods: () => ({ | 1290 methods: () => ({ |
1372 [dartx.codeUnitAt]: [core.int, [core.int]], | 1291 [dartx.codeUnitAt]: [core.int, [core.int]], |
1373 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int]
], | 1292 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int]
], |
1374 [dartx.matchAsPrefix]: [core.Match, [core.String], [core.int]], | 1293 [dartx.matchAsPrefix]: [core.Match, [core.String], [core.int]], |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 exports.JSString = JSString; | 1421 exports.JSString = JSString; |
1503 exports.getInterceptor = getInterceptor; | 1422 exports.getInterceptor = getInterceptor; |
1504 exports.JSBool = JSBool; | 1423 exports.JSBool = JSBool; |
1505 exports.JSIndexable = JSIndexable; | 1424 exports.JSIndexable = JSIndexable; |
1506 exports.JSMutableIndexable = JSMutableIndexable; | 1425 exports.JSMutableIndexable = JSMutableIndexable; |
1507 exports.JSObject = JSObject; | 1426 exports.JSObject = JSObject; |
1508 exports.JavaScriptObject = JavaScriptObject; | 1427 exports.JavaScriptObject = JavaScriptObject; |
1509 exports.PlainJavaScriptObject = PlainJavaScriptObject; | 1428 exports.PlainJavaScriptObject = PlainJavaScriptObject; |
1510 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; | 1429 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; |
1511 }); | 1430 }); |
OLD | NEW |