| OLD | NEW |
| (Empty) |
| 1 var _interceptors; | |
| 2 (function(exports) { | |
| 3 'use strict'; | |
| 4 class Interceptor extends core.Object { | |
| 5 Interceptor() { | |
| 6 } | |
| 7 ['=='](other) { | |
| 8 return core.identical(this, other); | |
| 9 } | |
| 10 get hashCode() { | |
| 11 return _js_helper.Primitives.objectHashCode(this); | |
| 12 } | |
| 13 toString() { | |
| 14 return _js_helper.Primitives.objectToString(this); | |
| 15 } | |
| 16 noSuchMethod(invocation) { | |
| 17 throw new core.NoSuchMethodError(this, invocation.memberName, invocation.p
ositionalArguments, invocation.namedArguments); | |
| 18 } | |
| 19 get runtimeType() { | |
| 20 return _js_helper.getRuntimeType(this); | |
| 21 } | |
| 22 } | |
| 23 let JSArray$ = dart.generic(function(E) { | |
| 24 class JSArray extends Interceptor { | |
| 25 JSArray() { | |
| 26 super.Interceptor(); | |
| 27 } | |
| 28 JSArray$fixed(length) { | |
| 29 if (dart.notNull(!(typeof length == number)) || dart.notNull(length) < 0
) { | |
| 30 throw new core.ArgumentError(`Length must be a non-negative integer: $
{length}`); | |
| 31 } | |
| 32 return new JSArray.markFixed(new Array(length)); | |
| 33 } | |
| 34 JSArray$emptyGrowable() { | |
| 35 return new JSArray.markGrowable([]); | |
| 36 } | |
| 37 JSArray$growable(length) { | |
| 38 if (dart.notNull(!(typeof length == number)) || dart.notNull(length) < 0
) { | |
| 39 throw new core.ArgumentError(`Length must be a non-negative integer: $
{length}`); | |
| 40 } | |
| 41 return new JSArray.markGrowable(new Array(length)); | |
| 42 } | |
| 43 JSArray$typed(allocation) { | |
| 44 return dart.as(allocation, JSArray$(E)); | |
| 45 } | |
| 46 JSArray$markFixed(allocation) { | |
| 47 return dart.as(markFixedList(new JSArray.typed(allocation)), JSArray$(E)
); | |
| 48 } | |
| 49 JSArray$markGrowable(allocation) { | |
| 50 return dart.as(new JSArray.typed(allocation), JSArray$(E)); | |
| 51 } | |
| 52 static markFixedList(list) { | |
| 53 list.fixed$length = Array; | |
| 54 return dart.as(list, core.List); | |
| 55 } | |
| 56 checkMutable(reason) { | |
| 57 if (!dart.is(this, JSMutableArray)) { | |
| 58 throw new core.UnsupportedError(dart.as(reason, core.String)); | |
| 59 } | |
| 60 } | |
| 61 checkGrowable(reason) { | |
| 62 if (!dart.is(this, JSExtendableArray)) { | |
| 63 throw new core.UnsupportedError(dart.as(reason, core.String)); | |
| 64 } | |
| 65 } | |
| 66 add(value) { | |
| 67 this.checkGrowable('add'); | |
| 68 this.push(value); | |
| 69 } | |
| 70 removeAt(index) { | |
| 71 if (!(typeof index == number)) | |
| 72 throw new core.ArgumentError(index); | |
| 73 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this.
length)) { | |
| 74 throw new core.RangeError.value(index); | |
| 75 } | |
| 76 this.checkGrowable('removeAt'); | |
| 77 return dart.as(this.splice(index, 1)[0], E); | |
| 78 } | |
| 79 insert(index, value) { | |
| 80 if (!(typeof index == number)) | |
| 81 throw new core.ArgumentError(index); | |
| 82 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.l
ength)) { | |
| 83 throw new core.RangeError.value(index); | |
| 84 } | |
| 85 this.checkGrowable('insert'); | |
| 86 this.splice(index, 0, value); | |
| 87 } | |
| 88 insertAll(index, iterable) { | |
| 89 this.checkGrowable('insertAll'); | |
| 90 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); | |
| 91 } | |
| 92 setAll(index, iterable) { | |
| 93 this.checkMutable('setAll'); | |
| 94 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); | |
| 95 } | |
| 96 removeLast() { | |
| 97 this.checkGrowable('removeLast'); | |
| 98 if (this.length === 0) | |
| 99 throw new core.RangeError.value(-1); | |
| 100 return dart.as(this.pop(), E); | |
| 101 } | |
| 102 remove(element) { | |
| 103 this.checkGrowable('remove'); | |
| 104 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | |
| 105 if (dart.equals(this.get(i), element)) { | |
| 106 this.splice(i, 1); | |
| 107 return true; | |
| 108 } | |
| 109 } | |
| 110 return false; | |
| 111 } | |
| 112 removeWhere(test) { | |
| 113 _internal.IterableMixinWorkaround.removeWhereList(this, test); | |
| 114 } | |
| 115 retainWhere(test) { | |
| 116 _internal.IterableMixinWorkaround.removeWhereList(this, (element) => !da
rt.notNull(test(element))); | |
| 117 } | |
| 118 where(f) { | |
| 119 return new _internal.IterableMixinWorkaround().where(this, f); | |
| 120 } | |
| 121 expand(f) { | |
| 122 return _internal.IterableMixinWorkaround.expand(this, f); | |
| 123 } | |
| 124 addAll(collection) { | |
| 125 for (let e of collection) { | |
| 126 this.add(e); | |
| 127 } | |
| 128 } | |
| 129 clear() { | |
| 130 this.length = 0; | |
| 131 } | |
| 132 forEach(f) { | |
| 133 let length = this.length; | |
| 134 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { | |
| 135 f(dart.as(this[i], E)); | |
| 136 if (length !== this.length) { | |
| 137 throw new core.ConcurrentModificationError(this); | |
| 138 } | |
| 139 } | |
| 140 } | |
| 141 map(f) { | |
| 142 return _internal.IterableMixinWorkaround.mapList(this, f); | |
| 143 } | |
| 144 join(separator) { | |
| 145 if (separator === void 0) | |
| 146 separator = ""; | |
| 147 let list = new core.List(this.length); | |
| 148 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | |
| 149 list.set(i, `${this.get(i)}`); | |
| 150 } | |
| 151 return list.join(separator); | |
| 152 } | |
| 153 take(n) { | |
| 154 return new _internal.IterableMixinWorkaround().takeList(this, n); | |
| 155 } | |
| 156 takeWhile(test) { | |
| 157 return new _internal.IterableMixinWorkaround().takeWhile(this, test); | |
| 158 } | |
| 159 skip(n) { | |
| 160 return new _internal.IterableMixinWorkaround().skipList(this, n); | |
| 161 } | |
| 162 skipWhile(test) { | |
| 163 return new _internal.IterableMixinWorkaround().skipWhile(this, test); | |
| 164 } | |
| 165 reduce(combine) { | |
| 166 return dart.as(_internal.IterableMixinWorkaround.reduce(this, combine),
E); | |
| 167 } | |
| 168 fold(initialValue, combine) { | |
| 169 return _internal.IterableMixinWorkaround.fold(this, initialValue, combin
e); | |
| 170 } | |
| 171 firstWhere(test, opt$) { | |
| 172 let orElse = opt$.orElse === void 0 ? null : opt$.orElse; | |
| 173 return dart.as(_internal.IterableMixinWorkaround.firstWhere(this, test,
orElse), E); | |
| 174 } | |
| 175 lastWhere(test, opt$) { | |
| 176 let orElse = opt$.orElse === void 0 ? null : opt$.orElse; | |
| 177 return dart.as(_internal.IterableMixinWorkaround.lastWhereList(this, tes
t, orElse), E); | |
| 178 } | |
| 179 singleWhere(test) { | |
| 180 return dart.as(_internal.IterableMixinWorkaround.singleWhere(this, test)
, E); | |
| 181 } | |
| 182 elementAt(index) { | |
| 183 return this.get(index); | |
| 184 } | |
| 185 sublist(start, end) { | |
| 186 if (end === void 0) | |
| 187 end = null; | |
| 188 _js_helper.checkNull(start); | |
| 189 if (!(typeof start == number)) | |
| 190 throw new core.ArgumentError(start); | |
| 191 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.l
ength)) { | |
| 192 throw new core.RangeError.range(start, 0, this.length); | |
| 193 } | |
| 194 if (end === null) { | |
| 195 end = this.length; | |
| 196 } else { | |
| 197 if (!(typeof end == number)) | |
| 198 throw new core.ArgumentError(end); | |
| 199 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar
t.notNull(this.length)) { | |
| 200 throw new core.RangeError.range(end, start, this.length); | |
| 201 } | |
| 202 } | |
| 203 if (start === end) | |
| 204 return new List.from([]); | |
| 205 return new JSArray.markGrowable(this.slice(start, end)); | |
| 206 } | |
| 207 getRange(start, end) { | |
| 208 return new _internal.IterableMixinWorkaround().getRangeList(this, start,
end); | |
| 209 } | |
| 210 get first() { | |
| 211 if (dart.notNull(this.length) > 0) | |
| 212 return this.get(0); | |
| 213 throw new core.StateError("No elements"); | |
| 214 } | |
| 215 get last() { | |
| 216 if (dart.notNull(this.length) > 0) | |
| 217 return this.get(dart.notNull(this.length) - 1); | |
| 218 throw new core.StateError("No elements"); | |
| 219 } | |
| 220 get single() { | |
| 221 if (this.length === 1) | |
| 222 return this.get(0); | |
| 223 if (this.length === 0) | |
| 224 throw new core.StateError("No elements"); | |
| 225 throw new core.StateError("More than one element"); | |
| 226 } | |
| 227 removeRange(start, end) { | |
| 228 this.checkGrowable('removeRange'); | |
| 229 let receiverLength = this.length; | |
| 230 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv
erLength)) { | |
| 231 throw new core.RangeError.range(start, 0, receiverLength); | |
| 232 } | |
| 233 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(receiverLength)) { | |
| 234 throw new core.RangeError.range(end, start, receiverLength); | |
| 235 } | |
| 236 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength
) - dart.notNull(end)); | |
| 237 this.length = dart.notNull(receiverLength) - (dart.notNull(end) - dart.n
otNull(start)); | |
| 238 } | |
| 239 setRange(start, end, iterable, skipCount) { | |
| 240 if (skipCount === void 0) | |
| 241 skipCount = 0; | |
| 242 this.checkMutable('set range'); | |
| 243 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl
e, skipCount); | |
| 244 } | |
| 245 fillRange(start, end, fillValue) { | |
| 246 if (fillValue === void 0) | |
| 247 fillValue = null; | |
| 248 this.checkMutable('fill range'); | |
| 249 _internal.IterableMixinWorkaround.fillRangeList(this, start, end, fillVa
lue); | |
| 250 } | |
| 251 replaceRange(start, end, iterable) { | |
| 252 this.checkGrowable('removeRange'); | |
| 253 _internal.IterableMixinWorkaround.replaceRangeList(this, start, end, ite
rable); | |
| 254 } | |
| 255 any(f) { | |
| 256 return _internal.IterableMixinWorkaround.any(this, f); | |
| 257 } | |
| 258 every(f) { | |
| 259 return _internal.IterableMixinWorkaround.every(this, f); | |
| 260 } | |
| 261 get reversed() { | |
| 262 return new _internal.IterableMixinWorkaround().reversedList(this); | |
| 263 } | |
| 264 sort(compare) { | |
| 265 if (compare === void 0) | |
| 266 compare = null; | |
| 267 this.checkMutable('sort'); | |
| 268 _internal.IterableMixinWorkaround.sortList(this, compare); | |
| 269 } | |
| 270 shuffle(random) { | |
| 271 if (random === void 0) | |
| 272 random = null; | |
| 273 _internal.IterableMixinWorkaround.shuffleList(this, random); | |
| 274 } | |
| 275 indexOf(element, start) { | |
| 276 if (start === void 0) | |
| 277 start = 0; | |
| 278 return _internal.IterableMixinWorkaround.indexOfList(this, element, star
t); | |
| 279 } | |
| 280 lastIndexOf(element, start) { | |
| 281 if (start === void 0) | |
| 282 start = null; | |
| 283 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element,
start); | |
| 284 } | |
| 285 contains(other) { | |
| 286 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | |
| 287 if (dart.equals(this.get(i), other)) | |
| 288 return true; | |
| 289 } | |
| 290 return false; | |
| 291 } | |
| 292 get isEmpty() { | |
| 293 return this.length === 0; | |
| 294 } | |
| 295 get isNotEmpty() { | |
| 296 return !dart.notNull(this.isEmpty); | |
| 297 } | |
| 298 toString() { | |
| 299 return collection.ListBase.listToString(this); | |
| 300 } | |
| 301 toList(opt$) { | |
| 302 let growable = opt$.growable === void 0 ? true : opt$.growable; | |
| 303 if (growable) { | |
| 304 return new JSArray.markGrowable(this.slice()); | |
| 305 } else { | |
| 306 return new JSArray.markFixed(this.slice()); | |
| 307 } | |
| 308 } | |
| 309 toSet() { | |
| 310 return new core.Set.from(this); | |
| 311 } | |
| 312 get iterator() { | |
| 313 return new _internal.ListIterator(this); | |
| 314 } | |
| 315 get hashCode() { | |
| 316 return _js_helper.Primitives.objectHashCode(this); | |
| 317 } | |
| 318 get length() { | |
| 319 return dart.as(this.length, core.int); | |
| 320 } | |
| 321 set length(newLength) { | |
| 322 if (!(typeof newLength == number)) | |
| 323 throw new core.ArgumentError(newLength); | |
| 324 if (dart.notNull(newLength) < 0) | |
| 325 throw new core.RangeError.value(newLength); | |
| 326 this.checkGrowable('set length'); | |
| 327 this.length = newLength; | |
| 328 } | |
| 329 get(index) { | |
| 330 if (!(typeof index == number)) | |
| 331 throw new core.ArgumentError(index); | |
| 332 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(ind
ex) < 0) | |
| 333 throw new core.RangeError.value(index); | |
| 334 return dart.as(this[index], E); | |
| 335 } | |
| 336 set(index, value) { | |
| 337 this.checkMutable('indexed set'); | |
| 338 if (!(typeof index == number)) | |
| 339 throw new core.ArgumentError(index); | |
| 340 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(ind
ex) < 0) | |
| 341 throw new core.RangeError.value(index); | |
| 342 this[index] = value; | |
| 343 } | |
| 344 asMap() { | |
| 345 return new _internal.IterableMixinWorkaround().asMapList(this); | |
| 346 } | |
| 347 } | |
| 348 dart.defineNamedConstructor(JSArray, 'fixed'); | |
| 349 dart.defineNamedConstructor(JSArray, 'emptyGrowable'); | |
| 350 dart.defineNamedConstructor(JSArray, 'growable'); | |
| 351 dart.defineNamedConstructor(JSArray, 'typed'); | |
| 352 dart.defineNamedConstructor(JSArray, 'markFixed'); | |
| 353 dart.defineNamedConstructor(JSArray, 'markGrowable'); | |
| 354 return JSArray; | |
| 355 }); | |
| 356 let JSArray = JSArray$(dart.dynamic); | |
| 357 let JSMutableArray$ = dart.generic(function(E) { | |
| 358 class JSMutableArray extends JSArray$(E) { | |
| 359 } | |
| 360 return JSMutableArray; | |
| 361 }); | |
| 362 let JSMutableArray = JSMutableArray$(dart.dynamic); | |
| 363 let JSFixedArray$ = dart.generic(function(E) { | |
| 364 class JSFixedArray extends JSMutableArray$(E) { | |
| 365 } | |
| 366 return JSFixedArray; | |
| 367 }); | |
| 368 let JSFixedArray = JSFixedArray$(dart.dynamic); | |
| 369 let JSExtendableArray$ = dart.generic(function(E) { | |
| 370 class JSExtendableArray extends JSMutableArray$(E) { | |
| 371 } | |
| 372 return JSExtendableArray; | |
| 373 }); | |
| 374 let JSExtendableArray = JSExtendableArray$(dart.dynamic); | |
| 375 let _handleIEtoString = Symbol('_handleIEtoString'); | |
| 376 let _isInt32 = Symbol('_isInt32'); | |
| 377 let _tdivFast = Symbol('_tdivFast'); | |
| 378 let _tdivSlow = Symbol('_tdivSlow'); | |
| 379 let _shlPositive = Symbol('_shlPositive'); | |
| 380 let _shrReceiverPositive = Symbol('_shrReceiverPositive'); | |
| 381 let _shrOtherPositive = Symbol('_shrOtherPositive'); | |
| 382 let _shrBothPositive = Symbol('_shrBothPositive'); | |
| 383 class JSNumber extends Interceptor { | |
| 384 JSNumber() { | |
| 385 super.Interceptor(); | |
| 386 } | |
| 387 compareTo(b) { | |
| 388 if (!dart.is(b, core.num)) | |
| 389 throw new core.ArgumentError(b); | |
| 390 if (this['<'](b)) { | |
| 391 return -1; | |
| 392 } else if (this['>'](b)) { | |
| 393 return 1; | |
| 394 } else if (dart.equals(this, b)) { | |
| 395 if (dart.equals(this, 0)) { | |
| 396 let bIsNegative = b.isNegative; | |
| 397 if (this.isNegative === bIsNegative) | |
| 398 return 0; | |
| 399 if (this.isNegative) | |
| 400 return -1; | |
| 401 return 1; | |
| 402 } | |
| 403 return 0; | |
| 404 } else if (this.isNaN) { | |
| 405 if (b.isNaN) { | |
| 406 return 0; | |
| 407 } | |
| 408 return 1; | |
| 409 } else { | |
| 410 return -1; | |
| 411 } | |
| 412 } | |
| 413 get isNegative() { | |
| 414 return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0); | |
| 415 } | |
| 416 get isNaN() { | |
| 417 return isNaN(this); | |
| 418 } | |
| 419 get isInfinite() { | |
| 420 return this == Infinity || this == -Infinity; | |
| 421 } | |
| 422 get isFinite() { | |
| 423 return isFinite(this); | |
| 424 } | |
| 425 remainder(b) { | |
| 426 _js_helper.checkNull(b); | |
| 427 if (!dart.is(b, core.num)) | |
| 428 throw new core.ArgumentError(b); | |
| 429 return this % b; | |
| 430 } | |
| 431 abs() { | |
| 432 return Math.abs(this); | |
| 433 } | |
| 434 get sign() { | |
| 435 return this['>'](0) ? 1 : this['<'](0) ? -1 : this; | |
| 436 } | |
| 437 toInt() { | |
| 438 if (dart.notNull(this['>='](JSNumber._MIN_INT32)) && dart.notNull(this['<=
'](JSNumber._MAX_INT32))) { | |
| 439 return this | 0; | |
| 440 } | |
| 441 if (isFinite(this)) { | |
| 442 return this.truncateToDouble() + 0; | |
| 443 } | |
| 444 throw new core.UnsupportedError('' + this); | |
| 445 } | |
| 446 truncate() { | |
| 447 return this.toInt(); | |
| 448 } | |
| 449 ceil() { | |
| 450 return this.ceilToDouble().toInt(); | |
| 451 } | |
| 452 floor() { | |
| 453 return this.floorToDouble().toInt(); | |
| 454 } | |
| 455 round() { | |
| 456 return this.roundToDouble().toInt(); | |
| 457 } | |
| 458 ceilToDouble() { | |
| 459 return Math.ceil(this); | |
| 460 } | |
| 461 floorToDouble() { | |
| 462 return Math.floor(this); | |
| 463 } | |
| 464 roundToDouble() { | |
| 465 if (this['<'](0)) { | |
| 466 return -Math.round(-this); | |
| 467 } else { | |
| 468 return Math.round(this); | |
| 469 } | |
| 470 } | |
| 471 truncateToDouble() { | |
| 472 return this['<'](0) ? this.ceilToDouble() : this.floorToDouble(); | |
| 473 } | |
| 474 clamp(lowerLimit, upperLimit) { | |
| 475 if (!dart.is(lowerLimit, core.num)) | |
| 476 throw new core.ArgumentError(lowerLimit); | |
| 477 if (!dart.is(upperLimit, core.num)) | |
| 478 throw new core.ArgumentError(upperLimit); | |
| 479 if (dart.dbinary(dart.dinvoke(lowerLimit, 'compareTo', upperLimit), '>', 0
)) { | |
| 480 throw new core.ArgumentError(lowerLimit); | |
| 481 } | |
| 482 if (dart.notNull(this.compareTo(dart.as(lowerLimit, core.num))) < 0) | |
| 483 return dart.as(lowerLimit, core.num); | |
| 484 if (dart.notNull(this.compareTo(dart.as(upperLimit, core.num))) > 0) | |
| 485 return dart.as(upperLimit, core.num); | |
| 486 return this; | |
| 487 } | |
| 488 toDouble() { | |
| 489 return this; | |
| 490 } | |
| 491 toStringAsFixed(fractionDigits) { | |
| 492 _js_helper.checkInt(fractionDigits); | |
| 493 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20)
{ | |
| 494 throw new core.RangeError(fractionDigits); | |
| 495 } | |
| 496 let result = this.toFixed(fractionDigits); | |
| 497 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) | |
| 498 return `-${result}`; | |
| 499 return result; | |
| 500 } | |
| 501 toStringAsExponential(fractionDigits) { | |
| 502 if (fractionDigits === void 0) | |
| 503 fractionDigits = null; | |
| 504 let result = null; | |
| 505 if (fractionDigits !== null) { | |
| 506 _js_helper.checkInt(fractionDigits); | |
| 507 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2
0) { | |
| 508 throw new core.RangeError(fractionDigits); | |
| 509 } | |
| 510 result = this.toExponential(fractionDigits); | |
| 511 } else { | |
| 512 result = this.toExponential(); | |
| 513 } | |
| 514 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) | |
| 515 return `-${result}`; | |
| 516 return result; | |
| 517 } | |
| 518 toStringAsPrecision(precision) { | |
| 519 _js_helper.checkInt(precision); | |
| 520 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { | |
| 521 throw new core.RangeError(precision); | |
| 522 } | |
| 523 let result = this.toPrecision(precision); | |
| 524 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) | |
| 525 return `-${result}`; | |
| 526 return result; | |
| 527 } | |
| 528 toRadixString(radix) { | |
| 529 _js_helper.checkInt(radix); | |
| 530 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) | |
| 531 throw new core.RangeError(radix); | |
| 532 let result = this.toString(radix); | |
| 533 let rightParenCode = 41; | |
| 534 if (result.codeUnitAt(dart.notNull(result.length) - 1) !== rightParenCode)
{ | |
| 535 return result; | |
| 536 } | |
| 537 return _handleIEtoString(result); | |
| 538 } | |
| 539 static [_handleIEtoString](result) { | |
| 540 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); | |
| 541 if (match === null) { | |
| 542 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; | |
| 543 } | |
| 544 let result = dart.dindex(match, 1); | |
| 545 let exponent = +dart.dindex(match, 3); | |
| 546 if (dart.dindex(match, 2) !== null) { | |
| 547 result = result + dart.dindex(match, 2); | |
| 548 exponent = dart.dindex(match, 2).length; | |
| 549 } | |
| 550 return core.String['+'](result, core.String['*']("0", exponent)); | |
| 551 } | |
| 552 toString() { | |
| 553 if (dart.notNull(dart.equals(this, 0)) && 1 / this < 0) { | |
| 554 return '-0.0'; | |
| 555 } else { | |
| 556 return "" + this; | |
| 557 } | |
| 558 } | |
| 559 get hashCode() { | |
| 560 return this & 0x1FFFFFFF; | |
| 561 } | |
| 562 ['-']() { | |
| 563 return -this; | |
| 564 } | |
| 565 ['+'](other) { | |
| 566 if (!dart.is(other, core.num)) | |
| 567 throw new core.ArgumentError(other); | |
| 568 return this + other; | |
| 569 } | |
| 570 ['-'](other) { | |
| 571 if (!dart.is(other, core.num)) | |
| 572 throw new core.ArgumentError(other); | |
| 573 return this - other; | |
| 574 } | |
| 575 ['/'](other) { | |
| 576 if (!dart.is(other, core.num)) | |
| 577 throw new core.ArgumentError(other); | |
| 578 return this / other; | |
| 579 } | |
| 580 ['*'](other) { | |
| 581 if (!dart.is(other, core.num)) | |
| 582 throw new core.ArgumentError(other); | |
| 583 return this * other; | |
| 584 } | |
| 585 ['%'](other) { | |
| 586 if (!dart.is(other, core.num)) | |
| 587 throw new core.ArgumentError(other); | |
| 588 let result = this % other; | |
| 589 if (result === 0) | |
| 590 return 0; | |
| 591 if (dart.notNull(result) > 0) | |
| 592 return result; | |
| 593 if (other < 0) { | |
| 594 return dart.notNull(result) - other; | |
| 595 } else { | |
| 596 return dart.notNull(result) + other; | |
| 597 } | |
| 598 } | |
| 599 [_isInt32](value) { | |
| 600 return (value | 0) === value; | |
| 601 } | |
| 602 ['~/'](other) { | |
| 603 if (false) | |
| 604 this[_tdivFast](other); | |
| 605 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe
r)) && 0 !== other && -1 !== other) { | |
| 606 return this / other | 0; | |
| 607 } else { | |
| 608 return this[_tdivSlow](other); | |
| 609 } | |
| 610 } | |
| 611 [_tdivFast](other) { | |
| 612 return this[_isInt32](this) ? this / other | 0 : (this / other).toInt(); | |
| 613 } | |
| 614 [_tdivSlow](other) { | |
| 615 if (!dart.is(other, core.num)) | |
| 616 throw new core.ArgumentError(other); | |
| 617 return (this / other).toInt(); | |
| 618 } | |
| 619 ['<<'](other) { | |
| 620 if (!dart.is(other, core.num)) | |
| 621 throw new core.ArgumentError(other); | |
| 622 if (other < 0) | |
| 623 throw new core.ArgumentError(other); | |
| 624 return this[_shlPositive](other); | |
| 625 } | |
| 626 [_shlPositive](other) { | |
| 627 return dart.as(other > 31 ? 0 : this << other >>> 0, core.num); | |
| 628 } | |
| 629 ['>>'](other) { | |
| 630 if (false) | |
| 631 this[_shrReceiverPositive](other); | |
| 632 if (!dart.is(other, core.num)) | |
| 633 throw new core.ArgumentError(other); | |
| 634 if (other < 0) | |
| 635 throw new core.ArgumentError(other); | |
| 636 return this[_shrOtherPositive](other); | |
| 637 } | |
| 638 [_shrOtherPositive](other) { | |
| 639 return dart.as(this > 0 ? this[_shrBothPositive](other) : this >> (dart.no
tNull(other) > 31 ? 31 : other) >>> 0, core.num); | |
| 640 } | |
| 641 [_shrReceiverPositive](other) { | |
| 642 if (other < 0) | |
| 643 throw new core.ArgumentError(other); | |
| 644 return this[_shrBothPositive](other); | |
| 645 } | |
| 646 [_shrBothPositive](other) { | |
| 647 return dart.as(other > 31 ? 0 : this >>> other, core.num); | |
| 648 } | |
| 649 ['&'](other) { | |
| 650 if (!dart.is(other, core.num)) | |
| 651 throw new core.ArgumentError(other); | |
| 652 return dart.as((this & other) >>> 0, core.num); | |
| 653 } | |
| 654 ['|'](other) { | |
| 655 if (!dart.is(other, core.num)) | |
| 656 throw new core.ArgumentError(other); | |
| 657 return dart.as((this | other) >>> 0, core.num); | |
| 658 } | |
| 659 ['^'](other) { | |
| 660 if (!dart.is(other, core.num)) | |
| 661 throw new core.ArgumentError(other); | |
| 662 return dart.as((this ^ other) >>> 0, core.num); | |
| 663 } | |
| 664 ['<'](other) { | |
| 665 if (!dart.is(other, core.num)) | |
| 666 throw new core.ArgumentError(other); | |
| 667 return this < other; | |
| 668 } | |
| 669 ['>'](other) { | |
| 670 if (!dart.is(other, core.num)) | |
| 671 throw new core.ArgumentError(other); | |
| 672 return this > other; | |
| 673 } | |
| 674 ['<='](other) { | |
| 675 if (!dart.is(other, core.num)) | |
| 676 throw new core.ArgumentError(other); | |
| 677 return this <= other; | |
| 678 } | |
| 679 ['>='](other) { | |
| 680 if (!dart.is(other, core.num)) | |
| 681 throw new core.ArgumentError(other); | |
| 682 return this >= other; | |
| 683 } | |
| 684 get runtimeType() { | |
| 685 return core.num; | |
| 686 } | |
| 687 } | |
| 688 JSNumber._MIN_INT32 = -2147483648; | |
| 689 JSNumber._MAX_INT32 = 2147483647; | |
| 690 let _bitCount = Symbol('_bitCount'); | |
| 691 let _shru = Symbol('_shru'); | |
| 692 let _shrs = Symbol('_shrs'); | |
| 693 let _ors = Symbol('_ors'); | |
| 694 let _spread = Symbol('_spread'); | |
| 695 class JSInt extends JSNumber { | |
| 696 JSInt() { | |
| 697 super.JSNumber(); | |
| 698 } | |
| 699 get isEven() { | |
| 700 return this['&'](1) === 0; | |
| 701 } | |
| 702 get isOdd() { | |
| 703 return this['&'](1) === 1; | |
| 704 } | |
| 705 toUnsigned(width) { | |
| 706 return this['&']((1 << dart.notNull(width)) - 1); | |
| 707 } | |
| 708 toSigned(width) { | |
| 709 let signMask = 1 << dart.notNull(width) - 1; | |
| 710 return dart.notNull(this['&'](dart.notNull(signMask) - 1)) - dart.notNull(
this['&'](signMask)); | |
| 711 } | |
| 712 get bitLength() { | |
| 713 let nonneg = this['<'](0) ? dart.notNull(this['unary-']()) - 1 : this; | |
| 714 if (dart.notNull(nonneg) >= 4294967296) { | |
| 715 nonneg = (dart.notNull(nonneg) / 4294967296).truncate(); | |
| 716 return dart.notNull(_bitCount(_spread(nonneg))) + 32; | |
| 717 } | |
| 718 return _bitCount(_spread(nonneg)); | |
| 719 } | |
| 720 static [_bitCount](i) { | |
| 721 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&',
1431655765)), core.int); | |
| 722 i = (dart.notNull(i) & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 8589
93459)); | |
| 723 i = 252645135 & i['+'](_shru(i, 4)); | |
| 724 i = dart.as(_shru(i, 8), core.int); | |
| 725 i = dart.as(_shru(i, 16), core.int); | |
| 726 return dart.notNull(i) & 63; | |
| 727 } | |
| 728 static [_shru](value, shift) { | |
| 729 return value >>> shift; | |
| 730 } | |
| 731 static [_shrs](value, shift) { | |
| 732 return value >> shift; | |
| 733 } | |
| 734 static [_ors](a, b) { | |
| 735 return a | b; | |
| 736 } | |
| 737 static [_spread](i) { | |
| 738 i = dart.as(_ors(i, dart.as(_shrs(i, 1), core.int)), core.int); | |
| 739 i = dart.as(_ors(i, dart.as(_shrs(i, 2), core.int)), core.int); | |
| 740 i = dart.as(_ors(i, dart.as(_shrs(i, 4), core.int)), core.int); | |
| 741 i = dart.as(_ors(i, dart.as(_shrs(i, 8), core.int)), core.int); | |
| 742 i = dart.as(_shru(dart.as(_ors(i, dart.as(_shrs(i, 16), core.int)), core.i
nt), 0), core.int); | |
| 743 return i; | |
| 744 } | |
| 745 get runtimeType() { | |
| 746 return core.int; | |
| 747 } | |
| 748 ['~']() { | |
| 749 return dart.as(~this >>> 0, core.int); | |
| 750 } | |
| 751 } | |
| 752 class JSDouble extends JSNumber { | |
| 753 JSDouble() { | |
| 754 super.JSNumber(); | |
| 755 } | |
| 756 get runtimeType() { | |
| 757 return core.double; | |
| 758 } | |
| 759 } | |
| 760 class JSPositiveInt extends JSInt { | |
| 761 } | |
| 762 class JSUInt32 extends JSPositiveInt { | |
| 763 } | |
| 764 class JSUInt31 extends JSUInt32 { | |
| 765 } | |
| 766 let _defaultSplit = Symbol('_defaultSplit'); | |
| 767 let _isWhitespace = Symbol('_isWhitespace'); | |
| 768 let _skipLeadingWhitespace = Symbol('_skipLeadingWhitespace'); | |
| 769 let _skipTrailingWhitespace = Symbol('_skipTrailingWhitespace'); | |
| 770 class JSString extends Interceptor { | |
| 771 JSString() { | |
| 772 super.Interceptor(); | |
| 773 } | |
| 774 codeUnitAt(index) { | |
| 775 if (!(typeof index == number)) | |
| 776 throw new core.ArgumentError(index); | |
| 777 if (dart.notNull(index) < 0) | |
| 778 throw new core.RangeError.value(index); | |
| 779 if (dart.notNull(index) >= dart.notNull(this.length)) | |
| 780 throw new core.RangeError.value(index); | |
| 781 return dart.as(this.charCodeAt(index), core.int); | |
| 782 } | |
| 783 allMatches(string, start) { | |
| 784 if (start === void 0) | |
| 785 start = 0; | |
| 786 _js_helper.checkString(string); | |
| 787 _js_helper.checkInt(start); | |
| 788 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string.l
ength)) { | |
| 789 throw new core.RangeError.range(start, 0, string.length); | |
| 790 } | |
| 791 return _js_helper.allMatchesInStringUnchecked(this, string, start); | |
| 792 } | |
| 793 matchAsPrefix(string, start) { | |
| 794 if (start === void 0) | |
| 795 start = 0; | |
| 796 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { | |
| 797 throw new core.RangeError.range(start, 0, string.length); | |
| 798 } | |
| 799 if (dart.notNull(start) + dart.notNull(this.length) > dart.notNull(string.
length)) | |
| 800 return null; | |
| 801 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notN
ull(i) + 1) { | |
| 802 if (string.codeUnitAt(dart.notNull(start) + dart.notNull(i)) !== this.co
deUnitAt(i)) { | |
| 803 return null; | |
| 804 } | |
| 805 } | |
| 806 return new _js_helper.StringMatch(start, string, this); | |
| 807 } | |
| 808 ['+'](other) { | |
| 809 if (!(typeof other == string)) | |
| 810 throw new core.ArgumentError(other); | |
| 811 return this + other; | |
| 812 } | |
| 813 endsWith(other) { | |
| 814 _js_helper.checkString(other); | |
| 815 let otherLength = other.length; | |
| 816 if (dart.notNull(otherLength) > dart.notNull(this.length)) | |
| 817 return false; | |
| 818 return dart.equals(other, this.substring(dart.notNull(this.length) - dart.
notNull(otherLength))); | |
| 819 } | |
| 820 replaceAll(from, to) { | |
| 821 _js_helper.checkString(to); | |
| 822 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core.
String); | |
| 823 } | |
| 824 replaceAllMapped(from, convert) { | |
| 825 return this.splitMapJoin(from, {onMatch: convert}); | |
| 826 } | |
| 827 splitMapJoin(from, opt$) { | |
| 828 let onMatch = opt$.onMatch === void 0 ? null : opt$.onMatch; | |
| 829 let onNonMatch = opt$.onNonMatch === void 0 ? null : opt$.onNonMatch; | |
| 830 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc
h, onNonMatch), core.String); | |
| 831 } | |
| 832 replaceFirst(from, to, startIndex) { | |
| 833 if (startIndex === void 0) | |
| 834 startIndex = 0; | |
| 835 _js_helper.checkString(to); | |
| 836 _js_helper.checkInt(startIndex); | |
| 837 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this.length)) { | |
| 838 throw new core.RangeError.range(startIndex, 0, this.length); | |
| 839 } | |
| 840 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); | |
| 841 } | |
| 842 split(pattern) { | |
| 843 _js_helper.checkNull(pattern); | |
| 844 if (typeof pattern == string) { | |
| 845 return dart.as(this.split(pattern), core.List$(core.String)); | |
| 846 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && _j
s_helper.regExpCaptureCount(pattern) === 0) { | |
| 847 let re = _js_helper.regExpGetNative(pattern); | |
| 848 return dart.as(this.split(re), core.List$(core.String)); | |
| 849 } else { | |
| 850 return this[_defaultSplit](pattern); | |
| 851 } | |
| 852 } | |
| 853 [_defaultSplit](pattern) { | |
| 854 let result = new List.from([]); | |
| 855 let start = 0; | |
| 856 let length = 1; | |
| 857 for (let match of pattern.allMatches(this)) { | |
| 858 let matchStart = dart.as(dart.dload(match, 'start'), core.int); | |
| 859 let matchEnd = dart.as(dart.dload(match, 'end'), core.int); | |
| 860 length = dart.notNull(matchEnd) - dart.notNull(matchStart); | |
| 861 if (length === 0 && start === matchStart) { | |
| 862 continue; | |
| 863 } | |
| 864 let end = matchStart; | |
| 865 result.add(this.substring(start, end)); | |
| 866 start = matchEnd; | |
| 867 } | |
| 868 if (dart.notNull(start) < dart.notNull(this.length) || dart.notNull(length
) > 0) { | |
| 869 result.add(this.substring(start)); | |
| 870 } | |
| 871 return result; | |
| 872 } | |
| 873 startsWith(pattern, index) { | |
| 874 if (index === void 0) | |
| 875 index = 0; | |
| 876 _js_helper.checkInt(index); | |
| 877 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.len
gth)) { | |
| 878 throw new core.RangeError.range(index, 0, this.length); | |
| 879 } | |
| 880 if (typeof pattern == string) { | |
| 881 let other = pattern; | |
| 882 let otherLength = other.length; | |
| 883 let endIndex = dart.notNull(index) + dart.notNull(otherLength); | |
| 884 if (dart.notNull(endIndex) > dart.notNull(this.length)) | |
| 885 return false; | |
| 886 return dart.equals(other, this.substring(index, endIndex)); | |
| 887 } | |
| 888 return pattern.matchAsPrefix(this, index) !== null; | |
| 889 } | |
| 890 substring(startIndex, endIndex) { | |
| 891 if (endIndex === void 0) | |
| 892 endIndex = null; | |
| 893 _js_helper.checkInt(startIndex); | |
| 894 if (endIndex === null) | |
| 895 endIndex = this.length; | |
| 896 _js_helper.checkInt(endIndex); | |
| 897 if (dart.notNull(startIndex) < 0) | |
| 898 throw new core.RangeError.value(startIndex); | |
| 899 if (dart.notNull(startIndex) > dart.notNull(endIndex)) | |
| 900 throw new core.RangeError.value(startIndex); | |
| 901 if (dart.notNull(endIndex) > dart.notNull(this.length)) | |
| 902 throw new core.RangeError.value(endIndex); | |
| 903 return this.substring(startIndex, endIndex); | |
| 904 } | |
| 905 toLowerCase() { | |
| 906 return this.toLowerCase(); | |
| 907 } | |
| 908 toUpperCase() { | |
| 909 return this.toUpperCase(); | |
| 910 } | |
| 911 static [_isWhitespace](codeUnit) { | |
| 912 if (dart.notNull(codeUnit) < 256) { | |
| 913 switch (codeUnit) { | |
| 914 case 9: | |
| 915 case 10: | |
| 916 case 11: | |
| 917 case 12: | |
| 918 case 13: | |
| 919 case 32: | |
| 920 case 133: | |
| 921 case 160: | |
| 922 return true; | |
| 923 default: | |
| 924 return false; | |
| 925 } | |
| 926 } | |
| 927 switch (codeUnit) { | |
| 928 case 5760: | |
| 929 case 6158: | |
| 930 case 8192: | |
| 931 case 8193: | |
| 932 case 8194: | |
| 933 case 8195: | |
| 934 case 8196: | |
| 935 case 8197: | |
| 936 case 8198: | |
| 937 case 8199: | |
| 938 case 8200: | |
| 939 case 8201: | |
| 940 case 8202: | |
| 941 case 8232: | |
| 942 case 8233: | |
| 943 case 8239: | |
| 944 case 8287: | |
| 945 case 12288: | |
| 946 case 65279: | |
| 947 return true; | |
| 948 default: | |
| 949 return false; | |
| 950 } | |
| 951 } | |
| 952 static [_skipLeadingWhitespace](string, index) { | |
| 953 let SPACE = 32; | |
| 954 let CARRIAGE_RETURN = 13; | |
| 955 while (dart.notNull(index) < dart.notNull(string.length)) { | |
| 956 let codeUnit = string.codeUnitAt(index); | |
| 957 if (codeUnit !== SPACE && codeUnit !== CARRIAGE_RETURN && !dart.notNull(
_isWhitespace(codeUnit))) { | |
| 958 break; | |
| 959 } | |
| 960 index = dart.notNull(index) + 1; | |
| 961 } | |
| 962 return index; | |
| 963 } | |
| 964 static [_skipTrailingWhitespace](string, index) { | |
| 965 let SPACE = 32; | |
| 966 let CARRIAGE_RETURN = 13; | |
| 967 while (dart.notNull(index) > 0) { | |
| 968 let codeUnit = string.codeUnitAt(dart.notNull(index) - 1); | |
| 969 if (codeUnit !== SPACE && codeUnit !== CARRIAGE_RETURN && !dart.notNull(
_isWhitespace(codeUnit))) { | |
| 970 break; | |
| 971 } | |
| 972 index = dart.notNull(index) - 1; | |
| 973 } | |
| 974 return index; | |
| 975 } | |
| 976 trim() { | |
| 977 let NEL = 133; | |
| 978 let result = this.trim(); | |
| 979 if (result.length === 0) | |
| 980 return result; | |
| 981 let firstCode = result.codeUnitAt(0); | |
| 982 let startIndex = 0; | |
| 983 if (firstCode === NEL) { | |
| 984 startIndex = _skipLeadingWhitespace(result, 1); | |
| 985 if (startIndex === result.length) | |
| 986 return ""; | |
| 987 } | |
| 988 let endIndex = result.length; | |
| 989 let lastCode = result.codeUnitAt(dart.notNull(endIndex) - 1); | |
| 990 if (lastCode === NEL) { | |
| 991 endIndex = _skipTrailingWhitespace(result, dart.notNull(endIndex) - 1); | |
| 992 } | |
| 993 if (startIndex === 0 && endIndex === result.length) | |
| 994 return result; | |
| 995 return result.substring(startIndex, endIndex); | |
| 996 } | |
| 997 trimLeft() { | |
| 998 let NEL = 133; | |
| 999 let result = null; | |
| 1000 let startIndex = 0; | |
| 1001 if (typeof this.trimLeft != "undefined") { | |
| 1002 result = this.trimLeft(); | |
| 1003 if (result.length === 0) | |
| 1004 return result; | |
| 1005 let firstCode = result.codeUnitAt(0); | |
| 1006 if (firstCode === NEL) { | |
| 1007 startIndex = _skipLeadingWhitespace(result, 1); | |
| 1008 } | |
| 1009 } else { | |
| 1010 result = this; | |
| 1011 startIndex = _skipLeadingWhitespace(this, 0); | |
| 1012 } | |
| 1013 if (startIndex === 0) | |
| 1014 return result; | |
| 1015 if (startIndex === result.length) | |
| 1016 return ""; | |
| 1017 return result.substring(startIndex); | |
| 1018 } | |
| 1019 trimRight() { | |
| 1020 let NEL = 133; | |
| 1021 let result = null; | |
| 1022 let endIndex = null; | |
| 1023 if (typeof this.trimRight != "undefined") { | |
| 1024 result = this.trimRight(); | |
| 1025 endIndex = result.length; | |
| 1026 if (endIndex === 0) | |
| 1027 return result; | |
| 1028 let lastCode = result.codeUnitAt(dart.notNull(endIndex) - 1); | |
| 1029 if (lastCode === NEL) { | |
| 1030 endIndex = _skipTrailingWhitespace(result, dart.notNull(endIndex) - 1)
; | |
| 1031 } | |
| 1032 } else { | |
| 1033 result = this; | |
| 1034 endIndex = _skipTrailingWhitespace(this, this.length); | |
| 1035 } | |
| 1036 if (endIndex === result.length) | |
| 1037 return result; | |
| 1038 if (endIndex === 0) | |
| 1039 return ""; | |
| 1040 return result.substring(0, endIndex); | |
| 1041 } | |
| 1042 ['*'](times) { | |
| 1043 if (0 >= dart.notNull(times)) | |
| 1044 return ''; | |
| 1045 if (times === 1 || this.length === 0) | |
| 1046 return this; | |
| 1047 if (times !== times >>> 0) { | |
| 1048 throw new core.OutOfMemoryError(); | |
| 1049 } | |
| 1050 let result = ''; | |
| 1051 let s = this; | |
| 1052 while (true) { | |
| 1053 if ((dart.notNull(times) & 1) === 1) | |
| 1054 result = s['+'](result); | |
| 1055 times = dart.as(times >>> 1, core.int); | |
| 1056 if (times === 0) | |
| 1057 break; | |
| 1058 s = s; | |
| 1059 } | |
| 1060 return result; | |
| 1061 } | |
| 1062 padLeft(width, padding) { | |
| 1063 if (padding === void 0) | |
| 1064 padding = ' '; | |
| 1065 let delta = dart.notNull(width) - dart.notNull(this.length); | |
| 1066 if (dart.notNull(delta) <= 0) | |
| 1067 return this; | |
| 1068 return core.String['+'](core.String['*'](padding, delta), this); | |
| 1069 } | |
| 1070 padRight(width, padding) { | |
| 1071 if (padding === void 0) | |
| 1072 padding = ' '; | |
| 1073 let delta = dart.notNull(width) - dart.notNull(this.length); | |
| 1074 if (dart.notNull(delta) <= 0) | |
| 1075 return this; | |
| 1076 return this['+'](core.String['*'](padding, delta)); | |
| 1077 } | |
| 1078 get codeUnits() { | |
| 1079 return new _CodeUnits(this); | |
| 1080 } | |
| 1081 get runes() { | |
| 1082 return new core.Runes(this); | |
| 1083 } | |
| 1084 indexOf(pattern, start) { | |
| 1085 if (start === void 0) | |
| 1086 start = 0; | |
| 1087 _js_helper.checkNull(pattern); | |
| 1088 if (!(typeof start == number)) | |
| 1089 throw new core.ArgumentError(start); | |
| 1090 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.len
gth)) { | |
| 1091 throw new core.RangeError.range(start, 0, this.length); | |
| 1092 } | |
| 1093 if (typeof pattern == string) { | |
| 1094 return this.indexOf(pattern, start); | |
| 1095 } | |
| 1096 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { | |
| 1097 let re = pattern; | |
| 1098 let match = _js_helper.firstMatchAfter(re, this, start); | |
| 1099 return match === null ? -1 : match.start; | |
| 1100 } | |
| 1101 for (let i = start; dart.notNull(i) <= dart.notNull(this.length); i = dart
.notNull(i) + 1) { | |
| 1102 if (pattern.matchAsPrefix(this, i) !== null) | |
| 1103 return i; | |
| 1104 } | |
| 1105 return -1; | |
| 1106 } | |
| 1107 lastIndexOf(pattern, start) { | |
| 1108 if (start === void 0) | |
| 1109 start = null; | |
| 1110 _js_helper.checkNull(pattern); | |
| 1111 if (start === null) { | |
| 1112 start = this.length; | |
| 1113 } else if (!(typeof start == number)) { | |
| 1114 throw new core.ArgumentError(start); | |
| 1115 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t
his.length)) { | |
| 1116 throw new core.RangeError.range(start, 0, this.length); | |
| 1117 } | |
| 1118 if (typeof pattern == string) { | |
| 1119 let other = pattern; | |
| 1120 if (dart.notNull(start) + dart.notNull(other.length) > dart.notNull(this
.length)) { | |
| 1121 start = dart.notNull(this.length) - dart.notNull(other.length); | |
| 1122 } | |
| 1123 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start)
, core.int); | |
| 1124 } | |
| 1125 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { | |
| 1126 if (pattern.matchAsPrefix(this, i) !== null) | |
| 1127 return i; | |
| 1128 } | |
| 1129 return -1; | |
| 1130 } | |
| 1131 contains(other, startIndex) { | |
| 1132 if (startIndex === void 0) | |
| 1133 startIndex = 0; | |
| 1134 _js_helper.checkNull(other); | |
| 1135 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this.length)) { | |
| 1136 throw new core.RangeError.range(startIndex, 0, this.length); | |
| 1137 } | |
| 1138 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex)
, core.bool); | |
| 1139 } | |
| 1140 get isEmpty() { | |
| 1141 return this.length === 0; | |
| 1142 } | |
| 1143 get isNotEmpty() { | |
| 1144 return !dart.notNull(this.isEmpty); | |
| 1145 } | |
| 1146 compareTo(other) { | |
| 1147 if (!(typeof other == string)) | |
| 1148 throw new core.ArgumentError(other); | |
| 1149 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; | |
| 1150 } | |
| 1151 toString() { | |
| 1152 return this; | |
| 1153 } | |
| 1154 get hashCode() { | |
| 1155 let hash = 0; | |
| 1156 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notN
ull(i) + 1) { | |
| 1157 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); | |
| 1158 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <
< 10); | |
| 1159 hash = hash ^ hash >> 6; | |
| 1160 } | |
| 1161 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); | |
| 1162 hash = hash ^ hash >> 11; | |
| 1163 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); | |
| 1164 } | |
| 1165 get runtimeType() { | |
| 1166 return core.String; | |
| 1167 } | |
| 1168 get length() { | |
| 1169 return this.length; | |
| 1170 } | |
| 1171 get(index) { | |
| 1172 if (!(typeof index == number)) | |
| 1173 throw new core.ArgumentError(index); | |
| 1174 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(index
) < 0) | |
| 1175 throw new core.RangeError.value(index); | |
| 1176 return this[index]; | |
| 1177 } | |
| 1178 } | |
| 1179 let _string = Symbol('_string'); | |
| 1180 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { | |
| 1181 _CodeUnits($_string) { | |
| 1182 this[_string] = $_string; | |
| 1183 super.UnmodifiableListBase(); | |
| 1184 } | |
| 1185 get length() { | |
| 1186 return this[_string].length; | |
| 1187 } | |
| 1188 get(i) { | |
| 1189 return this[_string].codeUnitAt(i); | |
| 1190 } | |
| 1191 } | |
| 1192 // Function _symbolToString: (Symbol) → String | |
| 1193 function _symbolToString(symbol) { | |
| 1194 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); | |
| 1195 } | |
| 1196 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic | |
| 1197 function _symbolMapToStringMap(map) { | |
| 1198 if (map === null) | |
| 1199 return null; | |
| 1200 let result = new core.Map(); | |
| 1201 map.forEach((key, value) => { | |
| 1202 result.set(_symbolToString(key), value); | |
| 1203 }); | |
| 1204 return result; | |
| 1205 } | |
| 1206 // Function getInterceptor: (dynamic) → dynamic | |
| 1207 function getInterceptor(object) { | |
| 1208 return void 0; | |
| 1209 } | |
| 1210 // Function getDispatchProperty: (dynamic) → dynamic | |
| 1211 function getDispatchProperty(object) { | |
| 1212 return object[_foreign_helper.JS_EMBEDDED_GLOBAL('String', _js_embedded_name
s.DISPATCH_PROPERTY_NAME)]; | |
| 1213 } | |
| 1214 // Function setDispatchProperty: (dynamic, dynamic) → dynamic | |
| 1215 function setDispatchProperty(object, value) { | |
| 1216 _js_helper.defineProperty(object, dart.as(_foreign_helper.JS_EMBEDDED_GLOBAL
('String', _js_embedded_names.DISPATCH_PROPERTY_NAME), core.String), value); | |
| 1217 } | |
| 1218 // Function makeDispatchRecord: (dynamic, dynamic, dynamic, dynamic) → dynamic | |
| 1219 function makeDispatchRecord(interceptor, proto, extension, indexability) { | |
| 1220 return {i: interceptor, p: proto, e: extension, x: indexability}; | |
| 1221 } | |
| 1222 // Function dispatchRecordInterceptor: (dynamic) → dynamic | |
| 1223 function dispatchRecordInterceptor(record) { | |
| 1224 return record.i; | |
| 1225 } | |
| 1226 // Function dispatchRecordProto: (dynamic) → dynamic | |
| 1227 function dispatchRecordProto(record) { | |
| 1228 return record.p; | |
| 1229 } | |
| 1230 // Function dispatchRecordExtension: (dynamic) → dynamic | |
| 1231 function dispatchRecordExtension(record) { | |
| 1232 return record.e; | |
| 1233 } | |
| 1234 // Function dispatchRecordIndexability: (dynamic) → dynamic | |
| 1235 function dispatchRecordIndexability(record) { | |
| 1236 return record.x; | |
| 1237 } | |
| 1238 // Function getNativeInterceptor: (dynamic) → dynamic | |
| 1239 function getNativeInterceptor(object) { | |
| 1240 let record = getDispatchProperty(object); | |
| 1241 if (record === null) { | |
| 1242 if (_js_helper.initNativeDispatchFlag === null) { | |
| 1243 _js_helper.initNativeDispatch(); | |
| 1244 record = getDispatchProperty(object); | |
| 1245 } | |
| 1246 } | |
| 1247 if (record !== null) { | |
| 1248 let proto = dispatchRecordProto(record); | |
| 1249 if (false === proto) | |
| 1250 return dispatchRecordInterceptor(record); | |
| 1251 if (true === proto) | |
| 1252 return object; | |
| 1253 let objectProto = Object.getPrototypeOf(object); | |
| 1254 if (proto === objectProto) { | |
| 1255 return dispatchRecordInterceptor(record); | |
| 1256 } | |
| 1257 let extension = dispatchRecordExtension(record); | |
| 1258 if (extension === objectProto) { | |
| 1259 let discriminatedTag = proto(object, record); | |
| 1260 throw new core.UnimplementedError(`Return interceptor for ${discriminate
dTag}`); | |
| 1261 } | |
| 1262 } | |
| 1263 let interceptor = _js_helper.lookupAndCacheInterceptor(object); | |
| 1264 if (interceptor === null) { | |
| 1265 let proto = Object.getPrototypeOf(object); | |
| 1266 if (proto == null || proto === Object.prototype) { | |
| 1267 return _foreign_helper.JS_INTERCEPTOR_CONSTANT(PlainJavaScriptObject); | |
| 1268 } else { | |
| 1269 return _foreign_helper.JS_INTERCEPTOR_CONSTANT(UnknownJavaScriptObject); | |
| 1270 } | |
| 1271 } | |
| 1272 return interceptor; | |
| 1273 } | |
| 1274 dart.copyProperties(exports, { | |
| 1275 get mapTypeToInterceptor() { | |
| 1276 return _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MAP_TYPE_
TO_INTERCEPTOR); | |
| 1277 } | |
| 1278 }); | |
| 1279 // Function findIndexForNativeSubclassType: (Type) → int | |
| 1280 function findIndexForNativeSubclassType(type) { | |
| 1281 if (exports.mapTypeToInterceptor == null) | |
| 1282 return null; | |
| 1283 let map = dart.as(exports.mapTypeToInterceptor, core.List); | |
| 1284 for (let i = 0; dart.notNull(i) + 1 < dart.notNull(map.length); i = 3) { | |
| 1285 if (dart.equals(type, map.get(i))) { | |
| 1286 return i; | |
| 1287 } | |
| 1288 } | |
| 1289 return null; | |
| 1290 } | |
| 1291 // Function findInterceptorConstructorForType: (Type) → dynamic | |
| 1292 function findInterceptorConstructorForType(type) { | |
| 1293 let index = findIndexForNativeSubclassType(type); | |
| 1294 if (index === null) | |
| 1295 return null; | |
| 1296 let map = dart.as(exports.mapTypeToInterceptor, core.List); | |
| 1297 return map.get(dart.notNull(index) + 1); | |
| 1298 } | |
| 1299 // Function findConstructorForNativeSubclassType: (Type, String) → dynamic | |
| 1300 function findConstructorForNativeSubclassType(type, name) { | |
| 1301 let index = findIndexForNativeSubclassType(type); | |
| 1302 if (index === null) | |
| 1303 return null; | |
| 1304 let map = dart.as(exports.mapTypeToInterceptor, core.List); | |
| 1305 let constructorMap = map.get(dart.notNull(index) + 2); | |
| 1306 let constructorFn = constructorMap[name]; | |
| 1307 return constructorFn; | |
| 1308 } | |
| 1309 // Function findInterceptorForType: (Type) → dynamic | |
| 1310 function findInterceptorForType(type) { | |
| 1311 let constructor = findInterceptorConstructorForType(type); | |
| 1312 if (constructor === null) | |
| 1313 return null; | |
| 1314 return constructor.prototype; | |
| 1315 } | |
| 1316 class JSBool extends Interceptor { | |
| 1317 JSBool() { | |
| 1318 super.Interceptor(); | |
| 1319 } | |
| 1320 toString() { | |
| 1321 return String(this); | |
| 1322 } | |
| 1323 get hashCode() { | |
| 1324 return this ? 2 * 3 * 23 * 3761 : 269 * 811; | |
| 1325 } | |
| 1326 get runtimeType() { | |
| 1327 return core.bool; | |
| 1328 } | |
| 1329 } | |
| 1330 class JSNull extends Interceptor { | |
| 1331 JSNull() { | |
| 1332 super.Interceptor(); | |
| 1333 } | |
| 1334 ['=='](other) { | |
| 1335 return core.identical(null, other); | |
| 1336 } | |
| 1337 toString() { | |
| 1338 return 'null'; | |
| 1339 } | |
| 1340 get hashCode() { | |
| 1341 return 0; | |
| 1342 } | |
| 1343 get runtimeType() { | |
| 1344 return core.Null; | |
| 1345 } | |
| 1346 noSuchMethod(invocation) { | |
| 1347 return super.noSuchMethod(invocation); | |
| 1348 } | |
| 1349 } | |
| 1350 class JSIndexable extends core.Object { | |
| 1351 } | |
| 1352 class JSMutableIndexable extends JSIndexable { | |
| 1353 } | |
| 1354 class JSObject extends core.Object { | |
| 1355 } | |
| 1356 class JavaScriptObject extends Interceptor { | |
| 1357 JavaScriptObject() { | |
| 1358 super.Interceptor(); | |
| 1359 } | |
| 1360 get hashCode() { | |
| 1361 return 0; | |
| 1362 } | |
| 1363 get runtimeType() { | |
| 1364 return JSObject; | |
| 1365 } | |
| 1366 } | |
| 1367 class PlainJavaScriptObject extends JavaScriptObject { | |
| 1368 PlainJavaScriptObject() { | |
| 1369 super.JavaScriptObject(); | |
| 1370 } | |
| 1371 } | |
| 1372 class UnknownJavaScriptObject extends JavaScriptObject { | |
| 1373 UnknownJavaScriptObject() { | |
| 1374 super.JavaScriptObject(); | |
| 1375 } | |
| 1376 toString() { | |
| 1377 return String(this); | |
| 1378 } | |
| 1379 } | |
| 1380 // Exports: | |
| 1381 exports.JSArray = JSArray; | |
| 1382 exports.JSArray$ = JSArray$; | |
| 1383 exports.Interceptor = Interceptor; | |
| 1384 exports.JSMutableArray = JSMutableArray; | |
| 1385 exports.JSMutableArray$ = JSMutableArray$; | |
| 1386 exports.JSFixedArray = JSFixedArray; | |
| 1387 exports.JSFixedArray$ = JSFixedArray$; | |
| 1388 exports.JSExtendableArray = JSExtendableArray; | |
| 1389 exports.JSExtendableArray$ = JSExtendableArray$; | |
| 1390 exports.JSNumber = JSNumber; | |
| 1391 exports.JSInt = JSInt; | |
| 1392 exports.JSDouble = JSDouble; | |
| 1393 exports.JSPositiveInt = JSPositiveInt; | |
| 1394 exports.JSUInt32 = JSUInt32; | |
| 1395 exports.JSUInt31 = JSUInt31; | |
| 1396 exports.JSString = JSString; | |
| 1397 exports.getInterceptor = getInterceptor; | |
| 1398 exports.getDispatchProperty = getDispatchProperty; | |
| 1399 exports.setDispatchProperty = setDispatchProperty; | |
| 1400 exports.makeDispatchRecord = makeDispatchRecord; | |
| 1401 exports.dispatchRecordInterceptor = dispatchRecordInterceptor; | |
| 1402 exports.dispatchRecordProto = dispatchRecordProto; | |
| 1403 exports.dispatchRecordExtension = dispatchRecordExtension; | |
| 1404 exports.dispatchRecordIndexability = dispatchRecordIndexability; | |
| 1405 exports.getNativeInterceptor = getNativeInterceptor; | |
| 1406 exports.mapTypeToInterceptor = mapTypeToInterceptor; | |
| 1407 exports.findIndexForNativeSubclassType = findIndexForNativeSubclassType; | |
| 1408 exports.findInterceptorConstructorForType = findInterceptorConstructorForType; | |
| 1409 exports.findConstructorForNativeSubclassType = findConstructorForNativeSubclas
sType; | |
| 1410 exports.findInterceptorForType = findInterceptorForType; | |
| 1411 exports.JSBool = JSBool; | |
| 1412 exports.JSNull = JSNull; | |
| 1413 exports.JSIndexable = JSIndexable; | |
| 1414 exports.JSMutableIndexable = JSMutableIndexable; | |
| 1415 exports.JSObject = JSObject; | |
| 1416 exports.JavaScriptObject = JavaScriptObject; | |
| 1417 exports.PlainJavaScriptObject = PlainJavaScriptObject; | |
| 1418 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; | |
| 1419 })(_interceptors || (_interceptors = {})); | |
| OLD | NEW |