| OLD | NEW |
| (Empty) |
| 1 dart_library.library('dart/_runtime', null, /* Imports */[ | |
| 2 ], /* Lazy imports */[ | |
| 3 'dart/core', | |
| 4 'dart/_interceptors', | |
| 5 'dart/_js_helper', | |
| 6 'dart/async', | |
| 7 'dart/collection' | |
| 8 ], function(exports, core, _interceptors, _js_helper, async, collection) { | |
| 9 'use strict'; | |
| 10 function mixin(base, ...mixins) { | |
| 11 class Mixin extends base { | |
| 12 [base.name](...args) { | |
| 13 for (let i = mixins.length - 1; i >= 0; i--) { | |
| 14 let mixin = mixins[i]; | |
| 15 let init = mixin.prototype[mixin.name]; | |
| 16 if (init) init.call(this); | |
| 17 } | |
| 18 let init = base.prototype[base.name]; | |
| 19 if (init) init.apply(this, args); | |
| 20 } | |
| 21 } | |
| 22 for (let m of mixins) { | |
| 23 copyProperties(Mixin.prototype, m.prototype); | |
| 24 } | |
| 25 setSignature(Mixin, { | |
| 26 methods: () => { | |
| 27 let s = {}; | |
| 28 for (let m of mixins) { | |
| 29 copyProperties(s, m[_methodSig]); | |
| 30 } | |
| 31 return s; | |
| 32 } | |
| 33 }); | |
| 34 Mixin[_mixins] = mixins; | |
| 35 return Mixin; | |
| 36 } | |
| 37 function getMixins(clazz) { | |
| 38 return clazz[_mixins]; | |
| 39 } | |
| 40 function getImplements(clazz) { | |
| 41 return clazz[implements_]; | |
| 42 } | |
| 43 const _typeArguments = Symbol("typeArguments"); | |
| 44 const _originalDeclaration = Symbol("originalDeclaration"); | |
| 45 function generic(typeConstructor) { | |
| 46 let length = typeConstructor.length; | |
| 47 if (length < 1) { | |
| 48 throwInternalError('must have at least one generic type argument'); | |
| 49 } | |
| 50 let resultMap = new Map(); | |
| 51 function makeGenericType(...args) { | |
| 52 if (args.length != length && args.length != 0) { | |
| 53 throwInternalError('requires ' + length + ' or 0 type arguments'); | |
| 54 } | |
| 55 while (args.length < length) | |
| 56 args.push(dynamicR); | |
| 57 let value = resultMap; | |
| 58 for (let i = 0; i < length; i++) { | |
| 59 let arg = args[i]; | |
| 60 if (arg == null) { | |
| 61 throwInternalError('type arguments should not be null: ' + typeConstru
ctor); | |
| 62 } | |
| 63 let map = value; | |
| 64 value = map.get(arg); | |
| 65 if (value === void 0) { | |
| 66 if (i + 1 == length) { | |
| 67 value = typeConstructor.apply(null, args); | |
| 68 if (value) { | |
| 69 value[_typeArguments] = args; | |
| 70 value[_originalDeclaration] = makeGenericType; | |
| 71 } | |
| 72 } else { | |
| 73 value = new Map(); | |
| 74 } | |
| 75 map.set(arg, value); | |
| 76 } | |
| 77 } | |
| 78 return value; | |
| 79 } | |
| 80 return makeGenericType; | |
| 81 } | |
| 82 function getGenericClass(type) { | |
| 83 return safeGetOwnProperty(type, _originalDeclaration); | |
| 84 } | |
| 85 function getGenericArgs(type) { | |
| 86 return safeGetOwnProperty(type, _typeArguments); | |
| 87 } | |
| 88 const _constructorSig = Symbol("sigCtor"); | |
| 89 const _methodSig = Symbol("sig"); | |
| 90 const _staticSig = Symbol("sigStatic"); | |
| 91 function getMethodType(obj, name) { | |
| 92 if (obj === void 0) return void 0; | |
| 93 if (obj == null) return void 0; | |
| 94 return getMethodTypeFromType(obj.__proto__.constructor, name); | |
| 95 } | |
| 96 function getMethodTypeFromType(type, name) { | |
| 97 let sigObj = type[_methodSig]; | |
| 98 if (sigObj === void 0) return void 0; | |
| 99 let parts = sigObj[name]; | |
| 100 if (parts === void 0) return void 0; | |
| 101 return definiteFunctionType.apply(null, parts); | |
| 102 } | |
| 103 function classGetConstructorType(cls, name) { | |
| 104 if (!name) name = cls.name; | |
| 105 if (cls === void 0) return void 0; | |
| 106 if (cls == null) return void 0; | |
| 107 let sigCtor = cls[_constructorSig]; | |
| 108 if (sigCtor === void 0) return void 0; | |
| 109 let parts = sigCtor[name]; | |
| 110 if (parts === void 0) return void 0; | |
| 111 return definiteFunctionType.apply(null, parts); | |
| 112 } | |
| 113 function bind(obj, name, f) { | |
| 114 if (f === void 0) f = obj[name]; | |
| 115 f = f.bind(obj); | |
| 116 let sig = getMethodType(obj, name); | |
| 117 assert_(sig); | |
| 118 tag(f, sig); | |
| 119 return f; | |
| 120 } | |
| 121 function _setMethodSignature(f, sigF) { | |
| 122 defineMemoizedGetter(f, _methodSig, () => { | |
| 123 let sigObj = sigF(); | |
| 124 sigObj.__proto__ = f.__proto__[_methodSig]; | |
| 125 return sigObj; | |
| 126 }); | |
| 127 } | |
| 128 function _setConstructorSignature(f, sigF) { | |
| 129 return defineMemoizedGetter(f, _constructorSig, sigF); | |
| 130 } | |
| 131 function _setStaticSignature(f, sigF) { | |
| 132 return defineMemoizedGetter(f, _staticSig, sigF); | |
| 133 } | |
| 134 function _setStaticTypes(f, names) { | |
| 135 for (let name of names) { | |
| 136 if (!f[name]) continue; | |
| 137 tagMemoized(f[name], function() { | |
| 138 let parts = f[_staticSig][name]; | |
| 139 return definiteFunctionType.apply(null, parts); | |
| 140 }); | |
| 141 } | |
| 142 } | |
| 143 function setSignature(f, signature) { | |
| 144 let constructors = 'constructors' in signature ? signature.constructors : ()
=> ({}); | |
| 145 let methods = 'methods' in signature ? signature.methods : () => ({}); | |
| 146 let statics = 'statics' in signature ? signature.statics : () => ({}); | |
| 147 let names = 'names' in signature ? signature.names : []; | |
| 148 _setConstructorSignature(f, constructors); | |
| 149 _setMethodSignature(f, methods); | |
| 150 _setStaticSignature(f, statics); | |
| 151 _setStaticTypes(f, names); | |
| 152 tagMemoized(f, () => core.Type); | |
| 153 } | |
| 154 function hasMethod(obj, name) { | |
| 155 return getMethodType(obj, name) !== void 0; | |
| 156 } | |
| 157 function virtualField(subclass, fieldName) { | |
| 158 let prop = getOwnPropertyDescriptor(subclass.prototype, fieldName); | |
| 159 if (prop) return; | |
| 160 let symbol = Symbol(subclass.name + '.' + fieldName.toString()); | |
| 161 defineProperty(subclass.prototype, fieldName, { | |
| 162 get: function() { | |
| 163 return this[symbol]; | |
| 164 }, | |
| 165 set: function(x) { | |
| 166 this[symbol] = x; | |
| 167 } | |
| 168 }); | |
| 169 } | |
| 170 function defineNamedConstructor(clazz, name) { | |
| 171 let proto = clazz.prototype; | |
| 172 let initMethod = proto[name]; | |
| 173 let ctor = function() { | |
| 174 return initMethod.apply(this, arguments); | |
| 175 }; | |
| 176 ctor.prototype = proto; | |
| 177 defineProperty(clazz, name, {value: ctor, configurable: true}); | |
| 178 } | |
| 179 const _extensionType = Symbol("extensionType"); | |
| 180 function getExtensionType(obj) { | |
| 181 return obj[_extensionType]; | |
| 182 } | |
| 183 const dartx = {}; | |
| 184 function getExtensionSymbol(name) { | |
| 185 let sym = dartx[name]; | |
| 186 if (!sym) dartx[name] = sym = Symbol('dartx.' + name.toString()); | |
| 187 return sym; | |
| 188 } | |
| 189 function defineExtensionNames(names) { | |
| 190 return names.forEach(getExtensionSymbol); | |
| 191 } | |
| 192 function _installProperties(jsProto, extProto) { | |
| 193 if (extProto !== core.Object.prototype && extProto !== jsProto) { | |
| 194 _installProperties(jsProto, extProto.__proto__); | |
| 195 } | |
| 196 copyTheseProperties(jsProto, extProto, getOwnPropertySymbols(extProto)); | |
| 197 } | |
| 198 function registerExtension(jsType, dartExtType) { | |
| 199 if (!jsType) return; | |
| 200 let extProto = dartExtType.prototype; | |
| 201 let jsProto = jsType.prototype; | |
| 202 jsProto[_extensionType] = dartExtType; | |
| 203 _installProperties(jsProto, extProto); | |
| 204 let originalSigFn = getOwnPropertyDescriptor(dartExtType, _methodSig).get; | |
| 205 assert_(originalSigFn); | |
| 206 defineMemoizedGetter(jsType, _methodSig, originalSigFn); | |
| 207 } | |
| 208 function defineExtensionMembers(type, methodNames) { | |
| 209 let proto = type.prototype; | |
| 210 for (let name of methodNames) { | |
| 211 let method = getOwnPropertyDescriptor(proto, name); | |
| 212 if (!method) continue; | |
| 213 defineProperty(proto, getExtensionSymbol(name), method); | |
| 214 } | |
| 215 let originalSigFn = getOwnPropertyDescriptor(type, _methodSig).get; | |
| 216 defineMemoizedGetter(type, _methodSig, function() { | |
| 217 let sig = originalSigFn(); | |
| 218 for (let name of methodNames) { | |
| 219 sig[getExtensionSymbol(name)] = sig[name]; | |
| 220 } | |
| 221 return sig; | |
| 222 }); | |
| 223 } | |
| 224 function canonicalMember(obj, name) { | |
| 225 if (obj != null && obj[_extensionType]) return dartx[name]; | |
| 226 if (name == 'constructor' || name == 'prototype') { | |
| 227 name = '+' + name; | |
| 228 } | |
| 229 return name; | |
| 230 } | |
| 231 function setType(obj, type) { | |
| 232 obj.__proto__ = type.prototype; | |
| 233 obj.__proto__[_extensionType] = type; | |
| 234 return obj; | |
| 235 } | |
| 236 function list(obj, elementType) { | |
| 237 return setType(obj, getGenericClass(_interceptors.JSArray)(elementType)); | |
| 238 } | |
| 239 function setBaseClass(derived, base) { | |
| 240 derived.prototype.__proto__ = base.prototype; | |
| 241 } | |
| 242 function throwCastError(actual, type) { | |
| 243 throw_(new _js_helper.CastErrorImplementation(actual, type)); | |
| 244 } | |
| 245 function throwAssertionError() { | |
| 246 throw_(new core.AssertionError()); | |
| 247 } | |
| 248 function throwNullValueError() { | |
| 249 throw_(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Va
lue>'), null, null, null)); | |
| 250 } | |
| 251 const _jsIterator = Symbol("_jsIterator"); | |
| 252 const _current = Symbol("_current"); | |
| 253 function syncStar(gen, E, ...args) { | |
| 254 const SyncIterable_E = getGenericClass(_js_helper.SyncIterable)(E); | |
| 255 return new SyncIterable_E(gen, args); | |
| 256 } | |
| 257 function async_(gen, T, ...args) { | |
| 258 let iter; | |
| 259 function onValue(res) { | |
| 260 if (res === void 0) res = null; | |
| 261 return next(iter.next(res)); | |
| 262 } | |
| 263 function onError(err) { | |
| 264 return next(iter.throw(err)); | |
| 265 } | |
| 266 function next(ret) { | |
| 267 if (ret.done) return ret.value; | |
| 268 let future = ret.value; | |
| 269 if (!instanceOf(future, getGenericClass(async.Future))) { | |
| 270 future = async.Future.value(future); | |
| 271 } | |
| 272 return future.then(onValue, {onError: onError}); | |
| 273 } | |
| 274 return getGenericClass(async.Future)(T).new(function() { | |
| 275 iter = gen(...args)[Symbol.iterator](); | |
| 276 return onValue(); | |
| 277 }); | |
| 278 } | |
| 279 class _AsyncStarStreamController { | |
| 280 constructor(generator, T, args) { | |
| 281 this.isAdding = false; | |
| 282 this.isWaiting = false; | |
| 283 this.isScheduled = false; | |
| 284 this.isSuspendedAtYield = false; | |
| 285 this.canceler = null; | |
| 286 this.iterator = generator(this, ...args)[Symbol.iterator](); | |
| 287 this.controller = getGenericClass(async.StreamController)(T).new({ | |
| 288 onListen: () => this.scheduleGenerator(), | |
| 289 onResume: () => this.onResume(), | |
| 290 onCancel: () => this.onCancel() | |
| 291 }); | |
| 292 } | |
| 293 onResume() { | |
| 294 if (this.isSuspendedAtYield) { | |
| 295 this.scheduleGenerator(); | |
| 296 } | |
| 297 } | |
| 298 onCancel() { | |
| 299 if (this.controller.isClosed) { | |
| 300 return null; | |
| 301 } | |
| 302 if (this.canceler == null) { | |
| 303 this.canceler = async.Completer.new(); | |
| 304 this.scheduleGenerator(); | |
| 305 } | |
| 306 return this.canceler.future; | |
| 307 } | |
| 308 close() { | |
| 309 if (this.canceler != null && !this.canceler.isCompleted) { | |
| 310 this.canceler.complete(); | |
| 311 } | |
| 312 this.controller.close(); | |
| 313 } | |
| 314 scheduleGenerator() { | |
| 315 if (this.isScheduled || this.controller.isPaused || this.isAdding || this.
isWaiting) { | |
| 316 return; | |
| 317 } | |
| 318 this.isScheduled = true; | |
| 319 async.scheduleMicrotask(() => this.runBody()); | |
| 320 } | |
| 321 runBody(opt_awaitValue) { | |
| 322 this.isScheduled = false; | |
| 323 this.isSuspendedAtYield = false; | |
| 324 this.isWaiting = false; | |
| 325 let iter; | |
| 326 try { | |
| 327 iter = this.iterator.next(opt_awaitValue); | |
| 328 } catch (e) { | |
| 329 this.addError(e, stackTrace(e)); | |
| 330 this.close(); | |
| 331 return; | |
| 332 } | |
| 333 | |
| 334 if (iter.done) { | |
| 335 this.close(); | |
| 336 return; | |
| 337 } | |
| 338 if (this.isSuspendedAtYield || this.isAdding) return; | |
| 339 this.isWaiting = true; | |
| 340 let future = iter.value; | |
| 341 if (!instanceOf(future, getGenericClass(async.Future))) { | |
| 342 future = async.Future.value(future); | |
| 343 } | |
| 344 return future.then(x => this.runBody(x), { | |
| 345 onError: (e, s) => this.throwError(e, s) | |
| 346 }); | |
| 347 } | |
| 348 add(event) { | |
| 349 if (!this.controller.hasListener) return true; | |
| 350 this.controller.add(event); | |
| 351 this.scheduleGenerator(); | |
| 352 this.isSuspendedAtYield = true; | |
| 353 return false; | |
| 354 } | |
| 355 addStream(stream) { | |
| 356 if (!this.controller.hasListener) return true; | |
| 357 this.isAdding = true; | |
| 358 this.controller.addStream(stream, {cancelOnError: false}).then(() => { | |
| 359 this.isAdding = false; | |
| 360 this.scheduleGenerator(); | |
| 361 }, { | |
| 362 onError: (e, s) => this.throwError(e, s) | |
| 363 }); | |
| 364 } | |
| 365 throwError(error, stackTrace) { | |
| 366 try { | |
| 367 this.iterator.throw(error); | |
| 368 } catch (e) { | |
| 369 this.addError(e, stackTrace); | |
| 370 } | |
| 371 | |
| 372 } | |
| 373 addError(error, stackTrace) { | |
| 374 if (this.canceler != null && !this.canceler.isCompleted) { | |
| 375 this.canceler.completeError(error, stackTrace); | |
| 376 return; | |
| 377 } | |
| 378 if (!this.controller.hasListener) return; | |
| 379 this.controller.addError(error, stackTrace); | |
| 380 } | |
| 381 } | |
| 382 function asyncStar(gen, T, ...args) { | |
| 383 return new _AsyncStarStreamController(gen, T, args).controller.stream; | |
| 384 } | |
| 385 function _canonicalFieldName(obj, name, args, displayName) { | |
| 386 name = canonicalMember(obj, name); | |
| 387 if (name) return name; | |
| 388 throwNoSuchMethodFunc(obj, displayName, args); | |
| 389 } | |
| 390 function dload(obj, field) { | |
| 391 field = _canonicalFieldName(obj, field, [], field); | |
| 392 if (hasMethod(obj, field)) { | |
| 393 return bind(obj, field); | |
| 394 } | |
| 395 let result = obj[field]; | |
| 396 return result; | |
| 397 } | |
| 398 function dput(obj, field, value) { | |
| 399 field = _canonicalFieldName(obj, field, [value], field); | |
| 400 obj[field] = value; | |
| 401 return value; | |
| 402 } | |
| 403 function checkApply(type, actuals) { | |
| 404 if (actuals.length < type.args.length) return false; | |
| 405 let index = 0; | |
| 406 for (let i = 0; i < type.args.length; ++i) { | |
| 407 if (!instanceOfOrNull(actuals[i], type.args[i])) return false; | |
| 408 ++index; | |
| 409 } | |
| 410 if (actuals.length == type.args.length) return true; | |
| 411 let extras = actuals.length - type.args.length; | |
| 412 if (type.optionals.length > 0) { | |
| 413 if (extras > type.optionals.length) return false; | |
| 414 for (let i = 0, j = index; i < extras; ++i, ++j) { | |
| 415 if (!instanceOfOrNull(actuals[j], type.optionals[i])) return false; | |
| 416 } | |
| 417 return true; | |
| 418 } | |
| 419 if (extras != 1) return false; | |
| 420 if (getOwnPropertyNames(type.named).length == 0) return false; | |
| 421 let opts = actuals[index]; | |
| 422 let names = getOwnPropertyNames(opts); | |
| 423 if (names.length == 0) return false; | |
| 424 for (var name of names) { | |
| 425 if (!hasOwnProperty.call(type.named, name)) { | |
| 426 return false; | |
| 427 } | |
| 428 if (!instanceOfOrNull(opts[name], type.named[name])) return false; | |
| 429 } | |
| 430 return true; | |
| 431 } | |
| 432 function _dartSymbol(name) { | |
| 433 return const_(core.Symbol.new(name.toString())); | |
| 434 } | |
| 435 function throwNoSuchMethod(obj, name, pArgs, nArgs, extras) { | |
| 436 throw_(new core.NoSuchMethodError(obj, _dartSymbol(name), pArgs, nArgs, extr
as)); | |
| 437 } | |
| 438 function throwNoSuchMethodFunc(obj, name, pArgs, opt_func) { | |
| 439 if (obj === void 0) obj = opt_func; | |
| 440 throwNoSuchMethod(obj, name, pArgs); | |
| 441 } | |
| 442 function checkAndCall(f, ftype, obj, args, name) { | |
| 443 let originalFunction = f; | |
| 444 if (!(f instanceof Function)) { | |
| 445 if (f != null) { | |
| 446 ftype = getMethodType(f, 'call'); | |
| 447 f = f.call; | |
| 448 } | |
| 449 if (!(f instanceof Function)) { | |
| 450 throwNoSuchMethodFunc(obj, name, args, originalFunction); | |
| 451 } | |
| 452 } | |
| 453 if (ftype === void 0) { | |
| 454 ftype = read(f); | |
| 455 } | |
| 456 if (!ftype) { | |
| 457 return f.apply(obj, args); | |
| 458 } | |
| 459 if (checkApply(ftype, args)) { | |
| 460 return f.apply(obj, args); | |
| 461 } | |
| 462 throwNoSuchMethodFunc(obj, name, args, originalFunction); | |
| 463 } | |
| 464 function dcall(f, ...args) { | |
| 465 let ftype = read(f); | |
| 466 return checkAndCall(f, ftype, void 0, args, 'call'); | |
| 467 } | |
| 468 function callMethod(obj, name, args, displayName) { | |
| 469 let symbol = _canonicalFieldName(obj, name, args, displayName); | |
| 470 let f = obj != null ? obj[symbol] : null; | |
| 471 let ftype = getMethodType(obj, name); | |
| 472 return checkAndCall(f, ftype, obj, args, displayName); | |
| 473 } | |
| 474 function dsend(obj, method, ...args) { | |
| 475 return callMethod(obj, method, args, method); | |
| 476 } | |
| 477 function dindex(obj, index) { | |
| 478 return callMethod(obj, 'get', [index], '[]'); | |
| 479 } | |
| 480 function dsetindex(obj, index, value) { | |
| 481 callMethod(obj, 'set', [index, value], '[]='); | |
| 482 return value; | |
| 483 } | |
| 484 function _ignoreTypeFailure(actual, type) { | |
| 485 if (isSubtype(type, core.Iterable) && isSubtype(actual, core.Iterable) || is
Subtype(type, async.Future) && isSubtype(actual, async.Future) || isSubtype(type
, core.Map) && isSubtype(actual, core.Map) || isSubtype(type, core.Function) &&
isSubtype(actual, core.Function) || isSubtype(type, async.Stream) && isSubtype(a
ctual, async.Stream) || isSubtype(type, async.StreamSubscription) && isSubtype(a
ctual, async.StreamSubscription)) { | |
| 486 console.warn('Ignoring cast fail from ' + typeName(actual) + ' to ' + type
Name(type)); | |
| 487 return true; | |
| 488 } | |
| 489 return false; | |
| 490 } | |
| 491 function strongInstanceOf(obj, type, ignoreFromWhiteList) { | |
| 492 let actual = realRuntimeType(obj); | |
| 493 if (isSubtype(actual, type) || actual == jsobject || actual == core.int && t
ype == core.double) return true; | |
| 494 if (ignoreFromWhiteList == void 0) return false; | |
| 495 if (isGroundType(type)) return false; | |
| 496 if (_ignoreTypeFailure(actual, type)) return true; | |
| 497 return false; | |
| 498 } | |
| 499 function instanceOfOrNull(obj, type) { | |
| 500 if (obj == null || strongInstanceOf(obj, type, true)) return true; | |
| 501 return false; | |
| 502 } | |
| 503 function instanceOf(obj, type) { | |
| 504 if (strongInstanceOf(obj, type)) return true; | |
| 505 if (isGroundType(type)) return false; | |
| 506 let actual = realRuntimeType(obj); | |
| 507 throwStrongModeError('Strong mode is check failure: ' + typeName(actual) + '
does not soundly subtype ' + typeName(type)); | |
| 508 } | |
| 509 function cast(obj, type) { | |
| 510 if (instanceOfOrNull(obj, type)) return obj; | |
| 511 let actual = realRuntimeType(obj); | |
| 512 if (isGroundType(type)) throwCastError(actual, type); | |
| 513 if (_ignoreTypeFailure(actual, type)) return obj; | |
| 514 throwStrongModeError('Strong mode cast failure from ' + typeName(actual) + '
to ' + typeName(type)); | |
| 515 } | |
| 516 function asInt(obj) { | |
| 517 if (obj == null) { | |
| 518 return null; | |
| 519 } | |
| 520 if (Math.floor(obj) != obj) { | |
| 521 throwCastError(realRuntimeType(obj), core.int); | |
| 522 } | |
| 523 return obj; | |
| 524 } | |
| 525 function arity(f) { | |
| 526 return {min: f.length, max: f.length}; | |
| 527 } | |
| 528 function equals(x, y) { | |
| 529 if (x == null || y == null) return x == y; | |
| 530 let eq = x['==']; | |
| 531 return eq ? eq.call(x, y) : x === y; | |
| 532 } | |
| 533 function notNull(x) { | |
| 534 if (x == null) throwNullValueError(); | |
| 535 return x; | |
| 536 } | |
| 537 function map(values, K, V) { | |
| 538 if (K === void 0) K = null; | |
| 539 if (V === void 0) V = null; | |
| 540 return (() => { | |
| 541 if (K == null) K = dynamicR; | |
| 542 if (V == null) V = dynamicR; | |
| 543 let map = getGenericClass(collection.LinkedHashMap)(K, V).new(); | |
| 544 if (Array.isArray(values)) { | |
| 545 for (let i = 0, end = values.length - 1; i < end; i += 2) { | |
| 546 let key = values[i]; | |
| 547 let value = values[i + 1]; | |
| 548 map.set(key, value); | |
| 549 } | |
| 550 } else if (typeof values === 'object') { | |
| 551 for (let key of getOwnPropertyNames(values)) { | |
| 552 map.set(key, values[key]); | |
| 553 } | |
| 554 } | |
| 555 return map; | |
| 556 })(); | |
| 557 } | |
| 558 function assert_(condition) { | |
| 559 if (!condition) throwAssertionError(); | |
| 560 } | |
| 561 const _stack = new WeakMap(); | |
| 562 function throw_(obj) { | |
| 563 if (obj != null && (typeof obj == 'object' || typeof obj == 'function')) { | |
| 564 _stack.set(obj, new Error()); | |
| 565 } | |
| 566 throw obj; | |
| 567 } | |
| 568 function getError(exception) { | |
| 569 var stack = _stack.get(exception); | |
| 570 return stack !== void 0 ? stack : exception; | |
| 571 } | |
| 572 function stackPrint(exception) { | |
| 573 var error = getError(exception); | |
| 574 console.log(error.stack ? error.stack : 'No stack trace for: ' + error); | |
| 575 } | |
| 576 function stackTrace(exception) { | |
| 577 var error = getError(exception); | |
| 578 return _js_helper.getTraceFromException(error); | |
| 579 } | |
| 580 function nullSafe(obj, ...callbacks) { | |
| 581 if (obj == null) return obj; | |
| 582 for (const callback of callbacks) { | |
| 583 obj = callback(obj); | |
| 584 if (obj == null) break; | |
| 585 } | |
| 586 return obj; | |
| 587 } | |
| 588 const _value = Symbol("_value"); | |
| 589 function multiKeyPutIfAbsent(map, keys, valueFn) { | |
| 590 for (let k of keys) { | |
| 591 let value = map.get(k); | |
| 592 if (!value) { | |
| 593 map.set(k, value = new Map()); | |
| 594 } | |
| 595 map = value; | |
| 596 } | |
| 597 if (map.has(_value)) return map.get(_value); | |
| 598 let value = valueFn(); | |
| 599 map.set(_value, value); | |
| 600 return value; | |
| 601 } | |
| 602 const constants = new Map(); | |
| 603 function const_(obj) { | |
| 604 let objectKey = [realRuntimeType(obj)]; | |
| 605 for (let name of getOwnNamesAndSymbols(obj)) { | |
| 606 objectKey.push(name); | |
| 607 objectKey.push(obj[name]); | |
| 608 } | |
| 609 return multiKeyPutIfAbsent(constants, objectKey, () => obj); | |
| 610 } | |
| 611 function hashCode(obj) { | |
| 612 if (obj == null) { | |
| 613 return 0; | |
| 614 } | |
| 615 switch (typeof obj) { | |
| 616 case "number": | |
| 617 case "boolean": | |
| 618 { | |
| 619 return obj & 0x1FFFFFFF; | |
| 620 } | |
| 621 case "string": | |
| 622 { | |
| 623 return obj.length; | |
| 624 } | |
| 625 } | |
| 626 return obj.hashCode; | |
| 627 } | |
| 628 function toString(obj) { | |
| 629 if (obj == null) { | |
| 630 return "null"; | |
| 631 } | |
| 632 return obj.toString(); | |
| 633 } | |
| 634 function noSuchMethod(obj, invocation) { | |
| 635 if (obj == null) { | |
| 636 throwNoSuchMethod(obj, invocation.memberName, invocation.positionalArgumen
ts, invocation.namedArguments); | |
| 637 } | |
| 638 switch (typeof obj) { | |
| 639 case "number": | |
| 640 case "boolean": | |
| 641 case "string": | |
| 642 { | |
| 643 throwNoSuchMethod(obj, invocation.memberName, invocation.positionalArgum
ents, invocation.namedArguments); | |
| 644 } | |
| 645 } | |
| 646 return obj.noSuchMethod(invocation); | |
| 647 } | |
| 648 class JsIterator { | |
| 649 constructor(dartIterator) { | |
| 650 this.dartIterator = dartIterator; | |
| 651 } | |
| 652 next() { | |
| 653 let i = this.dartIterator; | |
| 654 let done = !i.moveNext(); | |
| 655 return {done: done, value: done ? void 0 : i.current}; | |
| 656 } | |
| 657 } | |
| 658 function fn(closure, ...args) { | |
| 659 if (args.length == 1) { | |
| 660 defineLazyProperty(closure, _runtimeType, {get: args[0]}); | |
| 661 return closure; | |
| 662 } | |
| 663 let t; | |
| 664 if (args.length == 0) { | |
| 665 t = definiteFunctionType(dynamicR, Array(closure.length).fill(dynamicR)); | |
| 666 } else { | |
| 667 t = definiteFunctionType.apply(null, args); | |
| 668 } | |
| 669 tag(closure, t); | |
| 670 return closure; | |
| 671 } | |
| 672 const _runtimeType = Symbol("_runtimeType"); | |
| 673 function checkPrimitiveType(obj) { | |
| 674 switch (typeof obj) { | |
| 675 case "undefined": | |
| 676 { | |
| 677 return core.Null; | |
| 678 } | |
| 679 case "number": | |
| 680 { | |
| 681 return Math.floor(obj) == obj ? core.int : core.double; | |
| 682 } | |
| 683 case "boolean": | |
| 684 { | |
| 685 return core.bool; | |
| 686 } | |
| 687 case "string": | |
| 688 { | |
| 689 return core.String; | |
| 690 } | |
| 691 case "symbol": | |
| 692 { | |
| 693 return Symbol; | |
| 694 } | |
| 695 } | |
| 696 if (obj === null) return core.Null; | |
| 697 return null; | |
| 698 } | |
| 699 function runtimeType(obj) { | |
| 700 let result = checkPrimitiveType(obj); | |
| 701 if (result !== null) return result; | |
| 702 result = obj.runtimeType; | |
| 703 if (result) return result; | |
| 704 return _nonPrimitiveRuntimeType(obj); | |
| 705 } | |
| 706 function getFunctionType(obj) { | |
| 707 let args = Array(obj.length).fill(dynamicR); | |
| 708 return definiteFunctionType(bottom, args); | |
| 709 } | |
| 710 function realRuntimeType(obj) { | |
| 711 let result = checkPrimitiveType(obj); | |
| 712 if (result !== null) return result; | |
| 713 return _nonPrimitiveRuntimeType(obj); | |
| 714 } | |
| 715 function _nonPrimitiveRuntimeType(obj) { | |
| 716 let result = obj[_runtimeType]; | |
| 717 if (result) return result; | |
| 718 result = obj[_extensionType]; | |
| 719 if (result) return result; | |
| 720 result = obj.constructor; | |
| 721 if (result == Function) { | |
| 722 return jsobject; | |
| 723 } | |
| 724 return result; | |
| 725 } | |
| 726 function LazyTagged(infoFn) { | |
| 727 class _Tagged { | |
| 728 get [_runtimeType]() { | |
| 729 return infoFn(); | |
| 730 } | |
| 731 } | |
| 732 return _Tagged; | |
| 733 } | |
| 734 function read(value) { | |
| 735 return value[_runtimeType]; | |
| 736 } | |
| 737 function tag(value, info) { | |
| 738 value[_runtimeType] = info; | |
| 739 } | |
| 740 function tagComputed(value, compute) { | |
| 741 defineProperty(value, _runtimeType, {get: compute}); | |
| 742 } | |
| 743 function tagMemoized(value, compute) { | |
| 744 let cache = null; | |
| 745 function getter() { | |
| 746 if (compute == null) return cache; | |
| 747 cache = compute(); | |
| 748 compute = null; | |
| 749 return cache; | |
| 750 } | |
| 751 tagComputed(value, getter); | |
| 752 } | |
| 753 const _mixins = Symbol("mixins"); | |
| 754 const implements_ = Symbol("implements"); | |
| 755 const metadata = Symbol("metadata"); | |
| 756 const _TypeRepBase = LazyTagged(() => core.Type); | |
| 757 class TypeRep extends _TypeRepBase { | |
| 758 get name() { | |
| 759 return this.toString(); | |
| 760 } | |
| 761 } | |
| 762 class Dynamic extends TypeRep { | |
| 763 toString() { | |
| 764 return "dynamic"; | |
| 765 } | |
| 766 } | |
| 767 const dynamicR = new Dynamic(); | |
| 768 class Void extends TypeRep { | |
| 769 toString() { | |
| 770 return "void"; | |
| 771 } | |
| 772 } | |
| 773 const voidR = new Void(); | |
| 774 class Bottom extends TypeRep { | |
| 775 toString() { | |
| 776 return "bottom"; | |
| 777 } | |
| 778 } | |
| 779 const bottom = new Bottom(); | |
| 780 class JSObject extends TypeRep { | |
| 781 toString() { | |
| 782 return "NativeJavaScriptObject"; | |
| 783 } | |
| 784 } | |
| 785 const jsobject = new JSObject(); | |
| 786 class AbstractFunctionType extends TypeRep { | |
| 787 constructor() { | |
| 788 super(); | |
| 789 this._stringValue = null; | |
| 790 } | |
| 791 toString() { | |
| 792 return this.name; | |
| 793 } | |
| 794 get name() { | |
| 795 if (this._stringValue) return this._stringValue; | |
| 796 let buffer = '('; | |
| 797 for (let i = 0; i < this.args.length; ++i) { | |
| 798 if (i > 0) { | |
| 799 buffer += ', '; | |
| 800 } | |
| 801 buffer += typeName(this.args[i]); | |
| 802 } | |
| 803 if (this.optionals.length > 0) { | |
| 804 if (this.args.length > 0) buffer += ', '; | |
| 805 buffer += '['; | |
| 806 for (let i = 0; i < this.optionals.length; ++i) { | |
| 807 if (i > 0) { | |
| 808 buffer += ', '; | |
| 809 } | |
| 810 buffer += typeName(this.optionals[i]); | |
| 811 } | |
| 812 buffer += ']'; | |
| 813 } else if (Object.keys(this.named).length > 0) { | |
| 814 if (this.args.length > 0) buffer += ', '; | |
| 815 buffer += '{'; | |
| 816 let names = getOwnPropertyNames(this.named).sort(); | |
| 817 for (let i = 0; i < names.length; ++i) { | |
| 818 if (i > 0) { | |
| 819 buffer += ', '; | |
| 820 } | |
| 821 buffer += names[i] + ': ' + typeName(this.named[names[i]]); | |
| 822 } | |
| 823 buffer += '}'; | |
| 824 } | |
| 825 buffer += ') -> ' + typeName(this.returnType); | |
| 826 this._stringValue = buffer; | |
| 827 return buffer; | |
| 828 } | |
| 829 } | |
| 830 class FunctionType extends AbstractFunctionType { | |
| 831 constructor(definite, returnType, args, optionals, named) { | |
| 832 super(); | |
| 833 this.definite = definite; | |
| 834 this.returnType = returnType; | |
| 835 this.args = args; | |
| 836 this.optionals = optionals; | |
| 837 this.named = named; | |
| 838 this.metadata = []; | |
| 839 function process(array, metadata) { | |
| 840 var result = []; | |
| 841 for (var i = 0; i < array.length; ++i) { | |
| 842 var arg = array[i]; | |
| 843 if (arg instanceof Array) { | |
| 844 metadata.push(arg.slice(1)); | |
| 845 result.push(arg[0]); | |
| 846 } else { | |
| 847 metadata.push([]); | |
| 848 result.push(arg); | |
| 849 } | |
| 850 } | |
| 851 return result; | |
| 852 } | |
| 853 this.args = process(this.args, this.metadata); | |
| 854 this.optionals = process(this.optionals, this.metadata); | |
| 855 this._canonize(); | |
| 856 } | |
| 857 _canonize() { | |
| 858 if (this.definite) return; | |
| 859 function replace(a) { | |
| 860 return a == dynamicR ? bottom : a; | |
| 861 } | |
| 862 this.args = this.args.map(replace); | |
| 863 if (this.optionals.length > 0) { | |
| 864 this.optionals = this.optionals.map(replace); | |
| 865 } | |
| 866 if (Object.keys(this.named).length > 0) { | |
| 867 let r = {}; | |
| 868 for (let name of getOwnPropertyNames(this.named)) { | |
| 869 r[name] = replace(this.named[name]); | |
| 870 } | |
| 871 this.named = r; | |
| 872 } | |
| 873 } | |
| 874 } | |
| 875 class Typedef extends AbstractFunctionType { | |
| 876 constructor(name, closure) { | |
| 877 super(); | |
| 878 this._name = name; | |
| 879 this._closure = closure; | |
| 880 this._functionType = null; | |
| 881 } | |
| 882 get definite() { | |
| 883 return this._functionType.definite; | |
| 884 } | |
| 885 get name() { | |
| 886 return this._name; | |
| 887 } | |
| 888 get functionType() { | |
| 889 if (!this._functionType) { | |
| 890 this._functionType = this._closure(); | |
| 891 } | |
| 892 return this._functionType; | |
| 893 } | |
| 894 get returnType() { | |
| 895 return this.functionType.returnType; | |
| 896 } | |
| 897 get args() { | |
| 898 return this.functionType.args; | |
| 899 } | |
| 900 get optionals() { | |
| 901 return this.functionType.optionals; | |
| 902 } | |
| 903 get named() { | |
| 904 return this.functionType.named; | |
| 905 } | |
| 906 get metadata() { | |
| 907 return this.functionType.metadata; | |
| 908 } | |
| 909 } | |
| 910 function _functionType(definite, returnType, args, extra) { | |
| 911 let optionals; | |
| 912 let named; | |
| 913 if (extra === void 0) { | |
| 914 optionals = []; | |
| 915 named = {}; | |
| 916 } else if (extra instanceof Array) { | |
| 917 optionals = extra; | |
| 918 named = {}; | |
| 919 } else { | |
| 920 optionals = []; | |
| 921 named = extra; | |
| 922 } | |
| 923 return new FunctionType(definite, returnType, args, optionals, named); | |
| 924 } | |
| 925 function functionType(returnType, args, extra) { | |
| 926 return _functionType(false, returnType, args, extra); | |
| 927 } | |
| 928 function definiteFunctionType(returnType, args, extra) { | |
| 929 return _functionType(true, returnType, args, extra); | |
| 930 } | |
| 931 function typedef(name, closure) { | |
| 932 return new Typedef(name, closure); | |
| 933 } | |
| 934 function isDartType(type) { | |
| 935 return read(type) === core.Type; | |
| 936 } | |
| 937 function typeName(type) { | |
| 938 if (type instanceof TypeRep) return type.toString(); | |
| 939 let tag = read(type); | |
| 940 if (tag === core.Type) { | |
| 941 let name = type.name; | |
| 942 let args = getGenericArgs(type); | |
| 943 if (args) { | |
| 944 name += '<'; | |
| 945 for (let i = 0; i < args.length; ++i) { | |
| 946 if (i > 0) name += ', '; | |
| 947 name += typeName(args[i]); | |
| 948 } | |
| 949 name += '>'; | |
| 950 } | |
| 951 return name; | |
| 952 } | |
| 953 if (tag) return "Not a type: " + tag.name; | |
| 954 return "JSObject<" + type.name + ">"; | |
| 955 } | |
| 956 function getImplicitFunctionType(type) { | |
| 957 if (isFunctionType(type)) return type; | |
| 958 return getMethodTypeFromType(type, 'call'); | |
| 959 } | |
| 960 function isFunctionType(type) { | |
| 961 return type instanceof AbstractFunctionType || type == core.Function; | |
| 962 } | |
| 963 function isFunctionSubType(ft1, ft2) { | |
| 964 if (ft2 == core.Function) { | |
| 965 return true; | |
| 966 } | |
| 967 let ret1 = ft1.returnType; | |
| 968 let ret2 = ft2.returnType; | |
| 969 if (!isSubtype_(ret1, ret2)) { | |
| 970 if (ret2 != voidR) { | |
| 971 return false; | |
| 972 } | |
| 973 } | |
| 974 let args1 = ft1.args; | |
| 975 let args2 = ft2.args; | |
| 976 if (args1.length > args2.length) { | |
| 977 return false; | |
| 978 } | |
| 979 for (let i = 0; i < args1.length; ++i) { | |
| 980 if (!isSubtype_(args2[i], args1[i])) { | |
| 981 return false; | |
| 982 } | |
| 983 } | |
| 984 let optionals1 = ft1.optionals; | |
| 985 let optionals2 = ft2.optionals; | |
| 986 if (args1.length + optionals1.length < args2.length + optionals2.length) { | |
| 987 return false; | |
| 988 } | |
| 989 let j = 0; | |
| 990 for (let i = args1.length; i < args2.length; ++i, ++j) { | |
| 991 if (!isSubtype_(args2[i], optionals1[j])) { | |
| 992 return false; | |
| 993 } | |
| 994 } | |
| 995 for (let i = 0; i < optionals2.length; ++i, ++j) { | |
| 996 if (!isSubtype_(optionals2[i], optionals1[j])) { | |
| 997 return false; | |
| 998 } | |
| 999 } | |
| 1000 let named1 = ft1.named; | |
| 1001 let named2 = ft2.named; | |
| 1002 let names = getOwnPropertyNames(named2); | |
| 1003 for (let i = 0; i < names.length; ++i) { | |
| 1004 let name = names[i]; | |
| 1005 let n1 = named1[name]; | |
| 1006 let n2 = named2[name]; | |
| 1007 if (n1 === void 0) { | |
| 1008 return false; | |
| 1009 } | |
| 1010 if (!isSubtype_(n2, n1)) { | |
| 1011 return false; | |
| 1012 } | |
| 1013 } | |
| 1014 return true; | |
| 1015 } | |
| 1016 function canonicalType(t) { | |
| 1017 if (t === Object) return core.Object; | |
| 1018 if (t === Function) return core.Function; | |
| 1019 if (t === Array) return core.List; | |
| 1020 if (t === String) return core.String; | |
| 1021 if (t === Number) return core.double; | |
| 1022 if (t === Boolean) return core.bool; | |
| 1023 return t; | |
| 1024 } | |
| 1025 const subtypeMap = new Map(); | |
| 1026 function isSubtype(t1, t2) { | |
| 1027 let map = subtypeMap.get(t1); | |
| 1028 let result; | |
| 1029 if (map) { | |
| 1030 result = map.get(t2); | |
| 1031 if (result !== void 0) return result; | |
| 1032 } else { | |
| 1033 subtypeMap.set(t1, map = new Map()); | |
| 1034 } | |
| 1035 result = isSubtype_(t1, t2); | |
| 1036 map.set(t2, result); | |
| 1037 return result; | |
| 1038 } | |
| 1039 function _isBottom(type) { | |
| 1040 return type == bottom; | |
| 1041 } | |
| 1042 function _isTop(type) { | |
| 1043 return type == core.Object || type == dynamicR; | |
| 1044 } | |
| 1045 function isSubtype_(t1, t2) { | |
| 1046 t1 = canonicalType(t1); | |
| 1047 t2 = canonicalType(t2); | |
| 1048 if (t1 == t2) return true; | |
| 1049 if (_isTop(t2) || _isBottom(t1)) { | |
| 1050 return true; | |
| 1051 } | |
| 1052 if (_isTop(t1) || _isBottom(t2)) { | |
| 1053 return false; | |
| 1054 } | |
| 1055 if (isClassSubType(t1, t2)) { | |
| 1056 return true; | |
| 1057 } | |
| 1058 t1 = getImplicitFunctionType(t1); | |
| 1059 if (!t1) return false; | |
| 1060 if (isFunctionType(t1) && isFunctionType(t2)) { | |
| 1061 return isFunctionSubType(t1, t2); | |
| 1062 } | |
| 1063 return false; | |
| 1064 } | |
| 1065 function isClassSubType(t1, t2) { | |
| 1066 t1 = canonicalType(t1); | |
| 1067 assert_(t2 == canonicalType(t2)); | |
| 1068 if (t1 == t2) return true; | |
| 1069 if (t1 == core.Object) return false; | |
| 1070 if (t1 == null) return t2 == core.Object || t2 == dynamicR; | |
| 1071 let raw1 = getGenericClass(t1); | |
| 1072 let raw2 = getGenericClass(t2); | |
| 1073 if (raw1 != null && raw1 == raw2) { | |
| 1074 let typeArguments1 = getGenericArgs(t1); | |
| 1075 let typeArguments2 = getGenericArgs(t2); | |
| 1076 let length = typeArguments1.length; | |
| 1077 if (typeArguments2.length == 0) { | |
| 1078 return true; | |
| 1079 } else if (length == 0) { | |
| 1080 return false; | |
| 1081 } | |
| 1082 assert_(length == typeArguments2.length); | |
| 1083 for (let i = 0; i < length; ++i) { | |
| 1084 if (!isSubtype(typeArguments1[i], typeArguments2[i])) { | |
| 1085 return false; | |
| 1086 } | |
| 1087 } | |
| 1088 return true; | |
| 1089 } | |
| 1090 if (isClassSubType(t1.__proto__, t2)) return true; | |
| 1091 let mixins = getMixins(t1); | |
| 1092 if (mixins) { | |
| 1093 for (let m1 of mixins) { | |
| 1094 if (m1 != null && isClassSubType(m1, t2)) return true; | |
| 1095 } | |
| 1096 } | |
| 1097 let getInterfaces = getImplements(t1); | |
| 1098 if (getInterfaces) { | |
| 1099 for (let i1 of getInterfaces()) { | |
| 1100 if (i1 != null && isClassSubType(i1, t2)) return true; | |
| 1101 } | |
| 1102 } | |
| 1103 return false; | |
| 1104 } | |
| 1105 function isGroundType(type) { | |
| 1106 if (type instanceof AbstractFunctionType) { | |
| 1107 if (!_isTop(type.returnType)) return false; | |
| 1108 for (let i = 0; i < type.args.length; ++i) { | |
| 1109 if (!_isBottom(type.args[i])) return false; | |
| 1110 } | |
| 1111 for (let i = 0; i < type.optionals.length; ++i) { | |
| 1112 if (!_isBottom(type.optionals[i])) return false; | |
| 1113 } | |
| 1114 let names = getOwnPropertyNames(type.named); | |
| 1115 for (let i = 0; i < names.length; ++i) { | |
| 1116 if (!_isBottom(type.named[names[i]])) return false; | |
| 1117 } | |
| 1118 return true; | |
| 1119 } | |
| 1120 let typeArgs = getGenericArgs(type); | |
| 1121 if (!typeArgs) return true; | |
| 1122 for (let t of typeArgs) { | |
| 1123 if (t != core.Object && t != dynamicR) return false; | |
| 1124 } | |
| 1125 return true; | |
| 1126 } | |
| 1127 const defineProperty = Object.defineProperty; | |
| 1128 const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
| 1129 const getOwnPropertyNames = Object.getOwnPropertyNames; | |
| 1130 const getOwnPropertySymbols = Object.getOwnPropertySymbols; | |
| 1131 const hasOwnProperty = Object.prototype.hasOwnProperty; | |
| 1132 const StrongModeError = (function() { | |
| 1133 function StrongModeError(message) { | |
| 1134 Error.call(this); | |
| 1135 this.message = message; | |
| 1136 } | |
| 1137 ; | |
| 1138 Object.setPrototypeOf(StrongModeError.prototype, Error.prototype); | |
| 1139 return StrongModeError; | |
| 1140 })(); | |
| 1141 function throwStrongModeError(message) { | |
| 1142 throw new StrongModeError(message); | |
| 1143 } | |
| 1144 function throwInternalError(message) { | |
| 1145 throw Error(message); | |
| 1146 } | |
| 1147 function getOwnNamesAndSymbols(obj) { | |
| 1148 return getOwnPropertyNames(obj).concat(getOwnPropertySymbols(obj)); | |
| 1149 } | |
| 1150 function safeGetOwnProperty(obj, name) { | |
| 1151 let desc = getOwnPropertyDescriptor(obj, name); | |
| 1152 if (desc) return desc.value; | |
| 1153 } | |
| 1154 function defineLazyProperty(to, name, desc) { | |
| 1155 let init = desc.get; | |
| 1156 let value = null; | |
| 1157 function lazySetter(x) { | |
| 1158 init = null; | |
| 1159 value = x; | |
| 1160 } | |
| 1161 function circularInitError() { | |
| 1162 throwInternalError('circular initialization for field ' + name); | |
| 1163 } | |
| 1164 function lazyGetter() { | |
| 1165 if (init == null) return value; | |
| 1166 let f = init; | |
| 1167 init = circularInitError; | |
| 1168 lazySetter(f()); | |
| 1169 return value; | |
| 1170 } | |
| 1171 desc.get = lazyGetter; | |
| 1172 desc.configurable = true; | |
| 1173 if (desc.set) desc.set = lazySetter; | |
| 1174 return defineProperty(to, name, desc); | |
| 1175 } | |
| 1176 function defineLazy(to, from) { | |
| 1177 for (let name of getOwnNamesAndSymbols(from)) { | |
| 1178 defineLazyProperty(to, name, getOwnPropertyDescriptor(from, name)); | |
| 1179 } | |
| 1180 } | |
| 1181 function defineMemoizedGetter(obj, name, getter) { | |
| 1182 return defineLazyProperty(obj, name, {get: getter}); | |
| 1183 } | |
| 1184 function copyTheseProperties(to, from, names) { | |
| 1185 for (let name of names) { | |
| 1186 var desc = getOwnPropertyDescriptor(from, name); | |
| 1187 if (desc != void 0) { | |
| 1188 defineProperty(to, name, desc); | |
| 1189 } else { | |
| 1190 defineLazyProperty(to, name, () => from[name]); | |
| 1191 } | |
| 1192 } | |
| 1193 return to; | |
| 1194 } | |
| 1195 function copyProperties(to, from) { | |
| 1196 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); | |
| 1197 } | |
| 1198 function export_(to, from, show, hide) { | |
| 1199 if (show == void 0 || show.length == 0) { | |
| 1200 show = getOwnNamesAndSymbols(from); | |
| 1201 } | |
| 1202 if (hide != void 0) { | |
| 1203 var hideMap = new Set(hide); | |
| 1204 show = show.filter(k => !hideMap.has(k)); | |
| 1205 } | |
| 1206 return copyTheseProperties(to, from, show); | |
| 1207 } | |
| 1208 const defineLazyClass = defineLazy; | |
| 1209 const defineLazyProperties = defineLazy; | |
| 1210 const defineLazyClassGeneric = defineLazyProperty; | |
| 1211 const as_ = cast; | |
| 1212 const is_ = instanceOf; | |
| 1213 const global_ = typeof window == "undefined" ? global : window; | |
| 1214 const JsSymbol = Symbol; | |
| 1215 // Exports: | |
| 1216 exports.mixin = mixin; | |
| 1217 exports.getMixins = getMixins; | |
| 1218 exports.getImplements = getImplements; | |
| 1219 exports.generic = generic; | |
| 1220 exports.getGenericClass = getGenericClass; | |
| 1221 exports.getGenericArgs = getGenericArgs; | |
| 1222 exports.getMethodType = getMethodType; | |
| 1223 exports.getMethodTypeFromType = getMethodTypeFromType; | |
| 1224 exports.classGetConstructorType = classGetConstructorType; | |
| 1225 exports.bind = bind; | |
| 1226 exports.setSignature = setSignature; | |
| 1227 exports.hasMethod = hasMethod; | |
| 1228 exports.virtualField = virtualField; | |
| 1229 exports.defineNamedConstructor = defineNamedConstructor; | |
| 1230 exports.getExtensionType = getExtensionType; | |
| 1231 exports.dartx = dartx; | |
| 1232 exports.getExtensionSymbol = getExtensionSymbol; | |
| 1233 exports.defineExtensionNames = defineExtensionNames; | |
| 1234 exports.registerExtension = registerExtension; | |
| 1235 exports.defineExtensionMembers = defineExtensionMembers; | |
| 1236 exports.canonicalMember = canonicalMember; | |
| 1237 exports.setType = setType; | |
| 1238 exports.list = list; | |
| 1239 exports.setBaseClass = setBaseClass; | |
| 1240 exports.throwCastError = throwCastError; | |
| 1241 exports.throwAssertionError = throwAssertionError; | |
| 1242 exports.throwNullValueError = throwNullValueError; | |
| 1243 exports.syncStar = syncStar; | |
| 1244 exports.async = async_; | |
| 1245 exports.asyncStar = asyncStar; | |
| 1246 exports.dload = dload; | |
| 1247 exports.dput = dput; | |
| 1248 exports.checkApply = checkApply; | |
| 1249 exports.throwNoSuchMethod = throwNoSuchMethod; | |
| 1250 exports.throwNoSuchMethodFunc = throwNoSuchMethodFunc; | |
| 1251 exports.checkAndCall = checkAndCall; | |
| 1252 exports.dcall = dcall; | |
| 1253 exports.callMethod = callMethod; | |
| 1254 exports.dsend = dsend; | |
| 1255 exports.dindex = dindex; | |
| 1256 exports.dsetindex = dsetindex; | |
| 1257 exports.strongInstanceOf = strongInstanceOf; | |
| 1258 exports.instanceOfOrNull = instanceOfOrNull; | |
| 1259 exports.instanceOf = instanceOf; | |
| 1260 exports.cast = cast; | |
| 1261 exports.asInt = asInt; | |
| 1262 exports.arity = arity; | |
| 1263 exports.equals = equals; | |
| 1264 exports.notNull = notNull; | |
| 1265 exports.map = map; | |
| 1266 exports.assert = assert_; | |
| 1267 exports.throw = throw_; | |
| 1268 exports.getError = getError; | |
| 1269 exports.stackPrint = stackPrint; | |
| 1270 exports.stackTrace = stackTrace; | |
| 1271 exports.nullSafe = nullSafe; | |
| 1272 exports.multiKeyPutIfAbsent = multiKeyPutIfAbsent; | |
| 1273 exports.constants = constants; | |
| 1274 exports.const = const_; | |
| 1275 exports.hashCode = hashCode; | |
| 1276 exports.toString = toString; | |
| 1277 exports.noSuchMethod = noSuchMethod; | |
| 1278 exports.JsIterator = JsIterator; | |
| 1279 exports.fn = fn; | |
| 1280 exports.checkPrimitiveType = checkPrimitiveType; | |
| 1281 exports.runtimeType = runtimeType; | |
| 1282 exports.getFunctionType = getFunctionType; | |
| 1283 exports.realRuntimeType = realRuntimeType; | |
| 1284 exports.LazyTagged = LazyTagged; | |
| 1285 exports.read = read; | |
| 1286 exports.tag = tag; | |
| 1287 exports.tagComputed = tagComputed; | |
| 1288 exports.tagMemoized = tagMemoized; | |
| 1289 exports.implements = implements_; | |
| 1290 exports.metadata = metadata; | |
| 1291 exports.TypeRep = TypeRep; | |
| 1292 exports.Dynamic = Dynamic; | |
| 1293 exports.dynamic = dynamicR; | |
| 1294 exports.Void = Void; | |
| 1295 exports.void = voidR; | |
| 1296 exports.Bottom = Bottom; | |
| 1297 exports.bottom = bottom; | |
| 1298 exports.JSObject = JSObject; | |
| 1299 exports.jsobject = jsobject; | |
| 1300 exports.AbstractFunctionType = AbstractFunctionType; | |
| 1301 exports.FunctionType = FunctionType; | |
| 1302 exports.Typedef = Typedef; | |
| 1303 exports.functionType = functionType; | |
| 1304 exports.definiteFunctionType = definiteFunctionType; | |
| 1305 exports.typedef = typedef; | |
| 1306 exports.isDartType = isDartType; | |
| 1307 exports.typeName = typeName; | |
| 1308 exports.getImplicitFunctionType = getImplicitFunctionType; | |
| 1309 exports.isFunctionType = isFunctionType; | |
| 1310 exports.isFunctionSubType = isFunctionSubType; | |
| 1311 exports.canonicalType = canonicalType; | |
| 1312 exports.subtypeMap = subtypeMap; | |
| 1313 exports.isSubtype = isSubtype; | |
| 1314 exports.isSubtype_ = isSubtype_; | |
| 1315 exports.isClassSubType = isClassSubType; | |
| 1316 exports.isGroundType = isGroundType; | |
| 1317 exports.defineProperty = defineProperty; | |
| 1318 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor; | |
| 1319 exports.getOwnPropertyNames = getOwnPropertyNames; | |
| 1320 exports.getOwnPropertySymbols = getOwnPropertySymbols; | |
| 1321 exports.hasOwnProperty = hasOwnProperty; | |
| 1322 exports.StrongModeError = StrongModeError; | |
| 1323 exports.throwStrongModeError = throwStrongModeError; | |
| 1324 exports.throwInternalError = throwInternalError; | |
| 1325 exports.getOwnNamesAndSymbols = getOwnNamesAndSymbols; | |
| 1326 exports.safeGetOwnProperty = safeGetOwnProperty; | |
| 1327 exports.defineLazyProperty = defineLazyProperty; | |
| 1328 exports.defineLazy = defineLazy; | |
| 1329 exports.defineMemoizedGetter = defineMemoizedGetter; | |
| 1330 exports.copyTheseProperties = copyTheseProperties; | |
| 1331 exports.copyProperties = copyProperties; | |
| 1332 exports.export = export_; | |
| 1333 exports.defineLazyClass = defineLazyClass; | |
| 1334 exports.defineLazyProperties = defineLazyProperties; | |
| 1335 exports.defineLazyClassGeneric = defineLazyClassGeneric; | |
| 1336 exports.as = as_; | |
| 1337 exports.is = is_; | |
| 1338 exports.global = global_; | |
| 1339 exports.JsSymbol = JsSymbol; | |
| 1340 }); | |
| OLD | NEW |