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