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