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