| OLD | NEW |
| 1 var _js_helper; | 1 var _js_helper; |
| 2 (function(exports) { | 2 (function(exports) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 class _Patch extends dart.Object { | 4 class _Patch extends dart.Object { |
| 5 _Patch() { | 5 _Patch() { |
| 6 } | 6 } |
| 7 } | 7 } |
| 8 let patch = new _Patch(); | 8 let patch = new _Patch(); |
| 9 class InternalMap extends dart.Object { | 9 class InternalMap extends dart.Object { |
| 10 } | 10 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 get isSetter() { | 102 get isSetter() { |
| 103 return this[_kind] === SETTER; | 103 return this[_kind] === SETTER; |
| 104 } | 104 } |
| 105 get isAccessor() { | 105 get isAccessor() { |
| 106 return this[_kind] !== METHOD; | 106 return this[_kind] !== METHOD; |
| 107 } | 107 } |
| 108 get positionalArguments() { | 108 get positionalArguments() { |
| 109 if (this.isGetter) | 109 if (this.isGetter) |
| 110 return /* Unimplemented const */new List.from([]); | 110 return /* Unimplemented const */new List.from([]); |
| 111 let argumentCount = this[_arguments].length - this[_namedArgumentNames].le
ngth; | 111 let argumentCount = dart.notNull(this[_arguments].length) - dart.notNull(t
his[_namedArgumentNames].length); |
| 112 if (argumentCount === 0) | 112 if (argumentCount === 0) |
| 113 return /* Unimplemented const */new List.from([]); | 113 return /* Unimplemented const */new List.from([]); |
| 114 let list = new List.from([]); | 114 let list = new List.from([]); |
| 115 for (let index = 0; index < argumentCount; index++) { | 115 for (let index = 0; dart.notNull(index) < dart.notNull(argumentCount); dar
t.notNull(index)++) { |
| 116 list.add(this[_arguments].get(index)); | 116 list.add(this[_arguments].get(index)); |
| 117 } | 117 } |
| 118 return dart.as(makeLiteralListConst(list), core.List); | 118 return dart.as(makeLiteralListConst(list), core.List); |
| 119 } | 119 } |
| 120 get namedArguments() { | 120 get namedArguments() { |
| 121 if (this.isAccessor) | 121 if (this.isAccessor) |
| 122 return dart.map(); | 122 return dart.map(); |
| 123 let namedArgumentCount = this[_namedArgumentNames].length; | 123 let namedArgumentCount = this[_namedArgumentNames].length; |
| 124 let namedArgumentsStartIndex = this[_arguments].length - namedArgumentCoun
t; | 124 let namedArgumentsStartIndex = dart.notNull(this[_arguments].length) - dar
t.notNull(namedArgumentCount); |
| 125 if (namedArgumentCount === 0) | 125 if (namedArgumentCount === 0) |
| 126 return dart.map(); | 126 return dart.map(); |
| 127 let map = new core.Map(); | 127 let map = new core.Map(); |
| 128 for (let i = 0; i < namedArgumentCount; i++) { | 128 for (let i = 0; dart.notNull(i) < dart.notNull(namedArgumentCount); dart.n
otNull(i)++) { |
| 129 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName
s].get(i), core.String)), this[_arguments].get(namedArgumentsStartIndex + i)); | 129 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName
s].get(i), core.String)), this[_arguments].get(dart.notNull(namedArgumentsStartI
ndex) + dart.notNull(i))); |
| 130 } | 130 } |
| 131 return map; | 131 return map; |
| 132 } | 132 } |
| 133 [_getCachedInvocation](object) { | 133 [_getCachedInvocation](object) { |
| 134 let interceptor = _interceptors.getInterceptor(object); | 134 let interceptor = _interceptors.getInterceptor(object); |
| 135 let receiver = object; | 135 let receiver = object; |
| 136 let name = this[_internalName]; | 136 let name = this[_internalName]; |
| 137 let arguments = this[_arguments]; | 137 let arguments = this[_arguments]; |
| 138 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_
embedded_names.INTERCEPTED_NAMES, core.String)); | 138 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_
embedded_names.INTERCEPTED_NAMES, core.String)); |
| 139 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames,
name); | 139 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames,
name); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor)
{ | 218 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor)
{ |
| 219 this.info = new ReflectionInfo(jsFunction); | 219 this.info = new ReflectionInfo(jsFunction); |
| 220 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor)
; | 220 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor)
; |
| 221 } | 221 } |
| 222 get isGetterStub() { | 222 get isGetterStub() { |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 invokeOn(victim, arguments) { | 225 invokeOn(victim, arguments) { |
| 226 let receiver = victim; | 226 let receiver = victim; |
| 227 let providedArgumentCount = null; | 227 let providedArgumentCount = null; |
| 228 let fullParameterCount = this.info.requiredParameterCount + this.info.opti
onalParameterCount; | 228 let fullParameterCount = dart.notNull(this.info.requiredParameterCount) +
dart.notNull(this.info.optionalParameterCount); |
| 229 if (!dart.notNull(this.isIntercepted)) { | 229 if (!dart.notNull(this.isIntercepted)) { |
| 230 if (dart.is(arguments, _interceptors.JSArray)) { | 230 if (dart.is(arguments, _interceptors.JSArray)) { |
| 231 providedArgumentCount = arguments.length; | 231 providedArgumentCount = arguments.length; |
| 232 if (providedArgumentCount < fullParameterCount) { | 232 if (dart.notNull(providedArgumentCount) < dart.notNull(fullParameterCo
unt)) { |
| 233 arguments = new core.List.from(arguments); | 233 arguments = new core.List.from(arguments); |
| 234 } | 234 } |
| 235 } else { | 235 } else { |
| 236 arguments = new core.List.from(arguments); | 236 arguments = new core.List.from(arguments); |
| 237 providedArgumentCount = arguments.length; | 237 providedArgumentCount = arguments.length; |
| 238 } | 238 } |
| 239 } else { | 239 } else { |
| 240 arguments = new List.from([victim]); | 240 arguments = new List.from([victim]); |
| 241 arguments.addAll(arguments); | 241 arguments.addAll(arguments); |
| 242 if (this.cachedInterceptor !== null) | 242 if (this.cachedInterceptor !== null) |
| 243 receiver = this.cachedInterceptor; | 243 receiver = this.cachedInterceptor; |
| 244 providedArgumentCount = arguments.length - 1; | 244 providedArgumentCount = dart.notNull(arguments.length) - 1; |
| 245 } | 245 } |
| 246 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro
videdArgumentCount > this.info.requiredParameterCount)) { | 246 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro
videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) { |
| 247 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${arguments.length} arguments.`); | 247 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${arguments.length} arguments.`); |
| 248 } else if (providedArgumentCount < this.info.requiredParameterCount) { | 248 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re
quiredParameterCount)) { |
| 249 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
few).`); | 249 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
few).`); |
| 250 } else if (providedArgumentCount > fullParameterCount) { | 250 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete
rCount)) { |
| 251 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
many).`); | 251 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
many).`); |
| 252 } | 252 } |
| 253 for (let i = providedArgumentCount; i < fullParameterCount; i++) { | 253 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar
ameterCount); dart.notNull(i)++) { |
| 254 arguments.add(getMetadata(this.info.defaultValue(i))); | 254 arguments.add(getMetadata(this.info.defaultValue(i))); |
| 255 } | 255 } |
| 256 return this.jsFunction.apply(receiver, arguments); | 256 return this.jsFunction.apply(receiver, arguments); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 class CachedNoSuchMethodInvocation extends dart.Object { | 259 class CachedNoSuchMethodInvocation extends dart.Object { |
| 260 CachedNoSuchMethodInvocation(interceptor) { | 260 CachedNoSuchMethodInvocation(interceptor) { |
| 261 this.interceptor = interceptor; | 261 this.interceptor = interceptor; |
| 262 } | 262 } |
| 263 get isNoSuchMethod() { | 263 get isNoSuchMethod() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 282 this.functionType = functionType; | 282 this.functionType = functionType; |
| 283 this.cachedSortedIndices = null; | 283 this.cachedSortedIndices = null; |
| 284 } | 284 } |
| 285 ReflectionInfo(jsFunction) { | 285 ReflectionInfo(jsFunction) { |
| 286 let data = dart.as(jsFunction.$reflectionInfo, core.List); | 286 let data = dart.as(jsFunction.$reflectionInfo, core.List); |
| 287 if (data === null) | 287 if (data === null) |
| 288 return null; | 288 return null; |
| 289 data = _interceptors.JSArray.markFixedList(data); | 289 data = _interceptors.JSArray.markFixedList(data); |
| 290 let requiredParametersInfo = data[REQUIRED_PARAMETERS_INFO]; | 290 let requiredParametersInfo = data[REQUIRED_PARAMETERS_INFO]; |
| 291 let requiredParameterCount = requiredParametersInfo >> 1; | 291 let requiredParameterCount = requiredParametersInfo >> 1; |
| 292 let isAccessor = (requiredParametersInfo & 1) === 1; | 292 let isAccessor = (dart.notNull(requiredParametersInfo) & 1) === 1; |
| 293 let optionalParametersInfo = data[OPTIONAL_PARAMETERS_INFO]; | 293 let optionalParametersInfo = data[OPTIONAL_PARAMETERS_INFO]; |
| 294 let optionalParameterCount = optionalParametersInfo >> 1; | 294 let optionalParameterCount = optionalParametersInfo >> 1; |
| 295 let areOptionalParametersNamed = (optionalParametersInfo & 1) === 1; | 295 let areOptionalParametersNamed = (dart.notNull(optionalParametersInfo) & 1
) === 1; |
| 296 let functionType = data[FUNCTION_TYPE_INDEX]; | 296 let functionType = data[FUNCTION_TYPE_INDEX]; |
| 297 return new ReflectionInfo.internal(jsFunction, data, isAccessor, requiredP
arameterCount, optionalParameterCount, areOptionalParametersNamed, functionType)
; | 297 return new ReflectionInfo.internal(jsFunction, data, isAccessor, requiredP
arameterCount, optionalParameterCount, areOptionalParametersNamed, functionType)
; |
| 298 } | 298 } |
| 299 parameterName(parameter) { | 299 parameterName(parameter) { |
| 300 let metadataIndex = null; | 300 let metadataIndex = null; |
| 301 if (_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA')) { | 301 if (_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA')) { |
| 302 metadataIndex = this.data[2 * parameter + this.optionalParameterCount +
FIRST_DEFAULT_ARGUMENT]; | 302 metadataIndex = this.data[2 * parameter + this.optionalParameterCount +
FIRST_DEFAULT_ARGUMENT]; |
| 303 } else { | 303 } else { |
| 304 metadataIndex = this.data[parameter + this.optionalParameterCount + FIRS
T_DEFAULT_ARGUMENT]; | 304 metadataIndex = this.data[parameter + this.optionalParameterCount + FIRS
T_DEFAULT_ARGUMENT]; |
| 305 } | 305 } |
| 306 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded
_names.METADATA, core.String)); | 306 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded
_names.METADATA, core.String)); |
| 307 return metadata[metadataIndex]; | 307 return metadata[metadataIndex]; |
| 308 } | 308 } |
| 309 parameterMetadataAnnotations(parameter) { | 309 parameterMetadataAnnotations(parameter) { |
| 310 if (!dart.notNull(_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA'))) { | 310 if (!dart.notNull(_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA'))) { |
| 311 throw new core.StateError('metadata has not been preserved'); | 311 throw new core.StateError('metadata has not been preserved'); |
| 312 } else { | 312 } else { |
| 313 return dart.as(this.data[2 * parameter + this.optionalParameterCount + F
IRST_DEFAULT_ARGUMENT + 1], core.List$(core.int)); | 313 return dart.as(this.data[2 * parameter + this.optionalParameterCount + F
IRST_DEFAULT_ARGUMENT + 1], core.List$(core.int)); |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 defaultValue(parameter) { | 316 defaultValue(parameter) { |
| 317 if (parameter < this.requiredParameterCount) | 317 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) |
| 318 return dart.as(null, core.int); | 318 return null; |
| 319 return this.data[FIRST_DEFAULT_ARGUMENT + parameter - this.requiredParamet
erCount]; | 319 return this.data[FIRST_DEFAULT_ARGUMENT + parameter - this.requiredParamet
erCount]; |
| 320 } | 320 } |
| 321 defaultValueInOrder(parameter) { | 321 defaultValueInOrder(parameter) { |
| 322 if (parameter < this.requiredParameterCount) | 322 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) |
| 323 return dart.as(null, core.int); | 323 return null; |
| 324 if (dart.notNull(!dart.notNull(this.areOptionalParametersNamed)) || dart.n
otNull(this.optionalParameterCount === 1)) { | 324 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet
erCount === 1) { |
| 325 return this.defaultValue(parameter); | 325 return this.defaultValue(parameter); |
| 326 } | 326 } |
| 327 let index = this.sortedIndex(parameter - this.requiredParameterCount); | 327 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r
equiredParameterCount)); |
| 328 return this.defaultValue(index); | 328 return this.defaultValue(index); |
| 329 } | 329 } |
| 330 parameterNameInOrder(parameter) { | 330 parameterNameInOrder(parameter) { |
| 331 if (parameter < this.requiredParameterCount) | 331 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) |
| 332 return null; | 332 return null; |
| 333 if (dart.notNull(!dart.notNull(this.areOptionalParametersNamed)) || dart.n
otNull(this.optionalParameterCount === 1)) { | 333 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet
erCount === 1) { |
| 334 return this.parameterName(parameter); | 334 return this.parameterName(parameter); |
| 335 } | 335 } |
| 336 let index = this.sortedIndex(parameter - this.requiredParameterCount); | 336 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r
equiredParameterCount)); |
| 337 return this.parameterName(index); | 337 return this.parameterName(index); |
| 338 } | 338 } |
| 339 sortedIndex(unsortedIndex) { | 339 sortedIndex(unsortedIndex) { |
| 340 if (this.cachedSortedIndices === null) { | 340 if (this.cachedSortedIndices === null) { |
| 341 this.cachedSortedIndices = new core.List(this.optionalParameterCount); | 341 this.cachedSortedIndices = new core.List(this.optionalParameterCount); |
| 342 let positions = dart.map(); | 342 let positions = dart.map(); |
| 343 for (let i = 0; i < this.optionalParameterCount; i++) { | 343 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou
nt); dart.notNull(i)++) { |
| 344 let index = this.requiredParameterCount + i; | 344 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i
); |
| 345 positions.set(this.parameterName(index), index); | 345 positions.set(this.parameterName(index), index); |
| 346 } | 346 } |
| 347 let index = 0; | 347 let index = 0; |
| 348 ((_) => { | 348 ((_) => { |
| 349 _.sort(); | 349 _.sort(); |
| 350 return _; | 350 return _; |
| 351 }).bind(this)(positions.keys.toList()).forEach(((name) => { | 351 }).bind(this)(positions.keys.toList()).forEach(((name) => { |
| 352 this.cachedSortedIndices.set(index++, positions.get(name)); | 352 this.cachedSortedIndices.set(dart.notNull(index)++, positions.get(name
)); |
| 353 }).bind(this)); | 353 }).bind(this)); |
| 354 } | 354 } |
| 355 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int); | 355 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int); |
| 356 } | 356 } |
| 357 computeFunctionRti(jsConstructor) { | 357 computeFunctionRti(jsConstructor) { |
| 358 if (typeof this.functionType == "number") { | 358 if (typeof this.functionType == "number") { |
| 359 return getMetadata(dart.as(this.functionType, core.int)); | 359 return getMetadata(dart.as(this.functionType, core.int)); |
| 360 } else if (typeof this.functionType == "function") { | 360 } else if (typeof this.functionType == "function") { |
| 361 let fakeInstance = new jsConstructor(); | 361 let fakeInstance = new jsConstructor(); |
| 362 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); | 362 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 checkString(source); | 405 checkString(source); |
| 406 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source)
; | 406 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source)
; |
| 407 let digitsIndex = 1; | 407 let digitsIndex = 1; |
| 408 let hexIndex = 2; | 408 let hexIndex = 2; |
| 409 let decimalIndex = 3; | 409 let decimalIndex = 3; |
| 410 let nonDecimalHexIndex = 4; | 410 let nonDecimalHexIndex = 4; |
| 411 if (radix === null) { | 411 if (radix === null) { |
| 412 radix = 10; | 412 radix = 10; |
| 413 if (match !== null) { | 413 if (match !== null) { |
| 414 if (dart.dindex(match, hexIndex) !== null) { | 414 if (dart.dindex(match, hexIndex) !== null) { |
| 415 return dart.notNull(parseInt(source, 16)); | 415 return parseInt(source, 16); |
| 416 } | 416 } |
| 417 if (dart.dindex(match, decimalIndex) !== null) { | 417 if (dart.dindex(match, decimalIndex) !== null) { |
| 418 return dart.notNull(parseInt(source, 10)); | 418 return parseInt(source, 10); |
| 419 } | 419 } |
| 420 return handleError(source); | 420 return handleError(source); |
| 421 } | 421 } |
| 422 } else { | 422 } else { |
| 423 if (!(typeof radix == number)) | 423 if (!(typeof radix == number)) |
| 424 throw new core.ArgumentError("Radix is not an integer"); | 424 throw new core.ArgumentError("Radix is not an integer"); |
| 425 if (dart.notNull(radix < 2) || dart.notNull(radix > 36)) { | 425 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) { |
| 426 throw new core.RangeError(`Radix ${radix} not in range 2..36`); | 426 throw new core.RangeError(`Radix ${radix} not in range 2..36`); |
| 427 } | 427 } |
| 428 if (match !== null) { | 428 if (match !== null) { |
| 429 if (dart.notNull(radix === 10) && dart.notNull(dart.dindex(match, deci
malIndex) !== null)) { | 429 if (radix === 10 && dart.notNull(dart.dindex(match, decimalIndex) !==
null)) { |
| 430 return dart.notNull(parseInt(source, 10)); | 430 return parseInt(source, 10); |
| 431 } | 431 } |
| 432 if (dart.notNull(radix < 10) || dart.notNull(dart.dindex(match, decima
lIndex) === null)) { | 432 if (dart.notNull(radix) < 10 || dart.notNull(dart.dindex(match, decima
lIndex) === null)) { |
| 433 let maxCharCode = null; | 433 let maxCharCode = null; |
| 434 if (radix <= 10) { | 434 if (dart.notNull(radix) <= 10) { |
| 435 maxCharCode = 48 + radix - 1; | 435 maxCharCode = 48 + dart.notNull(radix) - 1; |
| 436 } else { | 436 } else { |
| 437 maxCharCode = 97 + radix - 10 - 1; | 437 maxCharCode = 97 + dart.notNull(radix) - 10 - 1; |
| 438 } | 438 } |
| 439 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin
g); | 439 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin
g); |
| 440 for (let i = 0; i < digitsPart.length; i++) { | 440 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); d
art.notNull(i)++) { |
| 441 let characterCode = digitsPart.codeUnitAt(0) | 32; | 441 let characterCode = dart.notNull(digitsPart.codeUnitAt(0)) | 32; |
| 442 if (digitsPart.codeUnitAt(i) > maxCharCode) { | 442 if (dart.notNull(digitsPart.codeUnitAt(i)) > dart.notNull(maxCharC
ode)) { |
| 443 return handleError(source); | 443 return handleError(source); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 if (match === null) | 449 if (match === null) |
| 450 return handleError(source); | 450 return handleError(source); |
| 451 return dart.notNull(parseInt(source, radix)); | 451 return parseInt(source, radix); |
| 452 } | 452 } |
| 453 static parseDouble(source, handleError) { | 453 static parseDouble(source, handleError) { |
| 454 checkString(source); | 454 checkString(source); |
| 455 if (handleError === null) | 455 if (handleError === null) |
| 456 handleError = dart.as(_throwFormatException, dart.throw_("Unimplemented
type (String) → double")); | 456 handleError = dart.as(_throwFormatException, dart.throw_("Unimplemented
type (String) → double")); |
| 457 if (!dart.notNull(/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE]
[+-]?\d+)?)\s*$/.test(source))) { | 457 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s
*$/.test(source)) { |
| 458 return handleError(source); | 458 return handleError(source); |
| 459 } | 459 } |
| 460 let result = parseFloat(source); | 460 let result = parseFloat(source); |
| 461 if (result.isNaN) { | 461 if (result.isNaN) { |
| 462 let trimmed = source.trim(); | 462 let trimmed = source.trim(); |
| 463 if (dart.notNull(dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNu
ll(dart.equals(trimmed, '+NaN'))) || dart.notNull(dart.equals(trimmed, '-NaN')))
{ | 463 if (dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNull(dart.equal
s(trimmed, '+NaN')) || dart.notNull(dart.equals(trimmed, '-NaN'))) { |
| 464 return dart.notNull(result); | 464 return result; |
| 465 } | 465 } |
| 466 return handleError(source); | 466 return handleError(source); |
| 467 } | 467 } |
| 468 return dart.notNull(result); | 468 return result; |
| 469 } | 469 } |
| 470 static formatType(className, typeArguments) { | 470 static formatType(className, typeArguments) { |
| 471 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j
oinArguments(typeArguments, 0)}`); | 471 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j
oinArguments(typeArguments, 0)}`); |
| 472 } | 472 } |
| 473 static objectTypeName(object) { | 473 static objectTypeName(object) { |
| 474 let name = constructorNameFallback(_interceptors.getInterceptor(object)); | 474 let name = constructorNameFallback(_interceptors.getInterceptor(object)); |
| 475 if (dart.equals(name, 'Object')) { | 475 if (dart.equals(name, 'Object')) { |
| 476 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\
s*\(/)[1]; | 476 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\
s*\(/)[1]; |
| 477 if (typeof decompiled == string) | 477 if (typeof decompiled == string) |
| 478 if (/^\w+$/.test(decompiled)) | 478 if (/^\w+$/.test(decompiled)) |
| 479 name = dart.as(decompiled, core.String); | 479 name = dart.as(decompiled, core.String); |
| 480 } | 480 } |
| 481 if (dart.notNull(name.length > 1) && dart.notNull(core.identical(name.code
UnitAt(0), DOLLAR_CHAR_VALUE))) { | 481 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code
UnitAt(0), DOLLAR_CHAR_VALUE))) { |
| 482 name = name.substring(1); | 482 name = name.substring(1); |
| 483 } | 483 } |
| 484 return formatType(name, dart.as(getRuntimeTypeInfo(object), core.List)); | 484 return formatType(name, dart.as(getRuntimeTypeInfo(object), core.List)); |
| 485 } | 485 } |
| 486 static objectToString(object) { | 486 static objectToString(object) { |
| 487 let name = objectTypeName(object); | 487 let name = objectTypeName(object); |
| 488 return `Instance of '${name}'`; | 488 return `Instance of '${name}'`; |
| 489 } | 489 } |
| 490 static dateNow() { | 490 static dateNow() { |
| 491 return Date.now(); | 491 return Date.now(); |
| 492 } | 492 } |
| 493 static initTicker() { | 493 static initTicker() { |
| 494 if (timerFrequency !== null) | 494 if (timerFrequency !== null) |
| 495 return; | 495 return; |
| 496 timerFrequency = 1000; | 496 timerFrequency = 1000; |
| 497 timerTicks = dateNow; | 497 timerTicks = dateNow; |
| 498 if (typeof window == "undefined") | 498 if (typeof window == "undefined") |
| 499 return; | 499 return; |
| 500 let window = window; | 500 let window = window; |
| 501 if (window === null) | 501 if (window === null) |
| 502 return; | 502 return; |
| 503 let performance = window.performance; | 503 let performance = window.performance; |
| 504 if (performance === null) | 504 if (performance === null) |
| 505 return; | 505 return; |
| 506 if (typeof performance.now != "function") | 506 if (typeof performance.now != "function") |
| 507 return; | 507 return; |
| 508 timerFrequency = 1000000; | 508 timerFrequency = 1000000; |
| 509 timerTicks = (() => (1000 * dart.notNull(performance.now())).floor()).bind
(this); | 509 timerTicks = (() => (1000 * performance.now()).floor()).bind(this); |
| 510 } | 510 } |
| 511 static get isD8() { | 511 static get isD8() { |
| 512 return typeof version == "function" && typeof os == "object" && "system" i
n os; | 512 return typeof version == "function" && typeof os == "object" && "system" i
n os; |
| 513 } | 513 } |
| 514 static get isJsshell() { | 514 static get isJsshell() { |
| 515 return typeof version == "function" && typeof system == "function"; | 515 return typeof version == "function" && typeof system == "function"; |
| 516 } | 516 } |
| 517 static currentUri() { | 517 static currentUri() { |
| 518 requiresPreamble(); | 518 requiresPreamble(); |
| 519 if (!!self.location) { | 519 if (!!self.location) { |
| 520 return self.location.href; | 520 return self.location.href; |
| 521 } | 521 } |
| 522 return null; | 522 return null; |
| 523 } | 523 } |
| 524 static [_fromCharCodeApply](array) { | 524 static [_fromCharCodeApply](array) { |
| 525 let result = ""; | 525 let result = ""; |
| 526 let kMaxApply = 500; | 526 let kMaxApply = 500; |
| 527 let end = array.length; | 527 let end = array.length; |
| 528 for (let i = 0; i < end; i = kMaxApply) { | 528 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) { |
| 529 let subarray = null; | 529 let subarray = null; |
| 530 if (end <= kMaxApply) { | 530 if (dart.notNull(end) <= dart.notNull(kMaxApply)) { |
| 531 subarray = array; | 531 subarray = array; |
| 532 } else { | 532 } else { |
| 533 subarray = array.slice(i, i + kMaxApply < end ? i + kMaxApply : end); | 533 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) <
dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); |
| 534 } | 534 } |
| 535 result = result + String.fromCharCode.apply(null, subarray); | 535 result = result + String.fromCharCode.apply(null, subarray); |
| 536 } | 536 } |
| 537 return result; | 537 return result; |
| 538 } | 538 } |
| 539 static stringFromCodePoints(codePoints) { | 539 static stringFromCodePoints(codePoints) { |
| 540 let a = new List.from([]); | 540 let a = new List.from([]); |
| 541 for (let i of codePoints) { | 541 for (let i of codePoints) { |
| 542 if (!(typeof i == number)) | 542 if (!(typeof i == number)) |
| 543 throw new core.ArgumentError(i); | 543 throw new core.ArgumentError(i); |
| 544 if (dart.dbinary(i, '<=', 65535)) { | 544 if (dart.dbinary(i, '<=', 65535)) { |
| 545 a.add(dart.as(i, core.int)); | 545 a.add(dart.as(i, core.int)); |
| 546 } else if (dart.dbinary(i, '<=', 1114111)) { | 546 } else if (dart.dbinary(i, '<=', 1114111)) { |
| 547 a.add(dart.notNull(55296['+'](dart.dbinary(dart.dbinary(dart.dbinary(i
, '-', 65536), '>>', 10), '&', 1023)))); | 547 a.add(55296['+'](dart.dbinary(dart.dbinary(dart.dbinary(i, '-', 65536)
, '>>', 10), '&', 1023))); |
| 548 a.add(dart.notNull(56320['+'](dart.dbinary(i, '&', 1023)))); | 548 a.add(56320['+'](dart.dbinary(i, '&', 1023))); |
| 549 } else { | 549 } else { |
| 550 throw new core.ArgumentError(i); | 550 throw new core.ArgumentError(i); |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 return _fromCharCodeApply(a); | 553 return _fromCharCodeApply(a); |
| 554 } | 554 } |
| 555 static stringFromCharCodes(charCodes) { | 555 static stringFromCharCodes(charCodes) { |
| 556 for (let i of charCodes) { | 556 for (let i of charCodes) { |
| 557 if (!(typeof i == number)) | 557 if (!(typeof i == number)) |
| 558 throw new core.ArgumentError(i); | 558 throw new core.ArgumentError(i); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 checkInt(seconds); | 609 checkInt(seconds); |
| 610 checkInt(milliseconds); | 610 checkInt(milliseconds); |
| 611 checkBool(isUtc); | 611 checkBool(isUtc); |
| 612 let jsMonth = dart.dbinary(month, '-', 1); | 612 let jsMonth = dart.dbinary(month, '-', 1); |
| 613 let value = null; | 613 let value = null; |
| 614 if (isUtc) { | 614 if (isUtc) { |
| 615 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco
nds); | 615 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco
nds); |
| 616 } else { | 616 } else { |
| 617 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco
nds).valueOf(); | 617 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco
nds).valueOf(); |
| 618 } | 618 } |
| 619 if (core.bool['||'](dart.dbinary(dart.dload(value, 'isNaN'), '||', dart.db
inary(value, '<', -MAX_MILLISECONDS_SINCE_EPOCH)), dart.dbinary(value, '>', MAX_
MILLISECONDS_SINCE_EPOCH))) { | 619 if (core.bool['||'](dart.dbinary(dart.dload(value, 'isNaN'), '||', dart.db
inary(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH))), dart.dbinary(va
lue, '>', MAX_MILLISECONDS_SINCE_EPOCH))) { |
| 620 return null; | 620 return null; |
| 621 } | 621 } |
| 622 if (dart.dbinary(dart.dbinary(years, '<=', 0), '||', dart.dbinary(years, '
<', 100))) | 622 if (dart.dbinary(dart.dbinary(years, '<=', 0), '||', dart.dbinary(years, '
<', 100))) |
| 623 return patchUpY2K(value, years, isUtc); | 623 return patchUpY2K(value, years, isUtc); |
| 624 return value; | 624 return value; |
| 625 } | 625 } |
| 626 static patchUpY2K(value, years, isUtc) { | 626 static patchUpY2K(value, years, isUtc) { |
| 627 let date = new Date(value); | 627 let date = new Date(value); |
| 628 if (isUtc) { | 628 if (isUtc) { |
| 629 date.setUTCFullYear(years); | 629 date.setUTCFullYear(years); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 654 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMinute
s() + 0 : lazyAsJsDate(receiver).getMinutes() + 0; | 654 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMinute
s() + 0 : lazyAsJsDate(receiver).getMinutes() + 0; |
| 655 } | 655 } |
| 656 static getSeconds(receiver) { | 656 static getSeconds(receiver) { |
| 657 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCSecond
s() + 0 : lazyAsJsDate(receiver).getSeconds() + 0; | 657 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCSecond
s() + 0 : lazyAsJsDate(receiver).getSeconds() + 0; |
| 658 } | 658 } |
| 659 static getMilliseconds(receiver) { | 659 static getMilliseconds(receiver) { |
| 660 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMillis
econds() + 0 : lazyAsJsDate(receiver).getMilliseconds() + 0; | 660 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMillis
econds() + 0 : lazyAsJsDate(receiver).getMilliseconds() + 0; |
| 661 } | 661 } |
| 662 static getWeekday(receiver) { | 662 static getWeekday(receiver) { |
| 663 let weekday = dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUT
CDay() + 0 : lazyAsJsDate(receiver).getDay() + 0; | 663 let weekday = dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUT
CDay() + 0 : lazyAsJsDate(receiver).getDay() + 0; |
| 664 return (weekday + 6) % 7 + 1; | 664 return (dart.notNull(weekday) + 6) % 7 + 1; |
| 665 } | 665 } |
| 666 static valueFromDateString(str) { | 666 static valueFromDateString(str) { |
| 667 if (!(typeof str == string)) | 667 if (!(typeof str == string)) |
| 668 throw new core.ArgumentError(str); | 668 throw new core.ArgumentError(str); |
| 669 let value = Date.parse(str); | 669 let value = Date.parse(str); |
| 670 if (value.isNaN) | 670 if (value.isNaN) |
| 671 throw new core.ArgumentError(str); | 671 throw new core.ArgumentError(str); |
| 672 return value; | 672 return value; |
| 673 } | 673 } |
| 674 static getProperty(object, key) { | 674 static getProperty(object, key) { |
| 675 if (dart.notNull(dart.notNull(dart.notNull(object === null) || dart.notNul
l(typeof object == boolean)) || dart.notNull(dart.is(object, core.num))) || dart
.notNull(typeof object == string)) { | 675 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean
) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st
ring)) { |
| 676 throw new core.ArgumentError(object); | 676 throw new core.ArgumentError(object); |
| 677 } | 677 } |
| 678 return object[key]; | 678 return object[key]; |
| 679 } | 679 } |
| 680 static setProperty(object, key, value) { | 680 static setProperty(object, key, value) { |
| 681 if (dart.notNull(dart.notNull(dart.notNull(object === null) || dart.notNul
l(typeof object == boolean)) || dart.notNull(dart.is(object, core.num))) || dart
.notNull(typeof object == string)) { | 681 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean
) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st
ring)) { |
| 682 throw new core.ArgumentError(object); | 682 throw new core.ArgumentError(object); |
| 683 } | 683 } |
| 684 object[key] = value; | 684 object[key] = value; |
| 685 } | 685 } |
| 686 static functionNoSuchMethod(function, positionalArguments, namedArguments) { | 686 static functionNoSuchMethod(function, positionalArguments, namedArguments) { |
| 687 let argumentCount = 0; | 687 let argumentCount = 0; |
| 688 let arguments = new List.from([]); | 688 let arguments = new List.from([]); |
| 689 let namedArgumentList = new List.from([]); | 689 let namedArgumentList = new List.from([]); |
| 690 if (positionalArguments !== null) { | 690 if (positionalArguments !== null) { |
| 691 argumentCount = positionalArguments.length; | 691 argumentCount = positionalArguments.length; |
| 692 arguments.addAll(positionalArguments); | 692 arguments.addAll(positionalArguments); |
| 693 } | 693 } |
| 694 let names = ''; | 694 let names = ''; |
| 695 if (dart.notNull(namedArguments !== null) && dart.notNull(!dart.notNull(na
medArguments.isEmpty))) { | 695 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments.
isEmpty)) { |
| 696 namedArguments.forEach(((name, argument) => { | 696 namedArguments.forEach(((name, argument) => { |
| 697 names = `${names}$${name}`; | 697 names = `${names}$${name}`; |
| 698 namedArgumentList.add(name); | 698 namedArgumentList.add(name); |
| 699 arguments.add(argument); | 699 arguments.add(argument); |
| 700 argumentCount++; | 700 dart.notNull(argumentCount)++; |
| 701 }).bind(this)); | 701 }).bind(this)); |
| 702 } | 702 } |
| 703 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume
ntCount}${names}`; | 703 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume
ntCount}${names}`; |
| 704 return dart.dinvoke(function, 'noSuchMethod', createUnmangledInvocationMir
ror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocatio
nMirror.METHOD, arguments, namedArgumentList)); | 704 return dart.dinvoke(function, 'noSuchMethod', createUnmangledInvocationMir
ror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocatio
nMirror.METHOD, arguments, namedArgumentList)); |
| 705 } | 705 } |
| 706 static applyFunction(function, positionalArguments, namedArguments) { | 706 static applyFunction(function, positionalArguments, namedArguments) { |
| 707 return namedArguments === null ? applyFunctionWithPositionalArguments(func
tion, positionalArguments) : applyFunctionWithNamedArguments(function, positiona
lArguments, namedArguments); | 707 return namedArguments === null ? applyFunctionWithPositionalArguments(func
tion, positionalArguments) : applyFunctionWithNamedArguments(function, positiona
lArguments, namedArguments); |
| 708 } | 708 } |
| 709 static applyFunctionWithPositionalArguments(function, positionalArguments) { | 709 static applyFunctionWithPositionalArguments(function, positionalArguments) { |
| 710 let argumentCount = 0; | 710 let argumentCount = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 729 static applyFunctionWithNamedArguments(function, positionalArguments, namedA
rguments) { | 729 static applyFunctionWithNamedArguments(function, positionalArguments, namedA
rguments) { |
| 730 if (namedArguments.isEmpty) { | 730 if (namedArguments.isEmpty) { |
| 731 return applyFunctionWithPositionalArguments(function, positionalArgument
s); | 731 return applyFunctionWithPositionalArguments(function, positionalArgument
s); |
| 732 } | 732 } |
| 733 let interceptor = _interceptors.getInterceptor(function); | 733 let interceptor = _interceptors.getInterceptor(function); |
| 734 let jsFunction = interceptor["call*"]; | 734 let jsFunction = interceptor["call*"]; |
| 735 if (jsFunction === null) { | 735 if (jsFunction === null) { |
| 736 return functionNoSuchMethod(function, positionalArguments, namedArgument
s); | 736 return functionNoSuchMethod(function, positionalArguments, namedArgument
s); |
| 737 } | 737 } |
| 738 let info = new ReflectionInfo(jsFunction); | 738 let info = new ReflectionInfo(jsFunction); |
| 739 if (dart.notNull(info === null) || dart.notNull(!dart.notNull(info.areOpti
onalParametersNamed))) { | 739 if (dart.notNull(info === null) || !dart.notNull(info.areOptionalParameter
sNamed)) { |
| 740 return functionNoSuchMethod(function, positionalArguments, namedArgument
s); | 740 return functionNoSuchMethod(function, positionalArguments, namedArgument
s); |
| 741 } | 741 } |
| 742 if (positionalArguments !== null) { | 742 if (positionalArguments !== null) { |
| 743 positionalArguments = new core.List.from(positionalArguments); | 743 positionalArguments = new core.List.from(positionalArguments); |
| 744 } else { | 744 } else { |
| 745 positionalArguments = new List.from([]); | 745 positionalArguments = new List.from([]); |
| 746 } | 746 } |
| 747 if (info.requiredParameterCount !== positionalArguments.length) { | 747 if (info.requiredParameterCount !== positionalArguments.length) { |
| 748 return functionNoSuchMethod(function, positionalArguments, namedArgument
s); | 748 return functionNoSuchMethod(function, positionalArguments, namedArgument
s); |
| 749 } | 749 } |
| 750 let defaultArguments = new core.Map(); | 750 let defaultArguments = new core.Map(); |
| 751 for (let i = 0; i < info.optionalParameterCount; i++) { | 751 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount
); dart.notNull(i)++) { |
| 752 let index = i + info.requiredParameterCount; | 752 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount); |
| 753 let parameterName = info.parameterNameInOrder(index); | 753 let parameterName = info.parameterNameInOrder(index); |
| 754 let value = info.defaultValueInOrder(index); | 754 let value = info.defaultValueInOrder(index); |
| 755 let defaultValue = getMetadata(value); | 755 let defaultValue = getMetadata(value); |
| 756 defaultArguments.set(parameterName, defaultValue); | 756 defaultArguments.set(parameterName, defaultValue); |
| 757 } | 757 } |
| 758 let bad = false; | 758 let bad = false; |
| 759 namedArguments.forEach(((parameter, value) => { | 759 namedArguments.forEach(((parameter, value) => { |
| 760 if (defaultArguments.containsKey(parameter)) { | 760 if (defaultArguments.containsKey(parameter)) { |
| 761 defaultArguments.set(parameter, value); | 761 defaultArguments.set(parameter, value); |
| 762 } else { | 762 } else { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 } | 1100 } |
| 1101 } | 1101 } |
| 1102 return error; | 1102 return error; |
| 1103 } | 1103 } |
| 1104 if (ex === null) | 1104 if (ex === null) |
| 1105 return null; | 1105 return null; |
| 1106 if (typeof ex !== "object") | 1106 if (typeof ex !== "object") |
| 1107 return ex; | 1107 return ex; |
| 1108 if ("dartException" in ex) { | 1108 if ("dartException" in ex) { |
| 1109 return saveStackTrace(ex.dartException); | 1109 return saveStackTrace(ex.dartException); |
| 1110 } else if (!dart.notNull("message" in ex)) { | 1110 } else if (!("message" in ex)) { |
| 1111 return ex; | 1111 return ex; |
| 1112 } | 1112 } |
| 1113 let message = ex.message; | 1113 let message = ex.message; |
| 1114 if (dart.notNull("number" in ex) && dart.notNull(typeof ex.number == "number
")) { | 1114 if ("number" in ex && typeof ex.number == "number") { |
| 1115 let number = ex.number; | 1115 let number = ex.number; |
| 1116 let ieErrorCode = number & 65535; | 1116 let ieErrorCode = dart.notNull(number) & 65535; |
| 1117 let ieFacilityNumber = number >> 16 & 8191; | 1117 let ieFacilityNumber = dart.notNull(number) >> 16 & 8191; |
| 1118 if (ieFacilityNumber === 10) { | 1118 if (ieFacilityNumber === 10) { |
| 1119 switch (ieErrorCode) { | 1119 switch (ieErrorCode) { |
| 1120 case 438: | 1120 case 438: |
| 1121 return saveStackTrace(new JsNoSuchMethodError(`${message} (Error ${i
eErrorCode})`, null)); | 1121 return saveStackTrace(new JsNoSuchMethodError(`${message} (Error ${i
eErrorCode})`, null)); |
| 1122 case 445: | 1122 case 445: |
| 1123 case 5007: | 1123 case 5007: |
| 1124 return saveStackTrace(new NullError(`${message} (Error ${ieErrorCode
})`, null)); | 1124 return saveStackTrace(new NullError(`${message} (Error ${ieErrorCode
})`, null)); |
| 1125 } | 1125 } |
| 1126 } | 1126 } |
| 1127 } | 1127 } |
| 1128 if (ex instanceof TypeError) { | 1128 if (ex instanceof TypeError) { |
| 1129 let match = null; | 1129 let match = null; |
| 1130 let nsme = TypeErrorDecoder.noSuchMethodPattern; | 1130 let nsme = TypeErrorDecoder.noSuchMethodPattern; |
| 1131 let notClosure = TypeErrorDecoder.notClosurePattern; | 1131 let notClosure = TypeErrorDecoder.notClosurePattern; |
| 1132 let nullCall = TypeErrorDecoder.nullCallPattern; | 1132 let nullCall = TypeErrorDecoder.nullCallPattern; |
| 1133 let nullLiteralCall = TypeErrorDecoder.nullLiteralCallPattern; | 1133 let nullLiteralCall = TypeErrorDecoder.nullLiteralCallPattern; |
| 1134 let undefCall = TypeErrorDecoder.undefinedCallPattern; | 1134 let undefCall = TypeErrorDecoder.undefinedCallPattern; |
| 1135 let undefLiteralCall = TypeErrorDecoder.undefinedLiteralCallPattern; | 1135 let undefLiteralCall = TypeErrorDecoder.undefinedLiteralCallPattern; |
| 1136 let nullProperty = TypeErrorDecoder.nullPropertyPattern; | 1136 let nullProperty = TypeErrorDecoder.nullPropertyPattern; |
| 1137 let nullLiteralProperty = TypeErrorDecoder.nullLiteralPropertyPattern; | 1137 let nullLiteralProperty = TypeErrorDecoder.nullLiteralPropertyPattern; |
| 1138 let undefProperty = TypeErrorDecoder.undefinedPropertyPattern; | 1138 let undefProperty = TypeErrorDecoder.undefinedPropertyPattern; |
| 1139 let undefLiteralProperty = TypeErrorDecoder.undefinedLiteralPropertyPatter
n; | 1139 let undefLiteralProperty = TypeErrorDecoder.undefinedLiteralPropertyPatter
n; |
| 1140 if ((match = dart.dinvoke(nsme, 'matchTypeError', message)) !== null) { | 1140 if ((match = dart.dinvoke(nsme, 'matchTypeError', message)) !== null) { |
| 1141 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri
ng), match)); | 1141 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri
ng), match)); |
| 1142 } else if ((match = dart.dinvoke(notClosure, 'matchTypeError', message)) !
== null) { | 1142 } else if ((match = dart.dinvoke(notClosure, 'matchTypeError', message)) !
== null) { |
| 1143 match.method = "call"; | 1143 match.method = "call"; |
| 1144 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri
ng), match)); | 1144 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri
ng), match)); |
| 1145 } else if (dart.notNull(dart.notNull(dart.notNull(dart.notNull(dart.notNul
l(dart.notNull(dart.notNull((match = dart.dinvoke(nullCall, 'matchTypeError', me
ssage)) !== null) || dart.notNull((match = dart.dinvoke(nullLiteralCall, 'matchT
ypeError', message)) !== null)) || dart.notNull((match = dart.dinvoke(undefCall,
'matchTypeError', message)) !== null)) || dart.notNull((match = dart.dinvoke(un
defLiteralCall, 'matchTypeError', message)) !== null)) || dart.notNull((match =
dart.dinvoke(nullProperty, 'matchTypeError', message)) !== null)) || dart.notNul
l((match = dart.dinvoke(nullLiteralCall, 'matchTypeError', message)) !== null))
|| dart.notNull((match = dart.dinvoke(undefProperty, 'matchTypeError', message))
!== null)) || dart.notNull((match = dart.dinvoke(undefLiteralProperty, 'matchTy
peError', message)) !== null)) { | 1145 } else if (dart.notNull((match = dart.dinvoke(nullCall, 'matchTypeError',
message)) !== null) || dart.notNull((match = dart.dinvoke(nullLiteralCall, 'matc
hTypeError', message)) !== null) || dart.notNull((match = dart.dinvoke(undefCall
, 'matchTypeError', message)) !== null) || dart.notNull((match = dart.dinvoke(un
defLiteralCall, 'matchTypeError', message)) !== null) || dart.notNull((match = d
art.dinvoke(nullProperty, 'matchTypeError', message)) !== null) || dart.notNull(
(match = dart.dinvoke(nullLiteralCall, 'matchTypeError', message)) !== null) ||
dart.notNull((match = dart.dinvoke(undefProperty, 'matchTypeError', message)) !=
= null) || dart.notNull((match = dart.dinvoke(undefLiteralProperty, 'matchTypeEr
ror', message)) !== null)) { |
| 1146 return saveStackTrace(new NullError(dart.as(message, core.String), match
)); | 1146 return saveStackTrace(new NullError(dart.as(message, core.String), match
)); |
| 1147 } | 1147 } |
| 1148 return saveStackTrace(new UnknownJsTypeError(dart.as(typeof message == str
ing ? message : '', core.String))); | 1148 return saveStackTrace(new UnknownJsTypeError(dart.as(typeof message == str
ing ? message : '', core.String))); |
| 1149 } | 1149 } |
| 1150 if (ex instanceof RangeError) { | 1150 if (ex instanceof RangeError) { |
| 1151 if (dart.notNull(typeof message == string) && dart.notNull(contains(dart.a
s(message, core.String), 'call stack'))) { | 1151 if (dart.notNull(typeof message == string) && dart.notNull(contains(dart.a
s(message, core.String), 'call stack'))) { |
| 1152 return new core.StackOverflowError(); | 1152 return new core.StackOverflowError(); |
| 1153 } | 1153 } |
| 1154 return saveStackTrace(new core.ArgumentError()); | 1154 return saveStackTrace(new core.ArgumentError()); |
| 1155 } | 1155 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1176 return this[_trace]; | 1176 return this[_trace]; |
| 1177 let trace = null; | 1177 let trace = null; |
| 1178 if (typeof this[_exception] === "object") { | 1178 if (typeof this[_exception] === "object") { |
| 1179 trace = dart.as(this[_exception].stack, core.String); | 1179 trace = dart.as(this[_exception].stack, core.String); |
| 1180 } | 1180 } |
| 1181 return this[_trace] = trace === null ? '' : trace; | 1181 return this[_trace] = trace === null ? '' : trace; |
| 1182 } | 1182 } |
| 1183 } | 1183 } |
| 1184 // Function objectHashCode: (dynamic) → int | 1184 // Function objectHashCode: (dynamic) → int |
| 1185 function objectHashCode(object) { | 1185 function objectHashCode(object) { |
| 1186 if (dart.notNull(object === null) || dart.notNull(typeof object != 'object')
) { | 1186 if (dart.notNull(object === null) || typeof object != 'object') { |
| 1187 return dart.as(dart.dload(object, 'hashCode'), core.int); | 1187 return dart.as(dart.dload(object, 'hashCode'), core.int); |
| 1188 } else { | 1188 } else { |
| 1189 return Primitives.objectHashCode(object); | 1189 return Primitives.objectHashCode(object); |
| 1190 } | 1190 } |
| 1191 } | 1191 } |
| 1192 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic | 1192 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic |
| 1193 function fillLiteralMap(keyValuePairs, result) { | 1193 function fillLiteralMap(keyValuePairs, result) { |
| 1194 let index = 0; | 1194 let index = 0; |
| 1195 let length = getLength(keyValuePairs); | 1195 let length = getLength(keyValuePairs); |
| 1196 while (index < length) { | 1196 while (dart.notNull(index) < dart.notNull(length)) { |
| 1197 let key = getIndex(keyValuePairs, index++); | 1197 let key = getIndex(keyValuePairs, dart.notNull(index)++); |
| 1198 let value = getIndex(keyValuePairs, index++); | 1198 let value = getIndex(keyValuePairs, dart.notNull(index)++); |
| 1199 result.set(key, value); | 1199 result.set(key, value); |
| 1200 } | 1200 } |
| 1201 return result; | 1201 return result; |
| 1202 } | 1202 } |
| 1203 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic,
dynamic) → dynamic | 1203 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic,
dynamic) → dynamic |
| 1204 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3,
arg4) { | 1204 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3,
arg4) { |
| 1205 if (numberOfArguments === 0) { | 1205 if (numberOfArguments === 0) { |
| 1206 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo
sure)); | 1206 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo
sure)); |
| 1207 } else if (numberOfArguments === 1) { | 1207 } else if (numberOfArguments === 1) { |
| 1208 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo
sure, arg1)); | 1208 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo
sure, arg1)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 let callName = dart.as(function.$callName, core.String); | 1244 let callName = dart.as(function.$callName, core.String); |
| 1245 function.$reflectionInfo = reflectionInfo; | 1245 function.$reflectionInfo = reflectionInfo; |
| 1246 let info = new ReflectionInfo(function); | 1246 let info = new ReflectionInfo(function); |
| 1247 let functionType = info.functionType; | 1247 let functionType = info.functionType; |
| 1248 let prototype = isStatic ? Object.create(new TearOffClosure().constructor.
prototype) : Object.create(new BoundClosure(null, null, null, null).constructor.
prototype); | 1248 let prototype = isStatic ? Object.create(new TearOffClosure().constructor.
prototype) : Object.create(new BoundClosure(null, null, null, null).constructor.
prototype); |
| 1249 prototype.$initialize = prototype.constructor; | 1249 prototype.$initialize = prototype.constructor; |
| 1250 let constructor = isStatic ? function() { | 1250 let constructor = isStatic ? function() { |
| 1251 this.$initialize(); | 1251 this.$initialize(); |
| 1252 } : isCsp ? function(a, b, c, d) { | 1252 } : isCsp ? function(a, b, c, d) { |
| 1253 this.$initialize(a, b, c, d); | 1253 this.$initialize(a, b, c, d); |
| 1254 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + functi
onCounter++); | 1254 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + dart.n
otNull(functionCounter)++); |
| 1255 prototype.constructor = constructor; | 1255 prototype.constructor = constructor; |
| 1256 constructor.prototype = prototype; | 1256 constructor.prototype = prototype; |
| 1257 let trampoline = function; | 1257 let trampoline = function; |
| 1258 let isIntercepted = false; | 1258 let isIntercepted = false; |
| 1259 if (!dart.notNull(isStatic)) { | 1259 if (!dart.notNull(isStatic)) { |
| 1260 if (jsArguments.length == 1) { | 1260 if (jsArguments.length == 1) { |
| 1261 isIntercepted = true; | 1261 isIntercepted = true; |
| 1262 } | 1262 } |
| 1263 trampoline = forwardCallTo(receiver, function, isIntercepted); | 1263 trampoline = forwardCallTo(receiver, function, isIntercepted); |
| 1264 trampoline.$reflectionInfo = reflectionInfo; | 1264 trampoline.$reflectionInfo = reflectionInfo; |
| 1265 } else { | 1265 } else { |
| 1266 prototype.$name = propertyName; | 1266 prototype.$name = propertyName; |
| 1267 } | 1267 } |
| 1268 let signatureFunction = null; | 1268 let signatureFunction = null; |
| 1269 if (typeof functionType == "number") { | 1269 if (typeof functionType == "number") { |
| 1270 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedd
ed_names.METADATA, core.String)); | 1270 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedd
ed_names.METADATA, core.String)); |
| 1271 signatureFunction = function(s) { | 1271 signatureFunction = function(s) { |
| 1272 return function() { | 1272 return function() { |
| 1273 return metadata[s]; | 1273 return metadata[s]; |
| 1274 }; | 1274 }; |
| 1275 }(functionType); | 1275 }(functionType); |
| 1276 } else if (dart.notNull(!dart.notNull(isStatic)) && dart.notNull(typeof fu
nctionType == "function")) { | 1276 } else if (!dart.notNull(isStatic) && typeof functionType == "function") { |
| 1277 let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF(
BoundClosure.receiverOf) : _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.se
lfOf); | 1277 let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF(
BoundClosure.receiverOf) : _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.se
lfOf); |
| 1278 signatureFunction = function(f, r) { | 1278 signatureFunction = function(f, r) { |
| 1279 return function() { | 1279 return function() { |
| 1280 return f.apply({$receiver: r(this)}, arguments); | 1280 return f.apply({$receiver: r(this)}, arguments); |
| 1281 }; | 1281 }; |
| 1282 }(functionType, getReceiver); | 1282 }(functionType, getReceiver); |
| 1283 } else { | 1283 } else { |
| 1284 throw 'Error in reflectionInfo.'; | 1284 throw 'Error in reflectionInfo.'; |
| 1285 } | 1285 } |
| 1286 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction; | 1286 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction; |
| 1287 prototype[callName] = trampoline; | 1287 prototype[callName] = trampoline; |
| 1288 for (let i = 1; i < functions.length; i++) { | 1288 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); dart.not
Null(i)++) { |
| 1289 let stub = functions.get(i); | 1289 let stub = functions.get(i); |
| 1290 let stubCallName = stub.$callName; | 1290 let stubCallName = stub.$callName; |
| 1291 if (stubCallName !== null) { | 1291 if (stubCallName !== null) { |
| 1292 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st
ub, isIntercepted); | 1292 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st
ub, isIntercepted); |
| 1293 } | 1293 } |
| 1294 } | 1294 } |
| 1295 prototype["call*"] = trampoline; | 1295 prototype["call*"] = trampoline; |
| 1296 return constructor; | 1296 return constructor; |
| 1297 } | 1297 } |
| 1298 static cspForwardCall(arity, isSuperCall, stubName, function) { | 1298 static cspForwardCall(arity, isSuperCall, stubName, function) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 static get isCsp() { | 1347 static get isCsp() { |
| 1348 return typeof dart_precompiled == "function"; | 1348 return typeof dart_precompiled == "function"; |
| 1349 } | 1349 } |
| 1350 static forwardCallTo(receiver, function, isIntercepted) { | 1350 static forwardCallTo(receiver, function, isIntercepted) { |
| 1351 if (isIntercepted) | 1351 if (isIntercepted) |
| 1352 return forwardInterceptedCallTo(receiver, function); | 1352 return forwardInterceptedCallTo(receiver, function); |
| 1353 let stubName = dart.as(function.$stubName, core.String); | 1353 let stubName = dart.as(function.$stubName, core.String); |
| 1354 let arity = function.length; | 1354 let arity = function.length; |
| 1355 let lookedUpFunction = receiver[stubName]; | 1355 let lookedUpFunction = receiver[stubName]; |
| 1356 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction)
); | 1356 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction)
); |
| 1357 if (dart.notNull(dart.notNull(isCsp) || dart.notNull(isSuperCall)) || dart
.notNull(arity >= 27)) { | 1357 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity
) >= 27) { |
| 1358 return cspForwardCall(arity, isSuperCall, stubName, function); | 1358 return cspForwardCall(arity, isSuperCall, stubName, function); |
| 1359 } | 1359 } |
| 1360 if (arity === 0) { | 1360 if (arity === 0) { |
| 1361 return new Function('return function(){' + `return this.${BoundClosure.s
elfFieldName()}.${stubName}();` + `${functionCounter++}` + '}')(); | 1361 return new Function('return function(){' + `return this.${BoundClosure.s
elfFieldName()}.${stubName}();` + `${dart.notNull(functionCounter)++}` + '}')(); |
| 1362 } | 1362 } |
| 1363 dart.assert(dart.notNull(1 <= arity) && dart.notNull(arity < 27)); | 1363 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); |
| 1364 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo
in(","); | 1364 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo
in(","); |
| 1365 return new Function(`return function(${arguments}){` + `return this.${Boun
dClosure.selfFieldName()}.${stubName}(${arguments});` + `${functionCounter++}` +
'}')(); | 1365 return new Function(`return function(${arguments}){` + `return this.${Boun
dClosure.selfFieldName()}.${stubName}(${arguments});` + `${dart.notNull(function
Counter)++}` + '}')(); |
| 1366 } | 1366 } |
| 1367 static cspForwardInterceptedCall(arity, isSuperCall, name, function) { | 1367 static cspForwardInterceptedCall(arity, isSuperCall, name, function) { |
| 1368 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); | 1368 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); |
| 1369 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei
verOf); | 1369 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei
verOf); |
| 1370 if (isSuperCall) | 1370 if (isSuperCall) |
| 1371 arity = -1; | 1371 arity = -1; |
| 1372 switch (arity) { | 1372 switch (arity) { |
| 1373 case 0: | 1373 case 0: |
| 1374 throw new RuntimeError('Intercepted function with no arguments.'); | 1374 throw new RuntimeError('Intercepted function with no arguments.'); |
| 1375 case 1: | 1375 case 1: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 } | 1419 } |
| 1420 } | 1420 } |
| 1421 static forwardInterceptedCallTo(receiver, function) { | 1421 static forwardInterceptedCallTo(receiver, function) { |
| 1422 let selfField = BoundClosure.selfFieldName(); | 1422 let selfField = BoundClosure.selfFieldName(); |
| 1423 let receiverField = BoundClosure.receiverFieldName(); | 1423 let receiverField = BoundClosure.receiverFieldName(); |
| 1424 let stubName = dart.as(function.$stubName, core.String); | 1424 let stubName = dart.as(function.$stubName, core.String); |
| 1425 let arity = function.length; | 1425 let arity = function.length; |
| 1426 let isCsp = typeof dart_precompiled == "function"; | 1426 let isCsp = typeof dart_precompiled == "function"; |
| 1427 let lookedUpFunction = receiver[stubName]; | 1427 let lookedUpFunction = receiver[stubName]; |
| 1428 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction)
); | 1428 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction)
); |
| 1429 if (dart.notNull(dart.notNull(isCsp) || dart.notNull(isSuperCall)) || dart
.notNull(arity >= 28)) { | 1429 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity
) >= 28) { |
| 1430 return cspForwardInterceptedCall(arity, isSuperCall, stubName, function)
; | 1430 return cspForwardInterceptedCall(arity, isSuperCall, stubName, function)
; |
| 1431 } | 1431 } |
| 1432 if (arity === 1) { | 1432 if (arity === 1) { |
| 1433 return new Function('return function(){' + `return this.${selfField}.${s
tubName}(this.${receiverField});` + `${functionCounter++}` + '}')(); | 1433 return new Function('return function(){' + `return this.${selfField}.${s
tubName}(this.${receiverField});` + `${dart.notNull(functionCounter)++}` + '}')(
); |
| 1434 } | 1434 } |
| 1435 dart.assert(dart.notNull(1 < arity) && dart.notNull(arity < 28)); | 1435 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); |
| 1436 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity - 1
).join(","); | 1436 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN
ull(arity) - 1).join(","); |
| 1437 return new Function(`return function(${arguments}){` + `return this.${self
Field}.${stubName}(this.${receiverField}, ${arguments});` + `${functionCounter++
}` + '}')(); | 1437 return new Function(`return function(${arguments}){` + `return this.${self
Field}.${stubName}(this.${receiverField}, ${arguments});` + `${dart.notNull(func
tionCounter)++}` + '}')(); |
| 1438 } | 1438 } |
| 1439 toString() { | 1439 toString() { |
| 1440 return "Closure"; | 1440 return "Closure"; |
| 1441 } | 1441 } |
| 1442 } | 1442 } |
| 1443 Closure.FUNCTION_INDEX = 0; | 1443 Closure.FUNCTION_INDEX = 0; |
| 1444 Closure.NAME_INDEX = 1; | 1444 Closure.NAME_INDEX = 1; |
| 1445 Closure.CALL_NAME_INDEX = 2; | 1445 Closure.CALL_NAME_INDEX = 2; |
| 1446 Closure.REQUIRED_PARAMETER_INDEX = 3; | 1446 Closure.REQUIRED_PARAMETER_INDEX = 3; |
| 1447 Closure.OPTIONAL_PARAMETER_INDEX = 4; | 1447 Closure.OPTIONAL_PARAMETER_INDEX = 4; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1473 } | 1473 } |
| 1474 get hashCode() { | 1474 get hashCode() { |
| 1475 let receiverHashCode = null; | 1475 let receiverHashCode = null; |
| 1476 if (this[_receiver] === null) { | 1476 if (this[_receiver] === null) { |
| 1477 receiverHashCode = Primitives.objectHashCode(this[_self]); | 1477 receiverHashCode = Primitives.objectHashCode(this[_self]); |
| 1478 } else if (!dart.equals(typeof this[_receiver], 'object')) { | 1478 } else if (!dart.equals(typeof this[_receiver], 'object')) { |
| 1479 receiverHashCode = dart.as(dart.dload(this[_receiver], 'hashCode'), core
.int); | 1479 receiverHashCode = dart.as(dart.dload(this[_receiver], 'hashCode'), core
.int); |
| 1480 } else { | 1480 } else { |
| 1481 receiverHashCode = Primitives.objectHashCode(this[_receiver]); | 1481 receiverHashCode = Primitives.objectHashCode(this[_receiver]); |
| 1482 } | 1482 } |
| 1483 return receiverHashCode ^ Primitives.objectHashCode(this[_target]); | 1483 return dart.notNull(receiverHashCode) ^ dart.notNull(Primitives.objectHash
Code(this[_target])); |
| 1484 } | 1484 } |
| 1485 static selfOf(closure) { | 1485 static selfOf(closure) { |
| 1486 return closure[_self]; | 1486 return closure[_self]; |
| 1487 } | 1487 } |
| 1488 static targetOf(closure) { | 1488 static targetOf(closure) { |
| 1489 return closure[_target]; | 1489 return closure[_target]; |
| 1490 } | 1490 } |
| 1491 static receiverOf(closure) { | 1491 static receiverOf(closure) { |
| 1492 return closure[_receiver]; | 1492 return closure[_receiver]; |
| 1493 } | 1493 } |
| 1494 static nameOf(closure) { | 1494 static nameOf(closure) { |
| 1495 return closure[_name]; | 1495 return closure[_name]; |
| 1496 } | 1496 } |
| 1497 static selfFieldName() { | 1497 static selfFieldName() { |
| 1498 if (selfFieldNameCache === null) { | 1498 if (selfFieldNameCache === null) { |
| 1499 selfFieldNameCache = computeFieldNamed('self'); | 1499 selfFieldNameCache = computeFieldNamed('self'); |
| 1500 } | 1500 } |
| 1501 return selfFieldNameCache; | 1501 return selfFieldNameCache; |
| 1502 } | 1502 } |
| 1503 static receiverFieldName() { | 1503 static receiverFieldName() { |
| 1504 if (receiverFieldNameCache === null) { | 1504 if (receiverFieldNameCache === null) { |
| 1505 receiverFieldNameCache = computeFieldNamed('receiver'); | 1505 receiverFieldNameCache = computeFieldNamed('receiver'); |
| 1506 } | 1506 } |
| 1507 return receiverFieldNameCache; | 1507 return receiverFieldNameCache; |
| 1508 } | 1508 } |
| 1509 static computeFieldNamed(fieldName) { | 1509 static computeFieldNamed(fieldName) { |
| 1510 let template = new BoundClosure('self', 'target', 'receiver', 'name'); | 1510 let template = new BoundClosure('self', 'target', 'receiver', 'name'); |
| 1511 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope
rtyNames(template), core.List)); | 1511 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope
rtyNames(template), core.List)); |
| 1512 for (let i = 0; i < names.length; i++) { | 1512 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); dart.notNull
(i)++) { |
| 1513 let name = names.get(i); | 1513 let name = names.get(i); |
| 1514 if (template[name] === fieldName) { | 1514 if (template[name] === fieldName) { |
| 1515 return name; | 1515 return name; |
| 1516 } | 1516 } |
| 1517 } | 1517 } |
| 1518 } | 1518 } |
| 1519 } | 1519 } |
| 1520 BoundClosure.selfFieldNameCache = null; | 1520 BoundClosure.selfFieldNameCache = null; |
| 1521 BoundClosure.receiverFieldNameCache = null; | 1521 BoundClosure.receiverFieldNameCache = null; |
| 1522 // Function jsHasOwnProperty: (dynamic, String) → bool | 1522 // Function jsHasOwnProperty: (dynamic, String) → bool |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 // Function propertyTypeCheck: (dynamic, dynamic) → dynamic | 1638 // Function propertyTypeCheck: (dynamic, dynamic) → dynamic |
| 1639 function propertyTypeCheck(value, property) { | 1639 function propertyTypeCheck(value, property) { |
| 1640 if (value === null) | 1640 if (value === null) |
| 1641 return value; | 1641 return value; |
| 1642 if (!!value[property]) | 1642 if (!!value[property]) |
| 1643 return value; | 1643 return value; |
| 1644 propertyTypeError(value, property); | 1644 propertyTypeError(value, property); |
| 1645 } | 1645 } |
| 1646 // Function propertyTypeCast: (dynamic, dynamic) → dynamic | 1646 // Function propertyTypeCast: (dynamic, dynamic) → dynamic |
| 1647 function propertyTypeCast(value, property) { | 1647 function propertyTypeCast(value, property) { |
| 1648 if (dart.notNull(value === null) || dart.notNull(!!value[property])) | 1648 if (dart.notNull(value === null) || !!value[property]) |
| 1649 return value; | 1649 return value; |
| 1650 propertyTypeCastError(value, property); | 1650 propertyTypeCastError(value, property); |
| 1651 } | 1651 } |
| 1652 // Function interceptedTypeCheck: (dynamic, dynamic) → dynamic | 1652 // Function interceptedTypeCheck: (dynamic, dynamic) → dynamic |
| 1653 function interceptedTypeCheck(value, property) { | 1653 function interceptedTypeCheck(value, property) { |
| 1654 if (value === null) | 1654 if (value === null) |
| 1655 return value; | 1655 return value; |
| 1656 if (dart.notNull(core.identical(typeof value, 'object')) && dart.notNull(_in
terceptors.getInterceptor(value)[property])) { | 1656 if (dart.notNull(core.identical(typeof value, 'object')) && _interceptors.ge
tInterceptor(value)[property]) { |
| 1657 return value; | 1657 return value; |
| 1658 } | 1658 } |
| 1659 propertyTypeError(value, property); | 1659 propertyTypeError(value, property); |
| 1660 } | 1660 } |
| 1661 // Function interceptedTypeCast: (dynamic, dynamic) → dynamic | 1661 // Function interceptedTypeCast: (dynamic, dynamic) → dynamic |
| 1662 function interceptedTypeCast(value, property) { | 1662 function interceptedTypeCast(value, property) { |
| 1663 if (dart.notNull(value === null) || dart.notNull(dart.notNull(typeof value =
== "object") && dart.notNull(_interceptors.getInterceptor(value)[property]))) { | 1663 if (dart.notNull(value === null) || typeof value === "object" && _intercepto
rs.getInterceptor(value)[property]) { |
| 1664 return value; | 1664 return value; |
| 1665 } | 1665 } |
| 1666 propertyTypeCastError(value, property); | 1666 propertyTypeCastError(value, property); |
| 1667 } | 1667 } |
| 1668 // Function numberOrStringSuperTypeCheck: (dynamic, dynamic) → dynamic | 1668 // Function numberOrStringSuperTypeCheck: (dynamic, dynamic) → dynamic |
| 1669 function numberOrStringSuperTypeCheck(value, property) { | 1669 function numberOrStringSuperTypeCheck(value, property) { |
| 1670 if (value === null) | 1670 if (value === null) |
| 1671 return value; | 1671 return value; |
| 1672 if (typeof value == string) | 1672 if (typeof value == string) |
| 1673 return value; | 1673 return value; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 } | 1943 } |
| 1944 toRti() { | 1944 toRti() { |
| 1945 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"}; | 1945 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"}; |
| 1946 if (this.isVoid) { | 1946 if (this.isVoid) { |
| 1947 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true; | 1947 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true; |
| 1948 } else { | 1948 } else { |
| 1949 if (!dart.is(this.returnType, DynamicRuntimeType)) { | 1949 if (!dart.is(this.returnType, DynamicRuntimeType)) { |
| 1950 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu
rnType.toRti(); | 1950 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu
rnType.toRti(); |
| 1951 } | 1951 } |
| 1952 } | 1952 } |
| 1953 if (dart.notNull(this.parameterTypes !== null) && dart.notNull(!dart.notNu
ll(this.parameterTypes.isEmpty))) { | 1953 if (dart.notNull(this.parameterTypes !== null) && !dart.notNull(this.param
eterTypes.isEmpty)) { |
| 1954 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = lis
tToRti(this.parameterTypes); | 1954 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = lis
tToRti(this.parameterTypes); |
| 1955 } | 1955 } |
| 1956 if (dart.notNull(this.optionalParameterTypes !== null) && dart.notNull(!da
rt.notNull(this.optionalParameterTypes.isEmpty))) { | 1956 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th
is.optionalParameterTypes.isEmpty)) { |
| 1957 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = lis
tToRti(this.optionalParameterTypes); | 1957 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = lis
tToRti(this.optionalParameterTypes); |
| 1958 } | 1958 } |
| 1959 if (this.namedParameters !== null) { | 1959 if (this.namedParameters !== null) { |
| 1960 let namedRti = Object.create(null); | 1960 let namedRti = Object.create(null); |
| 1961 let keys = _js_names.extractKeys(this.namedParameters); | 1961 let keys = _js_names.extractKeys(this.namedParameters); |
| 1962 for (let i = 0; i < keys.length; i++) { | 1962 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNul
l(i)++) { |
| 1963 let name = keys.get(i); | 1963 let name = keys.get(i); |
| 1964 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); | 1964 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); |
| 1965 namedRti[name] = rti; | 1965 namedRti[name] = rti; |
| 1966 } | 1966 } |
| 1967 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR
ti; | 1967 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR
ti; |
| 1968 } | 1968 } |
| 1969 return result; | 1969 return result; |
| 1970 } | 1970 } |
| 1971 static listToRti(list) { | 1971 static listToRti(list) { |
| 1972 list = list; | 1972 list = list; |
| 1973 let result = []; | 1973 let result = []; |
| 1974 for (let i = 0; i['<'](dart.dload(list, 'length')); i++) { | 1974 for (let i = 0; i['<'](dart.dload(list, 'length')); dart.notNull(i)++) { |
| 1975 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti')); | 1975 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti')); |
| 1976 } | 1976 } |
| 1977 return result; | 1977 return result; |
| 1978 } | 1978 } |
| 1979 toString() { | 1979 toString() { |
| 1980 let result = '('; | 1980 let result = '('; |
| 1981 let needsComma = false; | 1981 let needsComma = false; |
| 1982 if (this.parameterTypes !== null) { | 1982 if (this.parameterTypes !== null) { |
| 1983 for (let i = 0; i < this.parameterTypes.length; i++) { | 1983 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes.lengt
h); dart.notNull(i)++) { |
| 1984 let type = this.parameterTypes.get(i); | 1984 let type = this.parameterTypes.get(i); |
| 1985 if (needsComma) | 1985 if (needsComma) |
| 1986 result = ', '; | 1986 result = ', '; |
| 1987 result = `${type}`; | 1987 result = `${type}`; |
| 1988 needsComma = true; | 1988 needsComma = true; |
| 1989 } | 1989 } |
| 1990 } | 1990 } |
| 1991 if (dart.notNull(this.optionalParameterTypes !== null) && dart.notNull(!da
rt.notNull(this.optionalParameterTypes.isEmpty))) { | 1991 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th
is.optionalParameterTypes.isEmpty)) { |
| 1992 if (needsComma) | 1992 if (needsComma) |
| 1993 result = ', '; | 1993 result = ', '; |
| 1994 needsComma = false; | 1994 needsComma = false; |
| 1995 result = '['; | 1995 result = '['; |
| 1996 for (let i = 0; i < this.optionalParameterTypes.length; i++) { | 1996 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp
es.length); dart.notNull(i)++) { |
| 1997 let type = this.optionalParameterTypes.get(i); | 1997 let type = this.optionalParameterTypes.get(i); |
| 1998 if (needsComma) | 1998 if (needsComma) |
| 1999 result = ', '; | 1999 result = ', '; |
| 2000 result = `${type}`; | 2000 result = `${type}`; |
| 2001 needsComma = true; | 2001 needsComma = true; |
| 2002 } | 2002 } |
| 2003 result = ']'; | 2003 result = ']'; |
| 2004 } else if (this.namedParameters !== null) { | 2004 } else if (this.namedParameters !== null) { |
| 2005 if (needsComma) | 2005 if (needsComma) |
| 2006 result = ', '; | 2006 result = ', '; |
| 2007 needsComma = false; | 2007 needsComma = false; |
| 2008 result = '{'; | 2008 result = '{'; |
| 2009 let keys = _js_names.extractKeys(this.namedParameters); | 2009 let keys = _js_names.extractKeys(this.namedParameters); |
| 2010 for (let i = 0; i < keys.length; i++) { | 2010 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNul
l(i)++) { |
| 2011 let name = keys.get(i); | 2011 let name = keys.get(i); |
| 2012 if (needsComma) | 2012 if (needsComma) |
| 2013 result = ', '; | 2013 result = ', '; |
| 2014 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); | 2014 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); |
| 2015 result = `${rti} ${name}`; | 2015 result = `${rti} ${name}`; |
| 2016 needsComma = true; | 2016 needsComma = true; |
| 2017 } | 2017 } |
| 2018 result = '}'; | 2018 result = '}'; |
| 2019 } | 2019 } |
| 2020 result = `) -> ${this.returnType}`; | 2020 result = `) -> ${this.returnType}`; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType | 2089 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType |
| 2090 function convertRtiToRuntimeType(rti) { | 2090 function convertRtiToRuntimeType(rti) { |
| 2091 if (rti === null) { | 2091 if (rti === null) { |
| 2092 return getDynamicRuntimeType(); | 2092 return getDynamicRuntimeType(); |
| 2093 } else if (typeof rti == "function") { | 2093 } else if (typeof rti == "function") { |
| 2094 return new RuntimeTypePlain(rti.name); | 2094 return new RuntimeTypePlain(rti.name); |
| 2095 } else if (rti.constructor == Array) { | 2095 } else if (rti.constructor == Array) { |
| 2096 let list = dart.as(rti, core.List); | 2096 let list = dart.as(rti, core.List); |
| 2097 let name = list.get(0).name; | 2097 let name = list.get(0).name; |
| 2098 let arguments = new List.from([]); | 2098 let arguments = new List.from([]); |
| 2099 for (let i = 1; i < list.length; i++) { | 2099 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); dart.notNull(
i)++) { |
| 2100 arguments.add(convertRtiToRuntimeType(list.get(i))); | 2100 arguments.add(convertRtiToRuntimeType(list.get(i))); |
| 2101 } | 2101 } |
| 2102 return new RuntimeTypeGeneric(name, dart.as(arguments, core.List$(RuntimeT
ype)), rti); | 2102 return new RuntimeTypeGeneric(name, dart.as(arguments, core.List$(RuntimeT
ype)), rti); |
| 2103 } else if ("func" in rti) { | 2103 } else if ("func" in rti) { |
| 2104 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType(); | 2104 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType(); |
| 2105 } else { | 2105 } else { |
| 2106 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru
ntimeType.`); | 2106 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru
ntimeType.`); |
| 2107 } | 2107 } |
| 2108 } | 2108 } |
| 2109 class RuntimeTypePlain extends RuntimeType { | 2109 class RuntimeTypePlain extends RuntimeType { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 super.Error(); | 2252 super.Error(); |
| 2253 } | 2253 } |
| 2254 toString() { | 2254 toString() { |
| 2255 return `Unsupported operation: ${this[_message]}`; | 2255 return `Unsupported operation: ${this[_message]}`; |
| 2256 } | 2256 } |
| 2257 } | 2257 } |
| 2258 // Function random64: () → int | 2258 // Function random64: () → int |
| 2259 function random64() { | 2259 function random64() { |
| 2260 let int32a = Math.random() * 0x100000000 >>> 0; | 2260 let int32a = Math.random() * 0x100000000 >>> 0; |
| 2261 let int32b = Math.random() * 0x100000000 >>> 0; | 2261 let int32b = Math.random() * 0x100000000 >>> 0; |
| 2262 return int32a + int32b * 4294967296; | 2262 return dart.notNull(int32a) + dart.notNull(int32b) * 4294967296; |
| 2263 } | 2263 } |
| 2264 // Function jsonEncodeNative: (String) → String | 2264 // Function jsonEncodeNative: (String) → String |
| 2265 function jsonEncodeNative(string) { | 2265 function jsonEncodeNative(string) { |
| 2266 return JSON.stringify(string); | 2266 return JSON.stringify(string); |
| 2267 } | 2267 } |
| 2268 // Function getIsolateAffinityTag: (String) → String | 2268 // Function getIsolateAffinityTag: (String) → String |
| 2269 function getIsolateAffinityTag(name) { | 2269 function getIsolateAffinityTag(name) { |
| 2270 let isolateTagGetter = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_em
bedded_names.GET_ISOLATE_TAG, core.String)); | 2270 let isolateTagGetter = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_em
bedded_names.GET_ISOLATE_TAG, core.String)); |
| 2271 return isolateTagGetter(name); | 2271 return isolateTagGetter(name); |
| 2272 } | 2272 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2287 function loadDeferredLibrary(loadId) { | 2287 function loadDeferredLibrary(loadId) { |
| 2288 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_na
mes.DEFERRED_LIBRARY_URIS, core.String)); | 2288 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_na
mes.DEFERRED_LIBRARY_URIS, core.String)); |
| 2289 let uris = dart.as(urisMap[loadId], core.List$(core.String)); | 2289 let uris = dart.as(urisMap[loadId], core.List$(core.String)); |
| 2290 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_
names.DEFERRED_LIBRARY_HASHES, core.String)); | 2290 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_
names.DEFERRED_LIBRARY_HASHES, core.String)); |
| 2291 let hashes = dart.as(hashesMap[loadId], core.List$(core.String)); | 2291 let hashes = dart.as(hashesMap[loadId], core.List$(core.String)); |
| 2292 if (uris === null) | 2292 if (uris === null) |
| 2293 return dart.as(new async.Future.value(null), async.Future$(core.Null)); | 2293 return dart.as(new async.Future.value(null), async.Future$(core.Null)); |
| 2294 let indices = dart.as(new core.List.generate(uris.length, (i) => i), core.Li
st$(core.int)); | 2294 let indices = dart.as(new core.List.generate(uris.length, (i) => i), core.Li
st$(core.int)); |
| 2295 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedd
ed_names.IS_HUNK_LOADED, core.String)); | 2295 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedd
ed_names.IS_HUNK_LOADED, core.String)); |
| 2296 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_e
mbedded_names.IS_HUNK_INITIALIZED, core.String)); | 2296 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_e
mbedded_names.IS_HUNK_INITIALIZED, core.String)); |
| 2297 let indicesToLoad = indices.where((i) => !dart.notNull(isHunkLoaded(hashes.g
et(i)))).toList(); | 2297 let indicesToLoad = indices.where((i) => !isHunkLoaded(hashes.get(i))).toLis
t(); |
| 2298 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk(
uris.get(i))), core.Iterable$(async.Future))).then((_) => { | 2298 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk(
uris.get(i))), core.Iterable$(async.Future))).then((_) => { |
| 2299 let indicesToInitialize = indices.where((i) => !dart.notNull(isHunkInitial
ized(hashes.get(i)))).toList(); | 2299 let indicesToInitialize = indices.where((i) => !isHunkInitialized(hashes.g
et(i))).toList(); |
| 2300 for (let i of indicesToInitialize) { | 2300 for (let i of indicesToInitialize) { |
| 2301 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_emb
edded_names.INITIALIZE_LOADED_HUNK, core.String)); | 2301 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_emb
edded_names.INITIALIZE_LOADED_HUNK, core.String)); |
| 2302 initializer(hashes.get(i)); | 2302 initializer(hashes.get(i)); |
| 2303 } | 2303 } |
| 2304 let updated = exports._loadedLibraries.add(loadId); | 2304 let updated = exports._loadedLibraries.add(loadId); |
| 2305 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook !== nul
l)) { | 2305 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook !== nul
l)) { |
| 2306 exports.deferredLoadHook(); | 2306 exports.deferredLoadHook(); |
| 2307 } | 2307 } |
| 2308 }), async.Future$(core.Null)); | 2308 }), async.Future$(core.Null)); |
| 2309 } | 2309 } |
| 2310 // Function _loadHunk: (String) → Future<Null> | 2310 // Function _loadHunk: (String) → Future<Null> |
| 2311 function _loadHunk(hunkName) { | 2311 function _loadHunk(hunkName) { |
| 2312 let future = exports._loadingLibraries.get(hunkName); | 2312 let future = exports._loadingLibraries.get(hunkName); |
| 2313 if (future !== null) { | 2313 if (future !== null) { |
| 2314 return dart.as(future.then((_) => null), async.Future$(core.Null)); | 2314 return dart.as(future.then((_) => null), async.Future$(core.Null)); |
| 2315 } | 2315 } |
| 2316 let uri = _isolate_helper.IsolateNatives.thisScript; | 2316 let uri = _isolate_helper.IsolateNatives.thisScript; |
| 2317 let index = uri.lastIndexOf('/'); | 2317 let index = uri.lastIndexOf('/'); |
| 2318 uri = `${uri.substring(0, index + 1)}${hunkName}`; | 2318 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`; |
| 2319 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) { | 2319 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) { |
| 2320 return exports._loadingLibraries.set(hunkName, new async.Future(() => { | 2320 return exports._loadingLibraries.set(hunkName, new async.Future(() => { |
| 2321 try { | 2321 try { |
| 2322 new Function(`load("${uri}")`)(); | 2322 new Function(`load("${uri}")`)(); |
| 2323 } catch (error) { | 2323 } catch (error) { |
| 2324 let stackTrace = dart.stackTrace(error); | 2324 let stackTrace = dart.stackTrace(error); |
| 2325 throw new async.DeferredLoadException(`Loading ${uri} failed.`); | 2325 throw new async.DeferredLoadException(`Loading ${uri} failed.`); |
| 2326 } | 2326 } |
| 2327 | 2327 |
| 2328 return null; | 2328 return null; |
| 2329 })); | 2329 })); |
| 2330 } else if (_isolate_helper.isWorker()) { | 2330 } else if (_isolate_helper.isWorker()) { |
| 2331 return exports._loadingLibraries.set(hunkName, new async.Future(() => { | 2331 return exports._loadingLibraries.set(hunkName, new async.Future(() => { |
| 2332 let completer = new async.Completer(); | 2332 let completer = new async.Completer(); |
| 2333 _isolate_helper.enterJsAsync(); | 2333 _isolate_helper.enterJsAsync(); |
| 2334 let leavingFuture = dart.as(completer.future.whenComplete(() => { | 2334 let leavingFuture = dart.as(completer.future.whenComplete(() => { |
| 2335 _isolate_helper.leaveJsAsync(); | 2335 _isolate_helper.leaveJsAsync(); |
| 2336 }), async.Future$(core.Null)); | 2336 }), async.Future$(core.Null)); |
| 2337 let index = uri.lastIndexOf('/'); | 2337 let index = uri.lastIndexOf('/'); |
| 2338 uri = `${uri.substring(0, index + 1)}${hunkName}`; | 2338 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`; |
| 2339 let xhr = new XMLHttpRequest(); | 2339 let xhr = new XMLHttpRequest(); |
| 2340 xhr.open("GET", uri); | 2340 xhr.open("GET", uri); |
| 2341 xhr.addEventListener("load", convertDartClosureToJS((event) => { | 2341 xhr.addEventListener("load", convertDartClosureToJS((event) => { |
| 2342 if (xhr.status !== 200) { | 2342 if (xhr.status !== 200) { |
| 2343 completer.completeError(new async.DeferredLoadException(`Loading ${u
ri} failed.`)); | 2343 completer.completeError(new async.DeferredLoadException(`Loading ${u
ri} failed.`)); |
| 2344 return; | 2344 return; |
| 2345 } | 2345 } |
| 2346 let code = xhr.responseText; | 2346 let code = xhr.responseText; |
| 2347 try { | 2347 try { |
| 2348 new Function(code)(); | 2348 new Function(code)(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 } | 2474 } |
| 2475 containsKey(key) { | 2475 containsKey(key) { |
| 2476 if (!(typeof key == string)) | 2476 if (!(typeof key == string)) |
| 2477 return false; | 2477 return false; |
| 2478 if (dart.equals('__proto__', key)) | 2478 if (dart.equals('__proto__', key)) |
| 2479 return false; | 2479 return false; |
| 2480 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); | 2480 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); |
| 2481 } | 2481 } |
| 2482 get(key) { | 2482 get(key) { |
| 2483 if (!dart.notNull(this.containsKey(key))) | 2483 if (!dart.notNull(this.containsKey(key))) |
| 2484 return dart.as(null, V); | 2484 return null; |
| 2485 return dart.as(this[_fetch](key), V); | 2485 return dart.as(this[_fetch](key), V); |
| 2486 } | 2486 } |
| 2487 [_fetch](key) { | 2487 [_fetch](key) { |
| 2488 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); | 2488 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); |
| 2489 } | 2489 } |
| 2490 forEach(f) { | 2490 forEach(f) { |
| 2491 let keys = this[_keys]; | 2491 let keys = this[_keys]; |
| 2492 for (let i = 0; i['<'](dart.dload(keys, 'length')); i++) { | 2492 for (let i = 0; i['<'](dart.dload(keys, 'length')); dart.notNull(i)++) { |
| 2493 let key = dart.dindex(keys, i); | 2493 let key = dart.dindex(keys, i); |
| 2494 f(dart.as(key, K), dart.as(this[_fetch](key), V)); | 2494 f(dart.as(key, K), dart.as(this[_fetch](key), V)); |
| 2495 } | 2495 } |
| 2496 } | 2496 } |
| 2497 get keys() { | 2497 get keys() { |
| 2498 return new _ConstantMapKeyIterable(this); | 2498 return new _ConstantMapKeyIterable(this); |
| 2499 } | 2499 } |
| 2500 get values() { | 2500 get values() { |
| 2501 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[
_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); | 2501 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[
_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); |
| 2502 } | 2502 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 function initNativeDispatchContinue() { | 2765 function initNativeDispatchContinue() { |
| 2766 exports.dispatchRecordsForInstanceTags = Object.create(null); | 2766 exports.dispatchRecordsForInstanceTags = Object.create(null); |
| 2767 exports.interceptorsForUncacheableTags = Object.create(null); | 2767 exports.interceptorsForUncacheableTags = Object.create(null); |
| 2768 initHooks(); | 2768 initHooks(); |
| 2769 let map = exports.interceptorsByTag; | 2769 let map = exports.interceptorsByTag; |
| 2770 let tags = Object.getOwnPropertyNames(map); | 2770 let tags = Object.getOwnPropertyNames(map); |
| 2771 if (typeof window != "undefined") { | 2771 if (typeof window != "undefined") { |
| 2772 let context = window; | 2772 let context = window; |
| 2773 let fun = function() { | 2773 let fun = function() { |
| 2774 }; | 2774 }; |
| 2775 for (let i = 0; i['<'](dart.dload(tags, 'length')); i++) { | 2775 for (let i = 0; i['<'](dart.dload(tags, 'length')); dart.notNull(i)++) { |
| 2776 let tag = dart.dindex(tags, i); | 2776 let tag = dart.dindex(tags, i); |
| 2777 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); | 2777 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); |
| 2778 if (proto !== null) { | 2778 if (proto !== null) { |
| 2779 let interceptorClass = map[tag]; | 2779 let interceptorClass = map[tag]; |
| 2780 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); | 2780 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); |
| 2781 if (record !== null) { | 2781 if (record !== null) { |
| 2782 _interceptors.setDispatchProperty(proto, record); | 2782 _interceptors.setDispatchProperty(proto, record); |
| 2783 fun.prototype = proto; | 2783 fun.prototype = proto; |
| 2784 } | 2784 } |
| 2785 } | 2785 } |
| 2786 } | 2786 } |
| 2787 } | 2787 } |
| 2788 for (let i = 0; i['<'](dart.dload(tags, 'length')); i++) { | 2788 for (let i = 0; i['<'](dart.dload(tags, 'length')); dart.notNull(i)++) { |
| 2789 let tag = tags[i]; | 2789 let tag = tags[i]; |
| 2790 if (/^[A-Za-z_]/.test(tag)) { | 2790 if (/^[A-Za-z_]/.test(tag)) { |
| 2791 let interceptorClass = propertyGet(map, tag); | 2791 let interceptorClass = propertyGet(map, tag); |
| 2792 propertySet(map, dart.as(dart.dbinary(INSTANCE_CACHED_MARK, '+', tag), c
ore.String), interceptorClass); | 2792 propertySet(map, dart.as(dart.dbinary(INSTANCE_CACHED_MARK, '+', tag), c
ore.String), interceptorClass); |
| 2793 propertySet(map, dart.as(dart.dbinary(UNCACHED_MARK, '+', tag), core.Str
ing), interceptorClass); | 2793 propertySet(map, dart.as(dart.dbinary(UNCACHED_MARK, '+', tag), core.Str
ing), interceptorClass); |
| 2794 propertySet(map, dart.as(dart.dbinary(LEAF_MARK, '+', tag), core.String)
, interceptorClass); | 2794 propertySet(map, dart.as(dart.dbinary(LEAF_MARK, '+', tag), core.String)
, interceptorClass); |
| 2795 propertySet(map, dart.as(dart.dbinary(INTERIOR_MARK, '+', tag), core.Str
ing), interceptorClass); | 2795 propertySet(map, dart.as(dart.dbinary(INTERIOR_MARK, '+', tag), core.Str
ing), interceptorClass); |
| 2796 propertySet(map, dart.as(dart.dbinary(DISCRIMINATED_MARK, '+', tag), cor
e.String), interceptorClass); | 2796 propertySet(map, dart.as(dart.dbinary(DISCRIMINATED_MARK, '+', tag), cor
e.String), interceptorClass); |
| 2797 } | 2797 } |
| 2798 } | 2798 } |
| 2799 } | 2799 } |
| 2800 // Function initHooks: () → void | 2800 // Function initHooks: () → void |
| 2801 function initHooks() { | 2801 function initHooks() { |
| 2802 let hooks = _baseHooks(); | 2802 let hooks = _baseHooks(); |
| 2803 let _fallbackConstructorHooksTransformer = _fallbackConstructorHooksTransfor
merGenerator(_constructorNameFallback); | 2803 let _fallbackConstructorHooksTransformer = _fallbackConstructorHooksTransfor
merGenerator(_constructorNameFallback); |
| 2804 hooks = applyHooksTransformer(_fallbackConstructorHooksTransformer, hooks); | 2804 hooks = applyHooksTransformer(_fallbackConstructorHooksTransformer, hooks); |
| 2805 hooks = applyHooksTransformer(_firefoxHooksTransformer, hooks); | 2805 hooks = applyHooksTransformer(_firefoxHooksTransformer, hooks); |
| 2806 hooks = applyHooksTransformer(_ieHooksTransformer, hooks); | 2806 hooks = applyHooksTransformer(_ieHooksTransformer, hooks); |
| 2807 hooks = applyHooksTransformer(_operaHooksTransformer, hooks); | 2807 hooks = applyHooksTransformer(_operaHooksTransformer, hooks); |
| 2808 hooks = applyHooksTransformer(_safariHooksTransformer, hooks); | 2808 hooks = applyHooksTransformer(_safariHooksTransformer, hooks); |
| 2809 hooks = applyHooksTransformer(_fixDocumentHooksTransformer, hooks); | 2809 hooks = applyHooksTransformer(_fixDocumentHooksTransformer, hooks); |
| 2810 hooks = applyHooksTransformer(_dartExperimentalFixupGetTagHooksTransformer,
hooks); | 2810 hooks = applyHooksTransformer(_dartExperimentalFixupGetTagHooksTransformer,
hooks); |
| 2811 if (typeof dartNativeDispatchHooksTransformer != "undefined") { | 2811 if (typeof dartNativeDispatchHooksTransformer != "undefined") { |
| 2812 let transformers = dartNativeDispatchHooksTransformer; | 2812 let transformers = dartNativeDispatchHooksTransformer; |
| 2813 if (typeof transformers == "function") { | 2813 if (typeof transformers == "function") { |
| 2814 transformers = new List.from([transformers]); | 2814 transformers = new List.from([transformers]); |
| 2815 } | 2815 } |
| 2816 if (transformers.constructor == Array) { | 2816 if (transformers.constructor == Array) { |
| 2817 for (let i = 0; i < transformers.length; i++) { | 2817 for (let i = 0; dart.notNull(i) < transformers.length; dart.notNull(i)++
) { |
| 2818 let transformer = transformers[i]; | 2818 let transformer = transformers[i]; |
| 2819 if (typeof transformer == "function") { | 2819 if (typeof transformer == "function") { |
| 2820 hooks = applyHooksTransformer(transformer, hooks); | 2820 hooks = applyHooksTransformer(transformer, hooks); |
| 2821 } | 2821 } |
| 2822 } | 2822 } |
| 2823 } | 2823 } |
| 2824 } | 2824 } |
| 2825 let getTag = hooks.getTag; | 2825 let getTag = hooks.getTag; |
| 2826 let getUnknownTag = hooks.getUnknownTag; | 2826 let getUnknownTag = hooks.getUnknownTag; |
| 2827 let prototypeForTag = hooks.prototypeForTag; | 2827 let prototypeForTag = hooks.prototypeForTag; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2927 let match = this.firstMatch(string); | 2927 let match = this.firstMatch(string); |
| 2928 if (match !== null) | 2928 if (match !== null) |
| 2929 return match.group(0); | 2929 return match.group(0); |
| 2930 return null; | 2930 return null; |
| 2931 } | 2931 } |
| 2932 allMatches(string, start) { | 2932 allMatches(string, start) { |
| 2933 if (start === void 0) | 2933 if (start === void 0) |
| 2934 start = 0; | 2934 start = 0; |
| 2935 checkString(string); | 2935 checkString(string); |
| 2936 checkInt(start); | 2936 checkInt(start); |
| 2937 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { | 2937 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { |
| 2938 throw new core.RangeError.range(start, 0, string.length); | 2938 throw new core.RangeError.range(start, 0, string.length); |
| 2939 } | 2939 } |
| 2940 return new _AllMatchesIterable(this, string, start); | 2940 return new _AllMatchesIterable(this, string, start); |
| 2941 } | 2941 } |
| 2942 [_execGlobal](string, start) { | 2942 [_execGlobal](string, start) { |
| 2943 let regexp = this[_nativeGlobalVersion]; | 2943 let regexp = this[_nativeGlobalVersion]; |
| 2944 regexp.lastIndex = start; | 2944 regexp.lastIndex = start; |
| 2945 let match = dart.as(regexp.exec(string), core.List); | 2945 let match = dart.as(regexp.exec(string), core.List); |
| 2946 if (match === null) | 2946 if (match === null) |
| 2947 return null; | 2947 return null; |
| 2948 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); | 2948 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); |
| 2949 } | 2949 } |
| 2950 [_execAnchored](string, start) { | 2950 [_execAnchored](string, start) { |
| 2951 let regexp = this[_nativeAnchoredVersion]; | 2951 let regexp = this[_nativeAnchoredVersion]; |
| 2952 regexp.lastIndex = start; | 2952 regexp.lastIndex = start; |
| 2953 let match = dart.as(regexp.exec(string), core.List); | 2953 let match = dart.as(regexp.exec(string), core.List); |
| 2954 if (match === null) | 2954 if (match === null) |
| 2955 return null; | 2955 return null; |
| 2956 if (match.get(match.length - 1) !== null) | 2956 if (match.get(dart.notNull(match.length) - 1) !== null) |
| 2957 return null; | 2957 return null; |
| 2958 match.length = 1; | 2958 match.length = 1; |
| 2959 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); | 2959 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); |
| 2960 } | 2960 } |
| 2961 matchAsPrefix(string, start) { | 2961 matchAsPrefix(string, start) { |
| 2962 if (start === void 0) | 2962 if (start === void 0) |
| 2963 start = 0; | 2963 start = 0; |
| 2964 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { | 2964 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { |
| 2965 throw new core.RangeError.range(start, 0, string.length); | 2965 throw new core.RangeError.range(start, 0, string.length); |
| 2966 } | 2966 } |
| 2967 return this[_execAnchored](string, start); | 2967 return this[_execAnchored](string, start); |
| 2968 } | 2968 } |
| 2969 get isMultiLine() { | 2969 get isMultiLine() { |
| 2970 return this[_isMultiLine]; | 2970 return this[_isMultiLine]; |
| 2971 } | 2971 } |
| 2972 get isCaseSensitive() { | 2972 get isCaseSensitive() { |
| 2973 return this[_isCaseSensitive]; | 2973 return this[_isCaseSensitive]; |
| 2974 } | 2974 } |
| 2975 } | 2975 } |
| 2976 let _match = Symbol('_match'); | 2976 let _match = Symbol('_match'); |
| 2977 class _MatchImplementation extends dart.Object { | 2977 class _MatchImplementation extends dart.Object { |
| 2978 _MatchImplementation(pattern, $_match) { | 2978 _MatchImplementation(pattern, $_match) { |
| 2979 this.pattern = pattern; | 2979 this.pattern = pattern; |
| 2980 this[_match] = $_match; | 2980 this[_match] = $_match; |
| 2981 dart.assert(typeof this[_match].input == string); | 2981 dart.assert(typeof this[_match].input == string); |
| 2982 dart.assert(typeof this[_match].index == number); | 2982 dart.assert(typeof this[_match].index == number); |
| 2983 } | 2983 } |
| 2984 get input() { | 2984 get input() { |
| 2985 return this[_match].input; | 2985 return this[_match].input; |
| 2986 } | 2986 } |
| 2987 get start() { | 2987 get start() { |
| 2988 return this[_match].index; | 2988 return this[_match].index; |
| 2989 } | 2989 } |
| 2990 get end() { | 2990 get end() { |
| 2991 return this.start + this[_match].get(0).length; | 2991 return dart.notNull(this.start) + dart.notNull(this[_match].get(0).length)
; |
| 2992 } | 2992 } |
| 2993 group(index) { | 2993 group(index) { |
| 2994 return this[_match].get(index); | 2994 return this[_match].get(index); |
| 2995 } | 2995 } |
| 2996 get(index) { | 2996 get(index) { |
| 2997 return this.group(index); | 2997 return this.group(index); |
| 2998 } | 2998 } |
| 2999 get groupCount() { | 2999 get groupCount() { |
| 3000 return this[_match].length - 1; | 3000 return dart.notNull(this[_match].length) - 1; |
| 3001 } | 3001 } |
| 3002 groups(groups) { | 3002 groups(groups) { |
| 3003 let out = dart.as(new List.from([]), core.List$(core.String)); | 3003 let out = dart.as(new List.from([]), core.List$(core.String)); |
| 3004 for (let i of groups) { | 3004 for (let i of groups) { |
| 3005 out.add(this.group(i)); | 3005 out.add(this.group(i)); |
| 3006 } | 3006 } |
| 3007 return out; | 3007 return out; |
| 3008 } | 3008 } |
| 3009 } | 3009 } |
| 3010 let _re = Symbol('_re'); | 3010 let _re = Symbol('_re'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3030 this[_string] = $_string; | 3030 this[_string] = $_string; |
| 3031 this[_nextIndex] = $_nextIndex; | 3031 this[_nextIndex] = $_nextIndex; |
| 3032 this[_current] = null; | 3032 this[_current] = null; |
| 3033 } | 3033 } |
| 3034 get current() { | 3034 get current() { |
| 3035 return this[_current]; | 3035 return this[_current]; |
| 3036 } | 3036 } |
| 3037 moveNext() { | 3037 moveNext() { |
| 3038 if (this[_string] === null) | 3038 if (this[_string] === null) |
| 3039 return false; | 3039 return false; |
| 3040 if (this[_nextIndex] <= this[_string].length) { | 3040 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length))
{ |
| 3041 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]); | 3041 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]); |
| 3042 if (match !== null) { | 3042 if (match !== null) { |
| 3043 this[_current] = match; | 3043 this[_current] = match; |
| 3044 let nextIndex = match.end; | 3044 let nextIndex = match.end; |
| 3045 if (match.start === nextIndex) { | 3045 if (match.start === nextIndex) { |
| 3046 nextIndex++; | 3046 dart.notNull(nextIndex)++; |
| 3047 } | 3047 } |
| 3048 this[_nextIndex] = nextIndex; | 3048 this[_nextIndex] = nextIndex; |
| 3049 return true; | 3049 return true; |
| 3050 } | 3050 } |
| 3051 } | 3051 } |
| 3052 this[_current] = null; | 3052 this[_current] = null; |
| 3053 this[_string] = null; | 3053 this[_string] = null; |
| 3054 return false; | 3054 return false; |
| 3055 } | 3055 } |
| 3056 } | 3056 } |
| 3057 // Function firstMatchAfter: (JSSyntaxRegExp, String, int) → Match | 3057 // Function firstMatchAfter: (JSSyntaxRegExp, String, int) → Match |
| 3058 function firstMatchAfter(regExp, string, start) { | 3058 function firstMatchAfter(regExp, string, start) { |
| 3059 return regExp._execGlobal(string, start); | 3059 return regExp._execGlobal(string, start); |
| 3060 } | 3060 } |
| 3061 class StringMatch extends dart.Object { | 3061 class StringMatch extends dart.Object { |
| 3062 StringMatch(start, input, pattern) { | 3062 StringMatch(start, input, pattern) { |
| 3063 this.start = start; | 3063 this.start = start; |
| 3064 this.input = input; | 3064 this.input = input; |
| 3065 this.pattern = pattern; | 3065 this.pattern = pattern; |
| 3066 } | 3066 } |
| 3067 get end() { | 3067 get end() { |
| 3068 return this.start + this.pattern.length; | 3068 return dart.notNull(this.start) + dart.notNull(this.pattern.length); |
| 3069 } | 3069 } |
| 3070 get(g) { | 3070 get(g) { |
| 3071 return this.group(g); | 3071 return this.group(g); |
| 3072 } | 3072 } |
| 3073 get groupCount() { | 3073 get groupCount() { |
| 3074 return 0; | 3074 return 0; |
| 3075 } | 3075 } |
| 3076 group(group_) { | 3076 group(group_) { |
| 3077 if (group_ !== 0) { | 3077 if (group_ !== 0) { |
| 3078 throw new core.RangeError.value(group_); | 3078 throw new core.RangeError.value(group_); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3091 function allMatchesInStringUnchecked(needle, haystack, startIndex) { | 3091 function allMatchesInStringUnchecked(needle, haystack, startIndex) { |
| 3092 let result = new core.List(); | 3092 let result = new core.List(); |
| 3093 let length = haystack.length; | 3093 let length = haystack.length; |
| 3094 let patternLength = needle.length; | 3094 let patternLength = needle.length; |
| 3095 while (true) { | 3095 while (true) { |
| 3096 let position = haystack.indexOf(needle, startIndex); | 3096 let position = haystack.indexOf(needle, startIndex); |
| 3097 if (position === -1) { | 3097 if (position === -1) { |
| 3098 break; | 3098 break; |
| 3099 } | 3099 } |
| 3100 result.add(new StringMatch(position, haystack, needle)); | 3100 result.add(new StringMatch(position, haystack, needle)); |
| 3101 let endIndex = position + patternLength; | 3101 let endIndex = dart.notNull(position) + dart.notNull(patternLength); |
| 3102 if (endIndex === length) { | 3102 if (endIndex === length) { |
| 3103 break; | 3103 break; |
| 3104 } else if (position === endIndex) { | 3104 } else if (position === endIndex) { |
| 3105 ++startIndex; | 3105 ++dart.notNull(startIndex); |
| 3106 } else { | 3106 } else { |
| 3107 startIndex = endIndex; | 3107 startIndex = endIndex; |
| 3108 } | 3108 } |
| 3109 } | 3109 } |
| 3110 return result; | 3110 return result; |
| 3111 } | 3111 } |
| 3112 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic | 3112 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic |
| 3113 function stringContainsUnchecked(receiver, other, startIndex) { | 3113 function stringContainsUnchecked(receiver, other, startIndex) { |
| 3114 if (typeof other == string) { | 3114 if (typeof other == string) { |
| 3115 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex),
-1); | 3115 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex),
-1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3139 function stringReplaceAllUnchecked(receiver, from, to) { | 3139 function stringReplaceAllUnchecked(receiver, from, to) { |
| 3140 checkString(to); | 3140 checkString(to); |
| 3141 if (typeof from == string) { | 3141 if (typeof from == string) { |
| 3142 if (dart.equals(from, "")) { | 3142 if (dart.equals(from, "")) { |
| 3143 if (dart.equals(receiver, "")) { | 3143 if (dart.equals(receiver, "")) { |
| 3144 return to; | 3144 return to; |
| 3145 } else { | 3145 } else { |
| 3146 let result = new core.StringBuffer(); | 3146 let result = new core.StringBuffer(); |
| 3147 let length = dart.as(dart.dload(receiver, 'length'), core.int); | 3147 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 3148 result.write(to); | 3148 result.write(to); |
| 3149 for (let i = 0; i < length; i++) { | 3149 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i
)++) { |
| 3150 result.write(dart.dindex(receiver, i)); | 3150 result.write(dart.dindex(receiver, i)); |
| 3151 result.write(to); | 3151 result.write(to); |
| 3152 } | 3152 } |
| 3153 return result.toString(); | 3153 return result.toString(); |
| 3154 } | 3154 } |
| 3155 } else { | 3155 } else { |
| 3156 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); | 3156 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); |
| 3157 let quoted = from.replace(quoter, "\\$&"); | 3157 let quoted = from.replace(quoter, "\\$&"); |
| 3158 let replacer = new RegExp(quoted, 'g'); | 3158 let replacer = new RegExp(quoted, 'g'); |
| 3159 return stringReplaceJS(receiver, replacer, to); | 3159 return stringReplaceJS(receiver, replacer, to); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3195 } | 3195 } |
| 3196 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); | 3196 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); |
| 3197 return buffer.toString(); | 3197 return buffer.toString(); |
| 3198 } | 3198 } |
| 3199 // Function stringReplaceAllEmptyFuncUnchecked: (dynamic, dynamic, dynamic) →
dynamic | 3199 // Function stringReplaceAllEmptyFuncUnchecked: (dynamic, dynamic, dynamic) →
dynamic |
| 3200 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) { | 3200 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) { |
| 3201 let buffer = new core.StringBuffer(); | 3201 let buffer = new core.StringBuffer(); |
| 3202 let length = dart.as(dart.dload(receiver, 'length'), core.int); | 3202 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 3203 let i = 0; | 3203 let i = 0; |
| 3204 buffer.write(dart.dinvokef(onNonMatch, "")); | 3204 buffer.write(dart.dinvokef(onNonMatch, "")); |
| 3205 while (i < length) { | 3205 while (dart.notNull(i) < dart.notNull(length)) { |
| 3206 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c
ore.String), ""))); | 3206 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c
ore.String), ""))); |
| 3207 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); | 3207 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); |
| 3208 if (dart.notNull((code & ~1023) === 55296) && dart.notNull(length > i + 1)
) { | 3208 if ((dart.notNull(code) & ~1023) === 55296 && dart.notNull(length) > dart.
notNull(i) + 1) { |
| 3209 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i + 1), core.int); | 3209 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1)
, core.int); |
| 3210 if ((code & ~1023) === 56320) { | 3210 if ((dart.notNull(code) & ~1023) === 56320) { |
| 3211 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri
ng', i, i + 2))); | 3211 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri
ng', i, dart.notNull(i) + 2))); |
| 3212 i = 2; | 3212 i = 2; |
| 3213 continue; | 3213 continue; |
| 3214 } | 3214 } |
| 3215 } | 3215 } |
| 3216 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); | 3216 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); |
| 3217 i++; | 3217 dart.notNull(i)++; |
| 3218 } | 3218 } |
| 3219 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor
e.String), ""))); | 3219 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor
e.String), ""))); |
| 3220 buffer.write(dart.dinvokef(onNonMatch, "")); | 3220 buffer.write(dart.dinvokef(onNonMatch, "")); |
| 3221 return buffer.toString(); | 3221 return buffer.toString(); |
| 3222 } | 3222 } |
| 3223 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d
ynamic) → dynamic | 3223 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d
ynamic) → dynamic |
| 3224 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon
Match) { | 3224 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon
Match) { |
| 3225 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); | 3225 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); |
| 3226 if (patternLength === 0) { | 3226 if (patternLength === 0) { |
| 3227 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); | 3227 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); |
| 3228 } | 3228 } |
| 3229 let length = dart.as(dart.dload(receiver, 'length'), core.int); | 3229 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 3230 let buffer = new core.StringBuffer(); | 3230 let buffer = new core.StringBuffer(); |
| 3231 let startIndex = 0; | 3231 let startIndex = 0; |
| 3232 while (startIndex < length) { | 3232 while (dart.notNull(startIndex) < dart.notNull(length)) { |
| 3233 let position = dart.as(dart.dinvoke(receiver, 'indexOf', pattern, startInd
ex), core.int); | 3233 let position = dart.as(dart.dinvoke(receiver, 'indexOf', pattern, startInd
ex), core.int); |
| 3234 if (position === -1) { | 3234 if (position === -1) { |
| 3235 break; | 3235 break; |
| 3236 } | 3236 } |
| 3237 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring',
startIndex, position))); | 3237 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring',
startIndex, position))); |
| 3238 buffer.write(dart.dinvokef(onMatch, new StringMatch(position, dart.as(rece
iver, core.String), dart.as(pattern, core.String)))); | 3238 buffer.write(dart.dinvokef(onMatch, new StringMatch(position, dart.as(rece
iver, core.String), dart.as(pattern, core.String)))); |
| 3239 startIndex = position + patternLength; | 3239 startIndex = dart.notNull(position) + dart.notNull(patternLength); |
| 3240 } | 3240 } |
| 3241 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); | 3241 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); |
| 3242 return buffer.toString(); | 3242 return buffer.toString(); |
| 3243 } | 3243 } |
| 3244 // Function stringReplaceFirstUnchecked: (dynamic, dynamic, dynamic, [int]) →
dynamic | 3244 // Function stringReplaceFirstUnchecked: (dynamic, dynamic, dynamic, [int]) →
dynamic |
| 3245 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { | 3245 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { |
| 3246 if (startIndex === void 0) | 3246 if (startIndex === void 0) |
| 3247 startIndex = 0; | 3247 startIndex = 0; |
| 3248 if (typeof from == string) { | 3248 if (typeof from == string) { |
| 3249 let index = dart.dinvoke(receiver, 'indexOf', from, startIndex); | 3249 let index = dart.dinvoke(receiver, 'indexOf', from, startIndex); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3363 } | 3363 } |
| 3364 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) →
String | 3364 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) →
String |
| 3365 function joinArguments(types, startIndex, opt$) { | 3365 function joinArguments(types, startIndex, opt$) { |
| 3366 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; | 3366 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; |
| 3367 if (types === null) | 3367 if (types === null) |
| 3368 return ''; | 3368 return ''; |
| 3369 dart.assert(isJsArray(types)); | 3369 dart.assert(isJsArray(types)); |
| 3370 let firstArgument = true; | 3370 let firstArgument = true; |
| 3371 let allDynamic = true; | 3371 let allDynamic = true; |
| 3372 let buffer = new core.StringBuffer(); | 3372 let buffer = new core.StringBuffer(); |
| 3373 for (let index = startIndex; index < getLength(types); index++) { | 3373 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty
pes)); dart.notNull(index)++) { |
| 3374 if (firstArgument) { | 3374 if (firstArgument) { |
| 3375 firstArgument = false; | 3375 firstArgument = false; |
| 3376 } else { | 3376 } else { |
| 3377 buffer.write(', '); | 3377 buffer.write(', '); |
| 3378 } | 3378 } |
| 3379 let argument = getIndex(types, index); | 3379 let argument = getIndex(types, index); |
| 3380 if (argument !== null) { | 3380 if (argument !== null) { |
| 3381 allDynamic = false; | 3381 allDynamic = false; |
| 3382 } | 3382 } |
| 3383 buffer.write(runtimeTypeToString(argument, {onTypeVariable: onTypeVariable
})); | 3383 buffer.write(runtimeTypeToString(argument, {onTypeVariable: onTypeVariable
})); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3423 let substitution = getField(interceptor, asField); | 3423 let substitution = getField(interceptor, asField); |
| 3424 return checkArguments(substitution, arguments, checks); | 3424 return checkArguments(substitution, arguments, checks); |
| 3425 } | 3425 } |
| 3426 // Function computeTypeName: (String, List<dynamic>) → String | 3426 // Function computeTypeName: (String, List<dynamic>) → String |
| 3427 function computeTypeName(isField, arguments) { | 3427 function computeTypeName(isField, arguments) { |
| 3428 let prefixLength = _foreign_helper.JS_OPERATOR_IS_PREFIX().length; | 3428 let prefixLength = _foreign_helper.JS_OPERATOR_IS_PREFIX().length; |
| 3429 return Primitives.formatType(isField.substring(prefixLength, isField.length)
, arguments); | 3429 return Primitives.formatType(isField.substring(prefixLength, isField.length)
, arguments); |
| 3430 } | 3430 } |
| 3431 // Function subtypeCast: (Object, String, List<dynamic>, String) → Object | 3431 // Function subtypeCast: (Object, String, List<dynamic>, String) → Object |
| 3432 function subtypeCast(object, isField, checks, asField) { | 3432 function subtypeCast(object, isField, checks, asField) { |
| 3433 if (dart.notNull(object !== null) && dart.notNull(!dart.notNull(checkSubtype
(object, isField, checks, asField)))) { | 3433 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi
eld, checks, asField))) { |
| 3434 let actualType = Primitives.objectTypeName(object); | 3434 let actualType = Primitives.objectTypeName(object); |
| 3435 let typeName = computeTypeName(isField, checks); | 3435 let typeName = computeTypeName(isField, checks); |
| 3436 throw new CastErrorImplementation(actualType, typeName); | 3436 throw new CastErrorImplementation(actualType, typeName); |
| 3437 } | 3437 } |
| 3438 return object; | 3438 return object; |
| 3439 } | 3439 } |
| 3440 // Function assertSubtype: (Object, String, List<dynamic>, String) → Object | 3440 // Function assertSubtype: (Object, String, List<dynamic>, String) → Object |
| 3441 function assertSubtype(object, isField, checks, asField) { | 3441 function assertSubtype(object, isField, checks, asField) { |
| 3442 if (dart.notNull(object !== null) && dart.notNull(!dart.notNull(checkSubtype
(object, isField, checks, asField)))) { | 3442 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi
eld, checks, asField))) { |
| 3443 let typeName = computeTypeName(isField, checks); | 3443 let typeName = computeTypeName(isField, checks); |
| 3444 throw new TypeErrorImplementation(object, typeName); | 3444 throw new TypeErrorImplementation(object, typeName); |
| 3445 } | 3445 } |
| 3446 return object; | 3446 return object; |
| 3447 } | 3447 } |
| 3448 // Function assertIsSubtype: (dynamic, dynamic, String) → dynamic | 3448 // Function assertIsSubtype: (dynamic, dynamic, String) → dynamic |
| 3449 function assertIsSubtype(subtype, supertype, message) { | 3449 function assertIsSubtype(subtype, supertype, message) { |
| 3450 if (!dart.notNull(isSubtype(subtype, supertype))) { | 3450 if (!dart.notNull(isSubtype(subtype, supertype))) { |
| 3451 throwTypeError(message); | 3451 throwTypeError(message); |
| 3452 } | 3452 } |
| 3453 } | 3453 } |
| 3454 // Function throwTypeError: (dynamic) → dynamic | 3454 // Function throwTypeError: (dynamic) → dynamic |
| 3455 function throwTypeError(message) { | 3455 function throwTypeError(message) { |
| 3456 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String))
; | 3456 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String))
; |
| 3457 } | 3457 } |
| 3458 // Function checkArguments: (dynamic, dynamic, dynamic) → bool | 3458 // Function checkArguments: (dynamic, dynamic, dynamic) → bool |
| 3459 function checkArguments(substitution, arguments, checks) { | 3459 function checkArguments(substitution, arguments, checks) { |
| 3460 return areSubtypes(substitute(substitution, arguments), checks); | 3460 return areSubtypes(substitute(substitution, arguments), checks); |
| 3461 } | 3461 } |
| 3462 // Function areSubtypes: (dynamic, dynamic) → bool | 3462 // Function areSubtypes: (dynamic, dynamic) → bool |
| 3463 function areSubtypes(s, t) { | 3463 function areSubtypes(s, t) { |
| 3464 if (dart.notNull(s === null) || dart.notNull(t === null)) | 3464 if (dart.notNull(s === null) || dart.notNull(t === null)) |
| 3465 return true; | 3465 return true; |
| 3466 dart.assert(isJsArray(s)); | 3466 dart.assert(isJsArray(s)); |
| 3467 dart.assert(isJsArray(t)); | 3467 dart.assert(isJsArray(t)); |
| 3468 dart.assert(getLength(s) === getLength(t)); | 3468 dart.assert(getLength(s) === getLength(t)); |
| 3469 let len = getLength(s); | 3469 let len = getLength(s); |
| 3470 for (let i = 0; i < len; i++) { | 3470 for (let i = 0; dart.notNull(i) < dart.notNull(len); dart.notNull(i)++) { |
| 3471 if (!dart.notNull(isSubtype(getIndex(s, i), getIndex(t, i)))) { | 3471 if (!dart.notNull(isSubtype(getIndex(s, i), getIndex(t, i)))) { |
| 3472 return false; | 3472 return false; |
| 3473 } | 3473 } |
| 3474 } | 3474 } |
| 3475 return true; | 3475 return true; |
| 3476 } | 3476 } |
| 3477 // Function computeSignature: (dynamic, dynamic, dynamic) → dynamic | 3477 // Function computeSignature: (dynamic, dynamic, dynamic) → dynamic |
| 3478 function computeSignature(signature, context, contextName) { | 3478 function computeSignature(signature, context, contextName) { |
| 3479 let typeArguments = getRuntimeTypeArguments(context, contextName); | 3479 let typeArguments = getRuntimeTypeArguments(context, contextName); |
| 3480 return invokeOn(signature, context, typeArguments); | 3480 return invokeOn(signature, context, typeArguments); |
| 3481 } | 3481 } |
| 3482 // Function isSupertypeOfNull: (dynamic) → bool | 3482 // Function isSupertypeOfNull: (dynamic) → bool |
| 3483 function isSupertypeOfNull(type) { | 3483 function isSupertypeOfNull(type) { |
| 3484 return dart.notNull(dart.notNull(type === null) || dart.notNull(dart.equals(
getConstructorName(type), _foreign_helper.JS_OBJECT_CLASS_NAME()))) || dart.notN
ull(dart.equals(getConstructorName(type), _foreign_helper.JS_NULL_CLASS_NAME()))
; | 3484 return dart.notNull(type === null) || dart.notNull(dart.equals(getConstructo
rName(type), _foreign_helper.JS_OBJECT_CLASS_NAME())) || dart.notNull(dart.equal
s(getConstructorName(type), _foreign_helper.JS_NULL_CLASS_NAME())); |
| 3485 } | 3485 } |
| 3486 // Function checkSubtypeOfRuntimeType: (dynamic, dynamic) → bool | 3486 // Function checkSubtypeOfRuntimeType: (dynamic, dynamic) → bool |
| 3487 function checkSubtypeOfRuntimeType(o, t) { | 3487 function checkSubtypeOfRuntimeType(o, t) { |
| 3488 if (o === null) | 3488 if (o === null) |
| 3489 return isSupertypeOfNull(t); | 3489 return isSupertypeOfNull(t); |
| 3490 if (t === null) | 3490 if (t === null) |
| 3491 return true; | 3491 return true; |
| 3492 let rti = getRuntimeTypeInfo(o); | 3492 let rti = getRuntimeTypeInfo(o); |
| 3493 o = _interceptors.getInterceptor(o); | 3493 o = _interceptors.getInterceptor(o); |
| 3494 let type = o.constructor; | 3494 let type = o.constructor; |
| 3495 if (rti !== null) { | 3495 if (rti !== null) { |
| 3496 rti = rti.slice(); | 3496 rti = rti.slice(); |
| 3497 rti.splice(0, 0, type); | 3497 rti.splice(0, 0, type); |
| 3498 type = rti; | 3498 type = rti; |
| 3499 } else if (hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { | 3499 } else if (hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { |
| 3500 let signatureName = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}_${getField
(t, _foreign_helper.JS_FUNCTION_TYPE_TAG())}`; | 3500 let signatureName = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}_${getField
(t, _foreign_helper.JS_FUNCTION_TYPE_TAG())}`; |
| 3501 if (hasField(o, signatureName)) | 3501 if (hasField(o, signatureName)) |
| 3502 return true; | 3502 return true; |
| 3503 let targetSignatureFunction = getField(o, `${_foreign_helper.JS_SIGNATURE_
NAME()}`); | 3503 let targetSignatureFunction = getField(o, `${_foreign_helper.JS_SIGNATURE_
NAME()}`); |
| 3504 if (targetSignatureFunction === null) | 3504 if (targetSignatureFunction === null) |
| 3505 return false; | 3505 return false; |
| 3506 type = invokeOn(targetSignatureFunction, o, null); | 3506 type = invokeOn(targetSignatureFunction, o, null); |
| 3507 return isFunctionSubtype(type, t); | 3507 return isFunctionSubtype(type, t); |
| 3508 } | 3508 } |
| 3509 return isSubtype(type, t); | 3509 return isSubtype(type, t); |
| 3510 } | 3510 } |
| 3511 // Function subtypeOfRuntimeTypeCast: (Object, dynamic) → Object | 3511 // Function subtypeOfRuntimeTypeCast: (Object, dynamic) → Object |
| 3512 function subtypeOfRuntimeTypeCast(object, type) { | 3512 function subtypeOfRuntimeTypeCast(object, type) { |
| 3513 if (dart.notNull(object !== null) && dart.notNull(!dart.notNull(checkSubtype
OfRuntimeType(object, type)))) { | 3513 if (dart.notNull(object !== null) && !dart.notNull(checkSubtypeOfRuntimeType
(object, type))) { |
| 3514 let actualType = Primitives.objectTypeName(object); | 3514 let actualType = Primitives.objectTypeName(object); |
| 3515 throw new CastErrorImplementation(actualType, runtimeTypeToString(type)); | 3515 throw new CastErrorImplementation(actualType, runtimeTypeToString(type)); |
| 3516 } | 3516 } |
| 3517 return object; | 3517 return object; |
| 3518 } | 3518 } |
| 3519 // Function assertSubtypeOfRuntimeType: (Object, dynamic) → Object | 3519 // Function assertSubtypeOfRuntimeType: (Object, dynamic) → Object |
| 3520 function assertSubtypeOfRuntimeType(object, type) { | 3520 function assertSubtypeOfRuntimeType(object, type) { |
| 3521 if (dart.notNull(object !== null) && dart.notNull(!dart.notNull(checkSubtype
OfRuntimeType(object, type)))) { | 3521 if (dart.notNull(object !== null) && !dart.notNull(checkSubtypeOfRuntimeType
(object, type))) { |
| 3522 throw new TypeErrorImplementation(object, runtimeTypeToString(type)); | 3522 throw new TypeErrorImplementation(object, runtimeTypeToString(type)); |
| 3523 } | 3523 } |
| 3524 return object; | 3524 return object; |
| 3525 } | 3525 } |
| 3526 // Function getArguments: (dynamic) → dynamic | 3526 // Function getArguments: (dynamic) → dynamic |
| 3527 function getArguments(type) { | 3527 function getArguments(type) { |
| 3528 return isJsArray(type) ? type.slice(1) : null; | 3528 return isJsArray(type) ? type.slice(1) : null; |
| 3529 } | 3529 } |
| 3530 // Function isSubtype: (dynamic, dynamic) → bool | 3530 // Function isSubtype: (dynamic, dynamic) → bool |
| 3531 function isSubtype(s, t) { | 3531 function isSubtype(s, t) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3544 let name = runtimeTypeToString(typeOfT); | 3544 let name = runtimeTypeToString(typeOfT); |
| 3545 let substitution = null; | 3545 let substitution = null; |
| 3546 if (isNotIdentical(typeOfT, typeOfS)) { | 3546 if (isNotIdentical(typeOfT, typeOfS)) { |
| 3547 let test = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}${name}`; | 3547 let test = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}${name}`; |
| 3548 let typeOfSPrototype = typeOfS.prototype; | 3548 let typeOfSPrototype = typeOfS.prototype; |
| 3549 if (hasNoField(typeOfSPrototype, test)) | 3549 if (hasNoField(typeOfSPrototype, test)) |
| 3550 return false; | 3550 return false; |
| 3551 let field = `${_foreign_helper.JS_OPERATOR_AS_PREFIX()}${runtimeTypeToStri
ng(typeOfT)}`; | 3551 let field = `${_foreign_helper.JS_OPERATOR_AS_PREFIX()}${runtimeTypeToStri
ng(typeOfT)}`; |
| 3552 substitution = getField(typeOfSPrototype, field); | 3552 substitution = getField(typeOfSPrototype, field); |
| 3553 } | 3553 } |
| 3554 if (dart.notNull(dart.notNull(!dart.notNull(isJsArray(s))) && dart.notNull(s
ubstitution === null)) || dart.notNull(!dart.notNull(isJsArray(t)))) { | 3554 if (!dart.notNull(isJsArray(s)) && dart.notNull(substitution === null) || !d
art.notNull(isJsArray(t))) { |
| 3555 return true; | 3555 return true; |
| 3556 } | 3556 } |
| 3557 return checkArguments(substitution, getArguments(s), getArguments(t)); | 3557 return checkArguments(substitution, getArguments(s), getArguments(t)); |
| 3558 } | 3558 } |
| 3559 // Function isAssignable: (dynamic, dynamic) → bool | 3559 // Function isAssignable: (dynamic, dynamic) → bool |
| 3560 function isAssignable(s, t) { | 3560 function isAssignable(s, t) { |
| 3561 return dart.notNull(isSubtype(s, t)) || dart.notNull(isSubtype(t, s)); | 3561 return dart.notNull(isSubtype(s, t)) || dart.notNull(isSubtype(t, s)); |
| 3562 } | 3562 } |
| 3563 // Function areAssignable: (List<dynamic>, List, bool) → bool | 3563 // Function areAssignable: (List<dynamic>, List, bool) → bool |
| 3564 function areAssignable(s, t, allowShorter) { | 3564 function areAssignable(s, t, allowShorter) { |
| 3565 if (dart.notNull(t === null) && dart.notNull(s === null)) | 3565 if (dart.notNull(t === null) && dart.notNull(s === null)) |
| 3566 return true; | 3566 return true; |
| 3567 if (t === null) | 3567 if (t === null) |
| 3568 return allowShorter; | 3568 return allowShorter; |
| 3569 if (s === null) | 3569 if (s === null) |
| 3570 return false; | 3570 return false; |
| 3571 dart.assert(isJsArray(s)); | 3571 dart.assert(isJsArray(s)); |
| 3572 dart.assert(isJsArray(t)); | 3572 dart.assert(isJsArray(t)); |
| 3573 let sLength = getLength(s); | 3573 let sLength = getLength(s); |
| 3574 let tLength = getLength(t); | 3574 let tLength = getLength(t); |
| 3575 if (allowShorter) { | 3575 if (allowShorter) { |
| 3576 if (sLength < tLength) | 3576 if (dart.notNull(sLength) < dart.notNull(tLength)) |
| 3577 return false; | 3577 return false; |
| 3578 } else { | 3578 } else { |
| 3579 if (sLength !== tLength) | 3579 if (sLength !== tLength) |
| 3580 return false; | 3580 return false; |
| 3581 } | 3581 } |
| 3582 for (let i = 0; i < tLength; i++) { | 3582 for (let i = 0; dart.notNull(i) < dart.notNull(tLength); dart.notNull(i)++)
{ |
| 3583 if (!dart.notNull(isAssignable(getIndex(s, i), getIndex(t, i)))) { | 3583 if (!dart.notNull(isAssignable(getIndex(s, i), getIndex(t, i)))) { |
| 3584 return false; | 3584 return false; |
| 3585 } | 3585 } |
| 3586 } | 3586 } |
| 3587 return true; | 3587 return true; |
| 3588 } | 3588 } |
| 3589 // Function areAssignableMaps: (dynamic, dynamic) → bool | 3589 // Function areAssignableMaps: (dynamic, dynamic) → bool |
| 3590 function areAssignableMaps(s, t) { | 3590 function areAssignableMaps(s, t) { |
| 3591 if (t === null) | 3591 if (t === null) |
| 3592 return true; | 3592 return true; |
| 3593 if (s === null) | 3593 if (s === null) |
| 3594 return false; | 3594 return false; |
| 3595 dart.assert(isJsObject(s)); | 3595 dart.assert(isJsObject(s)); |
| 3596 dart.assert(isJsObject(t)); | 3596 dart.assert(isJsObject(t)); |
| 3597 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPropert
yNames(t), core.List)); | 3597 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPropert
yNames(t), core.List)); |
| 3598 for (let i = 0; i < names.length; i++) { | 3598 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); dart.notNull(i
)++) { |
| 3599 let name = names.get(i); | 3599 let name = names.get(i); |
| 3600 if (!Object.hasOwnProperty.call(s, name)) { | 3600 if (!Object.hasOwnProperty.call(s, name)) { |
| 3601 return false; | 3601 return false; |
| 3602 } | 3602 } |
| 3603 let tType = t[name]; | 3603 let tType = t[name]; |
| 3604 let sType = s[name]; | 3604 let sType = s[name]; |
| 3605 if (!dart.notNull(isAssignable(tType, sType))) | 3605 if (!dart.notNull(isAssignable(tType, sType))) |
| 3606 return false; | 3606 return false; |
| 3607 } | 3607 } |
| 3608 return true; | 3608 return true; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3623 return false; | 3623 return false; |
| 3624 } | 3624 } |
| 3625 let sParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); | 3625 let sParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); |
| 3626 let tParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); | 3626 let tParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); |
| 3627 let sOptionalParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); | 3627 let sOptionalParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); |
| 3628 let tOptionalParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); | 3628 let tOptionalParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); |
| 3629 let sParametersLen = sParameterTypes !== null ? getLength(sParameterTypes) :
0; | 3629 let sParametersLen = sParameterTypes !== null ? getLength(sParameterTypes) :
0; |
| 3630 let tParametersLen = tParameterTypes !== null ? getLength(tParameterTypes) :
0; | 3630 let tParametersLen = tParameterTypes !== null ? getLength(tParameterTypes) :
0; |
| 3631 let sOptionalParametersLen = sOptionalParameterTypes !== null ? getLength(sO
ptionalParameterTypes) : 0; | 3631 let sOptionalParametersLen = sOptionalParameterTypes !== null ? getLength(sO
ptionalParameterTypes) : 0; |
| 3632 let tOptionalParametersLen = tOptionalParameterTypes !== null ? getLength(tO
ptionalParameterTypes) : 0; | 3632 let tOptionalParametersLen = tOptionalParameterTypes !== null ? getLength(tO
ptionalParameterTypes) : 0; |
| 3633 if (sParametersLen > tParametersLen) { | 3633 if (dart.notNull(sParametersLen) > dart.notNull(tParametersLen)) { |
| 3634 return false; | 3634 return false; |
| 3635 } | 3635 } |
| 3636 if (sParametersLen + sOptionalParametersLen < tParametersLen + tOptionalPara
metersLen) { | 3636 if (dart.notNull(sParametersLen) + dart.notNull(sOptionalParametersLen) < da
rt.notNull(tParametersLen) + dart.notNull(tOptionalParametersLen)) { |
| 3637 return false; | 3637 return false; |
| 3638 } | 3638 } |
| 3639 if (sParametersLen === tParametersLen) { | 3639 if (sParametersLen === tParametersLen) { |
| 3640 if (!dart.notNull(areAssignable(dart.as(sParameterTypes, core.List), dart.
as(tParameterTypes, core.List), false))) | 3640 if (!dart.notNull(areAssignable(dart.as(sParameterTypes, core.List), dart.
as(tParameterTypes, core.List), false))) |
| 3641 return false; | 3641 return false; |
| 3642 if (!dart.notNull(areAssignable(dart.as(sOptionalParameterTypes, core.List
), dart.as(tOptionalParameterTypes, core.List), true))) { | 3642 if (!dart.notNull(areAssignable(dart.as(sOptionalParameterTypes, core.List
), dart.as(tOptionalParameterTypes, core.List), true))) { |
| 3643 return false; | 3643 return false; |
| 3644 } | 3644 } |
| 3645 } else { | 3645 } else { |
| 3646 let pos = 0; | 3646 let pos = 0; |
| 3647 for (; pos < sParametersLen; pos++) { | 3647 for (; dart.notNull(pos) < dart.notNull(sParametersLen); dart.notNull(pos)
++) { |
| 3648 if (!dart.notNull(isAssignable(getIndex(sParameterTypes, pos), getIndex(
tParameterTypes, pos)))) { | 3648 if (!dart.notNull(isAssignable(getIndex(sParameterTypes, pos), getIndex(
tParameterTypes, pos)))) { |
| 3649 return false; | 3649 return false; |
| 3650 } | 3650 } |
| 3651 } | 3651 } |
| 3652 let sPos = 0; | 3652 let sPos = 0; |
| 3653 let tPos = pos; | 3653 let tPos = pos; |
| 3654 for (; tPos < tParametersLen; sPos++, tPos++) { | 3654 for (; dart.notNull(tPos) < dart.notNull(tParametersLen); dart.notNull(sPo
s)++, dart.notNull(tPos)++) { |
| 3655 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tParameterTypes, tPos)))) { | 3655 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tParameterTypes, tPos)))) { |
| 3656 return false; | 3656 return false; |
| 3657 } | 3657 } |
| 3658 } | 3658 } |
| 3659 tPos = 0; | 3659 tPos = 0; |
| 3660 for (; tPos < tOptionalParametersLen; sPos++, tPos++) { | 3660 for (; dart.notNull(tPos) < dart.notNull(tOptionalParametersLen); dart.not
Null(sPos)++, dart.notNull(tPos)++) { |
| 3661 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tOptionalParameterTypes, tPos)))) { | 3661 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tOptionalParameterTypes, tPos)))) { |
| 3662 return false; | 3662 return false; |
| 3663 } | 3663 } |
| 3664 } | 3664 } |
| 3665 } | 3665 } |
| 3666 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); | 3666 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); |
| 3667 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); | 3667 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); |
| 3668 return areAssignableMaps(sNamedParameters, tNamedParameters); | 3668 return areAssignableMaps(sNamedParameters, tNamedParameters); |
| 3669 } | 3669 } |
| 3670 // Function invoke: (dynamic, dynamic) → dynamic | 3670 // Function invoke: (dynamic, dynamic) → dynamic |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3948 exports.getIndex = getIndex; | 3948 exports.getIndex = getIndex; |
| 3949 exports.getLength = getLength; | 3949 exports.getLength = getLength; |
| 3950 exports.isJsArray = isJsArray; | 3950 exports.isJsArray = isJsArray; |
| 3951 exports.hasField = hasField; | 3951 exports.hasField = hasField; |
| 3952 exports.hasNoField = hasNoField; | 3952 exports.hasNoField = hasNoField; |
| 3953 exports.isJsFunction = isJsFunction; | 3953 exports.isJsFunction = isJsFunction; |
| 3954 exports.isJsObject = isJsObject; | 3954 exports.isJsObject = isJsObject; |
| 3955 exports.isIdentical = isIdentical; | 3955 exports.isIdentical = isIdentical; |
| 3956 exports.isNotIdentical = isNotIdentical; | 3956 exports.isNotIdentical = isNotIdentical; |
| 3957 })(_js_helper || (_js_helper = {})); | 3957 })(_js_helper || (_js_helper = {})); |
| OLD | NEW |