| OLD | NEW |
| 1 var _interceptors; | 1 var _interceptors; |
| 2 (function(_interceptors) { | 2 (function(_interceptors) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 // Function _symbolToString: (Symbol) → String | 4 // Function _symbolToString: (Symbol) → String |
| 5 function _symbolToString(symbol) { | 5 function _symbolToString(symbol) { |
| 6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); | 6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); |
| 7 } | 7 } |
| 8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic | 8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic |
| 9 function _symbolMapToStringMap(map) { | 9 function _symbolMapToStringMap(map) { |
| 10 if (map === null) | 10 if (map === null) |
| 11 return null; | 11 return null; |
| 12 let result = new core.Map(); | 12 let result = new core.Map(); |
| 13 map.forEach((key, value) => { | 13 map.forEach((key, value) => { |
| 14 result.set(_symbolToString(key), value); | 14 result.set(_symbolToString(key), value); |
| 15 }); | 15 }); |
| 16 return result; | 16 return result; |
| 17 } | 17 } |
| 18 // Function getInterceptor: (dynamic) → dynamic | 18 // Function getInterceptor: (dynamic) → dynamic |
| 19 function getInterceptor(object) { | 19 function getInterceptor(object) { |
| 20 return _foreign_helper.JS('', 'void 0'); | 20 return void 0; |
| 21 } | 21 } |
| 22 // Function getDispatchProperty: (dynamic) → dynamic | 22 // Function getDispatchProperty: (dynamic) → dynamic |
| 23 function getDispatchProperty(object) { | 23 function getDispatchProperty(object) { |
| 24 return _foreign_helper.JS('', '#[#]', object, _foreign_helper.JS_EMBEDDED_GL
OBAL('String', dart.as(_js_embedded_names.DISPATCH_PROPERTY_NAME, core.String)))
; | 24 return object[_foreign_helper.JS_EMBEDDED_GLOBAL('String', dart.as(_js_embed
ded_names.DISPATCH_PROPERTY_NAME, core.String))]; |
| 25 } | 25 } |
| 26 // Function setDispatchProperty: (dynamic, dynamic) → dynamic | 26 // Function setDispatchProperty: (dynamic, dynamic) → dynamic |
| 27 function setDispatchProperty(object, value) { | 27 function setDispatchProperty(object, value) { |
| 28 _js_helper.defineProperty(object, dart.as(_foreign_helper.JS_EMBEDDED_GLOBAL
('String', dart.as(_js_embedded_names.DISPATCH_PROPERTY_NAME, core.String)), cor
e.String), value); | 28 _js_helper.defineProperty(object, dart.as(_foreign_helper.JS_EMBEDDED_GLOBAL
('String', dart.as(_js_embedded_names.DISPATCH_PROPERTY_NAME, core.String)), cor
e.String), value); |
| 29 } | 29 } |
| 30 // Function makeDispatchRecord: (dynamic, dynamic, dynamic, dynamic) → dynamic | 30 // Function makeDispatchRecord: (dynamic, dynamic, dynamic, dynamic) → dynamic |
| 31 function makeDispatchRecord(interceptor, proto, extension, indexability) { | 31 function makeDispatchRecord(interceptor, proto, extension, indexability) { |
| 32 return _foreign_helper.JS('', '{i: #, p: #, e: #, x: #}', interceptor, proto
, extension, indexability); | 32 return {i: interceptor, p: proto, e: extension, x: indexability}; |
| 33 } | 33 } |
| 34 // Function dispatchRecordInterceptor: (dynamic) → dynamic | 34 // Function dispatchRecordInterceptor: (dynamic) → dynamic |
| 35 function dispatchRecordInterceptor(record) { | 35 function dispatchRecordInterceptor(record) { |
| 36 return _foreign_helper.JS('', '#.i', record); | 36 return record.i; |
| 37 } | 37 } |
| 38 // Function dispatchRecordProto: (dynamic) → dynamic | 38 // Function dispatchRecordProto: (dynamic) → dynamic |
| 39 function dispatchRecordProto(record) { | 39 function dispatchRecordProto(record) { |
| 40 return _foreign_helper.JS('', '#.p', record); | 40 return record.p; |
| 41 } | 41 } |
| 42 // Function dispatchRecordExtension: (dynamic) → dynamic | 42 // Function dispatchRecordExtension: (dynamic) → dynamic |
| 43 function dispatchRecordExtension(record) { | 43 function dispatchRecordExtension(record) { |
| 44 return _foreign_helper.JS('', '#.e', record); | 44 return record.e; |
| 45 } | 45 } |
| 46 // Function dispatchRecordIndexability: (dynamic) → dynamic | 46 // Function dispatchRecordIndexability: (dynamic) → dynamic |
| 47 function dispatchRecordIndexability(record) { | 47 function dispatchRecordIndexability(record) { |
| 48 return _foreign_helper.JS('bool|Null', '#.x', record); | 48 return record.x; |
| 49 } | 49 } |
| 50 // Function getNativeInterceptor: (dynamic) → dynamic | 50 // Function getNativeInterceptor: (dynamic) → dynamic |
| 51 function getNativeInterceptor(object) { | 51 function getNativeInterceptor(object) { |
| 52 let record = getDispatchProperty(object); | 52 let record = getDispatchProperty(object); |
| 53 if (record === null) { | 53 if (record === null) { |
| 54 if (_js_helper.initNativeDispatchFlag === null) { | 54 if (_js_helper.initNativeDispatchFlag === null) { |
| 55 _js_helper.initNativeDispatch(); | 55 _js_helper.initNativeDispatch(); |
| 56 record = getDispatchProperty(object); | 56 record = getDispatchProperty(object); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 if (record !== null) { | 59 if (record !== null) { |
| 60 let proto = dispatchRecordProto(record); | 60 let proto = dispatchRecordProto(record); |
| 61 if (false === proto) | 61 if (false === proto) |
| 62 return dispatchRecordInterceptor(record); | 62 return dispatchRecordInterceptor(record); |
| 63 if (true === proto) | 63 if (true === proto) |
| 64 return object; | 64 return object; |
| 65 let objectProto = _foreign_helper.JS('', 'Object.getPrototypeOf(#)', objec
t); | 65 let objectProto = Object.getPrototypeOf(object); |
| 66 if (_foreign_helper.JS('bool', '# === #', proto, objectProto)) { | 66 if (proto === objectProto) { |
| 67 return dispatchRecordInterceptor(record); | 67 return dispatchRecordInterceptor(record); |
| 68 } | 68 } |
| 69 let extension = dispatchRecordExtension(record); | 69 let extension = dispatchRecordExtension(record); |
| 70 if (_foreign_helper.JS('bool', '# === #', extension, objectProto)) { | 70 if (extension === objectProto) { |
| 71 let discriminatedTag = _foreign_helper.JS('', '(#)(#, #)', proto, object
, record); | 71 let discriminatedTag = proto(object, record); |
| 72 throw new core.UnimplementedError(`Return interceptor for ${discriminate
dTag}`); | 72 throw new core.UnimplementedError(`Return interceptor for ${discriminate
dTag}`); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 let interceptor = _js_helper.lookupAndCacheInterceptor(object); | 75 let interceptor = _js_helper.lookupAndCacheInterceptor(object); |
| 76 if (interceptor === null) { | 76 if (interceptor === null) { |
| 77 let proto = _foreign_helper.JS('', 'Object.getPrototypeOf(#)', object); | 77 let proto = Object.getPrototypeOf(object); |
| 78 if (_foreign_helper.JS('bool', '# == null || # === Object.prototype', prot
o, proto)) { | 78 if (proto == null || proto === Object.prototype) { |
| 79 return _foreign_helper.JS_INTERCEPTOR_CONSTANT(PlainJavaScriptObject); | 79 return _foreign_helper.JS_INTERCEPTOR_CONSTANT(PlainJavaScriptObject); |
| 80 } else { | 80 } else { |
| 81 return _foreign_helper.JS_INTERCEPTOR_CONSTANT(UnknownJavaScriptObject); | 81 return _foreign_helper.JS_INTERCEPTOR_CONSTANT(UnknownJavaScriptObject); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 return interceptor; | 84 return interceptor; |
| 85 } | 85 } |
| 86 dart.copyProperties(_interceptors, { | 86 dart.copyProperties(_interceptors, { |
| 87 get mapTypeToInterceptor() { | 87 get mapTypeToInterceptor() { |
| 88 return _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.M
AP_TYPE_TO_INTERCEPTOR, core.String)); | 88 return _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.M
AP_TYPE_TO_INTERCEPTOR, core.String)); |
| 89 } | 89 } |
| 90 }); | 90 }); |
| 91 // Function findIndexForNativeSubclassType: (Type) → int | 91 // Function findIndexForNativeSubclassType: (Type) → int |
| 92 function findIndexForNativeSubclassType(type) { | 92 function findIndexForNativeSubclassType(type) { |
| 93 if (_foreign_helper.JS('bool', '# == null', _interceptors.mapTypeToIntercept
or)) | 93 if (_interceptors.mapTypeToInterceptor == null) |
| 94 return dart.as(null, core.int); | 94 return dart.as(null, core.int); |
| 95 let map = dart.as(_foreign_helper.JS('JSFixedArray', '#', _interceptors.mapT
ypeToInterceptor), core.List); | 95 let map = dart.as(_interceptors.mapTypeToInterceptor, core.List); |
| 96 for (let i = 0; i + 1 < map.length; i = 3) { | 96 for (let i = 0; i + 1 < map.length; i = 3) { |
| 97 if (dart.equals(type, map.get(i))) { | 97 if (dart.equals(type, map.get(i))) { |
| 98 return i; | 98 return i; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 return dart.as(null, core.int); | 101 return dart.as(null, core.int); |
| 102 } | 102 } |
| 103 // Function findInterceptorConstructorForType: (Type) → dynamic | 103 // Function findInterceptorConstructorForType: (Type) → dynamic |
| 104 function findInterceptorConstructorForType(type) { | 104 function findInterceptorConstructorForType(type) { |
| 105 let index = findIndexForNativeSubclassType(type); | 105 let index = findIndexForNativeSubclassType(type); |
| 106 if (index === null) | 106 if (index === null) |
| 107 return null; | 107 return null; |
| 108 let map = dart.as(_foreign_helper.JS('JSFixedArray', '#', _interceptors.mapT
ypeToInterceptor), core.List); | 108 let map = dart.as(_interceptors.mapTypeToInterceptor, core.List); |
| 109 return map.get(index + 1); | 109 return map.get(index + 1); |
| 110 } | 110 } |
| 111 // Function findConstructorForNativeSubclassType: (Type, String) → dynamic | 111 // Function findConstructorForNativeSubclassType: (Type, String) → dynamic |
| 112 function findConstructorForNativeSubclassType(type, name) { | 112 function findConstructorForNativeSubclassType(type, name) { |
| 113 let index = findIndexForNativeSubclassType(type); | 113 let index = findIndexForNativeSubclassType(type); |
| 114 if (index === null) | 114 if (index === null) |
| 115 return null; | 115 return null; |
| 116 let map = dart.as(_foreign_helper.JS('JSFixedArray', '#', _interceptors.mapT
ypeToInterceptor), core.List); | 116 let map = dart.as(_interceptors.mapTypeToInterceptor, core.List); |
| 117 let constructorMap = map.get(index + 2); | 117 let constructorMap = map.get(index + 2); |
| 118 let constructorFn = _foreign_helper.JS('', '#[#]', constructorMap, name); | 118 let constructorFn = constructorMap[name]; |
| 119 return constructorFn; | 119 return constructorFn; |
| 120 } | 120 } |
| 121 // Function findInterceptorForType: (Type) → dynamic | 121 // Function findInterceptorForType: (Type) → dynamic |
| 122 function findInterceptorForType(type) { | 122 function findInterceptorForType(type) { |
| 123 let constructor = findInterceptorConstructorForType(type); | 123 let constructor = findInterceptorConstructorForType(type); |
| 124 if (constructor === null) | 124 if (constructor === null) |
| 125 return null; | 125 return null; |
| 126 return _foreign_helper.JS('', '#.prototype', constructor); | 126 return constructor.prototype; |
| 127 } | 127 } |
| 128 class Interceptor extends dart.Object { | 128 class Interceptor extends dart.Object { |
| 129 Interceptor() { | 129 Interceptor() { |
| 130 } | 130 } |
| 131 ['=='](other) { | 131 ['=='](other) { |
| 132 return core.identical(this, other); | 132 return core.identical(this, other); |
| 133 } | 133 } |
| 134 get hashCode() { | 134 get hashCode() { |
| 135 return _js_helper.Primitives.objectHashCode(this); | 135 return _js_helper.Primitives.objectHashCode(this); |
| 136 } | 136 } |
| 137 toString() { | 137 toString() { |
| 138 return _js_helper.Primitives.objectToString(this); | 138 return _js_helper.Primitives.objectToString(this); |
| 139 } | 139 } |
| 140 noSuchMethod(invocation) { | 140 noSuchMethod(invocation) { |
| 141 throw new core.NoSuchMethodError(this, invocation.memberName, invocation.p
ositionalArguments, invocation.namedArguments); | 141 throw new core.NoSuchMethodError(this, invocation.memberName, invocation.p
ositionalArguments, invocation.namedArguments); |
| 142 } | 142 } |
| 143 get runtimeType() { | 143 get runtimeType() { |
| 144 return _js_helper.getRuntimeType(this); | 144 return _js_helper.getRuntimeType(this); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 class JSBool extends Interceptor { | 147 class JSBool extends Interceptor { |
| 148 JSBool() { | 148 JSBool() { |
| 149 super.Interceptor(); | 149 super.Interceptor(); |
| 150 } | 150 } |
| 151 toString() { | 151 toString() { |
| 152 return dart.as(_foreign_helper.JS('String', 'String(#)', this), core.Strin
g); | 152 return String(this); |
| 153 } | 153 } |
| 154 get hashCode() { | 154 get hashCode() { |
| 155 return this ? 2 * 3 * 23 * 3761 : 269 * 811; | 155 return this ? 2 * 3 * 23 * 3761 : 269 * 811; |
| 156 } | 156 } |
| 157 get runtimeType() { | 157 get runtimeType() { |
| 158 return core.bool; | 158 return core.bool; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 class JSNull extends Interceptor { | 161 class JSNull extends Interceptor { |
| 162 JSNull() { | 162 JSNull() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 class PlainJavaScriptObject extends JavaScriptObject { | 198 class PlainJavaScriptObject extends JavaScriptObject { |
| 199 PlainJavaScriptObject() { | 199 PlainJavaScriptObject() { |
| 200 super.JavaScriptObject(); | 200 super.JavaScriptObject(); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 class UnknownJavaScriptObject extends JavaScriptObject { | 203 class UnknownJavaScriptObject extends JavaScriptObject { |
| 204 UnknownJavaScriptObject() { | 204 UnknownJavaScriptObject() { |
| 205 super.JavaScriptObject(); | 205 super.JavaScriptObject(); |
| 206 } | 206 } |
| 207 toString() { | 207 toString() { |
| 208 return dart.as(_foreign_helper.JS('String', 'String(#)', this), core.Strin
g); | 208 return String(this); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 let JSArray$ = dart.generic(function(E) { | 211 let JSArray$ = dart.generic(function(E) { |
| 212 class JSArray extends Interceptor { | 212 class JSArray extends Interceptor { |
| 213 JSArray() { | 213 JSArray() { |
| 214 super.Interceptor(); | 214 super.Interceptor(); |
| 215 } | 215 } |
| 216 JSArray$fixed(length) { | 216 JSArray$fixed(length) { |
| 217 if (dart.notNull(!(typeof length == number)) || dart.notNull(length < 0)
) { | 217 if (dart.notNull(!(typeof length == number)) || dart.notNull(length < 0)
) { |
| 218 throw new core.ArgumentError(`Length must be a non-negative integer: $
{length}`); | 218 throw new core.ArgumentError(`Length must be a non-negative integer: $
{length}`); |
| 219 } | 219 } |
| 220 return new JSArray.markFixed(_foreign_helper.JS('', 'new Array(#)', leng
th)); | 220 return new JSArray.markFixed(new Array(length)); |
| 221 } | 221 } |
| 222 JSArray$emptyGrowable() { | 222 JSArray$emptyGrowable() { |
| 223 return new JSArray.markGrowable(_foreign_helper.JS('', '[]')); | 223 return new JSArray.markGrowable([]); |
| 224 } | 224 } |
| 225 JSArray$growable(length) { | 225 JSArray$growable(length) { |
| 226 if (dart.notNull(!(typeof length == number)) || dart.notNull(length < 0)
) { | 226 if (dart.notNull(!(typeof length == number)) || dart.notNull(length < 0)
) { |
| 227 throw new core.ArgumentError(`Length must be a non-negative integer: $
{length}`); | 227 throw new core.ArgumentError(`Length must be a non-negative integer: $
{length}`); |
| 228 } | 228 } |
| 229 return new JSArray.markGrowable(_foreign_helper.JS('', 'new Array(#)', l
ength)); | 229 return new JSArray.markGrowable(new Array(length)); |
| 230 } | 230 } |
| 231 JSArray$typed(allocation) { | 231 JSArray$typed(allocation) { |
| 232 return dart.as(_foreign_helper.JS('JSArray', '#', allocation), JSArray$(
E)); | 232 return dart.as(allocation, JSArray$(E)); |
| 233 } | 233 } |
| 234 JSArray$markFixed(allocation) { | 234 JSArray$markFixed(allocation) { |
| 235 return dart.as(_foreign_helper.JS('JSFixedArray', '#', markFixedList(new
JSArray.typed(allocation))), JSArray$(E)); | 235 return dart.as(markFixedList(new JSArray.typed(allocation)), JSArray$(E)
); |
| 236 } | 236 } |
| 237 JSArray$markGrowable(allocation) { | 237 JSArray$markGrowable(allocation) { |
| 238 return dart.as(_foreign_helper.JS('JSExtendableArray', '#', new JSArray.
typed(allocation)), JSArray$(E)); | 238 return dart.as(new JSArray.typed(allocation), JSArray$(E)); |
| 239 } | 239 } |
| 240 static markFixedList(list) { | 240 static markFixedList(list) { |
| 241 _foreign_helper.JS('void', '#.fixed$length = Array', list); | 241 list.fixed$length = Array; |
| 242 return dart.as(_foreign_helper.JS('JSFixedArray', '#', list), core.List)
; | 242 return dart.as(list, core.List); |
| 243 } | 243 } |
| 244 checkMutable(reason) { | 244 checkMutable(reason) { |
| 245 if (!dart.is(this, JSMutableArray)) { | 245 if (!dart.is(this, JSMutableArray)) { |
| 246 throw new core.UnsupportedError(dart.as(reason, core.String)); | 246 throw new core.UnsupportedError(dart.as(reason, core.String)); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 checkGrowable(reason) { | 249 checkGrowable(reason) { |
| 250 if (!dart.is(this, JSExtendableArray)) { | 250 if (!dart.is(this, JSExtendableArray)) { |
| 251 throw new core.UnsupportedError(dart.as(reason, core.String)); | 251 throw new core.UnsupportedError(dart.as(reason, core.String)); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 add(value) { | 254 add(value) { |
| 255 this.checkGrowable('add'); | 255 this.checkGrowable('add'); |
| 256 _foreign_helper.JS('void', '#.push(#)', this, value); | 256 this.push(value); |
| 257 } | 257 } |
| 258 removeAt(index) { | 258 removeAt(index) { |
| 259 if (!(typeof index == number)) | 259 if (!(typeof index == number)) |
| 260 throw new core.ArgumentError(index); | 260 throw new core.ArgumentError(index); |
| 261 if (dart.notNull(index < 0) || dart.notNull(index >= this.length)) { | 261 if (dart.notNull(index < 0) || dart.notNull(index >= this.length)) { |
| 262 throw new core.RangeError.value(index); | 262 throw new core.RangeError.value(index); |
| 263 } | 263 } |
| 264 this.checkGrowable('removeAt'); | 264 this.checkGrowable('removeAt'); |
| 265 return dart.as(_foreign_helper.JS('var', '#.splice(#, 1)[0]', this, inde
x), E); | 265 return dart.as(this.splice(index, 1)[0], E); |
| 266 } | 266 } |
| 267 insert(index, value) { | 267 insert(index, value) { |
| 268 if (!(typeof index == number)) | 268 if (!(typeof index == number)) |
| 269 throw new core.ArgumentError(index); | 269 throw new core.ArgumentError(index); |
| 270 if (dart.notNull(index < 0) || dart.notNull(index > this.length)) { | 270 if (dart.notNull(index < 0) || dart.notNull(index > this.length)) { |
| 271 throw new core.RangeError.value(index); | 271 throw new core.RangeError.value(index); |
| 272 } | 272 } |
| 273 this.checkGrowable('insert'); | 273 this.checkGrowable('insert'); |
| 274 _foreign_helper.JS('void', '#.splice(#, 0, #)', this, index, value); | 274 this.splice(index, 0, value); |
| 275 } | 275 } |
| 276 insertAll(index, iterable) { | 276 insertAll(index, iterable) { |
| 277 this.checkGrowable('insertAll'); | 277 this.checkGrowable('insertAll'); |
| 278 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); | 278 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); |
| 279 } | 279 } |
| 280 setAll(index, iterable) { | 280 setAll(index, iterable) { |
| 281 this.checkMutable('setAll'); | 281 this.checkMutable('setAll'); |
| 282 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); | 282 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); |
| 283 } | 283 } |
| 284 removeLast() { | 284 removeLast() { |
| 285 this.checkGrowable('removeLast'); | 285 this.checkGrowable('removeLast'); |
| 286 if (this.length === 0) | 286 if (this.length === 0) |
| 287 throw new core.RangeError.value(-1); | 287 throw new core.RangeError.value(-1); |
| 288 return dart.as(_foreign_helper.JS('var', '#.pop()', this), E); | 288 return dart.as(this.pop(), E); |
| 289 } | 289 } |
| 290 remove(element) { | 290 remove(element) { |
| 291 this.checkGrowable('remove'); | 291 this.checkGrowable('remove'); |
| 292 for (let i = 0; i < this.length; i++) { | 292 for (let i = 0; i < this.length; i++) { |
| 293 if (dart.equals(this.get(i), element)) { | 293 if (dart.equals(this.get(i), element)) { |
| 294 _foreign_helper.JS('var', '#.splice(#, 1)', this, i); | 294 this.splice(i, 1); |
| 295 return true; | 295 return true; |
| 296 } | 296 } |
| 297 } | 297 } |
| 298 return false; | 298 return false; |
| 299 } | 299 } |
| 300 removeWhere(test) { | 300 removeWhere(test) { |
| 301 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as(test, da
rt.throw_("Unimplemented type (dynamic) → bool"))); | 301 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as(test, da
rt.throw_("Unimplemented type (dynamic) → bool"))); |
| 302 } | 302 } |
| 303 retainWhere(test) { | 303 retainWhere(test) { |
| 304 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as((element
) => !dart.notNull(test(element)), dart.throw_("Unimplemented type (dynamic) → b
ool"))); | 304 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as((element
) => !dart.notNull(test(element)), dart.throw_("Unimplemented type (dynamic) → b
ool"))); |
| 305 } | 305 } |
| 306 where(f) { | 306 where(f) { |
| 307 return new _internal.IterableMixinWorkaround().where(this, dart.as(f, da
rt.throw_("Unimplemented type (dynamic) → bool"))); | 307 return new _internal.IterableMixinWorkaround().where(this, dart.as(f, da
rt.throw_("Unimplemented type (dynamic) → bool"))); |
| 308 } | 308 } |
| 309 expand(f) { | 309 expand(f) { |
| 310 return _internal.IterableMixinWorkaround.expand(this, dart.as(f, dart.th
row_("Unimplemented type (dynamic) → Iterable<dynamic>"))); | 310 return _internal.IterableMixinWorkaround.expand(this, dart.as(f, dart.th
row_("Unimplemented type (dynamic) → Iterable<dynamic>"))); |
| 311 } | 311 } |
| 312 addAll(collection) { | 312 addAll(collection) { |
| 313 for (let e of collection) { | 313 for (let e of collection) { |
| 314 this.add(e); | 314 this.add(e); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 clear() { | 317 clear() { |
| 318 this.length = 0; | 318 this.length = 0; |
| 319 } | 319 } |
| 320 forEach(f) { | 320 forEach(f) { |
| 321 let length = this.length; | 321 let length = this.length; |
| 322 for (let i = 0; i < length; i++) { | 322 for (let i = 0; i < length; i++) { |
| 323 f(dart.as(_foreign_helper.JS('', '#[#]', this, i), E)); | 323 f(dart.as(this[i], E)); |
| 324 if (length !== this.length) { | 324 if (length !== this.length) { |
| 325 throw new core.ConcurrentModificationError(this); | 325 throw new core.ConcurrentModificationError(this); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 map(f) { | 329 map(f) { |
| 330 return _internal.IterableMixinWorkaround.mapList(this, dart.as(f, dart.t
hrow_("Unimplemented type (dynamic) → dynamic"))); | 330 return _internal.IterableMixinWorkaround.mapList(this, dart.as(f, dart.t
hrow_("Unimplemented type (dynamic) → dynamic"))); |
| 331 } | 331 } |
| 332 join(separator) { | 332 join(separator) { |
| 333 if (separator === void 0) | 333 if (separator === void 0) |
| 334 separator = ""; | 334 separator = ""; |
| 335 let list = new core.List(this.length); | 335 let list = new core.List(this.length); |
| 336 for (let i = 0; i < this.length; i++) { | 336 for (let i = 0; i < this.length; i++) { |
| 337 list.set(i, `${this.get(i)}`); | 337 list.set(i, `${this.get(i)}`); |
| 338 } | 338 } |
| 339 return dart.as(_foreign_helper.JS('String', "#.join(#)", list, separator
), core.String); | 339 return list.join(separator); |
| 340 } | 340 } |
| 341 take(n) { | 341 take(n) { |
| 342 return new _internal.IterableMixinWorkaround().takeList(this, n); | 342 return new _internal.IterableMixinWorkaround().takeList(this, n); |
| 343 } | 343 } |
| 344 takeWhile(test) { | 344 takeWhile(test) { |
| 345 return new _internal.IterableMixinWorkaround().takeWhile(this, dart.as(t
est, dart.throw_("Unimplemented type (dynamic) → bool"))); | 345 return new _internal.IterableMixinWorkaround().takeWhile(this, dart.as(t
est, dart.throw_("Unimplemented type (dynamic) → bool"))); |
| 346 } | 346 } |
| 347 skip(n) { | 347 skip(n) { |
| 348 return new _internal.IterableMixinWorkaround().skipList(this, n); | 348 return new _internal.IterableMixinWorkaround().skipList(this, n); |
| 349 } | 349 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 end = this.length; | 383 end = this.length; |
| 384 } else { | 384 } else { |
| 385 if (!(typeof end == number)) | 385 if (!(typeof end == number)) |
| 386 throw new core.ArgumentError(end); | 386 throw new core.ArgumentError(end); |
| 387 if (dart.notNull(end < start) || dart.notNull(end > this.length)) { | 387 if (dart.notNull(end < start) || dart.notNull(end > this.length)) { |
| 388 throw new core.RangeError.range(end, start, this.length); | 388 throw new core.RangeError.range(end, start, this.length); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 if (start === end) | 391 if (start === end) |
| 392 return new List.from([]); | 392 return new List.from([]); |
| 393 return new JSArray.markGrowable(_foreign_helper.JS('', '#.slice(#, #)',
this, start, end)); | 393 return new JSArray.markGrowable(this.slice(start, end)); |
| 394 } | 394 } |
| 395 getRange(start, end) { | 395 getRange(start, end) { |
| 396 return new _internal.IterableMixinWorkaround().getRangeList(this, start,
end); | 396 return new _internal.IterableMixinWorkaround().getRangeList(this, start,
end); |
| 397 } | 397 } |
| 398 get first() { | 398 get first() { |
| 399 if (this.length > 0) | 399 if (this.length > 0) |
| 400 return this.get(0); | 400 return this.get(0); |
| 401 throw new core.StateError("No elements"); | 401 throw new core.StateError("No elements"); |
| 402 } | 402 } |
| 403 get last() { | 403 get last() { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 } | 482 } |
| 483 get isNotEmpty() { | 483 get isNotEmpty() { |
| 484 return !dart.notNull(this.isEmpty); | 484 return !dart.notNull(this.isEmpty); |
| 485 } | 485 } |
| 486 toString() { | 486 toString() { |
| 487 return collection.ListBase.listToString(this); | 487 return collection.ListBase.listToString(this); |
| 488 } | 488 } |
| 489 toList(opt$) { | 489 toList(opt$) { |
| 490 let growable = opt$.growable === void 0 ? true : opt$.growable; | 490 let growable = opt$.growable === void 0 ? true : opt$.growable; |
| 491 if (growable) { | 491 if (growable) { |
| 492 return new JSArray.markGrowable(_foreign_helper.JS('', '#.slice()', th
is)); | 492 return new JSArray.markGrowable(this.slice()); |
| 493 } else { | 493 } else { |
| 494 return new JSArray.markFixed(_foreign_helper.JS('', '#.slice()', this)
); | 494 return new JSArray.markFixed(this.slice()); |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 toSet() { | 497 toSet() { |
| 498 return new core.Set.from(this); | 498 return new core.Set.from(this); |
| 499 } | 499 } |
| 500 get iterator() { | 500 get iterator() { |
| 501 return new _internal.ListIterator(this); | 501 return new _internal.ListIterator(this); |
| 502 } | 502 } |
| 503 get hashCode() { | 503 get hashCode() { |
| 504 return _js_helper.Primitives.objectHashCode(this); | 504 return _js_helper.Primitives.objectHashCode(this); |
| 505 } | 505 } |
| 506 get length() { | 506 get length() { |
| 507 return dart.as(_foreign_helper.JS('JSUInt32', '#.length', this), core.in
t); | 507 return dart.as(this.length, core.int); |
| 508 } | 508 } |
| 509 set length(newLength) { | 509 set length(newLength) { |
| 510 if (!(typeof newLength == number)) | 510 if (!(typeof newLength == number)) |
| 511 throw new core.ArgumentError(newLength); | 511 throw new core.ArgumentError(newLength); |
| 512 if (newLength < 0) | 512 if (newLength < 0) |
| 513 throw new core.RangeError.value(newLength); | 513 throw new core.RangeError.value(newLength); |
| 514 this.checkGrowable('set length'); | 514 this.checkGrowable('set length'); |
| 515 _foreign_helper.JS('void', '#.length = #', this, newLength); | 515 this.length = newLength; |
| 516 } | 516 } |
| 517 get(index) { | 517 get(index) { |
| 518 if (!(typeof index == number)) | 518 if (!(typeof index == number)) |
| 519 throw new core.ArgumentError(index); | 519 throw new core.ArgumentError(index); |
| 520 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) | 520 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) |
| 521 throw new core.RangeError.value(index); | 521 throw new core.RangeError.value(index); |
| 522 return dart.as(_foreign_helper.JS('var', '#[#]', this, index), E); | 522 return dart.as(this[index], E); |
| 523 } | 523 } |
| 524 set(index, value) { | 524 set(index, value) { |
| 525 this.checkMutable('indexed set'); | 525 this.checkMutable('indexed set'); |
| 526 if (!(typeof index == number)) | 526 if (!(typeof index == number)) |
| 527 throw new core.ArgumentError(index); | 527 throw new core.ArgumentError(index); |
| 528 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) | 528 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) |
| 529 throw new core.RangeError.value(index); | 529 throw new core.RangeError.value(index); |
| 530 _foreign_helper.JS('void', '#[#] = #', this, index, value); | 530 this[index] = value; |
| 531 } | 531 } |
| 532 asMap() { | 532 asMap() { |
| 533 return new _internal.IterableMixinWorkaround().asMapList(this); | 533 return new _internal.IterableMixinWorkaround().asMapList(this); |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 dart.defineNamedConstructor(JSArray, 'fixed'); | 536 dart.defineNamedConstructor(JSArray, 'fixed'); |
| 537 dart.defineNamedConstructor(JSArray, 'emptyGrowable'); | 537 dart.defineNamedConstructor(JSArray, 'emptyGrowable'); |
| 538 dart.defineNamedConstructor(JSArray, 'growable'); | 538 dart.defineNamedConstructor(JSArray, 'growable'); |
| 539 dart.defineNamedConstructor(JSArray, 'typed'); | 539 dart.defineNamedConstructor(JSArray, 'typed'); |
| 540 dart.defineNamedConstructor(JSArray, 'markFixed'); | 540 dart.defineNamedConstructor(JSArray, 'markFixed'); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 587 } |
| 588 return 1; | 588 return 1; |
| 589 } else { | 589 } else { |
| 590 return -1; | 590 return -1; |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 get isNegative() { | 593 get isNegative() { |
| 594 return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0); | 594 return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0); |
| 595 } | 595 } |
| 596 get isNaN() { | 596 get isNaN() { |
| 597 return dart.as(_foreign_helper.JS('bool', 'isNaN(#)', this), core.bool); | 597 return isNaN(this); |
| 598 } | 598 } |
| 599 get isInfinite() { | 599 get isInfinite() { |
| 600 return dart.dbinary(_foreign_helper.JS('bool', '# == Infinity', this), '||
', _foreign_helper.JS('bool', '# == -Infinity', this)); | 600 return dart.notNull(this == Infinity) || dart.notNull(this == -Infinity); |
| 601 } | 601 } |
| 602 get isFinite() { | 602 get isFinite() { |
| 603 return dart.as(_foreign_helper.JS('bool', 'isFinite(#)', this), core.bool)
; | 603 return isFinite(this); |
| 604 } | 604 } |
| 605 remainder(b) { | 605 remainder(b) { |
| 606 _js_helper.checkNull(b); | 606 _js_helper.checkNull(b); |
| 607 if (!dart.is(b, core.num)) | 607 if (!dart.is(b, core.num)) |
| 608 throw new core.ArgumentError(b); | 608 throw new core.ArgumentError(b); |
| 609 return dart.as(_foreign_helper.JS('num', '# % #', this, b), core.num); | 609 return this % b; |
| 610 } | 610 } |
| 611 abs() { | 611 abs() { |
| 612 return dart.as(_foreign_helper.JS('num', 'Math.abs(#)', this), core.num); | 612 return Math.abs(this); |
| 613 } | 613 } |
| 614 get sign() { | 614 get sign() { |
| 615 return this['>'](0) ? 1 : this['<'](0) ? -1 : this; | 615 return this['>'](0) ? 1 : this['<'](0) ? -1 : this; |
| 616 } | 616 } |
| 617 toInt() { | 617 toInt() { |
| 618 if (dart.notNull(this['>='](_MIN_INT32)) && dart.notNull(this['<='](_MAX_I
NT32))) { | 618 if (dart.notNull(this['>='](_MIN_INT32)) && dart.notNull(this['<='](_MAX_I
NT32))) { |
| 619 return dart.as(_foreign_helper.JS('int', '# | 0', this), core.int); | 619 return this | 0; |
| 620 } | 620 } |
| 621 if (_foreign_helper.JS('bool', 'isFinite(#)', this)) { | 621 if (isFinite(this)) { |
| 622 return dart.as(_foreign_helper.JS('int', '# + 0', this.truncateToDouble(
)), core.int); | 622 return this.truncateToDouble() + 0; |
| 623 } | 623 } |
| 624 throw new core.UnsupportedError(dart.as(_foreign_helper.JS("String", "''+#
", this), core.String)); | 624 throw new core.UnsupportedError('' + this); |
| 625 } | 625 } |
| 626 truncate() { | 626 truncate() { |
| 627 return this.toInt(); | 627 return this.toInt(); |
| 628 } | 628 } |
| 629 ceil() { | 629 ceil() { |
| 630 return this.ceilToDouble().toInt(); | 630 return this.ceilToDouble().toInt(); |
| 631 } | 631 } |
| 632 floor() { | 632 floor() { |
| 633 return this.floorToDouble().toInt(); | 633 return this.floorToDouble().toInt(); |
| 634 } | 634 } |
| 635 round() { | 635 round() { |
| 636 return this.roundToDouble().toInt(); | 636 return this.roundToDouble().toInt(); |
| 637 } | 637 } |
| 638 ceilToDouble() { | 638 ceilToDouble() { |
| 639 return dart.as(_foreign_helper.JS('num', 'Math.ceil(#)', this), core.doubl
e); | 639 return dart.notNull(Math.ceil(this)); |
| 640 } | 640 } |
| 641 floorToDouble() { | 641 floorToDouble() { |
| 642 return dart.as(_foreign_helper.JS('num', 'Math.floor(#)', this), core.doub
le); | 642 return dart.notNull(Math.floor(this)); |
| 643 } | 643 } |
| 644 roundToDouble() { | 644 roundToDouble() { |
| 645 if (this['<'](0)) { | 645 if (this['<'](0)) { |
| 646 return dart.as(_foreign_helper.JS('num', '-Math.round(-#)', this), core.
double); | 646 return dart.notNull(-Math.round(-this)); |
| 647 } else { | 647 } else { |
| 648 return dart.as(_foreign_helper.JS('num', 'Math.round(#)', this), core.do
uble); | 648 return dart.notNull(Math.round(this)); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 truncateToDouble() { | 651 truncateToDouble() { |
| 652 return this['<'](0) ? this.ceilToDouble() : this.floorToDouble(); | 652 return this['<'](0) ? this.ceilToDouble() : this.floorToDouble(); |
| 653 } | 653 } |
| 654 clamp(lowerLimit, upperLimit) { | 654 clamp(lowerLimit, upperLimit) { |
| 655 if (!dart.is(lowerLimit, core.num)) | 655 if (!dart.is(lowerLimit, core.num)) |
| 656 throw new core.ArgumentError(lowerLimit); | 656 throw new core.ArgumentError(lowerLimit); |
| 657 if (!dart.is(upperLimit, core.num)) | 657 if (!dart.is(upperLimit, core.num)) |
| 658 throw new core.ArgumentError(upperLimit); | 658 throw new core.ArgumentError(upperLimit); |
| 659 if (dart.dbinary(dart.dinvoke(lowerLimit, 'compareTo', upperLimit), '>', 0
)) { | 659 if (dart.dbinary(dart.dinvoke(lowerLimit, 'compareTo', upperLimit), '>', 0
)) { |
| 660 throw new core.ArgumentError(lowerLimit); | 660 throw new core.ArgumentError(lowerLimit); |
| 661 } | 661 } |
| 662 if (this.compareTo(dart.as(lowerLimit, core.num)) < 0) | 662 if (this.compareTo(dart.as(lowerLimit, core.num)) < 0) |
| 663 return dart.as(lowerLimit, core.num); | 663 return dart.as(lowerLimit, core.num); |
| 664 if (this.compareTo(dart.as(upperLimit, core.num)) > 0) | 664 if (this.compareTo(dart.as(upperLimit, core.num)) > 0) |
| 665 return dart.as(upperLimit, core.num); | 665 return dart.as(upperLimit, core.num); |
| 666 return this; | 666 return this; |
| 667 } | 667 } |
| 668 toDouble() { | 668 toDouble() { |
| 669 return this; | 669 return this; |
| 670 } | 670 } |
| 671 toStringAsFixed(fractionDigits) { | 671 toStringAsFixed(fractionDigits) { |
| 672 _js_helper.checkInt(fractionDigits); | 672 _js_helper.checkInt(fractionDigits); |
| 673 if (dart.notNull(fractionDigits < 0) || dart.notNull(fractionDigits > 20))
{ | 673 if (dart.notNull(fractionDigits < 0) || dart.notNull(fractionDigits > 20))
{ |
| 674 throw new core.RangeError(fractionDigits); | 674 throw new core.RangeError(fractionDigits); |
| 675 } | 675 } |
| 676 let result = dart.as(_foreign_helper.JS('String', '#.toFixed(#)', this, fr
actionDigits), core.String); | 676 let result = this.toFixed(fractionDigits); |
| 677 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) | 677 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) |
| 678 return `-${result}`; | 678 return `-${result}`; |
| 679 return result; | 679 return result; |
| 680 } | 680 } |
| 681 toStringAsExponential(fractionDigits) { | 681 toStringAsExponential(fractionDigits) { |
| 682 if (fractionDigits === void 0) | 682 if (fractionDigits === void 0) |
| 683 fractionDigits = null; | 683 fractionDigits = null; |
| 684 let result = null; | 684 let result = null; |
| 685 if (fractionDigits !== null) { | 685 if (fractionDigits !== null) { |
| 686 _js_helper.checkInt(fractionDigits); | 686 _js_helper.checkInt(fractionDigits); |
| 687 if (dart.notNull(fractionDigits < 0) || dart.notNull(fractionDigits > 20
)) { | 687 if (dart.notNull(fractionDigits < 0) || dart.notNull(fractionDigits > 20
)) { |
| 688 throw new core.RangeError(fractionDigits); | 688 throw new core.RangeError(fractionDigits); |
| 689 } | 689 } |
| 690 result = dart.as(_foreign_helper.JS('String', '#.toExponential(#)', this
, fractionDigits), core.String); | 690 result = this.toExponential(fractionDigits); |
| 691 } else { | 691 } else { |
| 692 result = dart.as(_foreign_helper.JS('String', '#.toExponential()', this)
, core.String); | 692 result = this.toExponential(); |
| 693 } | 693 } |
| 694 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) | 694 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) |
| 695 return `-${result}`; | 695 return `-${result}`; |
| 696 return result; | 696 return result; |
| 697 } | 697 } |
| 698 toStringAsPrecision(precision) { | 698 toStringAsPrecision(precision) { |
| 699 _js_helper.checkInt(precision); | 699 _js_helper.checkInt(precision); |
| 700 if (dart.notNull(precision < 1) || dart.notNull(precision > 21)) { | 700 if (dart.notNull(precision < 1) || dart.notNull(precision > 21)) { |
| 701 throw new core.RangeError(precision); | 701 throw new core.RangeError(precision); |
| 702 } | 702 } |
| 703 let result = dart.as(_foreign_helper.JS('String', '#.toPrecision(#)', this
, precision), core.String); | 703 let result = this.toPrecision(precision); |
| 704 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) | 704 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) |
| 705 return `-${result}`; | 705 return `-${result}`; |
| 706 return result; | 706 return result; |
| 707 } | 707 } |
| 708 toRadixString(radix) { | 708 toRadixString(radix) { |
| 709 _js_helper.checkInt(radix); | 709 _js_helper.checkInt(radix); |
| 710 if (dart.notNull(radix < 2) || dart.notNull(radix > 36)) | 710 if (dart.notNull(radix < 2) || dart.notNull(radix > 36)) |
| 711 throw new core.RangeError(radix); | 711 throw new core.RangeError(radix); |
| 712 let result = dart.as(_foreign_helper.JS('String', '#.toString(#)', this, r
adix), core.String); | 712 let result = this.toString(radix); |
| 713 let rightParenCode = 41; | 713 let rightParenCode = 41; |
| 714 if (result.codeUnitAt(result.length - 1) !== rightParenCode) { | 714 if (result.codeUnitAt(result.length - 1) !== rightParenCode) { |
| 715 return result; | 715 return result; |
| 716 } | 716 } |
| 717 return _handleIEtoString(result); | 717 return _handleIEtoString(result); |
| 718 } | 718 } |
| 719 static _handleIEtoString(result) { | 719 static _handleIEtoString(result) { |
| 720 let match = _foreign_helper.JS('List|Null', '/^([\\da-z]+)(?:\\.([\\da-z]+
))?\\(e\\+(\\d+)\\)$/.exec(#)', result); | 720 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); |
| 721 if (match === null) { | 721 if (match === null) { |
| 722 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; | 722 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; |
| 723 } | 723 } |
| 724 let result = dart.as(_foreign_helper.JS('String', '#', dart.dindex(match,
1)), core.String); | 724 let result = dart.dindex(match, 1); |
| 725 let exponent = dart.as(_foreign_helper.JS("int", "+#", dart.dindex(match,
3)), core.int); | 725 let exponent = +dart.dindex(match, 3); |
| 726 if (dart.dindex(match, 2) !== null) { | 726 if (dart.dindex(match, 2) !== null) { |
| 727 result = dart.as(_foreign_helper.JS('String', '# + #', result, dart.dind
ex(match, 2)), core.String); | 727 result = result + dart.dindex(match, 2); |
| 728 exponent = dart.as(_foreign_helper.JS('int', '#.length', dart.dindex(mat
ch, 2)), core.int); | 728 exponent = dart.dindex(match, 2).length; |
| 729 } | 729 } |
| 730 return core.String['+'](result, core.String['*']("0", exponent)); | 730 return core.String['+'](result, core.String['*']("0", exponent)); |
| 731 } | 731 } |
| 732 toString() { | 732 toString() { |
| 733 if (core.bool['&&'](dart.equals(this, 0), _foreign_helper.JS('bool', '(1 /
#) < 0', this))) { | 733 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(1 / this < 0)) { |
| 734 return '-0.0'; | 734 return '-0.0'; |
| 735 } else { | 735 } else { |
| 736 return dart.as(_foreign_helper.JS('String', '"" + (#)', this), core.Stri
ng); | 736 return "" + this; |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 get hashCode() { | 739 get hashCode() { |
| 740 return dart.as(_foreign_helper.JS('int', '# & 0x1FFFFFFF', this), core.int
); | 740 return this & 0x1FFFFFFF; |
| 741 } | 741 } |
| 742 ['-']() { | 742 ['-']() { |
| 743 return dart.as(_foreign_helper.JS('num', '-#', this), core.num); | 743 return -this; |
| 744 } | 744 } |
| 745 ['+'](other) { | 745 ['+'](other) { |
| 746 if (!dart.is(other, core.num)) | 746 if (!dart.is(other, core.num)) |
| 747 throw new core.ArgumentError(other); | 747 throw new core.ArgumentError(other); |
| 748 return dart.as(_foreign_helper.JS('num', '# + #', this, other), core.num); | 748 return this + other; |
| 749 } | 749 } |
| 750 ['-'](other) { | 750 ['-'](other) { |
| 751 if (!dart.is(other, core.num)) | 751 if (!dart.is(other, core.num)) |
| 752 throw new core.ArgumentError(other); | 752 throw new core.ArgumentError(other); |
| 753 return dart.as(_foreign_helper.JS('num', '# - #', this, other), core.num); | 753 return this - other; |
| 754 } | 754 } |
| 755 ['/'](other) { | 755 ['/'](other) { |
| 756 if (!dart.is(other, core.num)) | 756 if (!dart.is(other, core.num)) |
| 757 throw new core.ArgumentError(other); | 757 throw new core.ArgumentError(other); |
| 758 return dart.as(_foreign_helper.JS('num', '# / #', this, other), core.num); | 758 return this / other; |
| 759 } | 759 } |
| 760 ['*'](other) { | 760 ['*'](other) { |
| 761 if (!dart.is(other, core.num)) | 761 if (!dart.is(other, core.num)) |
| 762 throw new core.ArgumentError(other); | 762 throw new core.ArgumentError(other); |
| 763 return dart.as(_foreign_helper.JS('num', '# * #', this, other), core.num); | 763 return this * other; |
| 764 } | 764 } |
| 765 ['%'](other) { | 765 ['%'](other) { |
| 766 if (!dart.is(other, core.num)) | 766 if (!dart.is(other, core.num)) |
| 767 throw new core.ArgumentError(other); | 767 throw new core.ArgumentError(other); |
| 768 let result = dart.as(_foreign_helper.JS('num', '# % #', this, other), core
.num); | 768 let result = this % other; |
| 769 if (result === 0) | 769 if (result === 0) |
| 770 return 0; | 770 return 0; |
| 771 if (dart.notNull(result) > 0) | 771 if (dart.notNull(result) > 0) |
| 772 return result; | 772 return result; |
| 773 if (dart.dbinary(_foreign_helper.JS('num', '#', other), '<', 0)) { | 773 if (dart.notNull(other) < 0) { |
| 774 return core.num['-'](result, _foreign_helper.JS('num', '#', other)); | 774 return dart.notNull(result) - dart.notNull(other); |
| 775 } else { | 775 } else { |
| 776 return core.num['+'](result, _foreign_helper.JS('num', '#', other)); | 776 return dart.notNull(result) + dart.notNull(other); |
| 777 } | 777 } |
| 778 } | 778 } |
| 779 _isInt32(value) { | 779 _isInt32(value) { |
| 780 return dart.as(_foreign_helper.JS('bool', '(# | 0) === #', value, value),
core.bool); | 780 return (value | 0) === value; |
| 781 } | 781 } |
| 782 ['~/'](other) { | 782 ['~/'](other) { |
| 783 if (false) | 783 if (false) |
| 784 this._tdivFast(other); | 784 this._tdivFast(other); |
| 785 if (dart.notNull(dart.notNull(dart.notNull(this._isInt32(this)) && dart.no
tNull(this._isInt32(other))) && dart.notNull(0 !== other)) && dart.notNull(-1 !=
= other)) { | 785 if (dart.notNull(dart.notNull(dart.notNull(this._isInt32(this)) && dart.no
tNull(this._isInt32(other))) && dart.notNull(0 !== other)) && dart.notNull(-1 !=
= other)) { |
| 786 return dart.as(_foreign_helper.JS('int', '(# / #) | 0', this, other), co
re.int); | 786 return this / other | 0; |
| 787 } else { | 787 } else { |
| 788 return this._tdivSlow(other); | 788 return this._tdivSlow(other); |
| 789 } | 789 } |
| 790 } | 790 } |
| 791 _tdivFast(other) { | 791 _tdivFast(other) { |
| 792 return dart.as(this._isInt32(this) ? _foreign_helper.JS('int', '(# / #) |
0', this, other) : dart.dinvoke(_foreign_helper.JS('num', '# / #', this, other),
'toInt'), core.int); | 792 return this._isInt32(this) ? this / other | 0 : (this / other).toInt(); |
| 793 } | 793 } |
| 794 _tdivSlow(other) { | 794 _tdivSlow(other) { |
| 795 if (!dart.is(other, core.num)) | 795 if (!dart.is(other, core.num)) |
| 796 throw new core.ArgumentError(other); | 796 throw new core.ArgumentError(other); |
| 797 return dart.as(dart.dinvoke(_foreign_helper.JS('num', '# / #', this, other
), 'toInt'), core.int); | 797 return (this / other).toInt(); |
| 798 } | 798 } |
| 799 ['<<'](other) { | 799 ['<<'](other) { |
| 800 if (!dart.is(other, core.num)) | 800 if (!dart.is(other, core.num)) |
| 801 throw new core.ArgumentError(other); | 801 throw new core.ArgumentError(other); |
| 802 if (dart.dbinary(_foreign_helper.JS('num', '#', other), '<', 0)) | 802 if (dart.notNull(other) < 0) |
| 803 throw new core.ArgumentError(other); | 803 throw new core.ArgumentError(other); |
| 804 return this._shlPositive(other); | 804 return this._shlPositive(other); |
| 805 } | 805 } |
| 806 _shlPositive(other) { | 806 _shlPositive(other) { |
| 807 return dart.as(_foreign_helper.JS('bool', '# > 31', other) ? 0 : _foreign_
helper.JS('JSUInt32', '(# << #) >>> 0', this, other), core.num); | 807 return dart.as(other > 31 ? 0 : this << other >>> 0, core.num); |
| 808 } | 808 } |
| 809 ['>>'](other) { | 809 ['>>'](other) { |
| 810 if (false) | 810 if (false) |
| 811 this._shrReceiverPositive(other); | 811 this._shrReceiverPositive(other); |
| 812 if (!dart.is(other, core.num)) | 812 if (!dart.is(other, core.num)) |
| 813 throw new core.ArgumentError(other); | 813 throw new core.ArgumentError(other); |
| 814 if (dart.dbinary(_foreign_helper.JS('num', '#', other), '<', 0)) | 814 if (dart.notNull(other) < 0) |
| 815 throw new core.ArgumentError(other); | 815 throw new core.ArgumentError(other); |
| 816 return this._shrOtherPositive(other); | 816 return this._shrOtherPositive(other); |
| 817 } | 817 } |
| 818 _shrOtherPositive(other) { | 818 _shrOtherPositive(other) { |
| 819 return dart.as(dart.dbinary(_foreign_helper.JS('num', '#', this), '>', 0)
? this._shrBothPositive(other) : _foreign_helper.JS('JSUInt32', '(# >> #) >>> 0'
, this, dart.notNull(other) > 31 ? 31 : other), core.num); | 819 return dart.as(dart.notNull(this) > 0 ? this._shrBothPositive(other) : thi
s >> (dart.notNull(other) > 31 ? 31 : other) >>> 0, core.num); |
| 820 } | 820 } |
| 821 _shrReceiverPositive(other) { | 821 _shrReceiverPositive(other) { |
| 822 if (dart.dbinary(_foreign_helper.JS('num', '#', other), '<', 0)) | 822 if (dart.notNull(other) < 0) |
| 823 throw new core.ArgumentError(other); | 823 throw new core.ArgumentError(other); |
| 824 return this._shrBothPositive(other); | 824 return this._shrBothPositive(other); |
| 825 } | 825 } |
| 826 _shrBothPositive(other) { | 826 _shrBothPositive(other) { |
| 827 return dart.as(_foreign_helper.JS('bool', '# > 31', other) ? 0 : _foreign_
helper.JS('JSUInt32', '# >>> #', this, other), core.num); | 827 return dart.as(other > 31 ? 0 : this >>> other, core.num); |
| 828 } | 828 } |
| 829 ['&'](other) { | 829 ['&'](other) { |
| 830 if (!dart.is(other, core.num)) | 830 if (!dart.is(other, core.num)) |
| 831 throw new core.ArgumentError(other); | 831 throw new core.ArgumentError(other); |
| 832 return dart.as(_foreign_helper.JS('JSUInt32', '(# & #) >>> 0', this, other
), core.num); | 832 return dart.as((this & other) >>> 0, core.num); |
| 833 } | 833 } |
| 834 ['|'](other) { | 834 ['|'](other) { |
| 835 if (!dart.is(other, core.num)) | 835 if (!dart.is(other, core.num)) |
| 836 throw new core.ArgumentError(other); | 836 throw new core.ArgumentError(other); |
| 837 return dart.as(_foreign_helper.JS('JSUInt32', '(# | #) >>> 0', this, other
), core.num); | 837 return dart.as((this | other) >>> 0, core.num); |
| 838 } | 838 } |
| 839 ['^'](other) { | 839 ['^'](other) { |
| 840 if (!dart.is(other, core.num)) | 840 if (!dart.is(other, core.num)) |
| 841 throw new core.ArgumentError(other); | 841 throw new core.ArgumentError(other); |
| 842 return dart.as(_foreign_helper.JS('JSUInt32', '(# ^ #) >>> 0', this, other
), core.num); | 842 return dart.as((this ^ other) >>> 0, core.num); |
| 843 } | 843 } |
| 844 ['<'](other) { | 844 ['<'](other) { |
| 845 if (!dart.is(other, core.num)) | 845 if (!dart.is(other, core.num)) |
| 846 throw new core.ArgumentError(other); | 846 throw new core.ArgumentError(other); |
| 847 return dart.as(_foreign_helper.JS('bool', '# < #', this, other), core.bool
); | 847 return this < other; |
| 848 } | 848 } |
| 849 ['>'](other) { | 849 ['>'](other) { |
| 850 if (!dart.is(other, core.num)) | 850 if (!dart.is(other, core.num)) |
| 851 throw new core.ArgumentError(other); | 851 throw new core.ArgumentError(other); |
| 852 return dart.as(_foreign_helper.JS('bool', '# > #', this, other), core.bool
); | 852 return this > other; |
| 853 } | 853 } |
| 854 ['<='](other) { | 854 ['<='](other) { |
| 855 if (!dart.is(other, core.num)) | 855 if (!dart.is(other, core.num)) |
| 856 throw new core.ArgumentError(other); | 856 throw new core.ArgumentError(other); |
| 857 return dart.as(_foreign_helper.JS('bool', '# <= #', this, other), core.boo
l); | 857 return this <= other; |
| 858 } | 858 } |
| 859 ['>='](other) { | 859 ['>='](other) { |
| 860 if (!dart.is(other, core.num)) | 860 if (!dart.is(other, core.num)) |
| 861 throw new core.ArgumentError(other); | 861 throw new core.ArgumentError(other); |
| 862 return dart.as(_foreign_helper.JS('bool', '# >= #', this, other), core.boo
l); | 862 return this >= other; |
| 863 } | 863 } |
| 864 get runtimeType() { | 864 get runtimeType() { |
| 865 return core.num; | 865 return core.num; |
| 866 } | 866 } |
| 867 } | 867 } |
| 868 JSNumber._MIN_INT32 = -2147483648; | 868 JSNumber._MIN_INT32 = -2147483648; |
| 869 JSNumber._MAX_INT32 = 2147483647; | 869 JSNumber._MAX_INT32 = 2147483647; |
| 870 class JSInt extends JSNumber { | 870 class JSInt extends JSNumber { |
| 871 JSInt() { | 871 JSInt() { |
| 872 super.JSNumber(); | 872 super.JSNumber(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 894 } | 894 } |
| 895 static _bitCount(i) { | 895 static _bitCount(i) { |
| 896 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&',
1431655765)), core.int); | 896 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&',
1431655765)), core.int); |
| 897 i = dart.notNull((i & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 85899
3459))); | 897 i = dart.notNull((i & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 85899
3459))); |
| 898 i = 252645135 & dart.notNull(i['+'](_shru(i, 4))); | 898 i = 252645135 & dart.notNull(i['+'](_shru(i, 4))); |
| 899 i = dart.as(_shru(i, 8), core.int); | 899 i = dart.as(_shru(i, 8), core.int); |
| 900 i = dart.as(_shru(i, 16), core.int); | 900 i = dart.as(_shru(i, 16), core.int); |
| 901 return i & 63; | 901 return i & 63; |
| 902 } | 902 } |
| 903 static _shru(value, shift) { | 903 static _shru(value, shift) { |
| 904 return _foreign_helper.JS('int', '# >>> #', value, shift); | 904 return value >>> shift; |
| 905 } | 905 } |
| 906 static _shrs(value, shift) { | 906 static _shrs(value, shift) { |
| 907 return _foreign_helper.JS('int', '# >> #', value, shift); | 907 return value >> shift; |
| 908 } | 908 } |
| 909 static _ors(a, b) { | 909 static _ors(a, b) { |
| 910 return _foreign_helper.JS('int', '# | #', a, b); | 910 return a | b; |
| 911 } | 911 } |
| 912 static _spread(i) { | 912 static _spread(i) { |
| 913 i = dart.as(_ors(i, dart.as(_shrs(i, 1), core.int)), core.int); | 913 i = dart.as(_ors(i, dart.as(_shrs(i, 1), core.int)), core.int); |
| 914 i = dart.as(_ors(i, dart.as(_shrs(i, 2), core.int)), core.int); | 914 i = dart.as(_ors(i, dart.as(_shrs(i, 2), core.int)), core.int); |
| 915 i = dart.as(_ors(i, dart.as(_shrs(i, 4), core.int)), core.int); | 915 i = dart.as(_ors(i, dart.as(_shrs(i, 4), core.int)), core.int); |
| 916 i = dart.as(_ors(i, dart.as(_shrs(i, 8), core.int)), core.int); | 916 i = dart.as(_ors(i, dart.as(_shrs(i, 8), core.int)), core.int); |
| 917 i = dart.as(_shru(dart.as(_ors(i, dart.as(_shrs(i, 16), core.int)), core.i
nt), 0), core.int); | 917 i = dart.as(_shru(dart.as(_ors(i, dart.as(_shrs(i, 16), core.int)), core.i
nt), 0), core.int); |
| 918 return i; | 918 return i; |
| 919 } | 919 } |
| 920 get runtimeType() { | 920 get runtimeType() { |
| 921 return core.int; | 921 return core.int; |
| 922 } | 922 } |
| 923 ['~']() { | 923 ['~']() { |
| 924 return dart.as(_foreign_helper.JS('JSUInt32', '(~#) >>> 0', this), core.in
t); | 924 return dart.as(~this >>> 0, core.int); |
| 925 } | 925 } |
| 926 } | 926 } |
| 927 class JSDouble extends JSNumber { | 927 class JSDouble extends JSNumber { |
| 928 JSDouble() { | 928 JSDouble() { |
| 929 super.JSNumber(); | 929 super.JSNumber(); |
| 930 } | 930 } |
| 931 get runtimeType() { | 931 get runtimeType() { |
| 932 return core.double; | 932 return core.double; |
| 933 } | 933 } |
| 934 } | 934 } |
| 935 class JSPositiveInt extends JSInt { | 935 class JSPositiveInt extends JSInt { |
| 936 } | 936 } |
| 937 class JSUInt32 extends JSPositiveInt { | 937 class JSUInt32 extends JSPositiveInt { |
| 938 } | 938 } |
| 939 class JSUInt31 extends JSUInt32 { | 939 class JSUInt31 extends JSUInt32 { |
| 940 } | 940 } |
| 941 class JSString extends Interceptor { | 941 class JSString extends Interceptor { |
| 942 JSString() { | 942 JSString() { |
| 943 super.Interceptor(); | 943 super.Interceptor(); |
| 944 } | 944 } |
| 945 codeUnitAt(index) { | 945 codeUnitAt(index) { |
| 946 if (!(typeof index == number)) | 946 if (!(typeof index == number)) |
| 947 throw new core.ArgumentError(index); | 947 throw new core.ArgumentError(index); |
| 948 if (index < 0) | 948 if (index < 0) |
| 949 throw new core.RangeError.value(index); | 949 throw new core.RangeError.value(index); |
| 950 if (index >= this.length) | 950 if (index >= this.length) |
| 951 throw new core.RangeError.value(index); | 951 throw new core.RangeError.value(index); |
| 952 return dart.as(_foreign_helper.JS('JSUInt31', '#.charCodeAt(#)', this, ind
ex), core.int); | 952 return dart.as(this.charCodeAt(index), core.int); |
| 953 } | 953 } |
| 954 allMatches(string, start) { | 954 allMatches(string, start) { |
| 955 if (start === void 0) | 955 if (start === void 0) |
| 956 start = 0; | 956 start = 0; |
| 957 _js_helper.checkString(string); | 957 _js_helper.checkString(string); |
| 958 _js_helper.checkInt(start); | 958 _js_helper.checkInt(start); |
| 959 if (dart.notNull(0 > start) || dart.notNull(start > string.length)) { | 959 if (dart.notNull(0 > start) || dart.notNull(start > string.length)) { |
| 960 throw new core.RangeError.range(start, 0, string.length); | 960 throw new core.RangeError.range(start, 0, string.length); |
| 961 } | 961 } |
| 962 return _js_helper.allMatchesInStringUnchecked(this, string, start); | 962 return _js_helper.allMatchesInStringUnchecked(this, string, start); |
| 963 } | 963 } |
| 964 matchAsPrefix(string, start) { | 964 matchAsPrefix(string, start) { |
| 965 if (start === void 0) | 965 if (start === void 0) |
| 966 start = 0; | 966 start = 0; |
| 967 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { | 967 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { |
| 968 throw new core.RangeError.range(start, 0, string.length); | 968 throw new core.RangeError.range(start, 0, string.length); |
| 969 } | 969 } |
| 970 if (start + this.length > string.length) | 970 if (start + this.length > string.length) |
| 971 return null; | 971 return null; |
| 972 for (let i = 0; i < this.length; i++) { | 972 for (let i = 0; i < this.length; i++) { |
| 973 if (string.codeUnitAt(start + i) !== this.codeUnitAt(i)) { | 973 if (string.codeUnitAt(start + i) !== this.codeUnitAt(i)) { |
| 974 return null; | 974 return null; |
| 975 } | 975 } |
| 976 } | 976 } |
| 977 return new _js_helper.StringMatch(start, string, this); | 977 return new _js_helper.StringMatch(start, string, this); |
| 978 } | 978 } |
| 979 ['+'](other) { | 979 ['+'](other) { |
| 980 if (!(typeof other == string)) | 980 if (!(typeof other == string)) |
| 981 throw new core.ArgumentError(other); | 981 throw new core.ArgumentError(other); |
| 982 return dart.as(_foreign_helper.JS('String', '# + #', this, other), core.St
ring); | 982 return this + other; |
| 983 } | 983 } |
| 984 endsWith(other) { | 984 endsWith(other) { |
| 985 _js_helper.checkString(other); | 985 _js_helper.checkString(other); |
| 986 let otherLength = other.length; | 986 let otherLength = other.length; |
| 987 if (otherLength > this.length) | 987 if (otherLength > this.length) |
| 988 return false; | 988 return false; |
| 989 return dart.equals(other, this.substring(this.length - otherLength)); | 989 return dart.equals(other, this.substring(this.length - otherLength)); |
| 990 } | 990 } |
| 991 replaceAll(from, to) { | 991 replaceAll(from, to) { |
| 992 _js_helper.checkString(to); | 992 _js_helper.checkString(to); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1006 _js_helper.checkString(to); | 1006 _js_helper.checkString(to); |
| 1007 _js_helper.checkInt(startIndex); | 1007 _js_helper.checkInt(startIndex); |
| 1008 if (dart.notNull(startIndex < 0) || dart.notNull(startIndex > this.length)
) { | 1008 if (dart.notNull(startIndex < 0) || dart.notNull(startIndex > this.length)
) { |
| 1009 throw new core.RangeError.range(startIndex, 0, this.length); | 1009 throw new core.RangeError.range(startIndex, 0, this.length); |
| 1010 } | 1010 } |
| 1011 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); | 1011 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star
tIndex), core.String); |
| 1012 } | 1012 } |
| 1013 split(pattern) { | 1013 split(pattern) { |
| 1014 _js_helper.checkNull(pattern); | 1014 _js_helper.checkNull(pattern); |
| 1015 if (typeof pattern == string) { | 1015 if (typeof pattern == string) { |
| 1016 return dart.as(_foreign_helper.JS('JSExtendableArray', '#.split(#)', thi
s, pattern), core.List$(core.String)); | 1016 return dart.as(this.split(pattern), core.List$(core.String)); |
| 1017 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && da
rt.notNull(_js_helper.regExpCaptureCount(pattern) === 0)) { | 1017 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && da
rt.notNull(_js_helper.regExpCaptureCount(pattern) === 0)) { |
| 1018 let re = _js_helper.regExpGetNative(pattern); | 1018 let re = _js_helper.regExpGetNative(pattern); |
| 1019 return dart.as(_foreign_helper.JS('JSExtendableArray', '#.split(#)', thi
s, re), core.List$(core.String)); | 1019 return dart.as(this.split(re), core.List$(core.String)); |
| 1020 } else { | 1020 } else { |
| 1021 return this._defaultSplit(pattern); | 1021 return this._defaultSplit(pattern); |
| 1022 } | 1022 } |
| 1023 } | 1023 } |
| 1024 _defaultSplit(pattern) { | 1024 _defaultSplit(pattern) { |
| 1025 let result = new List.from([]); | 1025 let result = new List.from([]); |
| 1026 let start = 0; | 1026 let start = 0; |
| 1027 let length = 1; | 1027 let length = 1; |
| 1028 for (let match of pattern.allMatches(this)) { | 1028 for (let match of pattern.allMatches(this)) { |
| 1029 let matchStart = dart.as(dart.dload(match, 'start'), core.int); | 1029 let matchStart = dart.as(dart.dload(match, 'start'), core.int); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1047 _js_helper.checkInt(index); | 1047 _js_helper.checkInt(index); |
| 1048 if (dart.notNull(index < 0) || dart.notNull(index > this.length)) { | 1048 if (dart.notNull(index < 0) || dart.notNull(index > this.length)) { |
| 1049 throw new core.RangeError.range(index, 0, this.length); | 1049 throw new core.RangeError.range(index, 0, this.length); |
| 1050 } | 1050 } |
| 1051 if (typeof pattern == string) { | 1051 if (typeof pattern == string) { |
| 1052 let other = pattern; | 1052 let other = pattern; |
| 1053 let otherLength = other.length; | 1053 let otherLength = other.length; |
| 1054 let endIndex = index + otherLength; | 1054 let endIndex = index + otherLength; |
| 1055 if (endIndex > this.length) | 1055 if (endIndex > this.length) |
| 1056 return false; | 1056 return false; |
| 1057 return dart.equals(other, _foreign_helper.JS('String', '#.substring(#, #
)', this, index, endIndex)); | 1057 return dart.equals(other, this.substring(index, endIndex)); |
| 1058 } | 1058 } |
| 1059 return pattern.matchAsPrefix(this, index) !== null; | 1059 return pattern.matchAsPrefix(this, index) !== null; |
| 1060 } | 1060 } |
| 1061 substring(startIndex, endIndex) { | 1061 substring(startIndex, endIndex) { |
| 1062 if (endIndex === void 0) | 1062 if (endIndex === void 0) |
| 1063 endIndex = null; | 1063 endIndex = null; |
| 1064 _js_helper.checkInt(startIndex); | 1064 _js_helper.checkInt(startIndex); |
| 1065 if (endIndex === null) | 1065 if (endIndex === null) |
| 1066 endIndex = this.length; | 1066 endIndex = this.length; |
| 1067 _js_helper.checkInt(endIndex); | 1067 _js_helper.checkInt(endIndex); |
| 1068 if (startIndex < 0) | 1068 if (startIndex < 0) |
| 1069 throw new core.RangeError.value(startIndex); | 1069 throw new core.RangeError.value(startIndex); |
| 1070 if (startIndex > endIndex) | 1070 if (startIndex > endIndex) |
| 1071 throw new core.RangeError.value(startIndex); | 1071 throw new core.RangeError.value(startIndex); |
| 1072 if (endIndex > this.length) | 1072 if (endIndex > this.length) |
| 1073 throw new core.RangeError.value(endIndex); | 1073 throw new core.RangeError.value(endIndex); |
| 1074 return dart.as(_foreign_helper.JS('String', '#.substring(#, #)', this, sta
rtIndex, endIndex), core.String); | 1074 return this.substring(startIndex, endIndex); |
| 1075 } | 1075 } |
| 1076 toLowerCase() { | 1076 toLowerCase() { |
| 1077 return dart.as(_foreign_helper.JS('String', '#.toLowerCase()', this), core
.String); | 1077 return this.toLowerCase(); |
| 1078 } | 1078 } |
| 1079 toUpperCase() { | 1079 toUpperCase() { |
| 1080 return dart.as(_foreign_helper.JS('String', '#.toUpperCase()', this), core
.String); | 1080 return this.toUpperCase(); |
| 1081 } | 1081 } |
| 1082 static _isWhitespace(codeUnit) { | 1082 static _isWhitespace(codeUnit) { |
| 1083 if (codeUnit < 256) { | 1083 if (codeUnit < 256) { |
| 1084 switch (codeUnit) { | 1084 switch (codeUnit) { |
| 1085 case 9: | 1085 case 9: |
| 1086 case 10: | 1086 case 10: |
| 1087 case 11: | 1087 case 11: |
| 1088 case 12: | 1088 case 12: |
| 1089 case 13: | 1089 case 13: |
| 1090 case 32: | 1090 case 32: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 let codeUnit = string.codeUnitAt(index - 1); | 1139 let codeUnit = string.codeUnitAt(index - 1); |
| 1140 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn
it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit)))
) { | 1140 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn
it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit)))
) { |
| 1141 break; | 1141 break; |
| 1142 } | 1142 } |
| 1143 index--; | 1143 index--; |
| 1144 } | 1144 } |
| 1145 return index; | 1145 return index; |
| 1146 } | 1146 } |
| 1147 trim() { | 1147 trim() { |
| 1148 let NEL = 133; | 1148 let NEL = 133; |
| 1149 let result = dart.as(_foreign_helper.JS('String', '#.trim()', this), core.
String); | 1149 let result = this.trim(); |
| 1150 if (result.length === 0) | 1150 if (result.length === 0) |
| 1151 return result; | 1151 return result; |
| 1152 let firstCode = result.codeUnitAt(0); | 1152 let firstCode = result.codeUnitAt(0); |
| 1153 let startIndex = 0; | 1153 let startIndex = 0; |
| 1154 if (firstCode === NEL) { | 1154 if (firstCode === NEL) { |
| 1155 startIndex = _skipLeadingWhitespace(result, 1); | 1155 startIndex = _skipLeadingWhitespace(result, 1); |
| 1156 if (startIndex === result.length) | 1156 if (startIndex === result.length) |
| 1157 return ""; | 1157 return ""; |
| 1158 } | 1158 } |
| 1159 let endIndex = result.length; | 1159 let endIndex = result.length; |
| 1160 let lastCode = result.codeUnitAt(endIndex - 1); | 1160 let lastCode = result.codeUnitAt(endIndex - 1); |
| 1161 if (lastCode === NEL) { | 1161 if (lastCode === NEL) { |
| 1162 endIndex = _skipTrailingWhitespace(result, endIndex - 1); | 1162 endIndex = _skipTrailingWhitespace(result, endIndex - 1); |
| 1163 } | 1163 } |
| 1164 if (dart.notNull(startIndex === 0) && dart.notNull(endIndex === result.len
gth)) | 1164 if (dart.notNull(startIndex === 0) && dart.notNull(endIndex === result.len
gth)) |
| 1165 return result; | 1165 return result; |
| 1166 return dart.as(_foreign_helper.JS('String', '#.substring(#, #)', result, s
tartIndex, endIndex), core.String); | 1166 return result.substring(startIndex, endIndex); |
| 1167 } | 1167 } |
| 1168 trimLeft() { | 1168 trimLeft() { |
| 1169 let NEL = 133; | 1169 let NEL = 133; |
| 1170 let result = null; | 1170 let result = null; |
| 1171 let startIndex = 0; | 1171 let startIndex = 0; |
| 1172 if (_foreign_helper.JS('bool', 'typeof #.trimLeft != "undefined"', this))
{ | 1172 if (typeof this.trimLeft != "undefined") { |
| 1173 result = dart.as(_foreign_helper.JS('String', '#.trimLeft()', this), cor
e.String); | 1173 result = this.trimLeft(); |
| 1174 if (result.length === 0) | 1174 if (result.length === 0) |
| 1175 return result; | 1175 return result; |
| 1176 let firstCode = result.codeUnitAt(0); | 1176 let firstCode = result.codeUnitAt(0); |
| 1177 if (firstCode === NEL) { | 1177 if (firstCode === NEL) { |
| 1178 startIndex = _skipLeadingWhitespace(result, 1); | 1178 startIndex = _skipLeadingWhitespace(result, 1); |
| 1179 } | 1179 } |
| 1180 } else { | 1180 } else { |
| 1181 result = this; | 1181 result = this; |
| 1182 startIndex = _skipLeadingWhitespace(this, 0); | 1182 startIndex = _skipLeadingWhitespace(this, 0); |
| 1183 } | 1183 } |
| 1184 if (startIndex === 0) | 1184 if (startIndex === 0) |
| 1185 return result; | 1185 return result; |
| 1186 if (startIndex === result.length) | 1186 if (startIndex === result.length) |
| 1187 return ""; | 1187 return ""; |
| 1188 return dart.as(_foreign_helper.JS('String', '#.substring(#)', result, star
tIndex), core.String); | 1188 return result.substring(startIndex); |
| 1189 } | 1189 } |
| 1190 trimRight() { | 1190 trimRight() { |
| 1191 let NEL = 133; | 1191 let NEL = 133; |
| 1192 let result = null; | 1192 let result = null; |
| 1193 let endIndex = null; | 1193 let endIndex = null; |
| 1194 if (_foreign_helper.JS('bool', 'typeof #.trimRight != "undefined"', this))
{ | 1194 if (typeof this.trimRight != "undefined") { |
| 1195 result = dart.as(_foreign_helper.JS('String', '#.trimRight()', this), co
re.String); | 1195 result = this.trimRight(); |
| 1196 endIndex = result.length; | 1196 endIndex = result.length; |
| 1197 if (endIndex === 0) | 1197 if (endIndex === 0) |
| 1198 return result; | 1198 return result; |
| 1199 let lastCode = result.codeUnitAt(endIndex - 1); | 1199 let lastCode = result.codeUnitAt(endIndex - 1); |
| 1200 if (lastCode === NEL) { | 1200 if (lastCode === NEL) { |
| 1201 endIndex = _skipTrailingWhitespace(result, endIndex - 1); | 1201 endIndex = _skipTrailingWhitespace(result, endIndex - 1); |
| 1202 } | 1202 } |
| 1203 } else { | 1203 } else { |
| 1204 result = this; | 1204 result = this; |
| 1205 endIndex = _skipTrailingWhitespace(this, this.length); | 1205 endIndex = _skipTrailingWhitespace(this, this.length); |
| 1206 } | 1206 } |
| 1207 if (endIndex === result.length) | 1207 if (endIndex === result.length) |
| 1208 return result; | 1208 return result; |
| 1209 if (endIndex === 0) | 1209 if (endIndex === 0) |
| 1210 return ""; | 1210 return ""; |
| 1211 return dart.as(_foreign_helper.JS('String', '#.substring(#, #)', result, 0
, endIndex), core.String); | 1211 return result.substring(0, endIndex); |
| 1212 } | 1212 } |
| 1213 ['*'](times) { | 1213 ['*'](times) { |
| 1214 if (0 >= times) | 1214 if (0 >= times) |
| 1215 return ''; | 1215 return ''; |
| 1216 if (dart.notNull(times === 1) || dart.notNull(this.length === 0)) | 1216 if (dart.notNull(times === 1) || dart.notNull(this.length === 0)) |
| 1217 return this; | 1217 return this; |
| 1218 if (times !== _foreign_helper.JS('JSUInt32', '# >>> 0', times)) { | 1218 if (times !== times >>> 0) { |
| 1219 throw new core.OutOfMemoryError(); | 1219 throw new core.OutOfMemoryError(); |
| 1220 } | 1220 } |
| 1221 let result = ''; | 1221 let result = ''; |
| 1222 let s = this; | 1222 let s = this; |
| 1223 while (true) { | 1223 while (true) { |
| 1224 if ((times & 1) === 1) | 1224 if ((times & 1) === 1) |
| 1225 result = s['+'](result); | 1225 result = s['+'](result); |
| 1226 times = dart.as(_foreign_helper.JS('JSUInt31', '# >>> 1', times), core.i
nt); | 1226 times = dart.as(times >>> 1, core.int); |
| 1227 if (times === 0) | 1227 if (times === 0) |
| 1228 break; | 1228 break; |
| 1229 s = s; | 1229 s = s; |
| 1230 } | 1230 } |
| 1231 return result; | 1231 return result; |
| 1232 } | 1232 } |
| 1233 padLeft(width, padding) { | 1233 padLeft(width, padding) { |
| 1234 if (padding === void 0) | 1234 if (padding === void 0) |
| 1235 padding = ' '; | 1235 padding = ' '; |
| 1236 let delta = width - this.length; | 1236 let delta = width - this.length; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1255 indexOf(pattern, start) { | 1255 indexOf(pattern, start) { |
| 1256 if (start === void 0) | 1256 if (start === void 0) |
| 1257 start = 0; | 1257 start = 0; |
| 1258 _js_helper.checkNull(pattern); | 1258 _js_helper.checkNull(pattern); |
| 1259 if (!(typeof start == number)) | 1259 if (!(typeof start == number)) |
| 1260 throw new core.ArgumentError(start); | 1260 throw new core.ArgumentError(start); |
| 1261 if (dart.notNull(start < 0) || dart.notNull(start > this.length)) { | 1261 if (dart.notNull(start < 0) || dart.notNull(start > this.length)) { |
| 1262 throw new core.RangeError.range(start, 0, this.length); | 1262 throw new core.RangeError.range(start, 0, this.length); |
| 1263 } | 1263 } |
| 1264 if (typeof pattern == string) { | 1264 if (typeof pattern == string) { |
| 1265 return dart.as(_foreign_helper.JS('int', '#.indexOf(#, #)', this, patter
n, start), core.int); | 1265 return this.indexOf(pattern, start); |
| 1266 } | 1266 } |
| 1267 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { | 1267 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { |
| 1268 let re = pattern; | 1268 let re = pattern; |
| 1269 let match = _js_helper.firstMatchAfter(re, this, start); | 1269 let match = _js_helper.firstMatchAfter(re, this, start); |
| 1270 return match === null ? -1 : match.start; | 1270 return match === null ? -1 : match.start; |
| 1271 } | 1271 } |
| 1272 for (let i = start; i <= this.length; i++) { | 1272 for (let i = start; i <= this.length; i++) { |
| 1273 if (pattern.matchAsPrefix(this, i) !== null) | 1273 if (pattern.matchAsPrefix(this, i) !== null) |
| 1274 return i; | 1274 return i; |
| 1275 } | 1275 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 } | 1310 } |
| 1311 get isEmpty() { | 1311 get isEmpty() { |
| 1312 return this.length === 0; | 1312 return this.length === 0; |
| 1313 } | 1313 } |
| 1314 get isNotEmpty() { | 1314 get isNotEmpty() { |
| 1315 return !dart.notNull(this.isEmpty); | 1315 return !dart.notNull(this.isEmpty); |
| 1316 } | 1316 } |
| 1317 compareTo(other) { | 1317 compareTo(other) { |
| 1318 if (!(typeof other == string)) | 1318 if (!(typeof other == string)) |
| 1319 throw new core.ArgumentError(other); | 1319 throw new core.ArgumentError(other); |
| 1320 return dart.equals(this, other) ? 0 : _foreign_helper.JS('bool', '# < #',
this, other) ? -1 : 1; | 1320 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; |
| 1321 } | 1321 } |
| 1322 toString() { | 1322 toString() { |
| 1323 return this; | 1323 return this; |
| 1324 } | 1324 } |
| 1325 get hashCode() { | 1325 get hashCode() { |
| 1326 let hash = 0; | 1326 let hash = 0; |
| 1327 for (let i = 0; i < this.length; i++) { | 1327 for (let i = 0; i < this.length; i++) { |
| 1328 hash = 536870911 & dart.notNull(hash['+'](_foreign_helper.JS('int', '#.c
harCodeAt(#)', this, i))); | 1328 hash = 536870911 & hash + this.charCodeAt(i); |
| 1329 hash = 536870911 & hash + ((524287 & hash) << 10); | 1329 hash = 536870911 & hash + ((524287 & hash) << 10); |
| 1330 hash = dart.as(_foreign_helper.JS('int', '# ^ (# >> 6)', hash, hash), co
re.int); | 1330 hash = hash ^ hash >> 6; |
| 1331 } | 1331 } |
| 1332 hash = 536870911 & hash + ((67108863 & hash) << 3); | 1332 hash = 536870911 & hash + ((67108863 & hash) << 3); |
| 1333 hash = dart.as(_foreign_helper.JS('int', '# ^ (# >> 11)', hash, hash), cor
e.int); | 1333 hash = hash ^ hash >> 11; |
| 1334 return 536870911 & hash + ((16383 & hash) << 15); | 1334 return 536870911 & hash + ((16383 & hash) << 15); |
| 1335 } | 1335 } |
| 1336 get runtimeType() { | 1336 get runtimeType() { |
| 1337 return core.String; | 1337 return core.String; |
| 1338 } | 1338 } |
| 1339 get length() { | 1339 get length() { |
| 1340 return dart.as(_foreign_helper.JS('int', '#.length', this), core.int); | 1340 return this.length; |
| 1341 } | 1341 } |
| 1342 get(index) { | 1342 get(index) { |
| 1343 if (!(typeof index == number)) | 1343 if (!(typeof index == number)) |
| 1344 throw new core.ArgumentError(index); | 1344 throw new core.ArgumentError(index); |
| 1345 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) | 1345 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) |
| 1346 throw new core.RangeError.value(index); | 1346 throw new core.RangeError.value(index); |
| 1347 return dart.as(_foreign_helper.JS('String', '#[#]', this, index), core.Str
ing); | 1347 return this[index]; |
| 1348 } | 1348 } |
| 1349 } | 1349 } |
| 1350 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { | 1350 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { |
| 1351 _CodeUnits(_string) { | 1351 _CodeUnits(_string) { |
| 1352 this._string = _string; | 1352 this._string = _string; |
| 1353 super.UnmodifiableListBase(); | 1353 super.UnmodifiableListBase(); |
| 1354 } | 1354 } |
| 1355 get length() { | 1355 get length() { |
| 1356 return this._string.length; | 1356 return this._string.length; |
| 1357 } | 1357 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 _interceptors.JSExtendableArray = JSExtendableArray; | 1392 _interceptors.JSExtendableArray = JSExtendableArray; |
| 1393 _interceptors.JSExtendableArray$ = JSExtendableArray$; | 1393 _interceptors.JSExtendableArray$ = JSExtendableArray$; |
| 1394 _interceptors.JSNumber = JSNumber; | 1394 _interceptors.JSNumber = JSNumber; |
| 1395 _interceptors.JSInt = JSInt; | 1395 _interceptors.JSInt = JSInt; |
| 1396 _interceptors.JSDouble = JSDouble; | 1396 _interceptors.JSDouble = JSDouble; |
| 1397 _interceptors.JSPositiveInt = JSPositiveInt; | 1397 _interceptors.JSPositiveInt = JSPositiveInt; |
| 1398 _interceptors.JSUInt32 = JSUInt32; | 1398 _interceptors.JSUInt32 = JSUInt32; |
| 1399 _interceptors.JSUInt31 = JSUInt31; | 1399 _interceptors.JSUInt31 = JSUInt31; |
| 1400 _interceptors.JSString = JSString; | 1400 _interceptors.JSString = JSString; |
| 1401 })(_interceptors || (_interceptors = {})); | 1401 })(_interceptors || (_interceptors = {})); |
| OLD | NEW |