| OLD | NEW |
| 1 dart.library('dart/_interceptors', null, /* Imports */[ | 1 dart.library('dart/_interceptors', null, /* Imports */[ |
| 2 'dart/core', | 2 'dart/core', |
| 3 'dart/_internal', | 3 'dart/_internal', |
| 4 'dart/collection', | 4 'dart/collection', |
| 5 'dart/math' | 5 'dart/math' |
| 6 ], /* Lazy imports */[ | 6 ], /* Lazy imports */[ |
| 7 'dart/_js_helper' | 7 'dart/_js_helper' |
| 8 ], function(exports, core, _internal, collection, math, _js_helper) { | 8 ], function(exports, core, _internal, collection, math, _js_helper) { |
| 9 'use strict'; | 9 'use strict'; |
| 10 let JSArray$ = dart.generic(function(E) { | 10 let JSArray$ = dart.generic(function(E) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 [dartx.add](value) { | 90 [dartx.add](value) { |
| 91 dart.as(value, E); | 91 dart.as(value, E); |
| 92 this[dartx.checkGrowable]('add'); | 92 this[dartx.checkGrowable]('add'); |
| 93 this.push(value); | 93 this.push(value); |
| 94 } | 94 } |
| 95 [dartx.removeAt](index) { | 95 [dartx.removeAt](index) { |
| 96 if (!(typeof index == 'number')) | 96 if (!(typeof index == 'number')) |
| 97 throw new core.ArgumentError(index); | 97 throw new core.ArgumentError(index); |
| 98 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this.
length)) { | 98 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[
dartx.length])) { |
| 99 throw new core.RangeError.value(index); | 99 throw new core.RangeError.value(index); |
| 100 } | 100 } |
| 101 this[dartx.checkGrowable]('removeAt'); | 101 this[dartx.checkGrowable]('removeAt'); |
| 102 return this.splice(index, 1)[0]; | 102 return this.splice(index, 1)[0]; |
| 103 } | 103 } |
| 104 [dartx.insert](index, value) { | 104 [dartx.insert](index, value) { |
| 105 dart.as(value, E); | 105 dart.as(value, E); |
| 106 if (!(typeof index == 'number')) | 106 if (!(typeof index == 'number')) |
| 107 throw new core.ArgumentError(index); | 107 throw new core.ArgumentError(index); |
| 108 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.l
ength)) { | 108 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[d
artx.length])) { |
| 109 throw new core.RangeError.value(index); | 109 throw new core.RangeError.value(index); |
| 110 } | 110 } |
| 111 this[dartx.checkGrowable]('insert'); | 111 this[dartx.checkGrowable]('insert'); |
| 112 this.splice(index, 0, value); | 112 this.splice(index, 0, value); |
| 113 } | 113 } |
| 114 [dartx.insertAll](index, iterable) { | 114 [dartx.insertAll](index, iterable) { |
| 115 dart.as(iterable, core.Iterable$(E)); | 115 dart.as(iterable, core.Iterable$(E)); |
| 116 this[dartx.checkGrowable]('insertAll'); | 116 this[dartx.checkGrowable]('insertAll'); |
| 117 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); | 117 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); |
| 118 } | 118 } |
| 119 [dartx.setAll](index, iterable) { | 119 [dartx.setAll](index, iterable) { |
| 120 dart.as(iterable, core.Iterable$(E)); | 120 dart.as(iterable, core.Iterable$(E)); |
| 121 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); | 121 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); |
| 122 } | 122 } |
| 123 [dartx.removeLast]() { | 123 [dartx.removeLast]() { |
| 124 this[dartx.checkGrowable]('removeLast'); | 124 this[dartx.checkGrowable]('removeLast'); |
| 125 if (this.length == 0) | 125 if (this[dartx.length] == 0) |
| 126 throw new core.RangeError.value(-1); | 126 throw new core.RangeError.value(-1); |
| 127 return dart.as(this.pop(), E); | 127 return dart.as(this.pop(), E); |
| 128 } | 128 } |
| 129 [dartx.remove](element) { | 129 [dartx.remove](element) { |
| 130 this[dartx.checkGrowable]('remove'); | 130 this[dartx.checkGrowable]('remove'); |
| 131 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | 131 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { |
| 132 if (dart.equals(this[dartx.get](i), element)) { | 132 if (dart.equals(this[dartx.get](i), element)) { |
| 133 this.splice(i, 1); | 133 this.splice(i, 1); |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 return false; | 137 return false; |
| 138 } | 138 } |
| 139 [dartx.removeWhere](test) { | 139 [dartx.removeWhere](test) { |
| 140 dart.as(test, dart.functionType(core.bool, [E])); | 140 dart.as(test, dart.functionType(core.bool, [E])); |
| 141 _internal.IterableMixinWorkaround.removeWhereList(this, test); | 141 _internal.IterableMixinWorkaround.removeWhereList(this, test); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 152 dart.as(f, dart.functionType(core.Iterable, [E])); | 152 dart.as(f, dart.functionType(core.Iterable, [E])); |
| 153 return _internal.IterableMixinWorkaround.expand(this, f); | 153 return _internal.IterableMixinWorkaround.expand(this, f); |
| 154 } | 154 } |
| 155 [dartx.addAll](collection) { | 155 [dartx.addAll](collection) { |
| 156 dart.as(collection, core.Iterable$(E)); | 156 dart.as(collection, core.Iterable$(E)); |
| 157 for (let e of collection) { | 157 for (let e of collection) { |
| 158 this[dartx.add](e); | 158 this[dartx.add](e); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 [dartx.clear]() { | 161 [dartx.clear]() { |
| 162 this.length = 0; | 162 this[dartx.length] = 0; |
| 163 } | 163 } |
| 164 [dartx.forEach](f) { | 164 [dartx.forEach](f) { |
| 165 dart.as(f, dart.functionType(dart.void, [E])); | 165 dart.as(f, dart.functionType(dart.void, [E])); |
| 166 let length = this.length; | 166 let length = this[dartx.length]; |
| 167 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { | 167 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { |
| 168 f(dart.as(this[i], E)); | 168 f(dart.as(this[i], E)); |
| 169 if (length != this.length) { | 169 if (length != this[dartx.length]) { |
| 170 throw new core.ConcurrentModificationError(this); | 170 throw new core.ConcurrentModificationError(this); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 [dartx.map](f) { | 174 [dartx.map](f) { |
| 175 dart.as(f, dart.functionType(core.Object, [E])); | 175 dart.as(f, dart.functionType(core.Object, [E])); |
| 176 return _internal.IterableMixinWorkaround.mapList(this, f); | 176 return _internal.IterableMixinWorkaround.mapList(this, f); |
| 177 } | 177 } |
| 178 [dartx.join](separator) { | 178 [dartx.join](separator) { |
| 179 if (separator === void 0) | 179 if (separator === void 0) |
| 180 separator = ""; | 180 separator = ""; |
| 181 let list = core.List.new(this.length); | 181 let list = core.List.new(this[dartx.length]); |
| 182 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | 182 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { |
| 183 list[dartx.set](i, `${this[dartx.get](i)}`); | 183 list[dartx.set](i, `${this[dartx.get](i)}`); |
| 184 } | 184 } |
| 185 return list.join(separator); | 185 return list.join(separator); |
| 186 } | 186 } |
| 187 [dartx.take](n) { | 187 [dartx.take](n) { |
| 188 return new (_internal.IterableMixinWorkaround$(E))().takeList(this, n); | 188 return new (_internal.IterableMixinWorkaround$(E))().takeList(this, n); |
| 189 } | 189 } |
| 190 [dartx.takeWhile](test) { | 190 [dartx.takeWhile](test) { |
| 191 dart.as(test, dart.functionType(core.bool, [E])); | 191 dart.as(test, dart.functionType(core.bool, [E])); |
| 192 return new (_internal.IterableMixinWorkaround$(E))().takeWhile(this, tes
t); | 192 return new (_internal.IterableMixinWorkaround$(E))().takeWhile(this, tes
t); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 [dartx.elementAt](index) { | 225 [dartx.elementAt](index) { |
| 226 return this[dartx.get](index); | 226 return this[dartx.get](index); |
| 227 } | 227 } |
| 228 [dartx.sublist](start, end) { | 228 [dartx.sublist](start, end) { |
| 229 if (end === void 0) | 229 if (end === void 0) |
| 230 end = null; | 230 end = null; |
| 231 _js_helper.checkNull(start); | 231 _js_helper.checkNull(start); |
| 232 if (!(typeof start == 'number')) | 232 if (!(typeof start == 'number')) |
| 233 throw new core.ArgumentError(start); | 233 throw new core.ArgumentError(start); |
| 234 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.l
ength)) { | 234 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[d
artx.length])) { |
| 235 throw new core.RangeError.range(start, 0, this.length); | 235 throw new core.RangeError.range(start, 0, this[dartx.length]); |
| 236 } | 236 } |
| 237 if (end == null) { | 237 if (end == null) { |
| 238 end = this.length; | 238 end = this[dartx.length]; |
| 239 } else { | 239 } else { |
| 240 if (!(typeof end == 'number')) | 240 if (!(typeof end == 'number')) |
| 241 throw new core.ArgumentError(end); | 241 throw new core.ArgumentError(end); |
| 242 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar
t.notNull(this.length)) { | 242 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar
t.notNull(this[dartx.length])) { |
| 243 throw new core.RangeError.range(end, start, this.length); | 243 throw new core.RangeError.range(end, start, this[dartx.length]); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 if (start == end) | 246 if (start == end) |
| 247 return dart.list([], E); | 247 return dart.list([], E); |
| 248 return JSArray$(E).typed(this.slice(start, end)); | 248 return JSArray$(E).typed(this.slice(start, end)); |
| 249 } | 249 } |
| 250 [dartx.getRange](start, end) { | 250 [dartx.getRange](start, end) { |
| 251 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this,
start, end); | 251 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this,
start, end); |
| 252 } | 252 } |
| 253 get [dartx.first]() { | 253 get [dartx.first]() { |
| 254 if (dart.notNull(this.length) > 0) | 254 if (dart.notNull(this[dartx.length]) > 0) |
| 255 return this[dartx.get](0); | 255 return this[dartx.get](0); |
| 256 throw new core.StateError("No elements"); | 256 throw new core.StateError("No elements"); |
| 257 } | 257 } |
| 258 get [dartx.last]() { | 258 get [dartx.last]() { |
| 259 if (dart.notNull(this.length) > 0) | 259 if (dart.notNull(this[dartx.length]) > 0) |
| 260 return this[dartx.get](dart.notNull(this.length) - 1); | 260 return this[dartx.get](dart.notNull(this[dartx.length]) - 1); |
| 261 throw new core.StateError("No elements"); | 261 throw new core.StateError("No elements"); |
| 262 } | 262 } |
| 263 get [dartx.single]() { | 263 get [dartx.single]() { |
| 264 if (this.length == 1) | 264 if (this[dartx.length] == 1) |
| 265 return this[dartx.get](0); | 265 return this[dartx.get](0); |
| 266 if (this.length == 0) | 266 if (this[dartx.length] == 0) |
| 267 throw new core.StateError("No elements"); | 267 throw new core.StateError("No elements"); |
| 268 throw new core.StateError("More than one element"); | 268 throw new core.StateError("More than one element"); |
| 269 } | 269 } |
| 270 [dartx.removeRange](start, end) { | 270 [dartx.removeRange](start, end) { |
| 271 this[dartx.checkGrowable]('removeRange'); | 271 this[dartx.checkGrowable]('removeRange'); |
| 272 let receiverLength = this.length; | 272 let receiverLength = this[dartx.length]; |
| 273 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv
erLength)) { | 273 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv
erLength)) { |
| 274 throw new core.RangeError.range(start, 0, receiverLength); | 274 throw new core.RangeError.range(start, 0, receiverLength); |
| 275 } | 275 } |
| 276 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(receiverLength)) { | 276 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(receiverLength)) { |
| 277 throw new core.RangeError.range(end, start, receiverLength); | 277 throw new core.RangeError.range(end, start, receiverLength); |
| 278 } | 278 } |
| 279 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength
) - dart.notNull(end)); | 279 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength
) - dart.notNull(end)); |
| 280 this.length = dart.notNull(receiverLength) - (dart.notNull(end) - dart.n
otNull(start)); | 280 this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) -
dart.notNull(start)); |
| 281 } | 281 } |
| 282 [dartx.setRange](start, end, iterable, skipCount) { | 282 [dartx.setRange](start, end, iterable, skipCount) { |
| 283 dart.as(iterable, core.Iterable$(E)); | 283 dart.as(iterable, core.Iterable$(E)); |
| 284 if (skipCount === void 0) | 284 if (skipCount === void 0) |
| 285 skipCount = 0; | 285 skipCount = 0; |
| 286 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl
e, skipCount); | 286 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl
e, skipCount); |
| 287 } | 287 } |
| 288 [dartx.fillRange](start, end, fillValue) { | 288 [dartx.fillRange](start, end, fillValue) { |
| 289 if (fillValue === void 0) | 289 if (fillValue === void 0) |
| 290 fillValue = null; | 290 fillValue = null; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 321 if (start === void 0) | 321 if (start === void 0) |
| 322 start = 0; | 322 start = 0; |
| 323 return _internal.IterableMixinWorkaround.indexOfList(this, element, star
t); | 323 return _internal.IterableMixinWorkaround.indexOfList(this, element, star
t); |
| 324 } | 324 } |
| 325 [dartx.lastIndexOf](element, start) { | 325 [dartx.lastIndexOf](element, start) { |
| 326 if (start === void 0) | 326 if (start === void 0) |
| 327 start = null; | 327 start = null; |
| 328 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element,
start); | 328 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element,
start); |
| 329 } | 329 } |
| 330 [dartx.contains](other) { | 330 [dartx.contains](other) { |
| 331 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | 331 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i =
dart.notNull(i) + 1) { |
| 332 if (dart.equals(this[dartx.get](i), other)) | 332 if (dart.equals(this[dartx.get](i), other)) |
| 333 return true; | 333 return true; |
| 334 } | 334 } |
| 335 return false; | 335 return false; |
| 336 } | 336 } |
| 337 get [dartx.isEmpty]() { | 337 get [dartx.isEmpty]() { |
| 338 return this.length == 0; | 338 return this[dartx.length] == 0; |
| 339 } | 339 } |
| 340 get [dartx.isNotEmpty]() { | 340 get [dartx.isNotEmpty]() { |
| 341 return !dart.notNull(this[dartx.isEmpty]); | 341 return !dart.notNull(this[dartx.isEmpty]); |
| 342 } | 342 } |
| 343 [dartx.toString]() { | 343 [dartx.toString]() { |
| 344 return collection.ListBase.listToString(this); | 344 return collection.ListBase.listToString(this); |
| 345 } | 345 } |
| 346 [dartx.toList](opts) { | 346 [dartx.toList](opts) { |
| 347 let growable = opts && 'growable' in opts ? opts.growable : true; | 347 let growable = opts && 'growable' in opts ? opts.growable : true; |
| 348 let list = this.slice(); | 348 let list = this.slice(); |
| 349 if (!dart.notNull(growable)) | 349 if (!dart.notNull(growable)) |
| 350 JSArray$().markFixedList(dart.as(list, core.List)); | 350 JSArray$().markFixedList(dart.as(list, core.List)); |
| 351 return JSArray$(E).typed(list); | 351 return JSArray$(E).typed(list); |
| 352 } | 352 } |
| 353 [dartx.toSet]() { | 353 [dartx.toSet]() { |
| 354 return core.Set$(E).from(this); | 354 return core.Set$(E).from(this); |
| 355 } | 355 } |
| 356 get [dartx.iterator]() { | 356 get [dartx.iterator]() { |
| 357 return new (_internal.ListIterator$(E))(this); | 357 return new (_internal.ListIterator$(E))(this); |
| 358 } | 358 } |
| 359 get [dartx.hashCode]() { | 359 get [dartx.hashCode]() { |
| 360 return _js_helper.Primitives.objectHashCode(this); | 360 return _js_helper.Primitives.objectHashCode(this); |
| 361 } | 361 } |
| 362 get length() { | 362 get [dartx.length]() { |
| 363 return dart.as(this.length, core.int); | 363 return dart.as(this.length, core.int); |
| 364 } | 364 } |
| 365 set length(newLength) { | 365 set [dartx.length](newLength) { |
| 366 if (!(typeof newLength == 'number')) | 366 if (!(typeof newLength == 'number')) |
| 367 throw new core.ArgumentError(newLength); | 367 throw new core.ArgumentError(newLength); |
| 368 if (dart.notNull(newLength) < 0) | 368 if (dart.notNull(newLength) < 0) |
| 369 throw new core.RangeError.value(newLength); | 369 throw new core.RangeError.value(newLength); |
| 370 this[dartx.checkGrowable]('set length'); | 370 this[dartx.checkGrowable]('set length'); |
| 371 this.length = newLength; | 371 this.length = newLength; |
| 372 } | 372 } |
| 373 [dartx.get](index) { | 373 [dartx.get](index) { |
| 374 if (!(typeof index == 'number')) | 374 if (!(typeof index == 'number')) |
| 375 throw new core.ArgumentError(index); | 375 throw new core.ArgumentError(index); |
| 376 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(ind
ex) < 0) | 376 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) |
| 377 throw new core.RangeError.value(index); | 377 throw new core.RangeError.value(index); |
| 378 return dart.as(this[index], E); | 378 return dart.as(this[index], E); |
| 379 } | 379 } |
| 380 [dartx.set](index, value) { | 380 [dartx.set](index, value) { |
| 381 dart.as(value, E); | 381 dart.as(value, E); |
| 382 if (!(typeof index == 'number')) | 382 if (!(typeof index == 'number')) |
| 383 throw new core.ArgumentError(index); | 383 throw new core.ArgumentError(index); |
| 384 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(ind
ex) < 0) | 384 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN
ull(index) < 0) |
| 385 throw new core.RangeError.value(index); | 385 throw new core.RangeError.value(index); |
| 386 this[index] = value; | 386 this[index] = value; |
| 387 } | 387 } |
| 388 [dartx.asMap]() { | 388 [dartx.asMap]() { |
| 389 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this); | 389 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this); |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 dart.setBaseClass(JSArray, dart.global.Array); | 392 dart.setBaseClass(JSArray, dart.global.Array); |
| 393 JSArray[dart.implements] = () => [core.List$(E), JSIndexable]; | 393 JSArray[dart.implements] = () => [core.List$(E), JSIndexable]; |
| 394 dart.setSignature(JSArray, { | 394 dart.setSignature(JSArray, { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) | 631 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) |
| 632 return `-${result}`; | 632 return `-${result}`; |
| 633 return result; | 633 return result; |
| 634 } | 634 } |
| 635 [dartx.toRadixString](radix) { | 635 [dartx.toRadixString](radix) { |
| 636 _js_helper.checkInt(radix); | 636 _js_helper.checkInt(radix); |
| 637 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) | 637 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) |
| 638 throw new core.RangeError(radix); | 638 throw new core.RangeError(radix); |
| 639 let result = this.toString(radix); | 639 let result = this.toString(radix); |
| 640 let rightParenCode = 41; | 640 let rightParenCode = 41; |
| 641 if (result[dartx.codeUnitAt](dart.notNull(result.length) - 1) != rightPare
nCode) { | 641 if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != ri
ghtParenCode) { |
| 642 return result; | 642 return result; |
| 643 } | 643 } |
| 644 return JSNumber._handleIEtoString(result); | 644 return JSNumber._handleIEtoString(result); |
| 645 } | 645 } |
| 646 static _handleIEtoString(result) { | 646 static _handleIEtoString(result) { |
| 647 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); | 647 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); |
| 648 if (match == null) { | 648 if (match == null) { |
| 649 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; | 649 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; |
| 650 } | 650 } |
| 651 result = dart.dindex(match, 1); | 651 result = dart.dindex(match, 1); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 ]); | 985 ]); |
| 986 class JSString extends Interceptor { | 986 class JSString extends Interceptor { |
| 987 JSString() { | 987 JSString() { |
| 988 super.Interceptor(); | 988 super.Interceptor(); |
| 989 } | 989 } |
| 990 [dartx.codeUnitAt](index) { | 990 [dartx.codeUnitAt](index) { |
| 991 if (!(typeof index == 'number')) | 991 if (!(typeof index == 'number')) |
| 992 throw new core.ArgumentError(index); | 992 throw new core.ArgumentError(index); |
| 993 if (dart.notNull(index) < 0) | 993 if (dart.notNull(index) < 0) |
| 994 throw new core.RangeError.value(index); | 994 throw new core.RangeError.value(index); |
| 995 if (dart.notNull(index) >= dart.notNull(this.length)) | 995 if (dart.notNull(index) >= dart.notNull(this[dartx.length])) |
| 996 throw new core.RangeError.value(index); | 996 throw new core.RangeError.value(index); |
| 997 return dart.as(this.charCodeAt(index), core.int); | 997 return dart.as(this.charCodeAt(index), core.int); |
| 998 } | 998 } |
| 999 [dartx.allMatches](string, start) { | 999 [dartx.allMatches](string, start) { |
| 1000 if (start === void 0) | 1000 if (start === void 0) |
| 1001 start = 0; | 1001 start = 0; |
| 1002 _js_helper.checkString(string); | 1002 _js_helper.checkString(string); |
| 1003 _js_helper.checkInt(start); | 1003 _js_helper.checkInt(start); |
| 1004 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string.l
ength)) { | 1004 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[d
artx.length])) { |
| 1005 throw new core.RangeError.range(start, 0, string.length); | 1005 throw new core.RangeError.range(start, 0, string[dartx.length]); |
| 1006 } | 1006 } |
| 1007 return _js_helper.allMatchesInStringUnchecked(this, string, start); | 1007 return _js_helper.allMatchesInStringUnchecked(this, string, start); |
| 1008 } | 1008 } |
| 1009 [dartx.matchAsPrefix](string, start) { | 1009 [dartx.matchAsPrefix](string, start) { |
| 1010 if (start === void 0) | 1010 if (start === void 0) |
| 1011 start = 0; | 1011 start = 0; |
| 1012 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { | 1012 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d
artx.length])) { |
| 1013 throw new core.RangeError.range(start, 0, string.length); | 1013 throw new core.RangeError.range(start, 0, string[dartx.length]); |
| 1014 } | 1014 } |
| 1015 if (dart.notNull(start) + dart.notNull(this.length) > dart.notNull(string.
length)) | 1015 if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull(
string[dartx.length])) |
| 1016 return null; | 1016 return null; |
| 1017 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notN
ull(i) + 1) { | 1017 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 1018 if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != t
his[dartx.codeUnitAt](i)) { | 1018 if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != t
his[dartx.codeUnitAt](i)) { |
| 1019 return null; | 1019 return null; |
| 1020 } | 1020 } |
| 1021 } | 1021 } |
| 1022 return new _js_helper.StringMatch(start, string, this); | 1022 return new _js_helper.StringMatch(start, string, this); |
| 1023 } | 1023 } |
| 1024 [dartx['+']](other) { | 1024 [dartx['+']](other) { |
| 1025 if (!(typeof other == 'string')) | 1025 if (!(typeof other == 'string')) |
| 1026 throw new core.ArgumentError(other); | 1026 throw new core.ArgumentError(other); |
| 1027 return this + other; | 1027 return this + other; |
| 1028 } | 1028 } |
| 1029 [dartx.endsWith](other) { | 1029 [dartx.endsWith](other) { |
| 1030 _js_helper.checkString(other); | 1030 _js_helper.checkString(other); |
| 1031 let otherLength = other.length; | 1031 let otherLength = other[dartx.length]; |
| 1032 if (dart.notNull(otherLength) > dart.notNull(this.length)) | 1032 if (dart.notNull(otherLength) > dart.notNull(this[dartx.length])) |
| 1033 return false; | 1033 return false; |
| 1034 return other == this[dartx.substring](dart.notNull(this.length) - dart.not
Null(otherLength)); | 1034 return other == this[dartx.substring](dart.notNull(this[dartx.length]) - d
art.notNull(otherLength)); |
| 1035 } | 1035 } |
| 1036 [dartx.replaceAll](from, to) { | 1036 [dartx.replaceAll](from, to) { |
| 1037 _js_helper.checkString(to); | 1037 _js_helper.checkString(to); |
| 1038 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core.
String); | 1038 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core.
String); |
| 1039 } | 1039 } |
| 1040 [dartx.replaceAllMapped](from, convert) { | 1040 [dartx.replaceAllMapped](from, convert) { |
| 1041 return this[dartx.splitMapJoin](from, {onMatch: convert}); | 1041 return this[dartx.splitMapJoin](from, {onMatch: convert}); |
| 1042 } | 1042 } |
| 1043 [dartx.splitMapJoin](from, opts) { | 1043 [dartx.splitMapJoin](from, opts) { |
| 1044 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null; | 1044 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null; |
| 1045 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null; | 1045 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null; |
| 1046 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc
h, onNonMatch), core.String); | 1046 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc
h, onNonMatch), core.String); |
| 1047 } | 1047 } |
| 1048 [dartx.replaceFirst](from, to, startIndex) { | 1048 [dartx.replaceFirst](from, to, startIndex) { |
| 1049 if (startIndex === void 0) | 1049 if (startIndex === void 0) |
| 1050 startIndex = 0; | 1050 startIndex = 0; |
| 1051 _js_helper.checkString(to); | 1051 _js_helper.checkString(to); |
| 1052 _js_helper.checkInt(startIndex); | 1052 _js_helper.checkInt(startIndex); |
| 1053 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this.length)) { | 1053 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { |
| 1054 throw new core.RangeError.range(startIndex, 0, this.length); | 1054 throw new core.RangeError.range(startIndex, 0, this[dartx.length]); |
| 1055 } | 1055 } |
| 1056 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); | 1056 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); |
| 1057 } | 1057 } |
| 1058 [dartx.split](pattern) { | 1058 [dartx.split](pattern) { |
| 1059 _js_helper.checkNull(pattern); | 1059 _js_helper.checkNull(pattern); |
| 1060 if (typeof pattern == 'string') { | 1060 if (typeof pattern == 'string') { |
| 1061 return dart.as(this.split(pattern), core.List$(core.String)); | 1061 return dart.as(this.split(pattern), core.List$(core.String)); |
| 1062 } else if (dart.is(pattern, _js_helper.JSSyntaxRegExp) && _js_helper.regEx
pCaptureCount(pattern) == 0) { | 1062 } else if (dart.is(pattern, _js_helper.JSSyntaxRegExp) && _js_helper.regEx
pCaptureCount(pattern) == 0) { |
| 1063 let re = _js_helper.regExpGetNative(pattern); | 1063 let re = _js_helper.regExpGetNative(pattern); |
| 1064 return dart.as(this.split(re), core.List$(core.String)); | 1064 return dart.as(this.split(re), core.List$(core.String)); |
| 1065 } else { | 1065 } else { |
| 1066 return this[_defaultSplit](pattern); | 1066 return this[_defaultSplit](pattern); |
| 1067 } | 1067 } |
| 1068 } | 1068 } |
| 1069 [_defaultSplit](pattern) { | 1069 [_defaultSplit](pattern) { |
| 1070 let result = dart.list([], core.String); | 1070 let result = dart.list([], core.String); |
| 1071 let start = 0; | 1071 let start = 0; |
| 1072 let length = 1; | 1072 let length = 1; |
| 1073 for (let match of pattern[dartx.allMatches](this)) { | 1073 for (let match of pattern[dartx.allMatches](this)) { |
| 1074 let matchStart = match.start; | 1074 let matchStart = match.start; |
| 1075 let matchEnd = match.end; | 1075 let matchEnd = match.end; |
| 1076 length = dart.notNull(matchEnd) - dart.notNull(matchStart); | 1076 length = dart.notNull(matchEnd) - dart.notNull(matchStart); |
| 1077 if (length == 0 && start == matchStart) { | 1077 if (length == 0 && start == matchStart) { |
| 1078 continue; | 1078 continue; |
| 1079 } | 1079 } |
| 1080 let end = matchStart; | 1080 let end = matchStart; |
| 1081 result[dartx.add](this[dartx.substring](start, end)); | 1081 result[dartx.add](this[dartx.substring](start, end)); |
| 1082 start = matchEnd; | 1082 start = matchEnd; |
| 1083 } | 1083 } |
| 1084 if (dart.notNull(start) < dart.notNull(this.length) || dart.notNull(length
) > 0) { | 1084 if (dart.notNull(start) < dart.notNull(this[dartx.length]) || dart.notNull
(length) > 0) { |
| 1085 result[dartx.add](this[dartx.substring](start)); | 1085 result[dartx.add](this[dartx.substring](start)); |
| 1086 } | 1086 } |
| 1087 return result; | 1087 return result; |
| 1088 } | 1088 } |
| 1089 [dartx.startsWith](pattern, index) { | 1089 [dartx.startsWith](pattern, index) { |
| 1090 if (index === void 0) | 1090 if (index === void 0) |
| 1091 index = 0; | 1091 index = 0; |
| 1092 _js_helper.checkInt(index); | 1092 _js_helper.checkInt(index); |
| 1093 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.len
gth)) { | 1093 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dar
tx.length])) { |
| 1094 throw new core.RangeError.range(index, 0, this.length); | 1094 throw new core.RangeError.range(index, 0, this[dartx.length]); |
| 1095 } | 1095 } |
| 1096 if (typeof pattern == 'string') { | 1096 if (typeof pattern == 'string') { |
| 1097 let other = pattern; | 1097 let other = pattern; |
| 1098 let otherLength = other.length; | 1098 let otherLength = other[dartx.length]; |
| 1099 let endIndex = dart.notNull(index) + dart.notNull(otherLength); | 1099 let endIndex = dart.notNull(index) + dart.notNull(otherLength); |
| 1100 if (dart.notNull(endIndex) > dart.notNull(this.length)) | 1100 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) |
| 1101 return false; | 1101 return false; |
| 1102 return other == this.substring(index, endIndex); | 1102 return other == this.substring(index, endIndex); |
| 1103 } | 1103 } |
| 1104 return pattern[dartx.matchAsPrefix](this, index) != null; | 1104 return pattern[dartx.matchAsPrefix](this, index) != null; |
| 1105 } | 1105 } |
| 1106 [dartx.substring](startIndex, endIndex) { | 1106 [dartx.substring](startIndex, endIndex) { |
| 1107 if (endIndex === void 0) | 1107 if (endIndex === void 0) |
| 1108 endIndex = null; | 1108 endIndex = null; |
| 1109 _js_helper.checkInt(startIndex); | 1109 _js_helper.checkInt(startIndex); |
| 1110 if (endIndex == null) | 1110 if (endIndex == null) |
| 1111 endIndex = this.length; | 1111 endIndex = this[dartx.length]; |
| 1112 _js_helper.checkInt(endIndex); | 1112 _js_helper.checkInt(endIndex); |
| 1113 if (dart.notNull(startIndex) < 0) | 1113 if (dart.notNull(startIndex) < 0) |
| 1114 throw new core.RangeError.value(startIndex); | 1114 throw new core.RangeError.value(startIndex); |
| 1115 if (dart.notNull(startIndex) > dart.notNull(endIndex)) | 1115 if (dart.notNull(startIndex) > dart.notNull(endIndex)) |
| 1116 throw new core.RangeError.value(startIndex); | 1116 throw new core.RangeError.value(startIndex); |
| 1117 if (dart.notNull(endIndex) > dart.notNull(this.length)) | 1117 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) |
| 1118 throw new core.RangeError.value(endIndex); | 1118 throw new core.RangeError.value(endIndex); |
| 1119 return this.substring(startIndex, endIndex); | 1119 return this.substring(startIndex, endIndex); |
| 1120 } | 1120 } |
| 1121 [dartx.toLowerCase]() { | 1121 [dartx.toLowerCase]() { |
| 1122 return this.toLowerCase(); | 1122 return this.toLowerCase(); |
| 1123 } | 1123 } |
| 1124 [dartx.toUpperCase]() { | 1124 [dartx.toUpperCase]() { |
| 1125 return this.toUpperCase(); | 1125 return this.toUpperCase(); |
| 1126 } | 1126 } |
| 1127 static _isWhitespace(codeUnit) { | 1127 static _isWhitespace(codeUnit) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 } | 1169 } |
| 1170 default: | 1170 default: |
| 1171 { | 1171 { |
| 1172 return false; | 1172 return false; |
| 1173 } | 1173 } |
| 1174 } | 1174 } |
| 1175 } | 1175 } |
| 1176 static _skipLeadingWhitespace(string, index) { | 1176 static _skipLeadingWhitespace(string, index) { |
| 1177 let SPACE = 32; | 1177 let SPACE = 32; |
| 1178 let CARRIAGE_RETURN = 13; | 1178 let CARRIAGE_RETURN = 13; |
| 1179 while (dart.notNull(index) < dart.notNull(string.length)) { | 1179 while (dart.notNull(index) < dart.notNull(string[dartx.length])) { |
| 1180 let codeUnit = string[dartx.codeUnitAt](index); | 1180 let codeUnit = string[dartx.codeUnitAt](index); |
| 1181 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { | 1181 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { |
| 1182 break; | 1182 break; |
| 1183 } | 1183 } |
| 1184 index = dart.notNull(index) + 1; | 1184 index = dart.notNull(index) + 1; |
| 1185 } | 1185 } |
| 1186 return index; | 1186 return index; |
| 1187 } | 1187 } |
| 1188 static _skipTrailingWhitespace(string, index) { | 1188 static _skipTrailingWhitespace(string, index) { |
| 1189 let SPACE = 32; | 1189 let SPACE = 32; |
| 1190 let CARRIAGE_RETURN = 13; | 1190 let CARRIAGE_RETURN = 13; |
| 1191 while (dart.notNull(index) > 0) { | 1191 while (dart.notNull(index) > 0) { |
| 1192 let codeUnit = string[dartx.codeUnitAt](dart.notNull(index) - 1); | 1192 let codeUnit = string[dartx.codeUnitAt](dart.notNull(index) - 1); |
| 1193 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { | 1193 if (codeUnit != SPACE && codeUnit != CARRIAGE_RETURN && !dart.notNull(JS
String._isWhitespace(codeUnit))) { |
| 1194 break; | 1194 break; |
| 1195 } | 1195 } |
| 1196 index = dart.notNull(index) - 1; | 1196 index = dart.notNull(index) - 1; |
| 1197 } | 1197 } |
| 1198 return index; | 1198 return index; |
| 1199 } | 1199 } |
| 1200 [dartx.trim]() { | 1200 [dartx.trim]() { |
| 1201 let NEL = 133; | 1201 let NEL = 133; |
| 1202 let result = this.trim(); | 1202 let result = this.trim(); |
| 1203 if (result.length == 0) | 1203 if (result[dartx.length] == 0) |
| 1204 return result; | 1204 return result; |
| 1205 let firstCode = result[dartx.codeUnitAt](0); | 1205 let firstCode = result[dartx.codeUnitAt](0); |
| 1206 let startIndex = 0; | 1206 let startIndex = 0; |
| 1207 if (firstCode == NEL) { | 1207 if (firstCode == NEL) { |
| 1208 startIndex = JSString._skipLeadingWhitespace(result, 1); | 1208 startIndex = JSString._skipLeadingWhitespace(result, 1); |
| 1209 if (startIndex == result.length) | 1209 if (startIndex == result[dartx.length]) |
| 1210 return ""; | 1210 return ""; |
| 1211 } | 1211 } |
| 1212 let endIndex = result.length; | 1212 let endIndex = result[dartx.length]; |
| 1213 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); | 1213 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); |
| 1214 if (lastCode == NEL) { | 1214 if (lastCode == NEL) { |
| 1215 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endInde
x) - 1); | 1215 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endInde
x) - 1); |
| 1216 } | 1216 } |
| 1217 if (startIndex == 0 && endIndex == result.length) | 1217 if (startIndex == 0 && endIndex == result[dartx.length]) |
| 1218 return result; | 1218 return result; |
| 1219 return result.substring(startIndex, endIndex); | 1219 return result.substring(startIndex, endIndex); |
| 1220 } | 1220 } |
| 1221 [dartx.trimLeft]() { | 1221 [dartx.trimLeft]() { |
| 1222 let NEL = 133; | 1222 let NEL = 133; |
| 1223 let result = null; | 1223 let result = null; |
| 1224 let startIndex = 0; | 1224 let startIndex = 0; |
| 1225 if (typeof this.trimLeft != "undefined") { | 1225 if (typeof this.trimLeft != "undefined") { |
| 1226 result = this.trimLeft(); | 1226 result = this.trimLeft(); |
| 1227 if (result.length == 0) | 1227 if (result[dartx.length] == 0) |
| 1228 return result; | 1228 return result; |
| 1229 let firstCode = result[dartx.codeUnitAt](0); | 1229 let firstCode = result[dartx.codeUnitAt](0); |
| 1230 if (firstCode == NEL) { | 1230 if (firstCode == NEL) { |
| 1231 startIndex = JSString._skipLeadingWhitespace(result, 1); | 1231 startIndex = JSString._skipLeadingWhitespace(result, 1); |
| 1232 } | 1232 } |
| 1233 } else { | 1233 } else { |
| 1234 result = this; | 1234 result = this; |
| 1235 startIndex = JSString._skipLeadingWhitespace(this, 0); | 1235 startIndex = JSString._skipLeadingWhitespace(this, 0); |
| 1236 } | 1236 } |
| 1237 if (startIndex == 0) | 1237 if (startIndex == 0) |
| 1238 return result; | 1238 return result; |
| 1239 if (startIndex == result.length) | 1239 if (startIndex == result[dartx.length]) |
| 1240 return ""; | 1240 return ""; |
| 1241 return result.substring(startIndex); | 1241 return result.substring(startIndex); |
| 1242 } | 1242 } |
| 1243 [dartx.trimRight]() { | 1243 [dartx.trimRight]() { |
| 1244 let NEL = 133; | 1244 let NEL = 133; |
| 1245 let result = null; | 1245 let result = null; |
| 1246 let endIndex = null; | 1246 let endIndex = null; |
| 1247 if (typeof this.trimRight != "undefined") { | 1247 if (typeof this.trimRight != "undefined") { |
| 1248 result = this.trimRight(); | 1248 result = this.trimRight(); |
| 1249 endIndex = result.length; | 1249 endIndex = result[dartx.length]; |
| 1250 if (endIndex == 0) | 1250 if (endIndex == 0) |
| 1251 return result; | 1251 return result; |
| 1252 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); | 1252 let lastCode = result[dartx.codeUnitAt](dart.notNull(endIndex) - 1); |
| 1253 if (lastCode == NEL) { | 1253 if (lastCode == NEL) { |
| 1254 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endIn
dex) - 1); | 1254 endIndex = JSString._skipTrailingWhitespace(result, dart.notNull(endIn
dex) - 1); |
| 1255 } | 1255 } |
| 1256 } else { | 1256 } else { |
| 1257 result = this; | 1257 result = this; |
| 1258 endIndex = JSString._skipTrailingWhitespace(this, this.length); | 1258 endIndex = JSString._skipTrailingWhitespace(this, this[dartx.length]); |
| 1259 } | 1259 } |
| 1260 if (endIndex == result.length) | 1260 if (endIndex == result[dartx.length]) |
| 1261 return result; | 1261 return result; |
| 1262 if (endIndex == 0) | 1262 if (endIndex == 0) |
| 1263 return ""; | 1263 return ""; |
| 1264 return result.substring(0, endIndex); | 1264 return result.substring(0, endIndex); |
| 1265 } | 1265 } |
| 1266 [dartx['*']](times) { | 1266 [dartx['*']](times) { |
| 1267 if (0 >= dart.notNull(times)) | 1267 if (0 >= dart.notNull(times)) |
| 1268 return ''; | 1268 return ''; |
| 1269 if (times == 1 || this.length == 0) | 1269 if (times == 1 || this[dartx.length] == 0) |
| 1270 return this; | 1270 return this; |
| 1271 if (!dart.equals(times, times >>> 0)) { | 1271 if (!dart.equals(times, times >>> 0)) { |
| 1272 throw dart.const(new core.OutOfMemoryError()); | 1272 throw dart.const(new core.OutOfMemoryError()); |
| 1273 } | 1273 } |
| 1274 let result = ''; | 1274 let result = ''; |
| 1275 let s = this; | 1275 let s = this; |
| 1276 while (true) { | 1276 while (true) { |
| 1277 if ((dart.notNull(times) & 1) == 1) | 1277 if ((dart.notNull(times) & 1) == 1) |
| 1278 result = s[dartx['+']](result); | 1278 result = s[dartx['+']](result); |
| 1279 times = dart.as(times >>> 1, core.int); | 1279 times = dart.as(times >>> 1, core.int); |
| 1280 if (times == 0) | 1280 if (times == 0) |
| 1281 break; | 1281 break; |
| 1282 s = s[dartx['+']](s); | 1282 s = s[dartx['+']](s); |
| 1283 } | 1283 } |
| 1284 return result; | 1284 return result; |
| 1285 } | 1285 } |
| 1286 [dartx.padLeft](width, padding) { | 1286 [dartx.padLeft](width, padding) { |
| 1287 if (padding === void 0) | 1287 if (padding === void 0) |
| 1288 padding = ' '; | 1288 padding = ' '; |
| 1289 let delta = dart.notNull(width) - dart.notNull(this.length); | 1289 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); |
| 1290 if (dart.notNull(delta) <= 0) | 1290 if (dart.notNull(delta) <= 0) |
| 1291 return this; | 1291 return this; |
| 1292 return padding[dartx['*']](delta) + this; | 1292 return padding[dartx['*']](delta) + this; |
| 1293 } | 1293 } |
| 1294 [dartx.padRight](width, padding) { | 1294 [dartx.padRight](width, padding) { |
| 1295 if (padding === void 0) | 1295 if (padding === void 0) |
| 1296 padding = ' '; | 1296 padding = ' '; |
| 1297 let delta = dart.notNull(width) - dart.notNull(this.length); | 1297 let delta = dart.notNull(width) - dart.notNull(this[dartx.length]); |
| 1298 if (dart.notNull(delta) <= 0) | 1298 if (dart.notNull(delta) <= 0) |
| 1299 return this; | 1299 return this; |
| 1300 return this[dartx['+']](padding[dartx['*']](delta)); | 1300 return this[dartx['+']](padding[dartx['*']](delta)); |
| 1301 } | 1301 } |
| 1302 get [dartx.codeUnits]() { | 1302 get [dartx.codeUnits]() { |
| 1303 return new _CodeUnits(this); | 1303 return new _CodeUnits(this); |
| 1304 } | 1304 } |
| 1305 get [dartx.runes]() { | 1305 get [dartx.runes]() { |
| 1306 return new core.Runes(this); | 1306 return new core.Runes(this); |
| 1307 } | 1307 } |
| 1308 [dartx.indexOf](pattern, start) { | 1308 [dartx.indexOf](pattern, start) { |
| 1309 if (start === void 0) | 1309 if (start === void 0) |
| 1310 start = 0; | 1310 start = 0; |
| 1311 _js_helper.checkNull(pattern); | 1311 _js_helper.checkNull(pattern); |
| 1312 if (!(typeof start == 'number')) | 1312 if (!(typeof start == 'number')) |
| 1313 throw new core.ArgumentError(start); | 1313 throw new core.ArgumentError(start); |
| 1314 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.len
gth)) { | 1314 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dar
tx.length])) { |
| 1315 throw new core.RangeError.range(start, 0, this.length); | 1315 throw new core.RangeError.range(start, 0, this[dartx.length]); |
| 1316 } | 1316 } |
| 1317 if (typeof pattern == 'string') { | 1317 if (typeof pattern == 'string') { |
| 1318 return this.indexOf(pattern, start); | 1318 return this.indexOf(pattern, start); |
| 1319 } | 1319 } |
| 1320 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { | 1320 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { |
| 1321 let re = pattern; | 1321 let re = pattern; |
| 1322 let match = _js_helper.firstMatchAfter(re, this, start); | 1322 let match = _js_helper.firstMatchAfter(re, this, start); |
| 1323 return match == null ? -1 : match.start; | 1323 return match == null ? -1 : match.start; |
| 1324 } | 1324 } |
| 1325 for (let i = start; dart.notNull(i) <= dart.notNull(this.length); i = dart
.notNull(i) + 1) { | 1325 for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i
= dart.notNull(i) + 1) { |
| 1326 if (pattern[dartx.matchAsPrefix](this, i) != null) | 1326 if (pattern[dartx.matchAsPrefix](this, i) != null) |
| 1327 return i; | 1327 return i; |
| 1328 } | 1328 } |
| 1329 return -1; | 1329 return -1; |
| 1330 } | 1330 } |
| 1331 [dartx.lastIndexOf](pattern, start) { | 1331 [dartx.lastIndexOf](pattern, start) { |
| 1332 if (start === void 0) | 1332 if (start === void 0) |
| 1333 start = null; | 1333 start = null; |
| 1334 _js_helper.checkNull(pattern); | 1334 _js_helper.checkNull(pattern); |
| 1335 if (start == null) { | 1335 if (start == null) { |
| 1336 start = this.length; | 1336 start = this[dartx.length]; |
| 1337 } else if (!(typeof start == 'number')) { | 1337 } else if (!(typeof start == 'number')) { |
| 1338 throw new core.ArgumentError(start); | 1338 throw new core.ArgumentError(start); |
| 1339 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t
his.length)) { | 1339 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t
his[dartx.length])) { |
| 1340 throw new core.RangeError.range(start, 0, this.length); | 1340 throw new core.RangeError.range(start, 0, this[dartx.length]); |
| 1341 } | 1341 } |
| 1342 if (typeof pattern == 'string') { | 1342 if (typeof pattern == 'string') { |
| 1343 let other = pattern; | 1343 let other = pattern; |
| 1344 if (dart.notNull(start) + dart.notNull(other.length) > dart.notNull(this
.length)) { | 1344 if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNu
ll(this[dartx.length])) { |
| 1345 start = dart.notNull(this.length) - dart.notNull(other.length); | 1345 start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.le
ngth]); |
| 1346 } | 1346 } |
| 1347 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start)
, core.int); | 1347 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start)
, core.int); |
| 1348 } | 1348 } |
| 1349 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { | 1349 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { |
| 1350 if (pattern[dartx.matchAsPrefix](this, i) != null) | 1350 if (pattern[dartx.matchAsPrefix](this, i) != null) |
| 1351 return i; | 1351 return i; |
| 1352 } | 1352 } |
| 1353 return -1; | 1353 return -1; |
| 1354 } | 1354 } |
| 1355 [dartx.contains](other, startIndex) { | 1355 [dartx.contains](other, startIndex) { |
| 1356 if (startIndex === void 0) | 1356 if (startIndex === void 0) |
| 1357 startIndex = 0; | 1357 startIndex = 0; |
| 1358 _js_helper.checkNull(other); | 1358 _js_helper.checkNull(other); |
| 1359 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this.length)) { | 1359 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul
l(this[dartx.length])) { |
| 1360 throw new core.RangeError.range(startIndex, 0, this.length); | 1360 throw new core.RangeError.range(startIndex, 0, this[dartx.length]); |
| 1361 } | 1361 } |
| 1362 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex)
, core.bool); | 1362 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex)
, core.bool); |
| 1363 } | 1363 } |
| 1364 get [dartx.isEmpty]() { | 1364 get [dartx.isEmpty]() { |
| 1365 return this.length == 0; | 1365 return this[dartx.length] == 0; |
| 1366 } | 1366 } |
| 1367 get [dartx.isNotEmpty]() { | 1367 get [dartx.isNotEmpty]() { |
| 1368 return !dart.notNull(this[dartx.isEmpty]); | 1368 return !dart.notNull(this[dartx.isEmpty]); |
| 1369 } | 1369 } |
| 1370 [dartx.compareTo](other) { | 1370 [dartx.compareTo](other) { |
| 1371 if (!(typeof other == 'string')) | 1371 if (!(typeof other == 'string')) |
| 1372 throw new core.ArgumentError(other); | 1372 throw new core.ArgumentError(other); |
| 1373 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; | 1373 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; |
| 1374 } | 1374 } |
| 1375 [dartx.toString]() { | 1375 [dartx.toString]() { |
| 1376 return this; | 1376 return this; |
| 1377 } | 1377 } |
| 1378 get [dartx.hashCode]() { | 1378 get [dartx.hashCode]() { |
| 1379 let hash = 0; | 1379 let hash = 0; |
| 1380 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.notN
ull(i) + 1) { | 1380 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da
rt.notNull(i) + 1) { |
| 1381 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); | 1381 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); |
| 1382 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <
< 10); | 1382 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <
< 10); |
| 1383 hash = hash ^ hash >> 6; | 1383 hash = hash ^ hash >> 6; |
| 1384 } | 1384 } |
| 1385 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); | 1385 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); |
| 1386 hash = hash ^ hash >> 11; | 1386 hash = hash ^ hash >> 11; |
| 1387 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); | 1387 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); |
| 1388 } | 1388 } |
| 1389 get [dartx.runtimeType]() { | 1389 get [dartx.runtimeType]() { |
| 1390 return core.String; | 1390 return core.String; |
| 1391 } | 1391 } |
| 1392 get length() { | 1392 get [dartx.length]() { |
| 1393 return this.length; | 1393 return this.length; |
| 1394 } | 1394 } |
| 1395 [dartx.get](index) { | 1395 [dartx.get](index) { |
| 1396 if (!(typeof index == 'number')) | 1396 if (!(typeof index == 'number')) |
| 1397 throw new core.ArgumentError(index); | 1397 throw new core.ArgumentError(index); |
| 1398 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(index
) < 0) | 1398 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNul
l(index) < 0) |
| 1399 throw new core.RangeError.value(index); | 1399 throw new core.RangeError.value(index); |
| 1400 return this[index]; | 1400 return this[index]; |
| 1401 } | 1401 } |
| 1402 } | 1402 } |
| 1403 JSString[dart.implements] = () => [core.String, JSIndexable]; | 1403 JSString[dart.implements] = () => [core.String, JSIndexable]; |
| 1404 dart.setSignature(JSString, { | 1404 dart.setSignature(JSString, { |
| 1405 constructors: () => ({JSString: [JSString, []]}), | 1405 constructors: () => ({JSString: [JSString, []]}), |
| 1406 methods: () => ({ | 1406 methods: () => ({ |
| 1407 [dartx.codeUnitAt]: [core.int, [core.int]], | 1407 [dartx.codeUnitAt]: [core.int, [core.int]], |
| 1408 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int]
], | 1408 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int]
], |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1439 names: ['_isWhitespace', '_skipLeadingWhitespace', '_skipTrailingWhitespace'
] | 1439 names: ['_isWhitespace', '_skipLeadingWhitespace', '_skipTrailingWhitespace'
] |
| 1440 }); | 1440 }); |
| 1441 JSString[dart.metadata] = () => [dart.const(new _js_helper.JsPeerInterface({na
me: 'String'}))]; | 1441 JSString[dart.metadata] = () => [dart.const(new _js_helper.JsPeerInterface({na
me: 'String'}))]; |
| 1442 dart.registerExtension(dart.global.String, JSString); | 1442 dart.registerExtension(dart.global.String, JSString); |
| 1443 let _string = Symbol('_string'); | 1443 let _string = Symbol('_string'); |
| 1444 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { | 1444 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { |
| 1445 _CodeUnits(string) { | 1445 _CodeUnits(string) { |
| 1446 this[_string] = string; | 1446 this[_string] = string; |
| 1447 } | 1447 } |
| 1448 get length() { | 1448 get length() { |
| 1449 return this[_string].length; | 1449 return this[_string][dartx.length]; |
| 1450 } | 1450 } |
| 1451 get(i) { | 1451 get(i) { |
| 1452 return this[_string][dartx.codeUnitAt](i); | 1452 return this[_string][dartx.codeUnitAt](i); |
| 1453 } | 1453 } |
| 1454 } | 1454 } |
| 1455 dart.setSignature(_CodeUnits, { | 1455 dart.setSignature(_CodeUnits, { |
| 1456 constructors: () => ({_CodeUnits: [_CodeUnits, [core.String]]}), | 1456 constructors: () => ({_CodeUnits: [_CodeUnits, [core.String]]}), |
| 1457 methods: () => ({get: [core.int, [core.int]]}) | 1457 methods: () => ({get: [core.int, [core.int]]}) |
| 1458 }); | 1458 }); |
| 1459 dart.defineExtensionMembers(_CodeUnits, ['get', 'length']); | 1459 dart.defineExtensionMembers(_CodeUnits, ['get', 'length']); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 exports.JSString = JSString; | 1542 exports.JSString = JSString; |
| 1543 exports.getInterceptor = getInterceptor; | 1543 exports.getInterceptor = getInterceptor; |
| 1544 exports.JSBool = JSBool; | 1544 exports.JSBool = JSBool; |
| 1545 exports.JSIndexable = JSIndexable; | 1545 exports.JSIndexable = JSIndexable; |
| 1546 exports.JSMutableIndexable = JSMutableIndexable; | 1546 exports.JSMutableIndexable = JSMutableIndexable; |
| 1547 exports.JSObject = JSObject; | 1547 exports.JSObject = JSObject; |
| 1548 exports.JavaScriptObject = JavaScriptObject; | 1548 exports.JavaScriptObject = JavaScriptObject; |
| 1549 exports.PlainJavaScriptObject = PlainJavaScriptObject; | 1549 exports.PlainJavaScriptObject = PlainJavaScriptObject; |
| 1550 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; | 1550 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; |
| 1551 }); | 1551 }); |
| OLD | NEW |