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