| OLD | NEW |
| 1 var _js_helper; | 1 var _js_helper; |
| 2 (function(exports) { | 2 (function(exports) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 class _Patch extends dart.Object { | 4 class NoSideEffects extends core.Object { |
| 5 NoSideEffects() { |
| 6 } |
| 7 } |
| 8 class NoThrows extends core.Object { |
| 9 NoThrows() { |
| 10 } |
| 11 } |
| 12 class NoInline extends core.Object { |
| 13 NoInline() { |
| 14 } |
| 15 } |
| 16 class IrRepresentation extends core.Object { |
| 17 IrRepresentation(value) { |
| 18 this.value = value; |
| 19 } |
| 20 } |
| 21 class Native extends core.Object { |
| 22 Native(name) { |
| 23 this.name = name; |
| 24 } |
| 25 } |
| 26 let _throwUnmodifiable = Symbol('_throwUnmodifiable'); |
| 27 let ConstantMap$ = dart.generic(function(K, V) { |
| 28 class ConstantMap extends core.Object { |
| 29 ConstantMap$_() { |
| 30 } |
| 31 get isEmpty() { |
| 32 return this.length === 0; |
| 33 } |
| 34 get isNotEmpty() { |
| 35 return !dart.notNull(this.isEmpty); |
| 36 } |
| 37 toString() { |
| 38 return collection.Maps.mapToString(this); |
| 39 } |
| 40 [_throwUnmodifiable]() { |
| 41 throw new core.UnsupportedError("Cannot modify unmodifiable Map"); |
| 42 } |
| 43 set(key, val) { |
| 44 return this[_throwUnmodifiable](); |
| 45 } |
| 46 putIfAbsent(key, ifAbsent) { |
| 47 return dart.as(this[_throwUnmodifiable](), V); |
| 48 } |
| 49 remove(key) { |
| 50 return dart.as(this[_throwUnmodifiable](), V); |
| 51 } |
| 52 clear() { |
| 53 return this[_throwUnmodifiable](); |
| 54 } |
| 55 addAll(other) { |
| 56 return this[_throwUnmodifiable](); |
| 57 } |
| 58 } |
| 59 dart.defineNamedConstructor(ConstantMap, '_'); |
| 60 return ConstantMap; |
| 61 }); |
| 62 let ConstantMap = ConstantMap$(dart.dynamic, dart.dynamic); |
| 63 let _jsObject = Symbol('_jsObject'); |
| 64 let _keys = Symbol('_keys'); |
| 65 let _fetch = Symbol('_fetch'); |
| 66 let ConstantStringMap$ = dart.generic(function(K, V) { |
| 67 class ConstantStringMap extends ConstantMap$(K, V) { |
| 68 ConstantStringMap$_(length, $_jsObject, $_keys) { |
| 69 this.length = length; |
| 70 this[_jsObject] = $_jsObject; |
| 71 this[_keys] = $_keys; |
| 72 super.ConstantMap$_(); |
| 73 } |
| 74 containsValue(needle) { |
| 75 return this.values.any((value) => dart.equals(value, needle)); |
| 76 } |
| 77 containsKey(key) { |
| 78 if (!(typeof key == string)) |
| 79 return false; |
| 80 if (dart.equals('__proto__', key)) |
| 81 return false; |
| 82 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); |
| 83 } |
| 84 get(key) { |
| 85 if (!dart.notNull(this.containsKey(key))) |
| 86 return null; |
| 87 return dart.as(this[_fetch](key), V); |
| 88 } |
| 89 [_fetch](key) { |
| 90 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); |
| 91 } |
| 92 forEach(f) { |
| 93 let keys = this[_keys]; |
| 94 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i)
+ 1) { |
| 95 let key = dart.dindex(keys, i); |
| 96 f(dart.as(key, K), dart.as(this[_fetch](key), V)); |
| 97 } |
| 98 } |
| 99 get keys() { |
| 100 return new _ConstantMapKeyIterable(this); |
| 101 } |
| 102 get values() { |
| 103 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[
_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); |
| 104 } |
| 105 } |
| 106 dart.defineNamedConstructor(ConstantStringMap, '_'); |
| 107 return ConstantStringMap; |
| 108 }); |
| 109 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic); |
| 110 let _protoValue = Symbol('_protoValue'); |
| 111 let ConstantProtoMap$ = dart.generic(function(K, V) { |
| 112 class ConstantProtoMap extends ConstantStringMap$(K, V) { |
| 113 ConstantProtoMap$_(length, jsObject, keys, $_protoValue) { |
| 114 this[_protoValue] = $_protoValue; |
| 115 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k
eys, core.List$(K))); |
| 116 } |
| 117 containsKey(key) { |
| 118 if (!(typeof key == string)) |
| 119 return false; |
| 120 if (dart.equals('__proto__', key)) |
| 121 return true; |
| 122 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); |
| 123 } |
| 124 [_fetch](key) { |
| 125 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc
ess(this[_jsObject], dart.as(key, core.String)); |
| 126 } |
| 127 } |
| 128 dart.defineNamedConstructor(ConstantProtoMap, '_'); |
| 129 return ConstantProtoMap; |
| 130 }); |
| 131 let ConstantProtoMap = ConstantProtoMap$(dart.dynamic, dart.dynamic); |
| 132 let _map = Symbol('_map'); |
| 133 let _ConstantMapKeyIterable$ = dart.generic(function(K) { |
| 134 class _ConstantMapKeyIterable extends collection.IterableBase$(K) { |
| 135 _ConstantMapKeyIterable($_map) { |
| 136 this[_map] = $_map; |
| 137 super.IterableBase(); |
| 138 } |
| 139 get iterator() { |
| 140 return this[_map][_keys].iterator; |
| 141 } |
| 142 get length() { |
| 143 return this[_map][_keys].length; |
| 144 } |
| 145 } |
| 146 return _ConstantMapKeyIterable; |
| 147 }); |
| 148 let _ConstantMapKeyIterable = _ConstantMapKeyIterable$(dart.dynamic); |
| 149 let _jsData = Symbol('_jsData'); |
| 150 let _getMap = Symbol('_getMap'); |
| 151 let GeneralConstantMap$ = dart.generic(function(K, V) { |
| 152 class GeneralConstantMap extends ConstantMap$(K, V) { |
| 153 GeneralConstantMap($_jsData) { |
| 154 this[_jsData] = $_jsData; |
| 155 super.ConstantMap$_(); |
| 156 } |
| 157 [_getMap]() { |
| 158 if (!this.$map) { |
| 159 let backingMap = new collection.LinkedHashMap(); |
| 160 this.$map = fillLiteralMap(this[_jsData], backingMap); |
| 161 } |
| 162 return this.$map; |
| 163 } |
| 164 containsValue(needle) { |
| 165 return this[_getMap]().containsValue(needle); |
| 166 } |
| 167 containsKey(key) { |
| 168 return this[_getMap]().containsKey(key); |
| 169 } |
| 170 get(key) { |
| 171 return this[_getMap]().get(key); |
| 172 } |
| 173 forEach(f) { |
| 174 this[_getMap]().forEach(f); |
| 175 } |
| 176 get keys() { |
| 177 return this[_getMap]().keys; |
| 178 } |
| 179 get values() { |
| 180 return this[_getMap]().values; |
| 181 } |
| 182 get length() { |
| 183 return this[_getMap]().length; |
| 184 } |
| 185 } |
| 186 return GeneralConstantMap; |
| 187 }); |
| 188 let GeneralConstantMap = GeneralConstantMap$(dart.dynamic, dart.dynamic); |
| 189 // Function contains: (String, String) → bool |
| 190 function contains(userAgent, name) { |
| 191 return userAgent.indexOf(name) !== -1; |
| 192 } |
| 193 // Function arrayLength: (List<dynamic>) → int |
| 194 function arrayLength(array) { |
| 195 return array.length; |
| 196 } |
| 197 // Function arrayGet: (List<dynamic>, int) → dynamic |
| 198 function arrayGet(array, index) { |
| 199 return array[index]; |
| 200 } |
| 201 // Function arraySet: (List<dynamic>, int, dynamic) → void |
| 202 function arraySet(array, index, value) { |
| 203 array[index] = value; |
| 204 } |
| 205 // Function propertyGet: (dynamic, String) → dynamic |
| 206 function propertyGet(object, property) { |
| 207 return object[property]; |
| 208 } |
| 209 // Function callHasOwnProperty: (dynamic, dynamic, String) → bool |
| 210 function callHasOwnProperty(function, object, property) { |
| 211 return function.call(object, property); |
| 212 } |
| 213 // Function propertySet: (dynamic, String, dynamic) → void |
| 214 function propertySet(object, property, value) { |
| 215 object[property] = value; |
| 216 } |
| 217 // Function getPropertyFromPrototype: (dynamic, String) → dynamic |
| 218 function getPropertyFromPrototype(object, name) { |
| 219 return Object.getPrototypeOf(object)[name]; |
| 220 } |
| 221 exports.getTagFunction = null; |
| 222 exports.alternateTagFunction = null; |
| 223 exports.prototypeForTagFunction = null; |
| 224 // Function toStringForNativeObject: (dynamic) → String |
| 225 function toStringForNativeObject(obj) { |
| 226 let name = exports.getTagFunction === null ? '<Unknown>' : dart.dinvokef(exp
orts.getTagFunction, obj); |
| 227 return `Instance of ${name}`; |
| 228 } |
| 229 // Function hashCodeForNativeObject: (dynamic) → int |
| 230 function hashCodeForNativeObject(object) { |
| 231 return Primitives.objectHashCode(object); |
| 232 } |
| 233 // Function defineProperty: (dynamic, String, dynamic) → void |
| 234 function defineProperty(obj, property, value) { |
| 235 Object.defineProperty(obj, property, {value: value, enumerable: false, writa
ble: true, configurable: true}); |
| 236 } |
| 237 // Function isDartObject: (dynamic) → bool |
| 238 function isDartObject(obj) { |
| 239 return obj instanceof _foreign_helper.JS_DART_OBJECT_CONSTRUCTOR(); |
| 240 } |
| 241 dart.copyProperties(exports, { |
| 242 get interceptorsByTag() { |
| 243 return _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_
names.INTERCEPTORS_BY_TAG, core.String)); |
| 244 }, |
| 245 get leafTags() { |
| 246 return _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_
names.LEAF_TAGS, core.String)); |
| 247 } |
| 248 }); |
| 249 // Function findDispatchTagForInterceptorClass: (dynamic) → String |
| 250 function findDispatchTagForInterceptorClass(interceptorClassConstructor) { |
| 251 return dart.as(interceptorClassConstructor[_js_embedded_names.NATIVE_SUPERCL
ASS_TAG_NAME], core.String); |
| 252 } |
| 253 exports.dispatchRecordsForInstanceTags = null; |
| 254 exports.interceptorsForUncacheableTags = null; |
| 255 // Function lookupInterceptor: (String) → dynamic |
| 256 function lookupInterceptor(tag) { |
| 257 return propertyGet(exports.interceptorsByTag, tag); |
| 258 } |
| 259 let UNCACHED_MARK = '~'; |
| 260 let INSTANCE_CACHED_MARK = '!'; |
| 261 let LEAF_MARK = '-'; |
| 262 let INTERIOR_MARK = '+'; |
| 263 let DISCRIMINATED_MARK = '*'; |
| 264 // Function lookupAndCacheInterceptor: (dynamic) → dynamic |
| 265 function lookupAndCacheInterceptor(obj) { |
| 266 dart.assert(!dart.notNull(isDartObject(obj))); |
| 267 let tag = dart.as(dart.dinvokef(exports.getTagFunction, obj), core.String); |
| 268 let record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); |
| 269 if (record !== null) |
| 270 return patchInstance(obj, record); |
| 271 let interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); |
| 272 if (interceptor !== null) |
| 273 return interceptor; |
| 274 let interceptorClass = lookupInterceptor(tag); |
| 275 if (interceptorClass === null) { |
| 276 tag = dart.as(dart.dinvokef(exports.alternateTagFunction, obj, tag), core.
String); |
| 277 if (tag !== null) { |
| 278 record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); |
| 279 if (record !== null) |
| 280 return patchInstance(obj, record); |
| 281 interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); |
| 282 if (interceptor !== null) |
| 283 return interceptor; |
| 284 interceptorClass = lookupInterceptor(tag); |
| 285 } |
| 286 } |
| 287 if (interceptorClass === null) { |
| 288 return null; |
| 289 } |
| 290 interceptor = interceptorClass.prototype; |
| 291 let mark = tag[0]; |
| 292 if (dart.equals(mark, INSTANCE_CACHED_MARK)) { |
| 293 record = makeLeafDispatchRecord(interceptor); |
| 294 propertySet(exports.dispatchRecordsForInstanceTags, tag, record); |
| 295 return patchInstance(obj, record); |
| 296 } |
| 297 if (dart.equals(mark, UNCACHED_MARK)) { |
| 298 propertySet(exports.interceptorsForUncacheableTags, tag, interceptor); |
| 299 return interceptor; |
| 300 } |
| 301 if (dart.equals(mark, LEAF_MARK)) { |
| 302 return patchProto(obj, makeLeafDispatchRecord(interceptor)); |
| 303 } |
| 304 if (dart.equals(mark, INTERIOR_MARK)) { |
| 305 return patchInteriorProto(obj, interceptor); |
| 306 } |
| 307 if (dart.equals(mark, DISCRIMINATED_MARK)) { |
| 308 throw new core.UnimplementedError(tag); |
| 309 } |
| 310 let isLeaf = exports.leafTags[tag] === true; |
| 311 if (isLeaf) { |
| 312 return patchProto(obj, makeLeafDispatchRecord(interceptor)); |
| 313 } else { |
| 314 return patchInteriorProto(obj, interceptor); |
| 315 } |
| 316 } |
| 317 // Function patchInstance: (dynamic, dynamic) → dynamic |
| 318 function patchInstance(obj, record) { |
| 319 _interceptors.setDispatchProperty(obj, record); |
| 320 return _interceptors.dispatchRecordInterceptor(record); |
| 321 } |
| 322 // Function patchProto: (dynamic, dynamic) → dynamic |
| 323 function patchProto(obj, record) { |
| 324 _interceptors.setDispatchProperty(Object.getPrototypeOf(obj), record); |
| 325 return _interceptors.dispatchRecordInterceptor(record); |
| 326 } |
| 327 // Function patchInteriorProto: (dynamic, dynamic) → dynamic |
| 328 function patchInteriorProto(obj, interceptor) { |
| 329 let proto = Object.getPrototypeOf(obj); |
| 330 let record = _interceptors.makeDispatchRecord(interceptor, proto, null, null
); |
| 331 _interceptors.setDispatchProperty(proto, record); |
| 332 return interceptor; |
| 333 } |
| 334 // Function makeLeafDispatchRecord: (dynamic) → dynamic |
| 335 function makeLeafDispatchRecord(interceptor) { |
| 336 let fieldName = _foreign_helper.JS_IS_INDEXABLE_FIELD_NAME(); |
| 337 let indexability = !!interceptor[fieldName]; |
| 338 return _interceptors.makeDispatchRecord(interceptor, false, null, indexabili
ty); |
| 339 } |
| 340 // Function makeDefaultDispatchRecord: (dynamic, dynamic, dynamic) → dynamic |
| 341 function makeDefaultDispatchRecord(tag, interceptorClass, proto) { |
| 342 let interceptor = interceptorClass.prototype; |
| 343 let isLeaf = exports.leafTags[tag] === true; |
| 344 if (isLeaf) { |
| 345 return makeLeafDispatchRecord(interceptor); |
| 346 } else { |
| 347 return _interceptors.makeDispatchRecord(interceptor, proto, null, null); |
| 348 } |
| 349 } |
| 350 // Function setNativeSubclassDispatchRecord: (dynamic, dynamic) → dynamic |
| 351 function setNativeSubclassDispatchRecord(proto, interceptor) { |
| 352 _interceptors.setDispatchProperty(proto, makeLeafDispatchRecord(interceptor)
); |
| 353 } |
| 354 // Function constructorNameFallback: (dynamic) → String |
| 355 function constructorNameFallback(object) { |
| 356 return _constructorNameFallback(object); |
| 357 } |
| 358 exports.initNativeDispatchFlag = null; |
| 359 // Function initNativeDispatch: () → void |
| 360 function initNativeDispatch() { |
| 361 if (true === exports.initNativeDispatchFlag) |
| 362 return; |
| 363 exports.initNativeDispatchFlag = true; |
| 364 initNativeDispatchContinue(); |
| 365 } |
| 366 // Function initNativeDispatchContinue: () → void |
| 367 function initNativeDispatchContinue() { |
| 368 exports.dispatchRecordsForInstanceTags = Object.create(null); |
| 369 exports.interceptorsForUncacheableTags = Object.create(null); |
| 370 initHooks(); |
| 371 let map = exports.interceptorsByTag; |
| 372 let tags = Object.getOwnPropertyNames(map); |
| 373 if (typeof window != "undefined") { |
| 374 let context = window; |
| 375 let fun = function() { |
| 376 }; |
| 377 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) +
1) { |
| 378 let tag = dart.dindex(tags, i); |
| 379 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); |
| 380 if (proto !== null) { |
| 381 let interceptorClass = map[tag]; |
| 382 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); |
| 383 if (record !== null) { |
| 384 _interceptors.setDispatchProperty(proto, record); |
| 385 fun.prototype = proto; |
| 386 } |
| 387 } |
| 388 } |
| 389 } |
| 390 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1)
{ |
| 391 let tag = tags[i]; |
| 392 if (/^[A-Za-z_]/.test(tag)) { |
| 393 let interceptorClass = propertyGet(map, tag); |
| 394 propertySet(map, dart.as(dart.dbinary(INSTANCE_CACHED_MARK, '+', tag), c
ore.String), interceptorClass); |
| 395 propertySet(map, dart.as(dart.dbinary(UNCACHED_MARK, '+', tag), core.Str
ing), interceptorClass); |
| 396 propertySet(map, dart.as(dart.dbinary(LEAF_MARK, '+', tag), core.String)
, interceptorClass); |
| 397 propertySet(map, dart.as(dart.dbinary(INTERIOR_MARK, '+', tag), core.Str
ing), interceptorClass); |
| 398 propertySet(map, dart.as(dart.dbinary(DISCRIMINATED_MARK, '+', tag), cor
e.String), interceptorClass); |
| 399 } |
| 400 } |
| 401 } |
| 402 // Function initHooks: () → void |
| 403 function initHooks() { |
| 404 let hooks = _baseHooks(); |
| 405 let _fallbackConstructorHooksTransformer = _fallbackConstructorHooksTransfor
merGenerator(_constructorNameFallback); |
| 406 hooks = applyHooksTransformer(_fallbackConstructorHooksTransformer, hooks); |
| 407 hooks = applyHooksTransformer(_firefoxHooksTransformer, hooks); |
| 408 hooks = applyHooksTransformer(_ieHooksTransformer, hooks); |
| 409 hooks = applyHooksTransformer(_operaHooksTransformer, hooks); |
| 410 hooks = applyHooksTransformer(_safariHooksTransformer, hooks); |
| 411 hooks = applyHooksTransformer(_fixDocumentHooksTransformer, hooks); |
| 412 hooks = applyHooksTransformer(_dartExperimentalFixupGetTagHooksTransformer,
hooks); |
| 413 if (typeof dartNativeDispatchHooksTransformer != "undefined") { |
| 414 let transformers = dartNativeDispatchHooksTransformer; |
| 415 if (typeof transformers == "function") { |
| 416 transformers = new List.from([transformers]); |
| 417 } |
| 418 if (transformers.constructor == Array) { |
| 419 for (let i = 0; dart.notNull(i) < transformers.length; i = dart.notNull(
i) + 1) { |
| 420 let transformer = transformers[i]; |
| 421 if (typeof transformer == "function") { |
| 422 hooks = applyHooksTransformer(transformer, hooks); |
| 423 } |
| 424 } |
| 425 } |
| 426 } |
| 427 let getTag = hooks.getTag; |
| 428 let getUnknownTag = hooks.getUnknownTag; |
| 429 let prototypeForTag = hooks.prototypeForTag; |
| 430 exports.getTagFunction = (o) => getTag(o); |
| 431 exports.alternateTagFunction = (o, tag) => getUnknownTag(o, tag); |
| 432 exports.prototypeForTagFunction = (tag) => prototypeForTag(tag); |
| 433 } |
| 434 // Function applyHooksTransformer: (dynamic, dynamic) → dynamic |
| 435 function applyHooksTransformer(transformer, hooks) { |
| 436 let newHooks = transformer(hooks); |
| 437 return newHooks || hooks; |
| 438 } |
| 439 let _baseHooks = new _foreign_helper.JS_CONST('\nfunction() {\n function type
NameInChrome(o) {\n var constructor = o.constructor;\n if (constructor) {\
n var name = constructor.name;\n if (name) return name;\n }\n va
r s = Object.prototype.toString.call(o);\n return s.substring(8, s.length - 1
);\n }\n function getUnknownTag(object, tag) {\n // This code really belong
s in [getUnknownTagGenericBrowser] but having it\n // here allows [getUnknown
Tag] to be tested on d8.\n if (/^HTML[A-Z].*Element$/.test(tag)) {\n //
Check that it is not a simple JavaScript object.\n var name = Object.protot
ype.toString.call(object);\n if (name == "[object Object]") return null;\n
return "HTMLElement";\n }\n }\n function getUnknownTagGenericBrowser(o
bject, tag) {\n if (self.HTMLElement && object instanceof HTMLElement) return
"HTMLElement";\n return getUnknownTag(object, tag);\n }\n function prototy
peForTag(tag) {\n if (typeof window == "undefined") return null;\n if (typ
eof window[tag] == "undefined") return null;\n var constructor = window[tag];
\n if (typeof constructor != "function") return null;\n return constructor
.prototype;\n }\n function discriminator(tag) { return null; }\n\n var isBrow
ser = typeof navigator == "object";\n\n return {\n getTag: typeNameInChrome,
\n getUnknownTag: isBrowser ? getUnknownTagGenericBrowser : getUnknownTag,\n
prototypeForTag: prototypeForTag,\n discriminator: discriminator };\n}'); |
| 440 let _constructorNameFallback = new _foreign_helper.JS_CONST('\nfunction getTag
Fallback(o) {\n var constructor = o.constructor;\n if (typeof constructor == "
function") {\n var name = constructor.name;\n // If the name is a non-empt
y string, we use that as the type name of this\n // object. There are variou
s cases where that does not work, so we have to\n // detect them and fall thr
ough to the toString() based implementation.\n\n if (typeof name == "string"
&&\n\n // Sometimes the string is empty. This test also catches minified
\n // shadow dom polyfil wrapper for Window on Firefox where the faked\n
// constructor name does not \'stick\'. The shortest real DOM object\n
// names have three characters (e.g. URL, CSS).\n name.length > 2 &
&\n\n // On Firefox we often get "Object" as the constructor name, even f
or\n // more specialized DOM objects.\n name !== "Object" &&\n\n
// This can happen in Opera.\n name !== "Function.prototype") {\n
return name;\n }\n }\n var s = Object.prototype.toString.call(o);\n re
turn s.substring(8, s.length - 1);\n}'); |
| 441 let _fallbackConstructorHooksTransformerGenerator = new _foreign_helper.JS_CON
ST('\nfunction(getTagFallback) {\n return function(hooks) {\n // If we are n
ot in a browser, assume we are in d8.\n // TODO(sra): Recognize jsshell.\n
if (typeof navigator != "object") return hooks;\n\n var ua = navigator.userA
gent;\n // TODO(antonm): remove a reference to DumpRenderTree.\n if (ua.in
dexOf("DumpRenderTree") >= 0) return hooks;\n if (ua.indexOf("Chrome") >= 0)
{\n // Confirm constructor name is usable for dispatch.\n function con
firm(p) {\n return typeof window == "object" && window[p] && window[p].na
me == p;\n }\n if (confirm("Window") && confirm("HTMLElement")) return
hooks;\n }\n\n hooks.getTag = getTagFallback;\n };\n}'); |
| 442 let _ieHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {\n
var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if
(userAgent.indexOf("Trident/") == -1) return hooks;\n\n var getTag = hooks.getT
ag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTransfer"
: "Clipboard",\n "HTMLDDElement": "HTMLElement",\n "HTMLDTElement": "HTMLE
lement",\n "HTMLPhraseElement": "HTMLElement",\n "Position": "Geoposition"
\n };\n\n function getTagIE(o) {\n var tag = getTag(o);\n var newTag = q
uickMap[tag];\n if (newTag) return newTag;\n // Patches for types which re
port themselves as Objects.\n if (tag == "Object") {\n if (window.DataVi
ew && (o instanceof window.DataView)) return "DataView";\n }\n return tag;
\n }\n\n function prototypeForTagIE(tag) {\n var constructor = window[tag];
\n if (constructor == null) return null;\n return constructor.prototype;\n
}\n\n hooks.getTag = getTagIE;\n hooks.prototypeForTag = prototypeForTagIE;\
n}'); |
| 443 let _fixDocumentHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(ho
oks) {\n var getTag = hooks.getTag;\n var prototypeForTag = hooks.prototypeFor
Tag;\n function getTagFixed(o) {\n var tag = getTag(o);\n if (tag == "Doc
ument") {\n // Some browsers and the polymer polyfill call both HTML and XM
L documents\n // "Document", so we check for the xmlVersion property, which
is the empty\n // string on HTML documents. Since both dart:html classes D
ocument and\n // HtmlDocument share the same type, we must patch the instan
ces and not\n // the prototype.\n if (!!o.xmlVersion) return "!Documen
t";\n return "!HTMLDocument";\n }\n return tag;\n }\n\n function pr
ototypeForTagFixed(tag) {\n if (tag == "Document") return null; // Do not pr
e-patch Document.\n return prototypeForTag(tag);\n }\n\n hooks.getTag = get
TagFixed;\n hooks.prototypeForTag = prototypeForTagFixed;\n}'); |
| 444 let _firefoxHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks)
{\n var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n
if (userAgent.indexOf("Firefox") == -1) return hooks;\n\n var getTag = hooks.
getTag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTrans
fer": "Clipboard",\n "GeoGeolocation": "Geolocation",\n "Location": "!Loca
tion", // Fixes issue 18151\n "WorkerMessageEvent": "MessageEve
nt",\n "XMLDocument": "!Document"};\n\n function getTagFirefox(o) {\n var
tag = getTag(o);\n return quickMap[tag] || tag;\n }\n\n hooks.getTag = get
TagFirefox;\n}'); |
| 445 let _operaHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {
return hooks; }\n'); |
| 446 let _safariHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks)
{ return hooks; }\n'); |
| 447 let _dartExperimentalFixupGetTagHooksTransformer = new _foreign_helper.JS_CONS
T('\nfunction(hooks) {\n if (typeof dartExperimentalFixupGetTag != "function")
return hooks;\n hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag);\n}'); |
| 448 let _nativeRegExp = Symbol('_nativeRegExp'); |
| 449 // Function regExpGetNative: (JSSyntaxRegExp) → dynamic |
| 450 function regExpGetNative(regexp) { |
| 451 return regexp[_nativeRegExp]; |
| 452 } |
| 453 let _nativeGlobalVersion = Symbol('_nativeGlobalVersion'); |
| 454 // Function regExpGetGlobalNative: (JSSyntaxRegExp) → dynamic |
| 455 function regExpGetGlobalNative(regexp) { |
| 456 let nativeRegexp = regexp[_nativeGlobalVersion]; |
| 457 nativeRegexp.lastIndex = 0; |
| 458 return nativeRegexp; |
| 459 } |
| 460 let _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion'); |
| 461 // Function regExpCaptureCount: (JSSyntaxRegExp) → int |
| 462 function regExpCaptureCount(regexp) { |
| 463 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion]; |
| 464 let match = nativeAnchoredRegExp.exec(''); |
| 465 return dart.as(dart.dbinary(dart.dload(match, 'length'), '-', 2), core.int); |
| 466 } |
| 467 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp'); |
| 468 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp'); |
| 469 let _isMultiLine = Symbol('_isMultiLine'); |
| 470 let _isCaseSensitive = Symbol('_isCaseSensitive'); |
| 471 let _execGlobal = Symbol('_execGlobal'); |
| 472 let _execAnchored = Symbol('_execAnchored'); |
| 473 class JSSyntaxRegExp extends core.Object { |
| 474 toString() { |
| 475 return `RegExp/${this.pattern}/`; |
| 476 } |
| 477 JSSyntaxRegExp(source, opt$) { |
| 478 let multiLine = opt$.multiLine === void 0 ? false : opt$.multiLine; |
| 479 let caseSensitive = opt$.caseSensitive === void 0 ? true : opt$.caseSensit
ive; |
| 480 this.pattern = source; |
| 481 this[_nativeRegExp] = makeNative(source, multiLine, caseSensitive, false); |
| 482 this[_nativeGlobalRegExp] = null; |
| 483 this[_nativeAnchoredRegExp] = null; |
| 484 } |
| 485 get [_nativeGlobalVersion]() { |
| 486 if (this[_nativeGlobalRegExp] !== null) |
| 487 return this[_nativeGlobalRegExp]; |
| 488 return this[_nativeGlobalRegExp] = makeNative(this.pattern, this[_isMultiL
ine], this[_isCaseSensitive], true); |
| 489 } |
| 490 get [_nativeAnchoredVersion]() { |
| 491 if (this[_nativeAnchoredRegExp] !== null) |
| 492 return this[_nativeAnchoredRegExp]; |
| 493 return this[_nativeAnchoredRegExp] = makeNative(`${this.pattern}|()`, this
[_isMultiLine], this[_isCaseSensitive], true); |
| 494 } |
| 495 get [_isMultiLine]() { |
| 496 return this[_nativeRegExp].multiline; |
| 497 } |
| 498 get [_isCaseSensitive]() { |
| 499 return !this[_nativeRegExp].ignoreCase; |
| 500 } |
| 501 static makeNative(source, multiLine, caseSensitive, global) { |
| 502 checkString(source); |
| 503 let m = multiLine ? 'm' : ''; |
| 504 let i = caseSensitive ? '' : 'i'; |
| 505 let g = global ? 'g' : ''; |
| 506 let regexp = function() { |
| 507 try { |
| 508 return new RegExp(source, m + i + g); |
| 509 } catch (e) { |
| 510 return e; |
| 511 } |
| 512 |
| 513 }(); |
| 514 if (regexp instanceof RegExp) |
| 515 return regexp; |
| 516 let errorMessage = String(regexp); |
| 517 throw new core.FormatException(`Illegal RegExp pattern: ${source}, ${error
Message}`); |
| 518 } |
| 519 firstMatch(string) { |
| 520 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$(
core.String)); |
| 521 if (m === null) |
| 522 return null; |
| 523 return new _MatchImplementation(this, m); |
| 524 } |
| 525 hasMatch(string) { |
| 526 return this[_nativeRegExp].test(checkString(string)); |
| 527 } |
| 528 stringMatch(string) { |
| 529 let match = this.firstMatch(string); |
| 530 if (match !== null) |
| 531 return match.group(0); |
| 532 return null; |
| 533 } |
| 534 allMatches(string, start) { |
| 535 if (start === void 0) |
| 536 start = 0; |
| 537 checkString(string); |
| 538 checkInt(start); |
| 539 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { |
| 540 throw new core.RangeError.range(start, 0, string.length); |
| 541 } |
| 542 return new _AllMatchesIterable(this, string, start); |
| 543 } |
| 544 [_execGlobal](string, start) { |
| 545 let regexp = this[_nativeGlobalVersion]; |
| 546 regexp.lastIndex = start; |
| 547 let match = dart.as(regexp.exec(string), core.List); |
| 548 if (match === null) |
| 549 return null; |
| 550 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); |
| 551 } |
| 552 [_execAnchored](string, start) { |
| 553 let regexp = this[_nativeAnchoredVersion]; |
| 554 regexp.lastIndex = start; |
| 555 let match = dart.as(regexp.exec(string), core.List); |
| 556 if (match === null) |
| 557 return null; |
| 558 if (match.get(dart.notNull(match.length) - 1) !== null) |
| 559 return null; |
| 560 match.length = 1; |
| 561 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); |
| 562 } |
| 563 matchAsPrefix(string, start) { |
| 564 if (start === void 0) |
| 565 start = 0; |
| 566 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { |
| 567 throw new core.RangeError.range(start, 0, string.length); |
| 568 } |
| 569 return this[_execAnchored](string, start); |
| 570 } |
| 571 get isMultiLine() { |
| 572 return this[_isMultiLine]; |
| 573 } |
| 574 get isCaseSensitive() { |
| 575 return this[_isCaseSensitive]; |
| 576 } |
| 577 } |
| 578 let _match = Symbol('_match'); |
| 579 class _MatchImplementation extends core.Object { |
| 580 _MatchImplementation(pattern, $_match) { |
| 581 this.pattern = pattern; |
| 582 this[_match] = $_match; |
| 583 dart.assert(typeof this[_match].input == string); |
| 584 dart.assert(typeof this[_match].index == number); |
| 585 } |
| 586 get input() { |
| 587 return this[_match].input; |
| 588 } |
| 589 get start() { |
| 590 return this[_match].index; |
| 591 } |
| 592 get end() { |
| 593 return dart.notNull(this.start) + dart.notNull(this[_match].get(0).length)
; |
| 594 } |
| 595 group(index) { |
| 596 return this[_match].get(index); |
| 597 } |
| 598 get(index) { |
| 599 return this.group(index); |
| 600 } |
| 601 get groupCount() { |
| 602 return dart.notNull(this[_match].length) - 1; |
| 603 } |
| 604 groups(groups) { |
| 605 let out = dart.as(new List.from([]), core.List$(core.String)); |
| 606 for (let i of groups) { |
| 607 out.add(this.group(i)); |
| 608 } |
| 609 return out; |
| 610 } |
| 611 } |
| 612 let _re = Symbol('_re'); |
| 613 let _string = Symbol('_string'); |
| 614 let _start = Symbol('_start'); |
| 615 class _AllMatchesIterable extends collection.IterableBase$(core.Match) { |
| 616 _AllMatchesIterable($_re, $_string, $_start) { |
| 617 this[_re] = $_re; |
| 618 this[_string] = $_string; |
| 619 this[_start] = $_start; |
| 620 super.IterableBase(); |
| 621 } |
| 622 get iterator() { |
| 623 return new _AllMatchesIterator(this[_re], this[_string], this[_start]); |
| 624 } |
| 625 } |
| 626 let _regExp = Symbol('_regExp'); |
| 627 let _nextIndex = Symbol('_nextIndex'); |
| 628 let _current = Symbol('_current'); |
| 629 class _AllMatchesIterator extends core.Object { |
| 630 _AllMatchesIterator($_regExp, $_string, $_nextIndex) { |
| 631 this[_regExp] = $_regExp; |
| 632 this[_string] = $_string; |
| 633 this[_nextIndex] = $_nextIndex; |
| 634 this[_current] = null; |
| 635 } |
| 636 get current() { |
| 637 return this[_current]; |
| 638 } |
| 639 moveNext() { |
| 640 if (this[_string] === null) |
| 641 return false; |
| 642 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length))
{ |
| 643 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]); |
| 644 if (match !== null) { |
| 645 this[_current] = match; |
| 646 let nextIndex = match.end; |
| 647 if (match.start === nextIndex) { |
| 648 nextIndex = dart.notNull(nextIndex) + 1; |
| 649 } |
| 650 this[_nextIndex] = nextIndex; |
| 651 return true; |
| 652 } |
| 653 } |
| 654 this[_current] = null; |
| 655 this[_string] = null; |
| 656 return false; |
| 657 } |
| 658 } |
| 659 // Function firstMatchAfter: (JSSyntaxRegExp, String, int) → Match |
| 660 function firstMatchAfter(regExp, string, start) { |
| 661 return regExp._execGlobal(string, start); |
| 662 } |
| 663 class StringMatch extends core.Object { |
| 664 StringMatch(start, input, pattern) { |
| 665 this.start = start; |
| 666 this.input = input; |
| 667 this.pattern = pattern; |
| 668 } |
| 669 get end() { |
| 670 return dart.notNull(this.start) + dart.notNull(this.pattern.length); |
| 671 } |
| 672 get(g) { |
| 673 return this.group(g); |
| 674 } |
| 675 get groupCount() { |
| 676 return 0; |
| 677 } |
| 678 group(group_) { |
| 679 if (group_ !== 0) { |
| 680 throw new core.RangeError.value(group_); |
| 681 } |
| 682 return this.pattern; |
| 683 } |
| 684 groups(groups_) { |
| 685 let result = new core.List(); |
| 686 for (let g of groups_) { |
| 687 result.add(this.group(g)); |
| 688 } |
| 689 return result; |
| 690 } |
| 691 } |
| 692 // Function allMatchesInStringUnchecked: (String, String, int) → List<Match> |
| 693 function allMatchesInStringUnchecked(needle, haystack, startIndex) { |
| 694 let result = new core.List(); |
| 695 let length = haystack.length; |
| 696 let patternLength = needle.length; |
| 697 while (true) { |
| 698 let position = haystack.indexOf(needle, startIndex); |
| 699 if (position === -1) { |
| 700 break; |
| 701 } |
| 702 result.add(new StringMatch(position, haystack, needle)); |
| 703 let endIndex = dart.notNull(position) + dart.notNull(patternLength); |
| 704 if (endIndex === length) { |
| 705 break; |
| 706 } else if (position === endIndex) { |
| 707 startIndex = dart.notNull(startIndex) + 1; |
| 708 } else { |
| 709 startIndex = endIndex; |
| 710 } |
| 711 } |
| 712 return result; |
| 713 } |
| 714 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic |
| 715 function stringContainsUnchecked(receiver, other, startIndex) { |
| 716 if (typeof other == string) { |
| 717 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex),
-1); |
| 718 } else if (dart.is(other, JSSyntaxRegExp)) { |
| 719 return dart.dinvoke(other, 'hasMatch', dart.dinvoke(receiver, 'substring',
startIndex)); |
| 720 } else { |
| 721 let substr = dart.dinvoke(receiver, 'substring', startIndex); |
| 722 return dart.dload(dart.dinvoke(other, 'allMatches', substr), 'isNotEmpty')
; |
| 723 } |
| 724 } |
| 725 // Function stringReplaceJS: (dynamic, dynamic, dynamic) → dynamic |
| 726 function stringReplaceJS(receiver, replacer, to) { |
| 727 to = to.replace(/\$/g, "$$$$"); |
| 728 return receiver.replace(replacer, to); |
| 729 } |
| 730 // Function stringReplaceFirstRE: (dynamic, dynamic, dynamic, dynamic) → dynam
ic |
| 731 function stringReplaceFirstRE(receiver, regexp, to, startIndex) { |
| 732 let match = dart.dinvoke(regexp, '_execGlobal', receiver, startIndex); |
| 733 if (match === null) |
| 734 return receiver; |
| 735 let start = dart.dload(match, 'start'); |
| 736 let end = dart.dload(match, 'end'); |
| 737 return `${dart.dinvoke(receiver, 'substring', 0, start)}${to}${dart.dinvoke(
receiver, 'substring', end)}`; |
| 738 } |
| 739 let ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]'; |
| 740 // Function stringReplaceAllUnchecked: (dynamic, dynamic, dynamic) → dynamic |
| 741 function stringReplaceAllUnchecked(receiver, from, to) { |
| 742 checkString(to); |
| 743 if (typeof from == string) { |
| 744 if (dart.equals(from, "")) { |
| 745 if (dart.equals(receiver, "")) { |
| 746 return to; |
| 747 } else { |
| 748 let result = new core.StringBuffer(); |
| 749 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 750 result.write(to); |
| 751 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNu
ll(i) + 1) { |
| 752 result.write(dart.dindex(receiver, i)); |
| 753 result.write(to); |
| 754 } |
| 755 return result.toString(); |
| 756 } |
| 757 } else { |
| 758 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); |
| 759 let quoted = from.replace(quoter, "\\$&"); |
| 760 let replacer = new RegExp(quoted, 'g'); |
| 761 return stringReplaceJS(receiver, replacer, to); |
| 762 } |
| 763 } else if (dart.is(from, JSSyntaxRegExp)) { |
| 764 let re = regExpGetGlobalNative(dart.as(from, JSSyntaxRegExp)); |
| 765 return stringReplaceJS(receiver, re, to); |
| 766 } else { |
| 767 checkNull(from); |
| 768 throw "String.replaceAll(Pattern) UNIMPLEMENTED"; |
| 769 } |
| 770 } |
| 771 // Function _matchString: (Match) → String |
| 772 function _matchString(match) { |
| 773 return match.get(0); |
| 774 } |
| 775 // Function _stringIdentity: (String) → String |
| 776 function _stringIdentity(string) { |
| 777 return string; |
| 778 } |
| 779 // Function stringReplaceAllFuncUnchecked: (dynamic, dynamic, dynamic, dynamic
) → dynamic |
| 780 function stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch)
{ |
| 781 if (!dart.is(pattern, core.Pattern)) { |
| 782 throw new core.ArgumentError(`${pattern} is not a Pattern`); |
| 783 } |
| 784 if (onMatch === null) |
| 785 onMatch = _matchString; |
| 786 if (onNonMatch === null) |
| 787 onNonMatch = _stringIdentity; |
| 788 if (typeof pattern == string) { |
| 789 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN
onMatch); |
| 790 } |
| 791 let buffer = new core.StringBuffer(); |
| 792 let startIndex = 0; |
| 793 for (let match of dart.dinvoke(pattern, 'allMatches', receiver)) { |
| 794 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring',
startIndex, match.start))); |
| 795 buffer.write(dart.dinvokef(onMatch, match)); |
| 796 startIndex = match.end; |
| 797 } |
| 798 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); |
| 799 return buffer.toString(); |
| 800 } |
| 801 // Function stringReplaceAllEmptyFuncUnchecked: (dynamic, dynamic, dynamic) →
dynamic |
| 802 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) { |
| 803 let buffer = new core.StringBuffer(); |
| 804 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 805 let i = 0; |
| 806 buffer.write(dart.dinvokef(onNonMatch, "")); |
| 807 while (dart.notNull(i) < dart.notNull(length)) { |
| 808 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c
ore.String), ""))); |
| 809 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); |
| 810 if ((dart.notNull(code) & ~1023) === 55296 && dart.notNull(length) > dart.
notNull(i) + 1) { |
| 811 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1)
, core.int); |
| 812 if ((dart.notNull(code) & ~1023) === 56320) { |
| 813 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri
ng', i, dart.notNull(i) + 2))); |
| 814 i = 2; |
| 815 continue; |
| 816 } |
| 817 } |
| 818 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); |
| 819 i = dart.notNull(i) + 1; |
| 820 } |
| 821 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor
e.String), ""))); |
| 822 buffer.write(dart.dinvokef(onNonMatch, "")); |
| 823 return buffer.toString(); |
| 824 } |
| 825 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d
ynamic) → dynamic |
| 826 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon
Match) { |
| 827 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); |
| 828 if (patternLength === 0) { |
| 829 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); |
| 830 } |
| 831 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 832 let buffer = new core.StringBuffer(); |
| 833 let startIndex = 0; |
| 834 while (dart.notNull(startIndex) < dart.notNull(length)) { |
| 835 let position = dart.as(dart.dinvoke(receiver, 'indexOf', pattern, startInd
ex), core.int); |
| 836 if (position === -1) { |
| 837 break; |
| 838 } |
| 839 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring',
startIndex, position))); |
| 840 buffer.write(dart.dinvokef(onMatch, new StringMatch(position, dart.as(rece
iver, core.String), dart.as(pattern, core.String)))); |
| 841 startIndex = dart.notNull(position) + dart.notNull(patternLength); |
| 842 } |
| 843 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); |
| 844 return buffer.toString(); |
| 845 } |
| 846 // Function stringReplaceFirstUnchecked: (dynamic, dynamic, dynamic, [int]) →
dynamic |
| 847 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { |
| 848 if (startIndex === void 0) |
| 849 startIndex = 0; |
| 850 if (typeof from == string) { |
| 851 let index = dart.dinvoke(receiver, 'indexOf', from, startIndex); |
| 852 if (dart.dbinary(index, '<', 0)) |
| 853 return receiver; |
| 854 return `${dart.dinvoke(receiver, 'substring', 0, index)}${to}` + `${dart.d
invoke(receiver, 'substring', dart.dbinary(index, '+', dart.dload(from, 'length'
)))}`; |
| 855 } else if (dart.is(from, JSSyntaxRegExp)) { |
| 856 return startIndex === 0 ? stringReplaceJS(receiver, regExpGetNative(dart.a
s(from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startIn
dex); |
| 857 } else { |
| 858 checkNull(from); |
| 859 throw "String.replace(Pattern) UNIMPLEMENTED"; |
| 860 } |
| 861 } |
| 862 // Function stringJoinUnchecked: (dynamic, dynamic) → dynamic |
| 863 function stringJoinUnchecked(array, separator) { |
| 864 return array.join(separator); |
| 865 } |
| 866 // Function createRuntimeType: (String) → Type |
| 867 function createRuntimeType(name) { |
| 868 return new TypeImpl(name); |
| 869 } |
| 870 let _typeName = Symbol('_typeName'); |
| 871 let _unmangledName = Symbol('_unmangledName'); |
| 872 class TypeImpl extends core.Object { |
| 873 TypeImpl($_typeName) { |
| 874 this[_typeName] = $_typeName; |
| 875 this[_unmangledName] = null; |
| 876 } |
| 877 toString() { |
| 878 if (this[_unmangledName] !== null) |
| 879 return this[_unmangledName]; |
| 880 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi
s[_typeName]); |
| 881 return this[_unmangledName] = unmangledName; |
| 882 } |
| 883 get hashCode() { |
| 884 return this[_typeName].hashCode; |
| 885 } |
| 886 ['=='](other) { |
| 887 return dart.notNull(dart.is(other, TypeImpl)) && dart.notNull(dart.equals(
this[_typeName], dart.dload(other, '_typeName'))); |
| 888 } |
| 889 } |
| 890 class TypeVariable extends core.Object { |
| 891 TypeVariable(owner, name, bound) { |
| 892 this.owner = owner; |
| 893 this.name = name; |
| 894 this.bound = bound; |
| 895 } |
| 896 } |
| 897 // Function getMangledTypeName: (TypeImpl) → dynamic |
| 898 function getMangledTypeName(type) { |
| 899 return type[_typeName]; |
| 900 } |
| 901 // Function setRuntimeTypeInfo: (Object, dynamic) → Object |
| 902 function setRuntimeTypeInfo(target, typeInfo) { |
| 903 dart.assert(dart.notNull(typeInfo === null) || dart.notNull(isJsArray(typeIn
fo))); |
| 904 if (target !== null) |
| 905 target.$builtinTypeInfo = typeInfo; |
| 906 return target; |
| 907 } |
| 908 // Function getRuntimeTypeInfo: (Object) → dynamic |
| 909 function getRuntimeTypeInfo(target) { |
| 910 if (target === null) |
| 911 return null; |
| 912 return target.$builtinTypeInfo; |
| 913 } |
| 914 // Function getRuntimeTypeArguments: (dynamic, dynamic) → dynamic |
| 915 function getRuntimeTypeArguments(target, substitutionName) { |
| 916 let substitution = getField(target, `${_foreign_helper.JS_OPERATOR_AS_PREFIX
()}${substitutionName}`); |
| 917 return substitute(substitution, getRuntimeTypeInfo(target)); |
| 918 } |
| 919 // Function getRuntimeTypeArgument: (Object, String, int) → dynamic |
| 920 function getRuntimeTypeArgument(target, substitutionName, index) { |
| 921 let arguments = getRuntimeTypeArguments(target, substitutionName); |
| 922 return arguments === null ? null : getIndex(arguments, index); |
| 923 } |
| 924 // Function getTypeArgumentByIndex: (Object, int) → dynamic |
| 925 function getTypeArgumentByIndex(target, index) { |
| 926 let rti = getRuntimeTypeInfo(target); |
| 927 return rti === null ? null : getIndex(rti, index); |
| 928 } |
| 929 // Function copyTypeArguments: (Object, Object) → void |
| 930 function copyTypeArguments(source, target) { |
| 931 target.$builtinTypeInfo = source.$builtinTypeInfo; |
| 932 } |
| 933 // Function getClassName: (dynamic) → String |
| 934 function getClassName(object) { |
| 935 return _interceptors.getInterceptor(object).constructor.builtin$cls; |
| 936 } |
| 937 // Function getRuntimeTypeAsString: (dynamic, {onTypeVariable: (int) → String}
) → String |
| 938 function getRuntimeTypeAsString(runtimeType, opt$) { |
| 939 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; |
| 940 dart.assert(isJsArray(runtimeType)); |
| 941 let className = getConstructorName(getIndex(runtimeType, 0)); |
| 942 return `${className}` + `${joinArguments(runtimeType, 1, {onTypeVariable: on
TypeVariable})}`; |
| 943 } |
| 944 // Function getConstructorName: (dynamic) → String |
| 945 function getConstructorName(type) { |
| 946 return type.builtin$cls; |
| 947 } |
| 948 // Function runtimeTypeToString: (dynamic, {onTypeVariable: (int) → String}) →
String |
| 949 function runtimeTypeToString(type, opt$) { |
| 950 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; |
| 951 if (type === null) { |
| 952 return 'dynamic'; |
| 953 } else if (isJsArray(type)) { |
| 954 return getRuntimeTypeAsString(type, {onTypeVariable: onTypeVariable}); |
| 955 } else if (isJsFunction(type)) { |
| 956 return getConstructorName(type); |
| 957 } else if (typeof type == number) { |
| 958 if (onTypeVariable === null) { |
| 959 return dart.as(dart.dinvoke(type, 'toString'), core.String); |
| 960 } else { |
| 961 return onTypeVariable(dart.as(type, core.int)); |
| 962 } |
| 963 } else { |
| 964 return null; |
| 965 } |
| 966 } |
| 967 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) →
String |
| 968 function joinArguments(types, startIndex, opt$) { |
| 969 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; |
| 970 if (types === null) |
| 971 return ''; |
| 972 dart.assert(isJsArray(types)); |
| 973 let firstArgument = true; |
| 974 let allDynamic = true; |
| 975 let buffer = new core.StringBuffer(); |
| 976 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty
pes)); index = dart.notNull(index) + 1) { |
| 977 if (firstArgument) { |
| 978 firstArgument = false; |
| 979 } else { |
| 980 buffer.write(', '); |
| 981 } |
| 982 let argument = getIndex(types, index); |
| 983 if (argument !== null) { |
| 984 allDynamic = false; |
| 985 } |
| 986 buffer.write(runtimeTypeToString(argument, {onTypeVariable: onTypeVariable
})); |
| 987 } |
| 988 return allDynamic ? '' : `<${buffer}>`; |
| 989 } |
| 990 // Function getRuntimeTypeString: (dynamic) → String |
| 991 function getRuntimeTypeString(object) { |
| 992 let className = getClassName(object); |
| 993 if (object === null) |
| 994 return className; |
| 995 let typeInfo = object.$builtinTypeInfo; |
| 996 return `${className}${joinArguments(typeInfo, 0)}`; |
| 997 } |
| 998 // Function getRuntimeType: (dynamic) → Type |
| 999 function getRuntimeType(object) { |
| 1000 let type = getRuntimeTypeString(object); |
| 1001 return new TypeImpl(type); |
| 1002 } |
| 1003 // Function substitute: (dynamic, dynamic) → dynamic |
| 1004 function substitute(substitution, arguments) { |
| 1005 dart.assert(dart.notNull(substitution === null) || dart.notNull(isJsFunction
(substitution))); |
| 1006 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum
ents))); |
| 1007 if (isJsFunction(substitution)) { |
| 1008 substitution = invoke(substitution, arguments); |
| 1009 if (isJsArray(substitution)) { |
| 1010 arguments = substitution; |
| 1011 } else if (isJsFunction(substitution)) { |
| 1012 arguments = invoke(substitution, arguments); |
| 1013 } |
| 1014 } |
| 1015 return arguments; |
| 1016 } |
| 1017 // Function checkSubtype: (Object, String, List<dynamic>, String) → bool |
| 1018 function checkSubtype(object, isField, checks, asField) { |
| 1019 if (object === null) |
| 1020 return false; |
| 1021 let arguments = getRuntimeTypeInfo(object); |
| 1022 let interceptor = _interceptors.getInterceptor(object); |
| 1023 let isSubclass = getField(interceptor, isField); |
| 1024 if (isSubclass === null) |
| 1025 return false; |
| 1026 let substitution = getField(interceptor, asField); |
| 1027 return checkArguments(substitution, arguments, checks); |
| 1028 } |
| 1029 // Function computeTypeName: (String, List<dynamic>) → String |
| 1030 function computeTypeName(isField, arguments) { |
| 1031 let prefixLength = _foreign_helper.JS_OPERATOR_IS_PREFIX().length; |
| 1032 return Primitives.formatType(isField.substring(prefixLength, isField.length)
, arguments); |
| 1033 } |
| 1034 // Function subtypeCast: (Object, String, List<dynamic>, String) → Object |
| 1035 function subtypeCast(object, isField, checks, asField) { |
| 1036 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi
eld, checks, asField))) { |
| 1037 let actualType = Primitives.objectTypeName(object); |
| 1038 let typeName = computeTypeName(isField, checks); |
| 1039 throw new CastErrorImplementation(actualType, typeName); |
| 1040 } |
| 1041 return object; |
| 1042 } |
| 1043 // Function assertSubtype: (Object, String, List<dynamic>, String) → Object |
| 1044 function assertSubtype(object, isField, checks, asField) { |
| 1045 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi
eld, checks, asField))) { |
| 1046 let typeName = computeTypeName(isField, checks); |
| 1047 throw new TypeErrorImplementation(object, typeName); |
| 1048 } |
| 1049 return object; |
| 1050 } |
| 1051 // Function assertIsSubtype: (dynamic, dynamic, String) → dynamic |
| 1052 function assertIsSubtype(subtype, supertype, message) { |
| 1053 if (!dart.notNull(isSubtype(subtype, supertype))) { |
| 1054 throwTypeError(message); |
| 1055 } |
| 1056 } |
| 1057 // Function throwTypeError: (dynamic) → dynamic |
| 1058 function throwTypeError(message) { |
| 1059 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String))
; |
| 1060 } |
| 1061 // Function checkArguments: (dynamic, dynamic, dynamic) → bool |
| 1062 function checkArguments(substitution, arguments, checks) { |
| 1063 return areSubtypes(substitute(substitution, arguments), checks); |
| 1064 } |
| 1065 // Function areSubtypes: (dynamic, dynamic) → bool |
| 1066 function areSubtypes(s, t) { |
| 1067 if (dart.notNull(s === null) || dart.notNull(t === null)) |
| 1068 return true; |
| 1069 dart.assert(isJsArray(s)); |
| 1070 dart.assert(isJsArray(t)); |
| 1071 dart.assert(getLength(s) === getLength(t)); |
| 1072 let len = getLength(s); |
| 1073 for (let i = 0; dart.notNull(i) < dart.notNull(len); i = dart.notNull(i) + 1
) { |
| 1074 if (!dart.notNull(isSubtype(getIndex(s, i), getIndex(t, i)))) { |
| 1075 return false; |
| 1076 } |
| 1077 } |
| 1078 return true; |
| 1079 } |
| 1080 // Function computeSignature: (dynamic, dynamic, dynamic) → dynamic |
| 1081 function computeSignature(signature, context, contextName) { |
| 1082 let typeArguments = getRuntimeTypeArguments(context, contextName); |
| 1083 return invokeOn(signature, context, typeArguments); |
| 1084 } |
| 1085 // Function isSupertypeOfNull: (dynamic) → bool |
| 1086 function isSupertypeOfNull(type) { |
| 1087 return dart.notNull(type === null) || dart.notNull(dart.equals(getConstructo
rName(type), _foreign_helper.JS_OBJECT_CLASS_NAME())) || dart.notNull(dart.equal
s(getConstructorName(type), _foreign_helper.JS_NULL_CLASS_NAME())); |
| 1088 } |
| 1089 // Function checkSubtypeOfRuntimeType: (dynamic, dynamic) → bool |
| 1090 function checkSubtypeOfRuntimeType(o, t) { |
| 1091 if (o === null) |
| 1092 return isSupertypeOfNull(t); |
| 1093 if (t === null) |
| 1094 return true; |
| 1095 let rti = getRuntimeTypeInfo(o); |
| 1096 o = _interceptors.getInterceptor(o); |
| 1097 let type = o.constructor; |
| 1098 if (rti !== null) { |
| 1099 rti = rti.slice(); |
| 1100 rti.splice(0, 0, type); |
| 1101 type = rti; |
| 1102 } else if (hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { |
| 1103 let signatureName = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}_${getField
(t, _foreign_helper.JS_FUNCTION_TYPE_TAG())}`; |
| 1104 if (hasField(o, signatureName)) |
| 1105 return true; |
| 1106 let targetSignatureFunction = getField(o, `${_foreign_helper.JS_SIGNATURE_
NAME()}`); |
| 1107 if (targetSignatureFunction === null) |
| 1108 return false; |
| 1109 type = invokeOn(targetSignatureFunction, o, null); |
| 1110 return isFunctionSubtype(type, t); |
| 1111 } |
| 1112 return isSubtype(type, t); |
| 1113 } |
| 1114 // Function subtypeOfRuntimeTypeCast: (Object, dynamic) → Object |
| 1115 function subtypeOfRuntimeTypeCast(object, type) { |
| 1116 if (dart.notNull(object !== null) && !dart.notNull(checkSubtypeOfRuntimeType
(object, type))) { |
| 1117 let actualType = Primitives.objectTypeName(object); |
| 1118 throw new CastErrorImplementation(actualType, runtimeTypeToString(type)); |
| 1119 } |
| 1120 return object; |
| 1121 } |
| 1122 // Function assertSubtypeOfRuntimeType: (Object, dynamic) → Object |
| 1123 function assertSubtypeOfRuntimeType(object, type) { |
| 1124 if (dart.notNull(object !== null) && !dart.notNull(checkSubtypeOfRuntimeType
(object, type))) { |
| 1125 throw new TypeErrorImplementation(object, runtimeTypeToString(type)); |
| 1126 } |
| 1127 return object; |
| 1128 } |
| 1129 // Function getArguments: (dynamic) → dynamic |
| 1130 function getArguments(type) { |
| 1131 return isJsArray(type) ? type.slice(1) : null; |
| 1132 } |
| 1133 // Function isSubtype: (dynamic, dynamic) → bool |
| 1134 function isSubtype(s, t) { |
| 1135 if (isIdentical(s, t)) |
| 1136 return true; |
| 1137 if (dart.notNull(s === null) || dart.notNull(t === null)) |
| 1138 return true; |
| 1139 if (hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { |
| 1140 return isFunctionSubtype(s, t); |
| 1141 } |
| 1142 if (hasField(s, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { |
| 1143 return dart.equals(getConstructorName(t), _foreign_helper.JS_FUNCTION_CLAS
S_NAME()); |
| 1144 } |
| 1145 let typeOfS = isJsArray(s) ? getIndex(s, 0) : s; |
| 1146 let typeOfT = isJsArray(t) ? getIndex(t, 0) : t; |
| 1147 let name = runtimeTypeToString(typeOfT); |
| 1148 let substitution = null; |
| 1149 if (isNotIdentical(typeOfT, typeOfS)) { |
| 1150 let test = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}${name}`; |
| 1151 let typeOfSPrototype = typeOfS.prototype; |
| 1152 if (hasNoField(typeOfSPrototype, test)) |
| 1153 return false; |
| 1154 let field = `${_foreign_helper.JS_OPERATOR_AS_PREFIX()}${runtimeTypeToStri
ng(typeOfT)}`; |
| 1155 substitution = getField(typeOfSPrototype, field); |
| 1156 } |
| 1157 if (!dart.notNull(isJsArray(s)) && dart.notNull(substitution === null) || !d
art.notNull(isJsArray(t))) { |
| 1158 return true; |
| 1159 } |
| 1160 return checkArguments(substitution, getArguments(s), getArguments(t)); |
| 1161 } |
| 1162 // Function isAssignable: (dynamic, dynamic) → bool |
| 1163 function isAssignable(s, t) { |
| 1164 return dart.notNull(isSubtype(s, t)) || dart.notNull(isSubtype(t, s)); |
| 1165 } |
| 1166 // Function areAssignable: (List<dynamic>, List, bool) → bool |
| 1167 function areAssignable(s, t, allowShorter) { |
| 1168 if (dart.notNull(t === null) && dart.notNull(s === null)) |
| 1169 return true; |
| 1170 if (t === null) |
| 1171 return allowShorter; |
| 1172 if (s === null) |
| 1173 return false; |
| 1174 dart.assert(isJsArray(s)); |
| 1175 dart.assert(isJsArray(t)); |
| 1176 let sLength = getLength(s); |
| 1177 let tLength = getLength(t); |
| 1178 if (allowShorter) { |
| 1179 if (dart.notNull(sLength) < dart.notNull(tLength)) |
| 1180 return false; |
| 1181 } else { |
| 1182 if (sLength !== tLength) |
| 1183 return false; |
| 1184 } |
| 1185 for (let i = 0; dart.notNull(i) < dart.notNull(tLength); i = dart.notNull(i)
+ 1) { |
| 1186 if (!dart.notNull(isAssignable(getIndex(s, i), getIndex(t, i)))) { |
| 1187 return false; |
| 1188 } |
| 1189 } |
| 1190 return true; |
| 1191 } |
| 1192 // Function areAssignableMaps: (dynamic, dynamic) → bool |
| 1193 function areAssignableMaps(s, t) { |
| 1194 if (t === null) |
| 1195 return true; |
| 1196 if (s === null) |
| 1197 return false; |
| 1198 dart.assert(isJsObject(s)); |
| 1199 dart.assert(isJsObject(t)); |
| 1200 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPropert
yNames(t), core.List)); |
| 1201 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.notNu
ll(i) + 1) { |
| 1202 let name = names.get(i); |
| 1203 if (!Object.hasOwnProperty.call(s, name)) { |
| 1204 return false; |
| 1205 } |
| 1206 let tType = t[name]; |
| 1207 let sType = s[name]; |
| 1208 if (!dart.notNull(isAssignable(tType, sType))) |
| 1209 return false; |
| 1210 } |
| 1211 return true; |
| 1212 } |
| 1213 // Function isFunctionSubtype: (dynamic, dynamic) → bool |
| 1214 function isFunctionSubtype(s, t) { |
| 1215 dart.assert(hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)); |
| 1216 if (hasNoField(s, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) |
| 1217 return false; |
| 1218 if (hasField(s, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()}`)) { |
| 1219 if (dart.dbinary(hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RE
TURN_TAG()}`), '&&', hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE
_TAG()}`))) { |
| 1220 return false; |
| 1221 } |
| 1222 } else if (hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG
()}`)) { |
| 1223 let sReturnType = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T
YPE_TAG()}`); |
| 1224 let tReturnType = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T
YPE_TAG()}`); |
| 1225 if (!dart.notNull(isAssignable(sReturnType, tReturnType))) |
| 1226 return false; |
| 1227 } |
| 1228 let sParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); |
| 1229 let tParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); |
| 1230 let sOptionalParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); |
| 1231 let tOptionalParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); |
| 1232 let sParametersLen = sParameterTypes !== null ? getLength(sParameterTypes) :
0; |
| 1233 let tParametersLen = tParameterTypes !== null ? getLength(tParameterTypes) :
0; |
| 1234 let sOptionalParametersLen = sOptionalParameterTypes !== null ? getLength(sO
ptionalParameterTypes) : 0; |
| 1235 let tOptionalParametersLen = tOptionalParameterTypes !== null ? getLength(tO
ptionalParameterTypes) : 0; |
| 1236 if (dart.notNull(sParametersLen) > dart.notNull(tParametersLen)) { |
| 1237 return false; |
| 1238 } |
| 1239 if (dart.notNull(sParametersLen) + dart.notNull(sOptionalParametersLen) < da
rt.notNull(tParametersLen) + dart.notNull(tOptionalParametersLen)) { |
| 1240 return false; |
| 1241 } |
| 1242 if (sParametersLen === tParametersLen) { |
| 1243 if (!dart.notNull(areAssignable(dart.as(sParameterTypes, core.List), dart.
as(tParameterTypes, core.List), false))) |
| 1244 return false; |
| 1245 if (!dart.notNull(areAssignable(dart.as(sOptionalParameterTypes, core.List
), dart.as(tOptionalParameterTypes, core.List), true))) { |
| 1246 return false; |
| 1247 } |
| 1248 } else { |
| 1249 let pos = 0; |
| 1250 for (; dart.notNull(pos) < dart.notNull(sParametersLen); pos = dart.notNul
l(pos) + 1) { |
| 1251 if (!dart.notNull(isAssignable(getIndex(sParameterTypes, pos), getIndex(
tParameterTypes, pos)))) { |
| 1252 return false; |
| 1253 } |
| 1254 } |
| 1255 let sPos = 0; |
| 1256 let tPos = pos; |
| 1257 for (; dart.notNull(tPos) < dart.notNull(tParametersLen); sPos = dart.notN
ull(sPos) + 1, tPos = dart.notNull(tPos) + 1) { |
| 1258 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tParameterTypes, tPos)))) { |
| 1259 return false; |
| 1260 } |
| 1261 } |
| 1262 tPos = 0; |
| 1263 for (; dart.notNull(tPos) < dart.notNull(tOptionalParametersLen); sPos = d
art.notNull(sPos) + 1, tPos = dart.notNull(tPos) + 1) { |
| 1264 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tOptionalParameterTypes, tPos)))) { |
| 1265 return false; |
| 1266 } |
| 1267 } |
| 1268 } |
| 1269 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); |
| 1270 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); |
| 1271 return areAssignableMaps(sNamedParameters, tNamedParameters); |
| 1272 } |
| 1273 // Function invoke: (dynamic, dynamic) → dynamic |
| 1274 function invoke(function, arguments) { |
| 1275 return invokeOn(function, null, arguments); |
| 1276 } |
| 1277 // Function invokeOn: (dynamic, dynamic, dynamic) → Object |
| 1278 function invokeOn(function, receiver, arguments) { |
| 1279 dart.assert(isJsFunction(function)); |
| 1280 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum
ents))); |
| 1281 return function.apply(receiver, arguments); |
| 1282 } |
| 1283 // Function call: (dynamic, String) → dynamic |
| 1284 function call(object, name) { |
| 1285 return object[name](); |
| 1286 } |
| 1287 // Function getField: (dynamic, String) → dynamic |
| 1288 function getField(object, name) { |
| 1289 return object[name]; |
| 1290 } |
| 1291 // Function getIndex: (dynamic, int) → dynamic |
| 1292 function getIndex(array, index) { |
| 1293 dart.assert(isJsArray(array)); |
| 1294 return array[index]; |
| 1295 } |
| 1296 // Function getLength: (dynamic) → int |
| 1297 function getLength(array) { |
| 1298 dart.assert(isJsArray(array)); |
| 1299 return array.length; |
| 1300 } |
| 1301 // Function isJsArray: (dynamic) → bool |
| 1302 function isJsArray(value) { |
| 1303 return dart.is(value, _interceptors.JSArray); |
| 1304 } |
| 1305 // Function hasField: (dynamic, dynamic) → dynamic |
| 1306 function hasField(object, name) { |
| 1307 return name in object; |
| 1308 } |
| 1309 // Function hasNoField: (dynamic, dynamic) → dynamic |
| 1310 function hasNoField(object, name) { |
| 1311 return dart.dunary('!', hasField(object, name)); |
| 1312 } |
| 1313 // Function isJsFunction: (dynamic) → bool |
| 1314 function isJsFunction(o) { |
| 1315 return typeof o == "function"; |
| 1316 } |
| 1317 // Function isJsObject: (dynamic) → bool |
| 1318 function isJsObject(o) { |
| 1319 return typeof o == 'object'; |
| 1320 } |
| 1321 // Function isIdentical: (dynamic, dynamic) → bool |
| 1322 function isIdentical(s, t) { |
| 1323 return s === t; |
| 1324 } |
| 1325 // Function isNotIdentical: (dynamic, dynamic) → bool |
| 1326 function isNotIdentical(s, t) { |
| 1327 return s !== t; |
| 1328 } |
| 1329 class _Patch extends core.Object { |
| 5 _Patch() { | 1330 _Patch() { |
| 6 } | 1331 } |
| 7 } | 1332 } |
| 8 let patch = new _Patch(); | 1333 let patch = new _Patch(); |
| 9 class InternalMap extends dart.Object { | 1334 class InternalMap extends core.Object { |
| 10 } | 1335 } |
| 11 // Function requiresPreamble: () → dynamic | 1336 // Function requiresPreamble: () → dynamic |
| 12 function requiresPreamble() { | 1337 function requiresPreamble() { |
| 13 } | 1338 } |
| 14 // Function isJsIndexable: (dynamic, dynamic) → bool | 1339 // Function isJsIndexable: (dynamic, dynamic) → bool |
| 15 function isJsIndexable(object, record) { | 1340 function isJsIndexable(object, record) { |
| 16 if (record !== null) { | 1341 if (record !== null) { |
| 17 let result = _interceptors.dispatchRecordIndexability(record); | 1342 let result = _interceptors.dispatchRecordIndexability(record); |
| 18 if (result !== null) | 1343 if (result !== null) |
| 19 return dart.as(result, core.bool); | 1344 return dart.as(result, core.bool); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 this.cache[method] = true; | 1387 this.cache[method] = true; |
| 63 } | 1388 } |
| 64 } | 1389 } |
| 65 let _memberName = Symbol('_memberName'); | 1390 let _memberName = Symbol('_memberName'); |
| 66 let _internalName = Symbol('_internalName'); | 1391 let _internalName = Symbol('_internalName'); |
| 67 let _kind = Symbol('_kind'); | 1392 let _kind = Symbol('_kind'); |
| 68 let _arguments = Symbol('_arguments'); | 1393 let _arguments = Symbol('_arguments'); |
| 69 let _namedArgumentNames = Symbol('_namedArgumentNames'); | 1394 let _namedArgumentNames = Symbol('_namedArgumentNames'); |
| 70 let _namedIndices = Symbol('_namedIndices'); | 1395 let _namedIndices = Symbol('_namedIndices'); |
| 71 let _getCachedInvocation = Symbol('_getCachedInvocation'); | 1396 let _getCachedInvocation = Symbol('_getCachedInvocation'); |
| 72 class JSInvocationMirror extends dart.Object { | 1397 class JSInvocationMirror extends core.Object { |
| 73 JSInvocationMirror($_memberName, $_internalName, $_kind, $_arguments, $_name
dArgumentNames) { | 1398 JSInvocationMirror($_memberName, $_internalName, $_kind, $_arguments, $_name
dArgumentNames) { |
| 74 this[_memberName] = $_memberName; | 1399 this[_memberName] = $_memberName; |
| 75 this[_internalName] = $_internalName; | 1400 this[_internalName] = $_internalName; |
| 76 this[_kind] = $_kind; | 1401 this[_kind] = $_kind; |
| 77 this[_arguments] = $_arguments; | 1402 this[_arguments] = $_arguments; |
| 78 this[_namedArgumentNames] = $_namedArgumentNames; | 1403 this[_namedArgumentNames] = $_namedArgumentNames; |
| 79 this[_namedIndices] = null; | 1404 this[_namedIndices] = null; |
| 80 } | 1405 } |
| 81 get memberName() { | 1406 get memberName() { |
| 82 if (dart.is(this[_memberName], core.Symbol)) | 1407 if (dart.is(this[_memberName], core.Symbol)) |
| 83 return dart.as(this[_memberName], core.Symbol); | 1408 return dart.as(this[_memberName], core.Symbol); |
| 84 let name = dart.as(this[_memberName], core.String); | 1409 let name = dart.as(this[_memberName], core.String); |
| 85 let unmangledName = _js_names.mangledNames.get(name); | 1410 let unmangledName = _js_names.mangledNames.get(name); |
| 86 if (unmangledName !== null) { | 1411 if (unmangledName !== null) { |
| 87 name = unmangledName.split(':').get(0); | 1412 name = unmangledName.split(':').get(0); |
| 88 } else { | 1413 } else { |
| 89 if (_js_names.mangledNames.get(this[_internalName]) === null) { | 1414 if (_js_names.mangledNames.get(this[_internalName]) === null) { |
| 90 core.print(`Warning: '${name}' is used reflectively but not in Mirrors
Used. ` + "This will break minified code."); | 1415 core.print(`Warning: '${name}' is used reflectively but not in Mirrors
Used. ` + "This will break minified code."); |
| 91 } | 1416 } |
| 92 } | 1417 } |
| 93 this[_memberName] = new _internal.Symbol.unvalidated(name); | 1418 this[_memberName] = new _internal.Symbol.unvalidated(name); |
| 94 return dart.as(this[_memberName], core.Symbol); | 1419 return dart.as(this[_memberName], core.Symbol); |
| 95 } | 1420 } |
| 96 get isMethod() { | 1421 get isMethod() { |
| 97 return this[_kind] === METHOD; | 1422 return this[_kind] === JSInvocationMirror.METHOD; |
| 98 } | 1423 } |
| 99 get isGetter() { | 1424 get isGetter() { |
| 100 return this[_kind] === GETTER; | 1425 return this[_kind] === JSInvocationMirror.GETTER; |
| 101 } | 1426 } |
| 102 get isSetter() { | 1427 get isSetter() { |
| 103 return this[_kind] === SETTER; | 1428 return this[_kind] === JSInvocationMirror.SETTER; |
| 104 } | 1429 } |
| 105 get isAccessor() { | 1430 get isAccessor() { |
| 106 return this[_kind] !== METHOD; | 1431 return this[_kind] !== JSInvocationMirror.METHOD; |
| 107 } | 1432 } |
| 108 get positionalArguments() { | 1433 get positionalArguments() { |
| 109 if (this.isGetter) | 1434 if (this.isGetter) |
| 110 return /* Unimplemented const */new List.from([]); | 1435 return /* Unimplemented const */new List.from([]); |
| 111 let argumentCount = dart.notNull(this[_arguments].length) - dart.notNull(t
his[_namedArgumentNames].length); | 1436 let argumentCount = dart.notNull(this[_arguments].length) - dart.notNull(t
his[_namedArgumentNames].length); |
| 112 if (argumentCount === 0) | 1437 if (argumentCount === 0) |
| 113 return /* Unimplemented const */new List.from([]); | 1438 return /* Unimplemented const */new List.from([]); |
| 114 let list = new List.from([]); | 1439 let list = new List.from([]); |
| 115 for (let index = 0; dart.notNull(index) < dart.notNull(argumentCount); ind
ex = dart.notNull(index) + 1) { | 1440 for (let index = 0; dart.notNull(index) < dart.notNull(argumentCount); ind
ex = dart.notNull(index) + 1) { |
| 116 list.add(this[_arguments].get(index)); | 1441 list.add(this[_arguments].get(index)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 return dart.dinvoke(cached, 'invokeOn', victim, invocation[_arguments]); | 1505 return dart.dinvoke(cached, 'invokeOn', victim, invocation[_arguments]); |
| 181 } | 1506 } |
| 182 } | 1507 } |
| 183 static getCachedInvocation(invocation, victim) { | 1508 static getCachedInvocation(invocation, victim) { |
| 184 return invocation._getCachedInvocation(victim); | 1509 return invocation._getCachedInvocation(victim); |
| 185 } | 1510 } |
| 186 } | 1511 } |
| 187 JSInvocationMirror.METHOD = 0; | 1512 JSInvocationMirror.METHOD = 0; |
| 188 JSInvocationMirror.GETTER = 1; | 1513 JSInvocationMirror.GETTER = 1; |
| 189 JSInvocationMirror.SETTER = 2; | 1514 JSInvocationMirror.SETTER = 2; |
| 190 class CachedInvocation extends dart.Object { | 1515 class CachedInvocation extends core.Object { |
| 191 CachedInvocation(mangledName, jsFunction, isIntercepted, cachedInterceptor)
{ | 1516 CachedInvocation(mangledName, jsFunction, isIntercepted, cachedInterceptor)
{ |
| 192 this.mangledName = mangledName; | 1517 this.mangledName = mangledName; |
| 193 this.jsFunction = jsFunction; | 1518 this.jsFunction = jsFunction; |
| 194 this.isIntercepted = isIntercepted; | 1519 this.isIntercepted = isIntercepted; |
| 195 this.cachedInterceptor = cachedInterceptor; | 1520 this.cachedInterceptor = cachedInterceptor; |
| 196 } | 1521 } |
| 197 get isNoSuchMethod() { | 1522 get isNoSuchMethod() { |
| 198 return false; | 1523 return false; |
| 199 } | 1524 } |
| 200 get isGetterStub() { | 1525 get isGetterStub() { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
few).`); | 1574 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
few).`); |
| 250 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete
rCount)) { | 1575 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete
rCount)) { |
| 251 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
many).`); | 1576 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method
'${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too
many).`); |
| 252 } | 1577 } |
| 253 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar
ameterCount); i = dart.notNull(i) + 1) { | 1578 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar
ameterCount); i = dart.notNull(i) + 1) { |
| 254 arguments.add(getMetadata(this.info.defaultValue(i))); | 1579 arguments.add(getMetadata(this.info.defaultValue(i))); |
| 255 } | 1580 } |
| 256 return this.jsFunction.apply(receiver, arguments); | 1581 return this.jsFunction.apply(receiver, arguments); |
| 257 } | 1582 } |
| 258 } | 1583 } |
| 259 class CachedNoSuchMethodInvocation extends dart.Object { | 1584 class CachedNoSuchMethodInvocation extends core.Object { |
| 260 CachedNoSuchMethodInvocation(interceptor) { | 1585 CachedNoSuchMethodInvocation(interceptor) { |
| 261 this.interceptor = interceptor; | 1586 this.interceptor = interceptor; |
| 262 } | 1587 } |
| 263 get isNoSuchMethod() { | 1588 get isNoSuchMethod() { |
| 264 return true; | 1589 return true; |
| 265 } | 1590 } |
| 266 get isGetterStub() { | 1591 get isGetterStub() { |
| 267 return false; | 1592 return false; |
| 268 } | 1593 } |
| 269 invokeOn(victim, invocation) { | 1594 invokeOn(victim, invocation) { |
| 270 let receiver = this.interceptor === null ? victim : this.interceptor; | 1595 let receiver = this.interceptor === null ? victim : this.interceptor; |
| 271 return dart.dinvoke(receiver, 'noSuchMethod', invocation); | 1596 return dart.dinvoke(receiver, 'noSuchMethod', invocation); |
| 272 } | 1597 } |
| 273 } | 1598 } |
| 274 class ReflectionInfo extends dart.Object { | 1599 class ReflectionInfo extends core.Object { |
| 275 ReflectionInfo$internal(jsFunction, data, isAccessor, requiredParameterCount
, optionalParameterCount, areOptionalParametersNamed, functionType) { | 1600 ReflectionInfo$internal(jsFunction, data, isAccessor, requiredParameterCount
, optionalParameterCount, areOptionalParametersNamed, functionType) { |
| 276 this.jsFunction = jsFunction; | 1601 this.jsFunction = jsFunction; |
| 277 this.data = data; | 1602 this.data = data; |
| 278 this.isAccessor = isAccessor; | 1603 this.isAccessor = isAccessor; |
| 279 this.requiredParameterCount = requiredParameterCount; | 1604 this.requiredParameterCount = requiredParameterCount; |
| 280 this.optionalParameterCount = optionalParameterCount; | 1605 this.optionalParameterCount = optionalParameterCount; |
| 281 this.areOptionalParametersNamed = areOptionalParametersNamed; | 1606 this.areOptionalParametersNamed = areOptionalParametersNamed; |
| 282 this.functionType = functionType; | 1607 this.functionType = functionType; |
| 283 this.cachedSortedIndices = null; | 1608 this.cachedSortedIndices = null; |
| 284 } | 1609 } |
| 285 ReflectionInfo(jsFunction) { | 1610 ReflectionInfo(jsFunction) { |
| 286 let data = dart.as(jsFunction.$reflectionInfo, core.List); | 1611 let data = dart.as(jsFunction.$reflectionInfo, core.List); |
| 287 if (data === null) | 1612 if (data === null) |
| 288 return null; | 1613 return null; |
| 289 data = _interceptors.JSArray.markFixedList(data); | 1614 data = _interceptors.JSArray.markFixedList(data); |
| 290 let requiredParametersInfo = data[REQUIRED_PARAMETERS_INFO]; | 1615 let requiredParametersInfo = data[ReflectionInfo.REQUIRED_PARAMETERS_INFO]
; |
| 291 let requiredParameterCount = requiredParametersInfo >> 1; | 1616 let requiredParameterCount = requiredParametersInfo >> 1; |
| 292 let isAccessor = (dart.notNull(requiredParametersInfo) & 1) === 1; | 1617 let isAccessor = (dart.notNull(requiredParametersInfo) & 1) === 1; |
| 293 let optionalParametersInfo = data[OPTIONAL_PARAMETERS_INFO]; | 1618 let optionalParametersInfo = data[ReflectionInfo.OPTIONAL_PARAMETERS_INFO]
; |
| 294 let optionalParameterCount = optionalParametersInfo >> 1; | 1619 let optionalParameterCount = optionalParametersInfo >> 1; |
| 295 let areOptionalParametersNamed = (dart.notNull(optionalParametersInfo) & 1
) === 1; | 1620 let areOptionalParametersNamed = (dart.notNull(optionalParametersInfo) & 1
) === 1; |
| 296 let functionType = data[FUNCTION_TYPE_INDEX]; | 1621 let functionType = data[ReflectionInfo.FUNCTION_TYPE_INDEX]; |
| 297 return new ReflectionInfo.internal(jsFunction, data, isAccessor, requiredP
arameterCount, optionalParameterCount, areOptionalParametersNamed, functionType)
; | 1622 return new ReflectionInfo.internal(jsFunction, data, isAccessor, requiredP
arameterCount, optionalParameterCount, areOptionalParametersNamed, functionType)
; |
| 298 } | 1623 } |
| 299 parameterName(parameter) { | 1624 parameterName(parameter) { |
| 300 let metadataIndex = null; | 1625 let metadataIndex = null; |
| 301 if (_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA')) { | 1626 if (_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA')) { |
| 302 metadataIndex = this.data[2 * parameter + this.optionalParameterCount +
FIRST_DEFAULT_ARGUMENT]; | 1627 metadataIndex = this.data[2 * parameter + this.optionalParameterCount +
ReflectionInfo.FIRST_DEFAULT_ARGUMENT]; |
| 303 } else { | 1628 } else { |
| 304 metadataIndex = this.data[parameter + this.optionalParameterCount + FIRS
T_DEFAULT_ARGUMENT]; | 1629 metadataIndex = this.data[parameter + this.optionalParameterCount + Refl
ectionInfo.FIRST_DEFAULT_ARGUMENT]; |
| 305 } | 1630 } |
| 306 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded
_names.METADATA, core.String)); | 1631 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded
_names.METADATA, core.String)); |
| 307 return metadata[metadataIndex]; | 1632 return metadata[metadataIndex]; |
| 308 } | 1633 } |
| 309 parameterMetadataAnnotations(parameter) { | 1634 parameterMetadataAnnotations(parameter) { |
| 310 if (!dart.notNull(_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA'))) { | 1635 if (!dart.notNull(_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA'))) { |
| 311 throw new core.StateError('metadata has not been preserved'); | 1636 throw new core.StateError('metadata has not been preserved'); |
| 312 } else { | 1637 } else { |
| 313 return dart.as(this.data[2 * parameter + this.optionalParameterCount + F
IRST_DEFAULT_ARGUMENT + 1], core.List$(core.int)); | 1638 return dart.as(this.data[2 * parameter + this.optionalParameterCount + R
eflectionInfo.FIRST_DEFAULT_ARGUMENT + 1], core.List$(core.int)); |
| 314 } | 1639 } |
| 315 } | 1640 } |
| 316 defaultValue(parameter) { | 1641 defaultValue(parameter) { |
| 317 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) | 1642 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) |
| 318 return null; | 1643 return null; |
| 319 return this.data[FIRST_DEFAULT_ARGUMENT + parameter - this.requiredParamet
erCount]; | 1644 return this.data[ReflectionInfo.FIRST_DEFAULT_ARGUMENT + parameter - this.
requiredParameterCount]; |
| 320 } | 1645 } |
| 321 defaultValueInOrder(parameter) { | 1646 defaultValueInOrder(parameter) { |
| 322 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) | 1647 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount)) |
| 323 return null; | 1648 return null; |
| 324 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet
erCount === 1) { | 1649 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet
erCount === 1) { |
| 325 return this.defaultValue(parameter); | 1650 return this.defaultValue(parameter); |
| 326 } | 1651 } |
| 327 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r
equiredParameterCount)); | 1652 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r
equiredParameterCount)); |
| 328 return this.defaultValue(index); | 1653 return this.defaultValue(index); |
| 329 } | 1654 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 ReflectionInfo.FUNCTION_TYPE_INDEX = 2; | 1700 ReflectionInfo.FUNCTION_TYPE_INDEX = 2; |
| 376 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3; | 1701 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3; |
| 377 // Function getMetadata: (int) → dynamic | 1702 // Function getMetadata: (int) → dynamic |
| 378 function getMetadata(index) { | 1703 function getMetadata(index) { |
| 379 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_n
ames.METADATA, core.String)); | 1704 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_n
ames.METADATA, core.String)); |
| 380 return metadata[index]; | 1705 return metadata[index]; |
| 381 } | 1706 } |
| 382 let _throwFormatException = Symbol('_throwFormatException'); | 1707 let _throwFormatException = Symbol('_throwFormatException'); |
| 383 let _fromCharCodeApply = Symbol('_fromCharCodeApply'); | 1708 let _fromCharCodeApply = Symbol('_fromCharCodeApply'); |
| 384 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType'); | 1709 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType'); |
| 385 let _typeName = Symbol('_typeName'); | 1710 class Primitives extends core.Object { |
| 386 class Primitives extends dart.Object { | |
| 387 static initializeStatics(id) { | 1711 static initializeStatics(id) { |
| 388 mirrorFunctionCacheName = `_${id}`; | 1712 mirrorFunctionCacheName = `_${id}`; |
| 389 mirrorInvokeCacheName = `_${id}`; | 1713 mirrorInvokeCacheName = `_${id}`; |
| 390 } | 1714 } |
| 391 static objectHashCode(object) { | 1715 static objectHashCode(object) { |
| 392 let hash = dart.as(object.$identityHash, core.int); | 1716 let hash = dart.as(object.$identityHash, core.int); |
| 393 if (hash === null) { | 1717 if (hash === null) { |
| 394 hash = Math.random() * 0x3fffffff | 0; | 1718 hash = Math.random() * 0x3fffffff | 0; |
| 395 object.$identityHash = hash; | 1719 object.$identityHash = hash; |
| 396 } | 1720 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j
oinArguments(typeArguments, 0)}`); | 1795 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j
oinArguments(typeArguments, 0)}`); |
| 472 } | 1796 } |
| 473 static objectTypeName(object) { | 1797 static objectTypeName(object) { |
| 474 let name = constructorNameFallback(_interceptors.getInterceptor(object)); | 1798 let name = constructorNameFallback(_interceptors.getInterceptor(object)); |
| 475 if (dart.equals(name, 'Object')) { | 1799 if (dart.equals(name, 'Object')) { |
| 476 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\
s*\(/)[1]; | 1800 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\
s*\(/)[1]; |
| 477 if (typeof decompiled == string) | 1801 if (typeof decompiled == string) |
| 478 if (/^\w+$/.test(decompiled)) | 1802 if (/^\w+$/.test(decompiled)) |
| 479 name = dart.as(decompiled, core.String); | 1803 name = dart.as(decompiled, core.String); |
| 480 } | 1804 } |
| 481 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code
UnitAt(0), DOLLAR_CHAR_VALUE))) { | 1805 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code
UnitAt(0), Primitives.DOLLAR_CHAR_VALUE))) { |
| 482 name = name.substring(1); | 1806 name = name.substring(1); |
| 483 } | 1807 } |
| 484 return formatType(name, dart.as(getRuntimeTypeInfo(object), core.List)); | 1808 return formatType(name, dart.as(getRuntimeTypeInfo(object), core.List)); |
| 485 } | 1809 } |
| 486 static objectToString(object) { | 1810 static objectToString(object) { |
| 487 let name = objectTypeName(object); | 1811 let name = objectTypeName(object); |
| 488 return `Instance of '${name}'`; | 1812 return `Instance of '${name}'`; |
| 489 } | 1813 } |
| 490 static dateNow() { | 1814 static dateNow() { |
| 491 return Date.now(); | 1815 return Date.now(); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 2101 } |
| 778 static extractStackTrace(error) { | 2102 static extractStackTrace(error) { |
| 779 return getTraceFromException(error.$thrownJsError); | 2103 return getTraceFromException(error.$thrownJsError); |
| 780 } | 2104 } |
| 781 } | 2105 } |
| 782 Primitives.mirrorFunctionCacheName = '$cachedFunction'; | 2106 Primitives.mirrorFunctionCacheName = '$cachedFunction'; |
| 783 Primitives.mirrorInvokeCacheName = '$cachedInvocation'; | 2107 Primitives.mirrorInvokeCacheName = '$cachedInvocation'; |
| 784 Primitives.DOLLAR_CHAR_VALUE = 36; | 2108 Primitives.DOLLAR_CHAR_VALUE = 36; |
| 785 Primitives.timerFrequency = null; | 2109 Primitives.timerFrequency = null; |
| 786 Primitives.timerTicks = null; | 2110 Primitives.timerTicks = null; |
| 787 class JsCache extends dart.Object { | 2111 class JsCache extends core.Object { |
| 788 static allocate() { | 2112 static allocate() { |
| 789 let result = Object.create(null); | 2113 let result = Object.create(null); |
| 790 result.x = 0; | 2114 result.x = 0; |
| 791 delete result.x; | 2115 delete result.x; |
| 792 return result; | 2116 return result; |
| 793 } | 2117 } |
| 794 static fetch(cache, key) { | 2118 static fetch(cache, key) { |
| 795 return cache[key]; | 2119 return cache[key]; |
| 796 } | 2120 } |
| 797 static update(cache, key, value) { | 2121 static update(cache, key, value) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 } | 2206 } |
| 883 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic | 2207 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic |
| 884 function throwAbstractClassInstantiationError(className) { | 2208 function throwAbstractClassInstantiationError(className) { |
| 885 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin
g)); | 2209 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin
g)); |
| 886 } | 2210 } |
| 887 let _argumentsExpr = Symbol('_argumentsExpr'); | 2211 let _argumentsExpr = Symbol('_argumentsExpr'); |
| 888 let _expr = Symbol('_expr'); | 2212 let _expr = Symbol('_expr'); |
| 889 let _method = Symbol('_method'); | 2213 let _method = Symbol('_method'); |
| 890 let _receiver = Symbol('_receiver'); | 2214 let _receiver = Symbol('_receiver'); |
| 891 let _pattern = Symbol('_pattern'); | 2215 let _pattern = Symbol('_pattern'); |
| 892 class TypeErrorDecoder extends dart.Object { | 2216 class TypeErrorDecoder extends core.Object { |
| 893 TypeErrorDecoder($_arguments, $_argumentsExpr, $_expr, $_method, $_receiver,
$_pattern) { | 2217 TypeErrorDecoder($_arguments, $_argumentsExpr, $_expr, $_method, $_receiver,
$_pattern) { |
| 894 this[_arguments] = $_arguments; | 2218 this[_arguments] = $_arguments; |
| 895 this[_argumentsExpr] = $_argumentsExpr; | 2219 this[_argumentsExpr] = $_argumentsExpr; |
| 896 this[_expr] = $_expr; | 2220 this[_expr] = $_expr; |
| 897 this[_method] = $_method; | 2221 this[_method] = $_method; |
| 898 this[_receiver] = $_receiver; | 2222 this[_receiver] = $_receiver; |
| 899 this[_pattern] = $_pattern; | 2223 this[_pattern] = $_pattern; |
| 900 } | 2224 } |
| 901 matchTypeError(message) { | 2225 matchTypeError(message) { |
| 902 let match = new RegExp(this[_pattern]).exec(message); | 2226 let match = new RegExp(this[_pattern]).exec(message); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 } | 2483 } |
| 1160 } | 2484 } |
| 1161 return ex; | 2485 return ex; |
| 1162 } | 2486 } |
| 1163 // Function getTraceFromException: (dynamic) → StackTrace | 2487 // Function getTraceFromException: (dynamic) → StackTrace |
| 1164 function getTraceFromException(exception) { | 2488 function getTraceFromException(exception) { |
| 1165 return new _StackTrace(exception); | 2489 return new _StackTrace(exception); |
| 1166 } | 2490 } |
| 1167 let _exception = Symbol('_exception'); | 2491 let _exception = Symbol('_exception'); |
| 1168 let _trace = Symbol('_trace'); | 2492 let _trace = Symbol('_trace'); |
| 1169 class _StackTrace extends dart.Object { | 2493 class _StackTrace extends core.Object { |
| 1170 _StackTrace($_exception) { | 2494 _StackTrace($_exception) { |
| 1171 this[_exception] = $_exception; | 2495 this[_exception] = $_exception; |
| 1172 this[_trace] = null; | 2496 this[_trace] = null; |
| 1173 } | 2497 } |
| 1174 toString() { | 2498 toString() { |
| 1175 if (this[_trace] !== null) | 2499 if (this[_trace] !== null) |
| 1176 return this[_trace]; | 2500 return this[_trace]; |
| 1177 let trace = null; | 2501 let trace = null; |
| 1178 if (typeof this[_exception] === "object") { | 2502 if (typeof this[_exception] === "object") { |
| 1179 trace = dart.as(this[_exception].stack, core.String); | 2503 trace = dart.as(this[_exception].stack, core.String); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 if (!!function) | 2548 if (!!function) |
| 1225 return function; | 2549 return function; |
| 1226 function = function(closure, arity, context, invoke) { | 2550 function = function(closure, arity, context, invoke) { |
| 1227 return function(a1, a2, a3, a4) { | 2551 return function(a1, a2, a3, a4) { |
| 1228 return invoke(closure, context, arity, a1, a2, a3, a4); | 2552 return invoke(closure, context, arity, a1, a2, a3, a4); |
| 1229 }; | 2553 }; |
| 1230 }(closure, arity, _foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _foreign_hel
per.DART_CLOSURE_TO_JS(invokeClosure)); | 2554 }(closure, arity, _foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _foreign_hel
per.DART_CLOSURE_TO_JS(invokeClosure)); |
| 1231 closure.$identity = function; | 2555 closure.$identity = function; |
| 1232 return function; | 2556 return function; |
| 1233 } | 2557 } |
| 1234 class Closure extends dart.Object { | 2558 class Closure extends core.Object { |
| 1235 Closure() { | 2559 Closure() { |
| 1236 } | 2560 } |
| 1237 static fromTearOff(receiver, functions, reflectionInfo, isStatic, jsArgument
s, propertyName) { | 2561 static fromTearOff(receiver, functions, reflectionInfo, isStatic, jsArgument
s, propertyName) { |
| 1238 _foreign_helper.JS_EFFECT(() => { | 2562 _foreign_helper.JS_EFFECT(() => { |
| 1239 BoundClosure.receiverOf(dart.as(void 0, BoundClosure)); | 2563 BoundClosure.receiverOf(dart.as(void 0, BoundClosure)); |
| 1240 BoundClosure.selfOf(dart.as(void 0, BoundClosure)); | 2564 BoundClosure.selfOf(dart.as(void 0, BoundClosure)); |
| 1241 }); | 2565 }); |
| 1242 let function = functions[0]; | 2566 let function = functions[0]; |
| 1243 let name = dart.as(function.$stubName, core.String); | 2567 let name = dart.as(function.$stubName, core.String); |
| 1244 let callName = dart.as(function.$callName, core.String); | 2568 let callName = dart.as(function.$callName, core.String); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 return jsObject.hasOwnProperty(property); | 2848 return jsObject.hasOwnProperty(property); |
| 1525 } | 2849 } |
| 1526 // Function jsPropertyAccess: (dynamic, String) → dynamic | 2850 // Function jsPropertyAccess: (dynamic, String) → dynamic |
| 1527 function jsPropertyAccess(jsObject, property) { | 2851 function jsPropertyAccess(jsObject, property) { |
| 1528 return jsObject[property]; | 2852 return jsObject[property]; |
| 1529 } | 2853 } |
| 1530 // Function getFallThroughError: () → dynamic | 2854 // Function getFallThroughError: () → dynamic |
| 1531 function getFallThroughError() { | 2855 function getFallThroughError() { |
| 1532 return new FallThroughErrorImplementation(); | 2856 return new FallThroughErrorImplementation(); |
| 1533 } | 2857 } |
| 1534 class Creates extends dart.Object { | 2858 class Creates extends core.Object { |
| 1535 Creates(types) { | 2859 Creates(types) { |
| 1536 this.types = types; | 2860 this.types = types; |
| 1537 } | 2861 } |
| 1538 } | 2862 } |
| 1539 class Returns extends dart.Object { | 2863 class Returns extends core.Object { |
| 1540 Returns(types) { | 2864 Returns(types) { |
| 1541 this.types = types; | 2865 this.types = types; |
| 1542 } | 2866 } |
| 1543 } | 2867 } |
| 1544 class JSName extends dart.Object { | 2868 class JSName extends core.Object { |
| 1545 JSName(name) { | 2869 JSName(name) { |
| 1546 this.name = name; | 2870 this.name = name; |
| 1547 } | 2871 } |
| 1548 } | 2872 } |
| 1549 // Function boolConversionCheck: (dynamic) → dynamic | 2873 // Function boolConversionCheck: (dynamic) → dynamic |
| 1550 function boolConversionCheck(value) { | 2874 function boolConversionCheck(value) { |
| 1551 if (typeof value == boolean) | 2875 if (typeof value == boolean) |
| 1552 return value; | 2876 return value; |
| 1553 boolTypeCheck(value); | 2877 boolTypeCheck(value); |
| 1554 dart.assert(value !== null); | 2878 dart.assert(value !== null); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 } | 3198 } |
| 1875 class DeferredNotLoadedError extends core.Error { | 3199 class DeferredNotLoadedError extends core.Error { |
| 1876 DeferredNotLoadedError(libraryName) { | 3200 DeferredNotLoadedError(libraryName) { |
| 1877 this.libraryName = libraryName; | 3201 this.libraryName = libraryName; |
| 1878 super.Error(); | 3202 super.Error(); |
| 1879 } | 3203 } |
| 1880 toString() { | 3204 toString() { |
| 1881 return `Deferred library ${this.libraryName} was not loaded.`; | 3205 return `Deferred library ${this.libraryName} was not loaded.`; |
| 1882 } | 3206 } |
| 1883 } | 3207 } |
| 1884 class RuntimeType extends dart.Object { | 3208 class RuntimeType extends core.Object { |
| 1885 RuntimeType() { | 3209 RuntimeType() { |
| 1886 } | 3210 } |
| 1887 } | 3211 } |
| 1888 let _isTest = Symbol('_isTest'); | 3212 let _isTest = Symbol('_isTest'); |
| 1889 let _extractFunctionTypeObjectFrom = Symbol('_extractFunctionTypeObjectFrom'); | 3213 let _extractFunctionTypeObjectFrom = Symbol('_extractFunctionTypeObjectFrom'); |
| 1890 let _asCheck = Symbol('_asCheck'); | 3214 let _asCheck = Symbol('_asCheck'); |
| 1891 let _check = Symbol('_check'); | 3215 let _check = Symbol('_check'); |
| 1892 let _assertCheck = Symbol('_assertCheck'); | 3216 let _assertCheck = Symbol('_assertCheck'); |
| 1893 class RuntimeFunctionType extends RuntimeType { | 3217 class RuntimeFunctionType extends RuntimeType { |
| 1894 RuntimeFunctionType(returnType, parameterTypes, optionalParameterTypes, name
dParameters) { | 3218 RuntimeFunctionType(returnType, parameterTypes, optionalParameterTypes, name
dParameters) { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 let _cachedToString = Symbol('_cachedToString'); | 3474 let _cachedToString = Symbol('_cachedToString'); |
| 2151 let _hasReturnType = Symbol('_hasReturnType'); | 3475 let _hasReturnType = Symbol('_hasReturnType'); |
| 2152 let _returnType = Symbol('_returnType'); | 3476 let _returnType = Symbol('_returnType'); |
| 2153 let _isVoid = Symbol('_isVoid'); | 3477 let _isVoid = Symbol('_isVoid'); |
| 2154 let _hasArguments = Symbol('_hasArguments'); | 3478 let _hasArguments = Symbol('_hasArguments'); |
| 2155 let _hasOptionalArguments = Symbol('_hasOptionalArguments'); | 3479 let _hasOptionalArguments = Symbol('_hasOptionalArguments'); |
| 2156 let _optionalArguments = Symbol('_optionalArguments'); | 3480 let _optionalArguments = Symbol('_optionalArguments'); |
| 2157 let _hasNamedArguments = Symbol('_hasNamedArguments'); | 3481 let _hasNamedArguments = Symbol('_hasNamedArguments'); |
| 2158 let _namedArguments = Symbol('_namedArguments'); | 3482 let _namedArguments = Symbol('_namedArguments'); |
| 2159 let _convert = Symbol('_convert'); | 3483 let _convert = Symbol('_convert'); |
| 2160 class FunctionTypeInfoDecoderRing extends dart.Object { | 3484 class FunctionTypeInfoDecoderRing extends core.Object { |
| 2161 FunctionTypeInfoDecoderRing($_typeData) { | 3485 FunctionTypeInfoDecoderRing($_typeData) { |
| 2162 this[_typeData] = $_typeData; | 3486 this[_typeData] = $_typeData; |
| 2163 this[_cachedToString] = null; | 3487 this[_cachedToString] = null; |
| 2164 } | 3488 } |
| 2165 get [_hasReturnType]() { | 3489 get [_hasReturnType]() { |
| 2166 return "ret" in this[_typeData]; | 3490 return "ret" in this[_typeData]; |
| 2167 } | 3491 } |
| 2168 get [_returnType]() { | 3492 get [_returnType]() { |
| 2169 return this[_typeData].ret; | 3493 return this[_typeData].ret; |
| 2170 } | 3494 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 throw new MainError("No top-level function named 'main'."); | 3716 throw new MainError("No top-level function named 'main'."); |
| 2393 } | 3717 } |
| 2394 // Function badMain: () → void | 3718 // Function badMain: () → void |
| 2395 function badMain() { | 3719 function badMain() { |
| 2396 throw new MainError("'main' is not a function."); | 3720 throw new MainError("'main' is not a function."); |
| 2397 } | 3721 } |
| 2398 // Function mainHasTooManyParameters: () → void | 3722 // Function mainHasTooManyParameters: () → void |
| 2399 function mainHasTooManyParameters() { | 3723 function mainHasTooManyParameters() { |
| 2400 throw new MainError("'main' expects too many parameters."); | 3724 throw new MainError("'main' expects too many parameters."); |
| 2401 } | 3725 } |
| 2402 class NoSideEffects extends dart.Object { | |
| 2403 NoSideEffects() { | |
| 2404 } | |
| 2405 } | |
| 2406 class NoThrows extends dart.Object { | |
| 2407 NoThrows() { | |
| 2408 } | |
| 2409 } | |
| 2410 class NoInline extends dart.Object { | |
| 2411 NoInline() { | |
| 2412 } | |
| 2413 } | |
| 2414 class IrRepresentation extends dart.Object { | |
| 2415 IrRepresentation(value) { | |
| 2416 this.value = value; | |
| 2417 } | |
| 2418 } | |
| 2419 class Native extends dart.Object { | |
| 2420 Native(name) { | |
| 2421 this.name = name; | |
| 2422 } | |
| 2423 } | |
| 2424 let _throwUnmodifiable = Symbol('_throwUnmodifiable'); | |
| 2425 let ConstantMap$ = dart.generic(function(K, V) { | |
| 2426 class ConstantMap extends dart.Object { | |
| 2427 ConstantMap$_() { | |
| 2428 } | |
| 2429 get isEmpty() { | |
| 2430 return this.length === 0; | |
| 2431 } | |
| 2432 get isNotEmpty() { | |
| 2433 return !dart.notNull(this.isEmpty); | |
| 2434 } | |
| 2435 toString() { | |
| 2436 return collection.Maps.mapToString(this); | |
| 2437 } | |
| 2438 [_throwUnmodifiable]() { | |
| 2439 throw new core.UnsupportedError("Cannot modify unmodifiable Map"); | |
| 2440 } | |
| 2441 set(key, val) { | |
| 2442 return this[_throwUnmodifiable](); | |
| 2443 } | |
| 2444 putIfAbsent(key, ifAbsent) { | |
| 2445 return dart.as(this[_throwUnmodifiable](), V); | |
| 2446 } | |
| 2447 remove(key) { | |
| 2448 return dart.as(this[_throwUnmodifiable](), V); | |
| 2449 } | |
| 2450 clear() { | |
| 2451 return this[_throwUnmodifiable](); | |
| 2452 } | |
| 2453 addAll(other) { | |
| 2454 return this[_throwUnmodifiable](); | |
| 2455 } | |
| 2456 } | |
| 2457 dart.defineNamedConstructor(ConstantMap, '_'); | |
| 2458 return ConstantMap; | |
| 2459 }); | |
| 2460 let ConstantMap = ConstantMap$(dynamic, dynamic); | |
| 2461 let _jsObject = Symbol('_jsObject'); | |
| 2462 let _keys = Symbol('_keys'); | |
| 2463 let _fetch = Symbol('_fetch'); | |
| 2464 let ConstantStringMap$ = dart.generic(function(K, V) { | |
| 2465 class ConstantStringMap extends ConstantMap$(K, V) { | |
| 2466 ConstantStringMap$_(length, $_jsObject, $_keys) { | |
| 2467 this.length = length; | |
| 2468 this[_jsObject] = $_jsObject; | |
| 2469 this[_keys] = $_keys; | |
| 2470 super.ConstantMap$_(); | |
| 2471 } | |
| 2472 containsValue(needle) { | |
| 2473 return this.values.any((value) => dart.equals(value, needle)); | |
| 2474 } | |
| 2475 containsKey(key) { | |
| 2476 if (!(typeof key == string)) | |
| 2477 return false; | |
| 2478 if (dart.equals('__proto__', key)) | |
| 2479 return false; | |
| 2480 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); | |
| 2481 } | |
| 2482 get(key) { | |
| 2483 if (!dart.notNull(this.containsKey(key))) | |
| 2484 return null; | |
| 2485 return dart.as(this[_fetch](key), V); | |
| 2486 } | |
| 2487 [_fetch](key) { | |
| 2488 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); | |
| 2489 } | |
| 2490 forEach(f) { | |
| 2491 let keys = this[_keys]; | |
| 2492 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i)
+ 1) { | |
| 2493 let key = dart.dindex(keys, i); | |
| 2494 f(dart.as(key, K), dart.as(this[_fetch](key), V)); | |
| 2495 } | |
| 2496 } | |
| 2497 get keys() { | |
| 2498 return new _ConstantMapKeyIterable(this); | |
| 2499 } | |
| 2500 get values() { | |
| 2501 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[
_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); | |
| 2502 } | |
| 2503 } | |
| 2504 dart.defineNamedConstructor(ConstantStringMap, '_'); | |
| 2505 return ConstantStringMap; | |
| 2506 }); | |
| 2507 let ConstantStringMap = ConstantStringMap$(dynamic, dynamic); | |
| 2508 let _protoValue = Symbol('_protoValue'); | |
| 2509 let ConstantProtoMap$ = dart.generic(function(K, V) { | |
| 2510 class ConstantProtoMap extends ConstantStringMap$(K, V) { | |
| 2511 ConstantProtoMap$_(length, jsObject, keys, $_protoValue) { | |
| 2512 this[_protoValue] = $_protoValue; | |
| 2513 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k
eys, core.List$(K))); | |
| 2514 } | |
| 2515 containsKey(key) { | |
| 2516 if (!(typeof key == string)) | |
| 2517 return false; | |
| 2518 if (dart.equals('__proto__', key)) | |
| 2519 return true; | |
| 2520 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); | |
| 2521 } | |
| 2522 [_fetch](key) { | |
| 2523 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc
ess(this[_jsObject], dart.as(key, core.String)); | |
| 2524 } | |
| 2525 } | |
| 2526 dart.defineNamedConstructor(ConstantProtoMap, '_'); | |
| 2527 return ConstantProtoMap; | |
| 2528 }); | |
| 2529 let ConstantProtoMap = ConstantProtoMap$(dynamic, dynamic); | |
| 2530 let _map = Symbol('_map'); | |
| 2531 let _ConstantMapKeyIterable$ = dart.generic(function(K) { | |
| 2532 class _ConstantMapKeyIterable extends collection.IterableBase$(K) { | |
| 2533 _ConstantMapKeyIterable($_map) { | |
| 2534 this[_map] = $_map; | |
| 2535 super.IterableBase(); | |
| 2536 } | |
| 2537 get iterator() { | |
| 2538 return this[_map][_keys].iterator; | |
| 2539 } | |
| 2540 get length() { | |
| 2541 return this[_map][_keys].length; | |
| 2542 } | |
| 2543 } | |
| 2544 return _ConstantMapKeyIterable; | |
| 2545 }); | |
| 2546 let _ConstantMapKeyIterable = _ConstantMapKeyIterable$(dynamic); | |
| 2547 let _jsData = Symbol('_jsData'); | |
| 2548 let _getMap = Symbol('_getMap'); | |
| 2549 let GeneralConstantMap$ = dart.generic(function(K, V) { | |
| 2550 class GeneralConstantMap extends ConstantMap$(K, V) { | |
| 2551 GeneralConstantMap($_jsData) { | |
| 2552 this[_jsData] = $_jsData; | |
| 2553 super.ConstantMap$_(); | |
| 2554 } | |
| 2555 [_getMap]() { | |
| 2556 if (!this.$map) { | |
| 2557 let backingMap = new collection.LinkedHashMap(); | |
| 2558 this.$map = fillLiteralMap(this[_jsData], backingMap); | |
| 2559 } | |
| 2560 return this.$map; | |
| 2561 } | |
| 2562 containsValue(needle) { | |
| 2563 return this[_getMap]().containsValue(needle); | |
| 2564 } | |
| 2565 containsKey(key) { | |
| 2566 return this[_getMap]().containsKey(key); | |
| 2567 } | |
| 2568 get(key) { | |
| 2569 return this[_getMap]().get(key); | |
| 2570 } | |
| 2571 forEach(f) { | |
| 2572 this[_getMap]().forEach(f); | |
| 2573 } | |
| 2574 get keys() { | |
| 2575 return this[_getMap]().keys; | |
| 2576 } | |
| 2577 get values() { | |
| 2578 return this[_getMap]().values; | |
| 2579 } | |
| 2580 get length() { | |
| 2581 return this[_getMap]().length; | |
| 2582 } | |
| 2583 } | |
| 2584 return GeneralConstantMap; | |
| 2585 }); | |
| 2586 let GeneralConstantMap = GeneralConstantMap$(dynamic, dynamic); | |
| 2587 // Function contains: (String, String) → bool | |
| 2588 function contains(userAgent, name) { | |
| 2589 return userAgent.indexOf(name) !== -1; | |
| 2590 } | |
| 2591 // Function arrayLength: (List<dynamic>) → int | |
| 2592 function arrayLength(array) { | |
| 2593 return array.length; | |
| 2594 } | |
| 2595 // Function arrayGet: (List<dynamic>, int) → dynamic | |
| 2596 function arrayGet(array, index) { | |
| 2597 return array[index]; | |
| 2598 } | |
| 2599 // Function arraySet: (List<dynamic>, int, dynamic) → void | |
| 2600 function arraySet(array, index, value) { | |
| 2601 array[index] = value; | |
| 2602 } | |
| 2603 // Function propertyGet: (dynamic, String) → dynamic | |
| 2604 function propertyGet(object, property) { | |
| 2605 return object[property]; | |
| 2606 } | |
| 2607 // Function callHasOwnProperty: (dynamic, dynamic, String) → bool | |
| 2608 function callHasOwnProperty(function, object, property) { | |
| 2609 return function.call(object, property); | |
| 2610 } | |
| 2611 // Function propertySet: (dynamic, String, dynamic) → void | |
| 2612 function propertySet(object, property, value) { | |
| 2613 object[property] = value; | |
| 2614 } | |
| 2615 // Function getPropertyFromPrototype: (dynamic, String) → dynamic | |
| 2616 function getPropertyFromPrototype(object, name) { | |
| 2617 return Object.getPrototypeOf(object)[name]; | |
| 2618 } | |
| 2619 exports.getTagFunction = null; | |
| 2620 exports.alternateTagFunction = null; | |
| 2621 exports.prototypeForTagFunction = null; | |
| 2622 // Function toStringForNativeObject: (dynamic) → String | |
| 2623 function toStringForNativeObject(obj) { | |
| 2624 let name = exports.getTagFunction === null ? '<Unknown>' : dart.dinvokef(exp
orts.getTagFunction, obj); | |
| 2625 return `Instance of ${name}`; | |
| 2626 } | |
| 2627 // Function hashCodeForNativeObject: (dynamic) → int | |
| 2628 function hashCodeForNativeObject(object) { | |
| 2629 return Primitives.objectHashCode(object); | |
| 2630 } | |
| 2631 // Function defineProperty: (dynamic, String, dynamic) → void | |
| 2632 function defineProperty(obj, property, value) { | |
| 2633 Object.defineProperty(obj, property, {value: value, enumerable: false, writa
ble: true, configurable: true}); | |
| 2634 } | |
| 2635 // Function isDartObject: (dynamic) → bool | |
| 2636 function isDartObject(obj) { | |
| 2637 return obj instanceof _foreign_helper.JS_DART_OBJECT_CONSTRUCTOR(); | |
| 2638 } | |
| 2639 dart.copyProperties(exports, { | |
| 2640 get interceptorsByTag() { | |
| 2641 return _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_
names.INTERCEPTORS_BY_TAG, core.String)); | |
| 2642 }, | |
| 2643 get leafTags() { | |
| 2644 return _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedded_
names.LEAF_TAGS, core.String)); | |
| 2645 } | |
| 2646 }); | |
| 2647 // Function findDispatchTagForInterceptorClass: (dynamic) → String | |
| 2648 function findDispatchTagForInterceptorClass(interceptorClassConstructor) { | |
| 2649 return dart.as(interceptorClassConstructor[_js_embedded_names.NATIVE_SUPERCL
ASS_TAG_NAME], core.String); | |
| 2650 } | |
| 2651 exports.dispatchRecordsForInstanceTags = null; | |
| 2652 exports.interceptorsForUncacheableTags = null; | |
| 2653 // Function lookupInterceptor: (String) → dynamic | |
| 2654 function lookupInterceptor(tag) { | |
| 2655 return propertyGet(exports.interceptorsByTag, tag); | |
| 2656 } | |
| 2657 let UNCACHED_MARK = '~'; | |
| 2658 let INSTANCE_CACHED_MARK = '!'; | |
| 2659 let LEAF_MARK = '-'; | |
| 2660 let INTERIOR_MARK = '+'; | |
| 2661 let DISCRIMINATED_MARK = '*'; | |
| 2662 // Function lookupAndCacheInterceptor: (dynamic) → dynamic | |
| 2663 function lookupAndCacheInterceptor(obj) { | |
| 2664 dart.assert(!dart.notNull(isDartObject(obj))); | |
| 2665 let tag = dart.as(dart.dinvokef(exports.getTagFunction, obj), core.String); | |
| 2666 let record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); | |
| 2667 if (record !== null) | |
| 2668 return patchInstance(obj, record); | |
| 2669 let interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); | |
| 2670 if (interceptor !== null) | |
| 2671 return interceptor; | |
| 2672 let interceptorClass = lookupInterceptor(tag); | |
| 2673 if (interceptorClass === null) { | |
| 2674 tag = dart.as(dart.dinvokef(exports.alternateTagFunction, obj, tag), core.
String); | |
| 2675 if (tag !== null) { | |
| 2676 record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); | |
| 2677 if (record !== null) | |
| 2678 return patchInstance(obj, record); | |
| 2679 interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); | |
| 2680 if (interceptor !== null) | |
| 2681 return interceptor; | |
| 2682 interceptorClass = lookupInterceptor(tag); | |
| 2683 } | |
| 2684 } | |
| 2685 if (interceptorClass === null) { | |
| 2686 return null; | |
| 2687 } | |
| 2688 interceptor = interceptorClass.prototype; | |
| 2689 let mark = tag[0]; | |
| 2690 if (dart.equals(mark, INSTANCE_CACHED_MARK)) { | |
| 2691 record = makeLeafDispatchRecord(interceptor); | |
| 2692 propertySet(exports.dispatchRecordsForInstanceTags, tag, record); | |
| 2693 return patchInstance(obj, record); | |
| 2694 } | |
| 2695 if (dart.equals(mark, UNCACHED_MARK)) { | |
| 2696 propertySet(exports.interceptorsForUncacheableTags, tag, interceptor); | |
| 2697 return interceptor; | |
| 2698 } | |
| 2699 if (dart.equals(mark, LEAF_MARK)) { | |
| 2700 return patchProto(obj, makeLeafDispatchRecord(interceptor)); | |
| 2701 } | |
| 2702 if (dart.equals(mark, INTERIOR_MARK)) { | |
| 2703 return patchInteriorProto(obj, interceptor); | |
| 2704 } | |
| 2705 if (dart.equals(mark, DISCRIMINATED_MARK)) { | |
| 2706 throw new core.UnimplementedError(tag); | |
| 2707 } | |
| 2708 let isLeaf = exports.leafTags[tag] === true; | |
| 2709 if (isLeaf) { | |
| 2710 return patchProto(obj, makeLeafDispatchRecord(interceptor)); | |
| 2711 } else { | |
| 2712 return patchInteriorProto(obj, interceptor); | |
| 2713 } | |
| 2714 } | |
| 2715 // Function patchInstance: (dynamic, dynamic) → dynamic | |
| 2716 function patchInstance(obj, record) { | |
| 2717 _interceptors.setDispatchProperty(obj, record); | |
| 2718 return _interceptors.dispatchRecordInterceptor(record); | |
| 2719 } | |
| 2720 // Function patchProto: (dynamic, dynamic) → dynamic | |
| 2721 function patchProto(obj, record) { | |
| 2722 _interceptors.setDispatchProperty(Object.getPrototypeOf(obj), record); | |
| 2723 return _interceptors.dispatchRecordInterceptor(record); | |
| 2724 } | |
| 2725 // Function patchInteriorProto: (dynamic, dynamic) → dynamic | |
| 2726 function patchInteriorProto(obj, interceptor) { | |
| 2727 let proto = Object.getPrototypeOf(obj); | |
| 2728 let record = _interceptors.makeDispatchRecord(interceptor, proto, null, null
); | |
| 2729 _interceptors.setDispatchProperty(proto, record); | |
| 2730 return interceptor; | |
| 2731 } | |
| 2732 // Function makeLeafDispatchRecord: (dynamic) → dynamic | |
| 2733 function makeLeafDispatchRecord(interceptor) { | |
| 2734 let fieldName = _foreign_helper.JS_IS_INDEXABLE_FIELD_NAME(); | |
| 2735 let indexability = !!interceptor[fieldName]; | |
| 2736 return _interceptors.makeDispatchRecord(interceptor, false, null, indexabili
ty); | |
| 2737 } | |
| 2738 // Function makeDefaultDispatchRecord: (dynamic, dynamic, dynamic) → dynamic | |
| 2739 function makeDefaultDispatchRecord(tag, interceptorClass, proto) { | |
| 2740 let interceptor = interceptorClass.prototype; | |
| 2741 let isLeaf = exports.leafTags[tag] === true; | |
| 2742 if (isLeaf) { | |
| 2743 return makeLeafDispatchRecord(interceptor); | |
| 2744 } else { | |
| 2745 return _interceptors.makeDispatchRecord(interceptor, proto, null, null); | |
| 2746 } | |
| 2747 } | |
| 2748 // Function setNativeSubclassDispatchRecord: (dynamic, dynamic) → dynamic | |
| 2749 function setNativeSubclassDispatchRecord(proto, interceptor) { | |
| 2750 _interceptors.setDispatchProperty(proto, makeLeafDispatchRecord(interceptor)
); | |
| 2751 } | |
| 2752 // Function constructorNameFallback: (dynamic) → String | |
| 2753 function constructorNameFallback(object) { | |
| 2754 return _constructorNameFallback(object); | |
| 2755 } | |
| 2756 exports.initNativeDispatchFlag = null; | |
| 2757 // Function initNativeDispatch: () → void | |
| 2758 function initNativeDispatch() { | |
| 2759 if (true === exports.initNativeDispatchFlag) | |
| 2760 return; | |
| 2761 exports.initNativeDispatchFlag = true; | |
| 2762 initNativeDispatchContinue(); | |
| 2763 } | |
| 2764 // Function initNativeDispatchContinue: () → void | |
| 2765 function initNativeDispatchContinue() { | |
| 2766 exports.dispatchRecordsForInstanceTags = Object.create(null); | |
| 2767 exports.interceptorsForUncacheableTags = Object.create(null); | |
| 2768 initHooks(); | |
| 2769 let map = exports.interceptorsByTag; | |
| 2770 let tags = Object.getOwnPropertyNames(map); | |
| 2771 if (typeof window != "undefined") { | |
| 2772 let context = window; | |
| 2773 let fun = function() { | |
| 2774 }; | |
| 2775 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) +
1) { | |
| 2776 let tag = dart.dindex(tags, i); | |
| 2777 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); | |
| 2778 if (proto !== null) { | |
| 2779 let interceptorClass = map[tag]; | |
| 2780 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); | |
| 2781 if (record !== null) { | |
| 2782 _interceptors.setDispatchProperty(proto, record); | |
| 2783 fun.prototype = proto; | |
| 2784 } | |
| 2785 } | |
| 2786 } | |
| 2787 } | |
| 2788 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1)
{ | |
| 2789 let tag = tags[i]; | |
| 2790 if (/^[A-Za-z_]/.test(tag)) { | |
| 2791 let interceptorClass = propertyGet(map, tag); | |
| 2792 propertySet(map, dart.as(dart.dbinary(INSTANCE_CACHED_MARK, '+', tag), c
ore.String), interceptorClass); | |
| 2793 propertySet(map, dart.as(dart.dbinary(UNCACHED_MARK, '+', tag), core.Str
ing), interceptorClass); | |
| 2794 propertySet(map, dart.as(dart.dbinary(LEAF_MARK, '+', tag), core.String)
, interceptorClass); | |
| 2795 propertySet(map, dart.as(dart.dbinary(INTERIOR_MARK, '+', tag), core.Str
ing), interceptorClass); | |
| 2796 propertySet(map, dart.as(dart.dbinary(DISCRIMINATED_MARK, '+', tag), cor
e.String), interceptorClass); | |
| 2797 } | |
| 2798 } | |
| 2799 } | |
| 2800 // Function initHooks: () → void | |
| 2801 function initHooks() { | |
| 2802 let hooks = _baseHooks(); | |
| 2803 let _fallbackConstructorHooksTransformer = _fallbackConstructorHooksTransfor
merGenerator(_constructorNameFallback); | |
| 2804 hooks = applyHooksTransformer(_fallbackConstructorHooksTransformer, hooks); | |
| 2805 hooks = applyHooksTransformer(_firefoxHooksTransformer, hooks); | |
| 2806 hooks = applyHooksTransformer(_ieHooksTransformer, hooks); | |
| 2807 hooks = applyHooksTransformer(_operaHooksTransformer, hooks); | |
| 2808 hooks = applyHooksTransformer(_safariHooksTransformer, hooks); | |
| 2809 hooks = applyHooksTransformer(_fixDocumentHooksTransformer, hooks); | |
| 2810 hooks = applyHooksTransformer(_dartExperimentalFixupGetTagHooksTransformer,
hooks); | |
| 2811 if (typeof dartNativeDispatchHooksTransformer != "undefined") { | |
| 2812 let transformers = dartNativeDispatchHooksTransformer; | |
| 2813 if (typeof transformers == "function") { | |
| 2814 transformers = new List.from([transformers]); | |
| 2815 } | |
| 2816 if (transformers.constructor == Array) { | |
| 2817 for (let i = 0; dart.notNull(i) < transformers.length; i = dart.notNull(
i) + 1) { | |
| 2818 let transformer = transformers[i]; | |
| 2819 if (typeof transformer == "function") { | |
| 2820 hooks = applyHooksTransformer(transformer, hooks); | |
| 2821 } | |
| 2822 } | |
| 2823 } | |
| 2824 } | |
| 2825 let getTag = hooks.getTag; | |
| 2826 let getUnknownTag = hooks.getUnknownTag; | |
| 2827 let prototypeForTag = hooks.prototypeForTag; | |
| 2828 exports.getTagFunction = (o) => getTag(o); | |
| 2829 exports.alternateTagFunction = (o, tag) => getUnknownTag(o, tag); | |
| 2830 exports.prototypeForTagFunction = (tag) => prototypeForTag(tag); | |
| 2831 } | |
| 2832 // Function applyHooksTransformer: (dynamic, dynamic) → dynamic | |
| 2833 function applyHooksTransformer(transformer, hooks) { | |
| 2834 let newHooks = transformer(hooks); | |
| 2835 return newHooks || hooks; | |
| 2836 } | |
| 2837 let _baseHooks = new _foreign_helper.JS_CONST('\nfunction() {\n function type
NameInChrome(o) {\n var constructor = o.constructor;\n if (constructor) {\
n var name = constructor.name;\n if (name) return name;\n }\n va
r s = Object.prototype.toString.call(o);\n return s.substring(8, s.length - 1
);\n }\n function getUnknownTag(object, tag) {\n // This code really belong
s in [getUnknownTagGenericBrowser] but having it\n // here allows [getUnknown
Tag] to be tested on d8.\n if (/^HTML[A-Z].*Element$/.test(tag)) {\n //
Check that it is not a simple JavaScript object.\n var name = Object.protot
ype.toString.call(object);\n if (name == "[object Object]") return null;\n
return "HTMLElement";\n }\n }\n function getUnknownTagGenericBrowser(o
bject, tag) {\n if (self.HTMLElement && object instanceof HTMLElement) return
"HTMLElement";\n return getUnknownTag(object, tag);\n }\n function prototy
peForTag(tag) {\n if (typeof window == "undefined") return null;\n if (typ
eof window[tag] == "undefined") return null;\n var constructor = window[tag];
\n if (typeof constructor != "function") return null;\n return constructor
.prototype;\n }\n function discriminator(tag) { return null; }\n\n var isBrow
ser = typeof navigator == "object";\n\n return {\n getTag: typeNameInChrome,
\n getUnknownTag: isBrowser ? getUnknownTagGenericBrowser : getUnknownTag,\n
prototypeForTag: prototypeForTag,\n discriminator: discriminator };\n}'); | |
| 2838 let _constructorNameFallback = new _foreign_helper.JS_CONST('\nfunction getTag
Fallback(o) {\n var constructor = o.constructor;\n if (typeof constructor == "
function") {\n var name = constructor.name;\n // If the name is a non-empt
y string, we use that as the type name of this\n // object. There are variou
s cases where that does not work, so we have to\n // detect them and fall thr
ough to the toString() based implementation.\n\n if (typeof name == "string"
&&\n\n // Sometimes the string is empty. This test also catches minified
\n // shadow dom polyfil wrapper for Window on Firefox where the faked\n
// constructor name does not \'stick\'. The shortest real DOM object\n
// names have three characters (e.g. URL, CSS).\n name.length > 2 &
&\n\n // On Firefox we often get "Object" as the constructor name, even f
or\n // more specialized DOM objects.\n name !== "Object" &&\n\n
// This can happen in Opera.\n name !== "Function.prototype") {\n
return name;\n }\n }\n var s = Object.prototype.toString.call(o);\n re
turn s.substring(8, s.length - 1);\n}'); | |
| 2839 let _fallbackConstructorHooksTransformerGenerator = new _foreign_helper.JS_CON
ST('\nfunction(getTagFallback) {\n return function(hooks) {\n // If we are n
ot in a browser, assume we are in d8.\n // TODO(sra): Recognize jsshell.\n
if (typeof navigator != "object") return hooks;\n\n var ua = navigator.userA
gent;\n // TODO(antonm): remove a reference to DumpRenderTree.\n if (ua.in
dexOf("DumpRenderTree") >= 0) return hooks;\n if (ua.indexOf("Chrome") >= 0)
{\n // Confirm constructor name is usable for dispatch.\n function con
firm(p) {\n return typeof window == "object" && window[p] && window[p].na
me == p;\n }\n if (confirm("Window") && confirm("HTMLElement")) return
hooks;\n }\n\n hooks.getTag = getTagFallback;\n };\n}'); | |
| 2840 let _ieHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {\n
var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if
(userAgent.indexOf("Trident/") == -1) return hooks;\n\n var getTag = hooks.getT
ag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTransfer"
: "Clipboard",\n "HTMLDDElement": "HTMLElement",\n "HTMLDTElement": "HTMLE
lement",\n "HTMLPhraseElement": "HTMLElement",\n "Position": "Geoposition"
\n };\n\n function getTagIE(o) {\n var tag = getTag(o);\n var newTag = q
uickMap[tag];\n if (newTag) return newTag;\n // Patches for types which re
port themselves as Objects.\n if (tag == "Object") {\n if (window.DataVi
ew && (o instanceof window.DataView)) return "DataView";\n }\n return tag;
\n }\n\n function prototypeForTagIE(tag) {\n var constructor = window[tag];
\n if (constructor == null) return null;\n return constructor.prototype;\n
}\n\n hooks.getTag = getTagIE;\n hooks.prototypeForTag = prototypeForTagIE;\
n}'); | |
| 2841 let _fixDocumentHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(ho
oks) {\n var getTag = hooks.getTag;\n var prototypeForTag = hooks.prototypeFor
Tag;\n function getTagFixed(o) {\n var tag = getTag(o);\n if (tag == "Doc
ument") {\n // Some browsers and the polymer polyfill call both HTML and XM
L documents\n // "Document", so we check for the xmlVersion property, which
is the empty\n // string on HTML documents. Since both dart:html classes D
ocument and\n // HtmlDocument share the same type, we must patch the instan
ces and not\n // the prototype.\n if (!!o.xmlVersion) return "!Documen
t";\n return "!HTMLDocument";\n }\n return tag;\n }\n\n function pr
ototypeForTagFixed(tag) {\n if (tag == "Document") return null; // Do not pr
e-patch Document.\n return prototypeForTag(tag);\n }\n\n hooks.getTag = get
TagFixed;\n hooks.prototypeForTag = prototypeForTagFixed;\n}'); | |
| 2842 let _firefoxHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks)
{\n var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n
if (userAgent.indexOf("Firefox") == -1) return hooks;\n\n var getTag = hooks.
getTag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTrans
fer": "Clipboard",\n "GeoGeolocation": "Geolocation",\n "Location": "!Loca
tion", // Fixes issue 18151\n "WorkerMessageEvent": "MessageEve
nt",\n "XMLDocument": "!Document"};\n\n function getTagFirefox(o) {\n var
tag = getTag(o);\n return quickMap[tag] || tag;\n }\n\n hooks.getTag = get
TagFirefox;\n}'); | |
| 2843 let _operaHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {
return hooks; }\n'); | |
| 2844 let _safariHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks)
{ return hooks; }\n'); | |
| 2845 let _dartExperimentalFixupGetTagHooksTransformer = new _foreign_helper.JS_CONS
T('\nfunction(hooks) {\n if (typeof dartExperimentalFixupGetTag != "function")
return hooks;\n hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag);\n}'); | |
| 2846 let _nativeRegExp = Symbol('_nativeRegExp'); | |
| 2847 // Function regExpGetNative: (JSSyntaxRegExp) → dynamic | |
| 2848 function regExpGetNative(regexp) { | |
| 2849 return regexp[_nativeRegExp]; | |
| 2850 } | |
| 2851 let _nativeGlobalVersion = Symbol('_nativeGlobalVersion'); | |
| 2852 // Function regExpGetGlobalNative: (JSSyntaxRegExp) → dynamic | |
| 2853 function regExpGetGlobalNative(regexp) { | |
| 2854 let nativeRegexp = regexp[_nativeGlobalVersion]; | |
| 2855 nativeRegexp.lastIndex = 0; | |
| 2856 return nativeRegexp; | |
| 2857 } | |
| 2858 let _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion'); | |
| 2859 // Function regExpCaptureCount: (JSSyntaxRegExp) → int | |
| 2860 function regExpCaptureCount(regexp) { | |
| 2861 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion]; | |
| 2862 let match = nativeAnchoredRegExp.exec(''); | |
| 2863 return dart.as(dart.dbinary(dart.dload(match, 'length'), '-', 2), core.int); | |
| 2864 } | |
| 2865 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp'); | |
| 2866 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp'); | |
| 2867 let _isMultiLine = Symbol('_isMultiLine'); | |
| 2868 let _isCaseSensitive = Symbol('_isCaseSensitive'); | |
| 2869 let _execGlobal = Symbol('_execGlobal'); | |
| 2870 let _execAnchored = Symbol('_execAnchored'); | |
| 2871 class JSSyntaxRegExp extends dart.Object { | |
| 2872 toString() { | |
| 2873 return `RegExp/${this.pattern}/`; | |
| 2874 } | |
| 2875 JSSyntaxRegExp(source, opt$) { | |
| 2876 let multiLine = opt$.multiLine === void 0 ? false : opt$.multiLine; | |
| 2877 let caseSensitive = opt$.caseSensitive === void 0 ? true : opt$.caseSensit
ive; | |
| 2878 this.pattern = source; | |
| 2879 this[_nativeRegExp] = makeNative(source, multiLine, caseSensitive, false); | |
| 2880 this[_nativeGlobalRegExp] = null; | |
| 2881 this[_nativeAnchoredRegExp] = null; | |
| 2882 } | |
| 2883 get [_nativeGlobalVersion]() { | |
| 2884 if (this[_nativeGlobalRegExp] !== null) | |
| 2885 return this[_nativeGlobalRegExp]; | |
| 2886 return this[_nativeGlobalRegExp] = makeNative(this.pattern, this[_isMultiL
ine], this[_isCaseSensitive], true); | |
| 2887 } | |
| 2888 get [_nativeAnchoredVersion]() { | |
| 2889 if (this[_nativeAnchoredRegExp] !== null) | |
| 2890 return this[_nativeAnchoredRegExp]; | |
| 2891 return this[_nativeAnchoredRegExp] = makeNative(`${this.pattern}|()`, this
[_isMultiLine], this[_isCaseSensitive], true); | |
| 2892 } | |
| 2893 get [_isMultiLine]() { | |
| 2894 return this[_nativeRegExp].multiline; | |
| 2895 } | |
| 2896 get [_isCaseSensitive]() { | |
| 2897 return !this[_nativeRegExp].ignoreCase; | |
| 2898 } | |
| 2899 static makeNative(source, multiLine, caseSensitive, global) { | |
| 2900 checkString(source); | |
| 2901 let m = multiLine ? 'm' : ''; | |
| 2902 let i = caseSensitive ? '' : 'i'; | |
| 2903 let g = global ? 'g' : ''; | |
| 2904 let regexp = function() { | |
| 2905 try { | |
| 2906 return new RegExp(source, m + i + g); | |
| 2907 } catch (e) { | |
| 2908 return e; | |
| 2909 } | |
| 2910 | |
| 2911 }(); | |
| 2912 if (regexp instanceof RegExp) | |
| 2913 return regexp; | |
| 2914 let errorMessage = String(regexp); | |
| 2915 throw new core.FormatException(`Illegal RegExp pattern: ${source}, ${error
Message}`); | |
| 2916 } | |
| 2917 firstMatch(string) { | |
| 2918 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$(
core.String)); | |
| 2919 if (m === null) | |
| 2920 return null; | |
| 2921 return new _MatchImplementation(this, m); | |
| 2922 } | |
| 2923 hasMatch(string) { | |
| 2924 return this[_nativeRegExp].test(checkString(string)); | |
| 2925 } | |
| 2926 stringMatch(string) { | |
| 2927 let match = this.firstMatch(string); | |
| 2928 if (match !== null) | |
| 2929 return match.group(0); | |
| 2930 return null; | |
| 2931 } | |
| 2932 allMatches(string, start) { | |
| 2933 if (start === void 0) | |
| 2934 start = 0; | |
| 2935 checkString(string); | |
| 2936 checkInt(start); | |
| 2937 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { | |
| 2938 throw new core.RangeError.range(start, 0, string.length); | |
| 2939 } | |
| 2940 return new _AllMatchesIterable(this, string, start); | |
| 2941 } | |
| 2942 [_execGlobal](string, start) { | |
| 2943 let regexp = this[_nativeGlobalVersion]; | |
| 2944 regexp.lastIndex = start; | |
| 2945 let match = dart.as(regexp.exec(string), core.List); | |
| 2946 if (match === null) | |
| 2947 return null; | |
| 2948 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); | |
| 2949 } | |
| 2950 [_execAnchored](string, start) { | |
| 2951 let regexp = this[_nativeAnchoredVersion]; | |
| 2952 regexp.lastIndex = start; | |
| 2953 let match = dart.as(regexp.exec(string), core.List); | |
| 2954 if (match === null) | |
| 2955 return null; | |
| 2956 if (match.get(dart.notNull(match.length) - 1) !== null) | |
| 2957 return null; | |
| 2958 match.length = 1; | |
| 2959 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); | |
| 2960 } | |
| 2961 matchAsPrefix(string, start) { | |
| 2962 if (start === void 0) | |
| 2963 start = 0; | |
| 2964 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l
ength)) { | |
| 2965 throw new core.RangeError.range(start, 0, string.length); | |
| 2966 } | |
| 2967 return this[_execAnchored](string, start); | |
| 2968 } | |
| 2969 get isMultiLine() { | |
| 2970 return this[_isMultiLine]; | |
| 2971 } | |
| 2972 get isCaseSensitive() { | |
| 2973 return this[_isCaseSensitive]; | |
| 2974 } | |
| 2975 } | |
| 2976 let _match = Symbol('_match'); | |
| 2977 class _MatchImplementation extends dart.Object { | |
| 2978 _MatchImplementation(pattern, $_match) { | |
| 2979 this.pattern = pattern; | |
| 2980 this[_match] = $_match; | |
| 2981 dart.assert(typeof this[_match].input == string); | |
| 2982 dart.assert(typeof this[_match].index == number); | |
| 2983 } | |
| 2984 get input() { | |
| 2985 return this[_match].input; | |
| 2986 } | |
| 2987 get start() { | |
| 2988 return this[_match].index; | |
| 2989 } | |
| 2990 get end() { | |
| 2991 return dart.notNull(this.start) + dart.notNull(this[_match].get(0).length)
; | |
| 2992 } | |
| 2993 group(index) { | |
| 2994 return this[_match].get(index); | |
| 2995 } | |
| 2996 get(index) { | |
| 2997 return this.group(index); | |
| 2998 } | |
| 2999 get groupCount() { | |
| 3000 return dart.notNull(this[_match].length) - 1; | |
| 3001 } | |
| 3002 groups(groups) { | |
| 3003 let out = dart.as(new List.from([]), core.List$(core.String)); | |
| 3004 for (let i of groups) { | |
| 3005 out.add(this.group(i)); | |
| 3006 } | |
| 3007 return out; | |
| 3008 } | |
| 3009 } | |
| 3010 let _re = Symbol('_re'); | |
| 3011 let _string = Symbol('_string'); | |
| 3012 let _start = Symbol('_start'); | |
| 3013 class _AllMatchesIterable extends collection.IterableBase$(core.Match) { | |
| 3014 _AllMatchesIterable($_re, $_string, $_start) { | |
| 3015 this[_re] = $_re; | |
| 3016 this[_string] = $_string; | |
| 3017 this[_start] = $_start; | |
| 3018 super.IterableBase(); | |
| 3019 } | |
| 3020 get iterator() { | |
| 3021 return new _AllMatchesIterator(this[_re], this[_string], this[_start]); | |
| 3022 } | |
| 3023 } | |
| 3024 let _regExp = Symbol('_regExp'); | |
| 3025 let _nextIndex = Symbol('_nextIndex'); | |
| 3026 let _current = Symbol('_current'); | |
| 3027 class _AllMatchesIterator extends dart.Object { | |
| 3028 _AllMatchesIterator($_regExp, $_string, $_nextIndex) { | |
| 3029 this[_regExp] = $_regExp; | |
| 3030 this[_string] = $_string; | |
| 3031 this[_nextIndex] = $_nextIndex; | |
| 3032 this[_current] = null; | |
| 3033 } | |
| 3034 get current() { | |
| 3035 return this[_current]; | |
| 3036 } | |
| 3037 moveNext() { | |
| 3038 if (this[_string] === null) | |
| 3039 return false; | |
| 3040 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length))
{ | |
| 3041 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]); | |
| 3042 if (match !== null) { | |
| 3043 this[_current] = match; | |
| 3044 let nextIndex = match.end; | |
| 3045 if (match.start === nextIndex) { | |
| 3046 nextIndex = dart.notNull(nextIndex) + 1; | |
| 3047 } | |
| 3048 this[_nextIndex] = nextIndex; | |
| 3049 return true; | |
| 3050 } | |
| 3051 } | |
| 3052 this[_current] = null; | |
| 3053 this[_string] = null; | |
| 3054 return false; | |
| 3055 } | |
| 3056 } | |
| 3057 // Function firstMatchAfter: (JSSyntaxRegExp, String, int) → Match | |
| 3058 function firstMatchAfter(regExp, string, start) { | |
| 3059 return regExp._execGlobal(string, start); | |
| 3060 } | |
| 3061 class StringMatch extends dart.Object { | |
| 3062 StringMatch(start, input, pattern) { | |
| 3063 this.start = start; | |
| 3064 this.input = input; | |
| 3065 this.pattern = pattern; | |
| 3066 } | |
| 3067 get end() { | |
| 3068 return dart.notNull(this.start) + dart.notNull(this.pattern.length); | |
| 3069 } | |
| 3070 get(g) { | |
| 3071 return this.group(g); | |
| 3072 } | |
| 3073 get groupCount() { | |
| 3074 return 0; | |
| 3075 } | |
| 3076 group(group_) { | |
| 3077 if (group_ !== 0) { | |
| 3078 throw new core.RangeError.value(group_); | |
| 3079 } | |
| 3080 return this.pattern; | |
| 3081 } | |
| 3082 groups(groups_) { | |
| 3083 let result = new core.List(); | |
| 3084 for (let g of groups_) { | |
| 3085 result.add(this.group(g)); | |
| 3086 } | |
| 3087 return result; | |
| 3088 } | |
| 3089 } | |
| 3090 // Function allMatchesInStringUnchecked: (String, String, int) → List<Match> | |
| 3091 function allMatchesInStringUnchecked(needle, haystack, startIndex) { | |
| 3092 let result = new core.List(); | |
| 3093 let length = haystack.length; | |
| 3094 let patternLength = needle.length; | |
| 3095 while (true) { | |
| 3096 let position = haystack.indexOf(needle, startIndex); | |
| 3097 if (position === -1) { | |
| 3098 break; | |
| 3099 } | |
| 3100 result.add(new StringMatch(position, haystack, needle)); | |
| 3101 let endIndex = dart.notNull(position) + dart.notNull(patternLength); | |
| 3102 if (endIndex === length) { | |
| 3103 break; | |
| 3104 } else if (position === endIndex) { | |
| 3105 startIndex = dart.notNull(startIndex) + 1; | |
| 3106 } else { | |
| 3107 startIndex = endIndex; | |
| 3108 } | |
| 3109 } | |
| 3110 return result; | |
| 3111 } | |
| 3112 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic | |
| 3113 function stringContainsUnchecked(receiver, other, startIndex) { | |
| 3114 if (typeof other == string) { | |
| 3115 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex),
-1); | |
| 3116 } else if (dart.is(other, JSSyntaxRegExp)) { | |
| 3117 return dart.dinvoke(other, 'hasMatch', dart.dinvoke(receiver, 'substring',
startIndex)); | |
| 3118 } else { | |
| 3119 let substr = dart.dinvoke(receiver, 'substring', startIndex); | |
| 3120 return dart.dload(dart.dinvoke(other, 'allMatches', substr), 'isNotEmpty')
; | |
| 3121 } | |
| 3122 } | |
| 3123 // Function stringReplaceJS: (dynamic, dynamic, dynamic) → dynamic | |
| 3124 function stringReplaceJS(receiver, replacer, to) { | |
| 3125 to = to.replace(/\$/g, "$$$$"); | |
| 3126 return receiver.replace(replacer, to); | |
| 3127 } | |
| 3128 // Function stringReplaceFirstRE: (dynamic, dynamic, dynamic, dynamic) → dynam
ic | |
| 3129 function stringReplaceFirstRE(receiver, regexp, to, startIndex) { | |
| 3130 let match = dart.dinvoke(regexp, '_execGlobal', receiver, startIndex); | |
| 3131 if (match === null) | |
| 3132 return receiver; | |
| 3133 let start = dart.dload(match, 'start'); | |
| 3134 let end = dart.dload(match, 'end'); | |
| 3135 return `${dart.dinvoke(receiver, 'substring', 0, start)}${to}${dart.dinvoke(
receiver, 'substring', end)}`; | |
| 3136 } | |
| 3137 let ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]'; | |
| 3138 // Function stringReplaceAllUnchecked: (dynamic, dynamic, dynamic) → dynamic | |
| 3139 function stringReplaceAllUnchecked(receiver, from, to) { | |
| 3140 checkString(to); | |
| 3141 if (typeof from == string) { | |
| 3142 if (dart.equals(from, "")) { | |
| 3143 if (dart.equals(receiver, "")) { | |
| 3144 return to; | |
| 3145 } else { | |
| 3146 let result = new core.StringBuffer(); | |
| 3147 let length = dart.as(dart.dload(receiver, 'length'), core.int); | |
| 3148 result.write(to); | |
| 3149 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNu
ll(i) + 1) { | |
| 3150 result.write(dart.dindex(receiver, i)); | |
| 3151 result.write(to); | |
| 3152 } | |
| 3153 return result.toString(); | |
| 3154 } | |
| 3155 } else { | |
| 3156 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); | |
| 3157 let quoted = from.replace(quoter, "\\$&"); | |
| 3158 let replacer = new RegExp(quoted, 'g'); | |
| 3159 return stringReplaceJS(receiver, replacer, to); | |
| 3160 } | |
| 3161 } else if (dart.is(from, JSSyntaxRegExp)) { | |
| 3162 let re = regExpGetGlobalNative(dart.as(from, JSSyntaxRegExp)); | |
| 3163 return stringReplaceJS(receiver, re, to); | |
| 3164 } else { | |
| 3165 checkNull(from); | |
| 3166 throw "String.replaceAll(Pattern) UNIMPLEMENTED"; | |
| 3167 } | |
| 3168 } | |
| 3169 // Function _matchString: (Match) → String | |
| 3170 function _matchString(match) { | |
| 3171 return match.get(0); | |
| 3172 } | |
| 3173 // Function _stringIdentity: (String) → String | |
| 3174 function _stringIdentity(string) { | |
| 3175 return string; | |
| 3176 } | |
| 3177 // Function stringReplaceAllFuncUnchecked: (dynamic, dynamic, dynamic, dynamic
) → dynamic | |
| 3178 function stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch)
{ | |
| 3179 if (!dart.is(pattern, core.Pattern)) { | |
| 3180 throw new core.ArgumentError(`${pattern} is not a Pattern`); | |
| 3181 } | |
| 3182 if (onMatch === null) | |
| 3183 onMatch = _matchString; | |
| 3184 if (onNonMatch === null) | |
| 3185 onNonMatch = _stringIdentity; | |
| 3186 if (typeof pattern == string) { | |
| 3187 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN
onMatch); | |
| 3188 } | |
| 3189 let buffer = new core.StringBuffer(); | |
| 3190 let startIndex = 0; | |
| 3191 for (let match of dart.dinvoke(pattern, 'allMatches', receiver)) { | |
| 3192 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring',
startIndex, match.start))); | |
| 3193 buffer.write(dart.dinvokef(onMatch, match)); | |
| 3194 startIndex = match.end; | |
| 3195 } | |
| 3196 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); | |
| 3197 return buffer.toString(); | |
| 3198 } | |
| 3199 // Function stringReplaceAllEmptyFuncUnchecked: (dynamic, dynamic, dynamic) →
dynamic | |
| 3200 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) { | |
| 3201 let buffer = new core.StringBuffer(); | |
| 3202 let length = dart.as(dart.dload(receiver, 'length'), core.int); | |
| 3203 let i = 0; | |
| 3204 buffer.write(dart.dinvokef(onNonMatch, "")); | |
| 3205 while (dart.notNull(i) < dart.notNull(length)) { | |
| 3206 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c
ore.String), ""))); | |
| 3207 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); | |
| 3208 if ((dart.notNull(code) & ~1023) === 55296 && dart.notNull(length) > dart.
notNull(i) + 1) { | |
| 3209 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1)
, core.int); | |
| 3210 if ((dart.notNull(code) & ~1023) === 56320) { | |
| 3211 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri
ng', i, dart.notNull(i) + 2))); | |
| 3212 i = 2; | |
| 3213 continue; | |
| 3214 } | |
| 3215 } | |
| 3216 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); | |
| 3217 i = dart.notNull(i) + 1; | |
| 3218 } | |
| 3219 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor
e.String), ""))); | |
| 3220 buffer.write(dart.dinvokef(onNonMatch, "")); | |
| 3221 return buffer.toString(); | |
| 3222 } | |
| 3223 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d
ynamic) → dynamic | |
| 3224 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon
Match) { | |
| 3225 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); | |
| 3226 if (patternLength === 0) { | |
| 3227 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); | |
| 3228 } | |
| 3229 let length = dart.as(dart.dload(receiver, 'length'), core.int); | |
| 3230 let buffer = new core.StringBuffer(); | |
| 3231 let startIndex = 0; | |
| 3232 while (dart.notNull(startIndex) < dart.notNull(length)) { | |
| 3233 let position = dart.as(dart.dinvoke(receiver, 'indexOf', pattern, startInd
ex), core.int); | |
| 3234 if (position === -1) { | |
| 3235 break; | |
| 3236 } | |
| 3237 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring',
startIndex, position))); | |
| 3238 buffer.write(dart.dinvokef(onMatch, new StringMatch(position, dart.as(rece
iver, core.String), dart.as(pattern, core.String)))); | |
| 3239 startIndex = dart.notNull(position) + dart.notNull(patternLength); | |
| 3240 } | |
| 3241 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s
tartIndex))); | |
| 3242 return buffer.toString(); | |
| 3243 } | |
| 3244 // Function stringReplaceFirstUnchecked: (dynamic, dynamic, dynamic, [int]) →
dynamic | |
| 3245 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { | |
| 3246 if (startIndex === void 0) | |
| 3247 startIndex = 0; | |
| 3248 if (typeof from == string) { | |
| 3249 let index = dart.dinvoke(receiver, 'indexOf', from, startIndex); | |
| 3250 if (dart.dbinary(index, '<', 0)) | |
| 3251 return receiver; | |
| 3252 return `${dart.dinvoke(receiver, 'substring', 0, index)}${to}` + `${dart.d
invoke(receiver, 'substring', dart.dbinary(index, '+', dart.dload(from, 'length'
)))}`; | |
| 3253 } else if (dart.is(from, JSSyntaxRegExp)) { | |
| 3254 return startIndex === 0 ? stringReplaceJS(receiver, regExpGetNative(dart.a
s(from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startIn
dex); | |
| 3255 } else { | |
| 3256 checkNull(from); | |
| 3257 throw "String.replace(Pattern) UNIMPLEMENTED"; | |
| 3258 } | |
| 3259 } | |
| 3260 // Function stringJoinUnchecked: (dynamic, dynamic) → dynamic | |
| 3261 function stringJoinUnchecked(array, separator) { | |
| 3262 return array.join(separator); | |
| 3263 } | |
| 3264 // Function createRuntimeType: (String) → Type | |
| 3265 function createRuntimeType(name) { | |
| 3266 return new TypeImpl(name); | |
| 3267 } | |
| 3268 let _unmangledName = Symbol('_unmangledName'); | |
| 3269 class TypeImpl extends dart.Object { | |
| 3270 TypeImpl($_typeName) { | |
| 3271 this[_typeName] = $_typeName; | |
| 3272 this[_unmangledName] = null; | |
| 3273 } | |
| 3274 toString() { | |
| 3275 if (this[_unmangledName] !== null) | |
| 3276 return this[_unmangledName]; | |
| 3277 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi
s[_typeName]); | |
| 3278 return this[_unmangledName] = unmangledName; | |
| 3279 } | |
| 3280 get hashCode() { | |
| 3281 return this[_typeName].hashCode; | |
| 3282 } | |
| 3283 ['=='](other) { | |
| 3284 return dart.notNull(dart.is(other, TypeImpl)) && dart.notNull(dart.equals(
this[_typeName], dart.dload(other, '_typeName'))); | |
| 3285 } | |
| 3286 } | |
| 3287 class TypeVariable extends dart.Object { | |
| 3288 TypeVariable(owner, name, bound) { | |
| 3289 this.owner = owner; | |
| 3290 this.name = name; | |
| 3291 this.bound = bound; | |
| 3292 } | |
| 3293 } | |
| 3294 // Function getMangledTypeName: (TypeImpl) → dynamic | |
| 3295 function getMangledTypeName(type) { | |
| 3296 return type[_typeName]; | |
| 3297 } | |
| 3298 // Function setRuntimeTypeInfo: (Object, dynamic) → Object | |
| 3299 function setRuntimeTypeInfo(target, typeInfo) { | |
| 3300 dart.assert(dart.notNull(typeInfo === null) || dart.notNull(isJsArray(typeIn
fo))); | |
| 3301 if (target !== null) | |
| 3302 target.$builtinTypeInfo = typeInfo; | |
| 3303 return target; | |
| 3304 } | |
| 3305 // Function getRuntimeTypeInfo: (Object) → dynamic | |
| 3306 function getRuntimeTypeInfo(target) { | |
| 3307 if (target === null) | |
| 3308 return null; | |
| 3309 return target.$builtinTypeInfo; | |
| 3310 } | |
| 3311 // Function getRuntimeTypeArguments: (dynamic, dynamic) → dynamic | |
| 3312 function getRuntimeTypeArguments(target, substitutionName) { | |
| 3313 let substitution = getField(target, `${_foreign_helper.JS_OPERATOR_AS_PREFIX
()}${substitutionName}`); | |
| 3314 return substitute(substitution, getRuntimeTypeInfo(target)); | |
| 3315 } | |
| 3316 // Function getRuntimeTypeArgument: (Object, String, int) → dynamic | |
| 3317 function getRuntimeTypeArgument(target, substitutionName, index) { | |
| 3318 let arguments = getRuntimeTypeArguments(target, substitutionName); | |
| 3319 return arguments === null ? null : getIndex(arguments, index); | |
| 3320 } | |
| 3321 // Function getTypeArgumentByIndex: (Object, int) → dynamic | |
| 3322 function getTypeArgumentByIndex(target, index) { | |
| 3323 let rti = getRuntimeTypeInfo(target); | |
| 3324 return rti === null ? null : getIndex(rti, index); | |
| 3325 } | |
| 3326 // Function copyTypeArguments: (Object, Object) → void | |
| 3327 function copyTypeArguments(source, target) { | |
| 3328 target.$builtinTypeInfo = source.$builtinTypeInfo; | |
| 3329 } | |
| 3330 // Function getClassName: (dynamic) → String | |
| 3331 function getClassName(object) { | |
| 3332 return _interceptors.getInterceptor(object).constructor.builtin$cls; | |
| 3333 } | |
| 3334 // Function getRuntimeTypeAsString: (dynamic, {onTypeVariable: (int) → String}
) → String | |
| 3335 function getRuntimeTypeAsString(runtimeType, opt$) { | |
| 3336 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; | |
| 3337 dart.assert(isJsArray(runtimeType)); | |
| 3338 let className = getConstructorName(getIndex(runtimeType, 0)); | |
| 3339 return `${className}` + `${joinArguments(runtimeType, 1, {onTypeVariable: on
TypeVariable})}`; | |
| 3340 } | |
| 3341 // Function getConstructorName: (dynamic) → String | |
| 3342 function getConstructorName(type) { | |
| 3343 return type.builtin$cls; | |
| 3344 } | |
| 3345 // Function runtimeTypeToString: (dynamic, {onTypeVariable: (int) → String}) →
String | |
| 3346 function runtimeTypeToString(type, opt$) { | |
| 3347 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; | |
| 3348 if (type === null) { | |
| 3349 return 'dynamic'; | |
| 3350 } else if (isJsArray(type)) { | |
| 3351 return getRuntimeTypeAsString(type, {onTypeVariable: onTypeVariable}); | |
| 3352 } else if (isJsFunction(type)) { | |
| 3353 return getConstructorName(type); | |
| 3354 } else if (typeof type == number) { | |
| 3355 if (onTypeVariable === null) { | |
| 3356 return dart.as(dart.dinvoke(type, 'toString'), core.String); | |
| 3357 } else { | |
| 3358 return onTypeVariable(dart.as(type, core.int)); | |
| 3359 } | |
| 3360 } else { | |
| 3361 return null; | |
| 3362 } | |
| 3363 } | |
| 3364 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) →
String | |
| 3365 function joinArguments(types, startIndex, opt$) { | |
| 3366 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari
able; | |
| 3367 if (types === null) | |
| 3368 return ''; | |
| 3369 dart.assert(isJsArray(types)); | |
| 3370 let firstArgument = true; | |
| 3371 let allDynamic = true; | |
| 3372 let buffer = new core.StringBuffer(); | |
| 3373 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty
pes)); index = dart.notNull(index) + 1) { | |
| 3374 if (firstArgument) { | |
| 3375 firstArgument = false; | |
| 3376 } else { | |
| 3377 buffer.write(', '); | |
| 3378 } | |
| 3379 let argument = getIndex(types, index); | |
| 3380 if (argument !== null) { | |
| 3381 allDynamic = false; | |
| 3382 } | |
| 3383 buffer.write(runtimeTypeToString(argument, {onTypeVariable: onTypeVariable
})); | |
| 3384 } | |
| 3385 return allDynamic ? '' : `<${buffer}>`; | |
| 3386 } | |
| 3387 // Function getRuntimeTypeString: (dynamic) → String | |
| 3388 function getRuntimeTypeString(object) { | |
| 3389 let className = getClassName(object); | |
| 3390 if (object === null) | |
| 3391 return className; | |
| 3392 let typeInfo = object.$builtinTypeInfo; | |
| 3393 return `${className}${joinArguments(typeInfo, 0)}`; | |
| 3394 } | |
| 3395 // Function getRuntimeType: (dynamic) → Type | |
| 3396 function getRuntimeType(object) { | |
| 3397 let type = getRuntimeTypeString(object); | |
| 3398 return new TypeImpl(type); | |
| 3399 } | |
| 3400 // Function substitute: (dynamic, dynamic) → dynamic | |
| 3401 function substitute(substitution, arguments) { | |
| 3402 dart.assert(dart.notNull(substitution === null) || dart.notNull(isJsFunction
(substitution))); | |
| 3403 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum
ents))); | |
| 3404 if (isJsFunction(substitution)) { | |
| 3405 substitution = invoke(substitution, arguments); | |
| 3406 if (isJsArray(substitution)) { | |
| 3407 arguments = substitution; | |
| 3408 } else if (isJsFunction(substitution)) { | |
| 3409 arguments = invoke(substitution, arguments); | |
| 3410 } | |
| 3411 } | |
| 3412 return arguments; | |
| 3413 } | |
| 3414 // Function checkSubtype: (Object, String, List<dynamic>, String) → bool | |
| 3415 function checkSubtype(object, isField, checks, asField) { | |
| 3416 if (object === null) | |
| 3417 return false; | |
| 3418 let arguments = getRuntimeTypeInfo(object); | |
| 3419 let interceptor = _interceptors.getInterceptor(object); | |
| 3420 let isSubclass = getField(interceptor, isField); | |
| 3421 if (isSubclass === null) | |
| 3422 return false; | |
| 3423 let substitution = getField(interceptor, asField); | |
| 3424 return checkArguments(substitution, arguments, checks); | |
| 3425 } | |
| 3426 // Function computeTypeName: (String, List<dynamic>) → String | |
| 3427 function computeTypeName(isField, arguments) { | |
| 3428 let prefixLength = _foreign_helper.JS_OPERATOR_IS_PREFIX().length; | |
| 3429 return Primitives.formatType(isField.substring(prefixLength, isField.length)
, arguments); | |
| 3430 } | |
| 3431 // Function subtypeCast: (Object, String, List<dynamic>, String) → Object | |
| 3432 function subtypeCast(object, isField, checks, asField) { | |
| 3433 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi
eld, checks, asField))) { | |
| 3434 let actualType = Primitives.objectTypeName(object); | |
| 3435 let typeName = computeTypeName(isField, checks); | |
| 3436 throw new CastErrorImplementation(actualType, typeName); | |
| 3437 } | |
| 3438 return object; | |
| 3439 } | |
| 3440 // Function assertSubtype: (Object, String, List<dynamic>, String) → Object | |
| 3441 function assertSubtype(object, isField, checks, asField) { | |
| 3442 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi
eld, checks, asField))) { | |
| 3443 let typeName = computeTypeName(isField, checks); | |
| 3444 throw new TypeErrorImplementation(object, typeName); | |
| 3445 } | |
| 3446 return object; | |
| 3447 } | |
| 3448 // Function assertIsSubtype: (dynamic, dynamic, String) → dynamic | |
| 3449 function assertIsSubtype(subtype, supertype, message) { | |
| 3450 if (!dart.notNull(isSubtype(subtype, supertype))) { | |
| 3451 throwTypeError(message); | |
| 3452 } | |
| 3453 } | |
| 3454 // Function throwTypeError: (dynamic) → dynamic | |
| 3455 function throwTypeError(message) { | |
| 3456 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String))
; | |
| 3457 } | |
| 3458 // Function checkArguments: (dynamic, dynamic, dynamic) → bool | |
| 3459 function checkArguments(substitution, arguments, checks) { | |
| 3460 return areSubtypes(substitute(substitution, arguments), checks); | |
| 3461 } | |
| 3462 // Function areSubtypes: (dynamic, dynamic) → bool | |
| 3463 function areSubtypes(s, t) { | |
| 3464 if (dart.notNull(s === null) || dart.notNull(t === null)) | |
| 3465 return true; | |
| 3466 dart.assert(isJsArray(s)); | |
| 3467 dart.assert(isJsArray(t)); | |
| 3468 dart.assert(getLength(s) === getLength(t)); | |
| 3469 let len = getLength(s); | |
| 3470 for (let i = 0; dart.notNull(i) < dart.notNull(len); i = dart.notNull(i) + 1
) { | |
| 3471 if (!dart.notNull(isSubtype(getIndex(s, i), getIndex(t, i)))) { | |
| 3472 return false; | |
| 3473 } | |
| 3474 } | |
| 3475 return true; | |
| 3476 } | |
| 3477 // Function computeSignature: (dynamic, dynamic, dynamic) → dynamic | |
| 3478 function computeSignature(signature, context, contextName) { | |
| 3479 let typeArguments = getRuntimeTypeArguments(context, contextName); | |
| 3480 return invokeOn(signature, context, typeArguments); | |
| 3481 } | |
| 3482 // Function isSupertypeOfNull: (dynamic) → bool | |
| 3483 function isSupertypeOfNull(type) { | |
| 3484 return dart.notNull(type === null) || dart.notNull(dart.equals(getConstructo
rName(type), _foreign_helper.JS_OBJECT_CLASS_NAME())) || dart.notNull(dart.equal
s(getConstructorName(type), _foreign_helper.JS_NULL_CLASS_NAME())); | |
| 3485 } | |
| 3486 // Function checkSubtypeOfRuntimeType: (dynamic, dynamic) → bool | |
| 3487 function checkSubtypeOfRuntimeType(o, t) { | |
| 3488 if (o === null) | |
| 3489 return isSupertypeOfNull(t); | |
| 3490 if (t === null) | |
| 3491 return true; | |
| 3492 let rti = getRuntimeTypeInfo(o); | |
| 3493 o = _interceptors.getInterceptor(o); | |
| 3494 let type = o.constructor; | |
| 3495 if (rti !== null) { | |
| 3496 rti = rti.slice(); | |
| 3497 rti.splice(0, 0, type); | |
| 3498 type = rti; | |
| 3499 } else if (hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { | |
| 3500 let signatureName = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}_${getField
(t, _foreign_helper.JS_FUNCTION_TYPE_TAG())}`; | |
| 3501 if (hasField(o, signatureName)) | |
| 3502 return true; | |
| 3503 let targetSignatureFunction = getField(o, `${_foreign_helper.JS_SIGNATURE_
NAME()}`); | |
| 3504 if (targetSignatureFunction === null) | |
| 3505 return false; | |
| 3506 type = invokeOn(targetSignatureFunction, o, null); | |
| 3507 return isFunctionSubtype(type, t); | |
| 3508 } | |
| 3509 return isSubtype(type, t); | |
| 3510 } | |
| 3511 // Function subtypeOfRuntimeTypeCast: (Object, dynamic) → Object | |
| 3512 function subtypeOfRuntimeTypeCast(object, type) { | |
| 3513 if (dart.notNull(object !== null) && !dart.notNull(checkSubtypeOfRuntimeType
(object, type))) { | |
| 3514 let actualType = Primitives.objectTypeName(object); | |
| 3515 throw new CastErrorImplementation(actualType, runtimeTypeToString(type)); | |
| 3516 } | |
| 3517 return object; | |
| 3518 } | |
| 3519 // Function assertSubtypeOfRuntimeType: (Object, dynamic) → Object | |
| 3520 function assertSubtypeOfRuntimeType(object, type) { | |
| 3521 if (dart.notNull(object !== null) && !dart.notNull(checkSubtypeOfRuntimeType
(object, type))) { | |
| 3522 throw new TypeErrorImplementation(object, runtimeTypeToString(type)); | |
| 3523 } | |
| 3524 return object; | |
| 3525 } | |
| 3526 // Function getArguments: (dynamic) → dynamic | |
| 3527 function getArguments(type) { | |
| 3528 return isJsArray(type) ? type.slice(1) : null; | |
| 3529 } | |
| 3530 // Function isSubtype: (dynamic, dynamic) → bool | |
| 3531 function isSubtype(s, t) { | |
| 3532 if (isIdentical(s, t)) | |
| 3533 return true; | |
| 3534 if (dart.notNull(s === null) || dart.notNull(t === null)) | |
| 3535 return true; | |
| 3536 if (hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { | |
| 3537 return isFunctionSubtype(s, t); | |
| 3538 } | |
| 3539 if (hasField(s, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) { | |
| 3540 return dart.equals(getConstructorName(t), _foreign_helper.JS_FUNCTION_CLAS
S_NAME()); | |
| 3541 } | |
| 3542 let typeOfS = isJsArray(s) ? getIndex(s, 0) : s; | |
| 3543 let typeOfT = isJsArray(t) ? getIndex(t, 0) : t; | |
| 3544 let name = runtimeTypeToString(typeOfT); | |
| 3545 let substitution = null; | |
| 3546 if (isNotIdentical(typeOfT, typeOfS)) { | |
| 3547 let test = `${_foreign_helper.JS_OPERATOR_IS_PREFIX()}${name}`; | |
| 3548 let typeOfSPrototype = typeOfS.prototype; | |
| 3549 if (hasNoField(typeOfSPrototype, test)) | |
| 3550 return false; | |
| 3551 let field = `${_foreign_helper.JS_OPERATOR_AS_PREFIX()}${runtimeTypeToStri
ng(typeOfT)}`; | |
| 3552 substitution = getField(typeOfSPrototype, field); | |
| 3553 } | |
| 3554 if (!dart.notNull(isJsArray(s)) && dart.notNull(substitution === null) || !d
art.notNull(isJsArray(t))) { | |
| 3555 return true; | |
| 3556 } | |
| 3557 return checkArguments(substitution, getArguments(s), getArguments(t)); | |
| 3558 } | |
| 3559 // Function isAssignable: (dynamic, dynamic) → bool | |
| 3560 function isAssignable(s, t) { | |
| 3561 return dart.notNull(isSubtype(s, t)) || dart.notNull(isSubtype(t, s)); | |
| 3562 } | |
| 3563 // Function areAssignable: (List<dynamic>, List, bool) → bool | |
| 3564 function areAssignable(s, t, allowShorter) { | |
| 3565 if (dart.notNull(t === null) && dart.notNull(s === null)) | |
| 3566 return true; | |
| 3567 if (t === null) | |
| 3568 return allowShorter; | |
| 3569 if (s === null) | |
| 3570 return false; | |
| 3571 dart.assert(isJsArray(s)); | |
| 3572 dart.assert(isJsArray(t)); | |
| 3573 let sLength = getLength(s); | |
| 3574 let tLength = getLength(t); | |
| 3575 if (allowShorter) { | |
| 3576 if (dart.notNull(sLength) < dart.notNull(tLength)) | |
| 3577 return false; | |
| 3578 } else { | |
| 3579 if (sLength !== tLength) | |
| 3580 return false; | |
| 3581 } | |
| 3582 for (let i = 0; dart.notNull(i) < dart.notNull(tLength); i = dart.notNull(i)
+ 1) { | |
| 3583 if (!dart.notNull(isAssignable(getIndex(s, i), getIndex(t, i)))) { | |
| 3584 return false; | |
| 3585 } | |
| 3586 } | |
| 3587 return true; | |
| 3588 } | |
| 3589 // Function areAssignableMaps: (dynamic, dynamic) → bool | |
| 3590 function areAssignableMaps(s, t) { | |
| 3591 if (t === null) | |
| 3592 return true; | |
| 3593 if (s === null) | |
| 3594 return false; | |
| 3595 dart.assert(isJsObject(s)); | |
| 3596 dart.assert(isJsObject(t)); | |
| 3597 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPropert
yNames(t), core.List)); | |
| 3598 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.notNu
ll(i) + 1) { | |
| 3599 let name = names.get(i); | |
| 3600 if (!Object.hasOwnProperty.call(s, name)) { | |
| 3601 return false; | |
| 3602 } | |
| 3603 let tType = t[name]; | |
| 3604 let sType = s[name]; | |
| 3605 if (!dart.notNull(isAssignable(tType, sType))) | |
| 3606 return false; | |
| 3607 } | |
| 3608 return true; | |
| 3609 } | |
| 3610 // Function isFunctionSubtype: (dynamic, dynamic) → bool | |
| 3611 function isFunctionSubtype(s, t) { | |
| 3612 dart.assert(hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)); | |
| 3613 if (hasNoField(s, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) | |
| 3614 return false; | |
| 3615 if (hasField(s, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()}`)) { | |
| 3616 if (dart.dbinary(hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RE
TURN_TAG()}`), '&&', hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE
_TAG()}`))) { | |
| 3617 return false; | |
| 3618 } | |
| 3619 } else if (hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG
()}`)) { | |
| 3620 let sReturnType = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T
YPE_TAG()}`); | |
| 3621 let tReturnType = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T
YPE_TAG()}`); | |
| 3622 if (!dart.notNull(isAssignable(sReturnType, tReturnType))) | |
| 3623 return false; | |
| 3624 } | |
| 3625 let sParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); | |
| 3626 let tParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR
ED_PARAMETERS_TAG()}`); | |
| 3627 let sOptionalParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); | |
| 3628 let tOptionalParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYP
E_OPTIONAL_PARAMETERS_TAG()}`); | |
| 3629 let sParametersLen = sParameterTypes !== null ? getLength(sParameterTypes) :
0; | |
| 3630 let tParametersLen = tParameterTypes !== null ? getLength(tParameterTypes) :
0; | |
| 3631 let sOptionalParametersLen = sOptionalParameterTypes !== null ? getLength(sO
ptionalParameterTypes) : 0; | |
| 3632 let tOptionalParametersLen = tOptionalParameterTypes !== null ? getLength(tO
ptionalParameterTypes) : 0; | |
| 3633 if (dart.notNull(sParametersLen) > dart.notNull(tParametersLen)) { | |
| 3634 return false; | |
| 3635 } | |
| 3636 if (dart.notNull(sParametersLen) + dart.notNull(sOptionalParametersLen) < da
rt.notNull(tParametersLen) + dart.notNull(tOptionalParametersLen)) { | |
| 3637 return false; | |
| 3638 } | |
| 3639 if (sParametersLen === tParametersLen) { | |
| 3640 if (!dart.notNull(areAssignable(dart.as(sParameterTypes, core.List), dart.
as(tParameterTypes, core.List), false))) | |
| 3641 return false; | |
| 3642 if (!dart.notNull(areAssignable(dart.as(sOptionalParameterTypes, core.List
), dart.as(tOptionalParameterTypes, core.List), true))) { | |
| 3643 return false; | |
| 3644 } | |
| 3645 } else { | |
| 3646 let pos = 0; | |
| 3647 for (; dart.notNull(pos) < dart.notNull(sParametersLen); pos = dart.notNul
l(pos) + 1) { | |
| 3648 if (!dart.notNull(isAssignable(getIndex(sParameterTypes, pos), getIndex(
tParameterTypes, pos)))) { | |
| 3649 return false; | |
| 3650 } | |
| 3651 } | |
| 3652 let sPos = 0; | |
| 3653 let tPos = pos; | |
| 3654 for (; dart.notNull(tPos) < dart.notNull(tParametersLen); sPos = dart.notN
ull(sPos) + 1, tPos = dart.notNull(tPos) + 1) { | |
| 3655 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tParameterTypes, tPos)))) { | |
| 3656 return false; | |
| 3657 } | |
| 3658 } | |
| 3659 tPos = 0; | |
| 3660 for (; dart.notNull(tPos) < dart.notNull(tOptionalParametersLen); sPos = d
art.notNull(sPos) + 1, tPos = dart.notNull(tPos) + 1) { | |
| 3661 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos),
getIndex(tOptionalParameterTypes, tPos)))) { | |
| 3662 return false; | |
| 3663 } | |
| 3664 } | |
| 3665 } | |
| 3666 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); | |
| 3667 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED
_PARAMETERS_TAG()}`); | |
| 3668 return areAssignableMaps(sNamedParameters, tNamedParameters); | |
| 3669 } | |
| 3670 // Function invoke: (dynamic, dynamic) → dynamic | |
| 3671 function invoke(function, arguments) { | |
| 3672 return invokeOn(function, null, arguments); | |
| 3673 } | |
| 3674 // Function invokeOn: (dynamic, dynamic, dynamic) → Object | |
| 3675 function invokeOn(function, receiver, arguments) { | |
| 3676 dart.assert(isJsFunction(function)); | |
| 3677 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum
ents))); | |
| 3678 return function.apply(receiver, arguments); | |
| 3679 } | |
| 3680 // Function call: (dynamic, String) → dynamic | |
| 3681 function call(object, name) { | |
| 3682 return object[name](); | |
| 3683 } | |
| 3684 // Function getField: (dynamic, String) → dynamic | |
| 3685 function getField(object, name) { | |
| 3686 return object[name]; | |
| 3687 } | |
| 3688 // Function getIndex: (dynamic, int) → dynamic | |
| 3689 function getIndex(array, index) { | |
| 3690 dart.assert(isJsArray(array)); | |
| 3691 return array[index]; | |
| 3692 } | |
| 3693 // Function getLength: (dynamic) → int | |
| 3694 function getLength(array) { | |
| 3695 dart.assert(isJsArray(array)); | |
| 3696 return array.length; | |
| 3697 } | |
| 3698 // Function isJsArray: (dynamic) → bool | |
| 3699 function isJsArray(value) { | |
| 3700 return dart.is(value, _interceptors.JSArray); | |
| 3701 } | |
| 3702 // Function hasField: (dynamic, dynamic) → dynamic | |
| 3703 function hasField(object, name) { | |
| 3704 return name in object; | |
| 3705 } | |
| 3706 // Function hasNoField: (dynamic, dynamic) → dynamic | |
| 3707 function hasNoField(object, name) { | |
| 3708 return dart.dunary('!', hasField(object, name)); | |
| 3709 } | |
| 3710 // Function isJsFunction: (dynamic) → bool | |
| 3711 function isJsFunction(o) { | |
| 3712 return typeof o == "function"; | |
| 3713 } | |
| 3714 // Function isJsObject: (dynamic) → bool | |
| 3715 function isJsObject(o) { | |
| 3716 return typeof o == 'object'; | |
| 3717 } | |
| 3718 // Function isIdentical: (dynamic, dynamic) → bool | |
| 3719 function isIdentical(s, t) { | |
| 3720 return s === t; | |
| 3721 } | |
| 3722 // Function isNotIdentical: (dynamic, dynamic) → bool | |
| 3723 function isNotIdentical(s, t) { | |
| 3724 return s !== t; | |
| 3725 } | |
| 3726 // Exports: | 3726 // Exports: |
| 3727 exports.NoSideEffects = NoSideEffects; |
| 3728 exports.NoThrows = NoThrows; |
| 3729 exports.NoInline = NoInline; |
| 3730 exports.IrRepresentation = IrRepresentation; |
| 3731 exports.Native = Native; |
| 3732 exports.ConstantMap = ConstantMap; |
| 3733 exports.ConstantMap$ = ConstantMap$; |
| 3734 exports.ConstantStringMap = ConstantStringMap; |
| 3735 exports.ConstantStringMap$ = ConstantStringMap$; |
| 3736 exports.ConstantProtoMap = ConstantProtoMap; |
| 3737 exports.ConstantProtoMap$ = ConstantProtoMap$; |
| 3738 exports.GeneralConstantMap = GeneralConstantMap; |
| 3739 exports.GeneralConstantMap$ = GeneralConstantMap$; |
| 3740 exports.contains = contains; |
| 3741 exports.arrayLength = arrayLength; |
| 3742 exports.arrayGet = arrayGet; |
| 3743 exports.arraySet = arraySet; |
| 3744 exports.propertyGet = propertyGet; |
| 3745 exports.callHasOwnProperty = callHasOwnProperty; |
| 3746 exports.propertySet = propertySet; |
| 3747 exports.getPropertyFromPrototype = getPropertyFromPrototype; |
| 3748 exports.toStringForNativeObject = toStringForNativeObject; |
| 3749 exports.hashCodeForNativeObject = hashCodeForNativeObject; |
| 3750 exports.defineProperty = defineProperty; |
| 3751 exports.isDartObject = isDartObject; |
| 3752 exports.interceptorsByTag = interceptorsByTag; |
| 3753 exports.leafTags = leafTags; |
| 3754 exports.findDispatchTagForInterceptorClass = findDispatchTagForInterceptorClas
s; |
| 3755 exports.lookupInterceptor = lookupInterceptor; |
| 3756 exports.UNCACHED_MARK = UNCACHED_MARK; |
| 3757 exports.INSTANCE_CACHED_MARK = INSTANCE_CACHED_MARK; |
| 3758 exports.LEAF_MARK = LEAF_MARK; |
| 3759 exports.INTERIOR_MARK = INTERIOR_MARK; |
| 3760 exports.DISCRIMINATED_MARK = DISCRIMINATED_MARK; |
| 3761 exports.lookupAndCacheInterceptor = lookupAndCacheInterceptor; |
| 3762 exports.patchInstance = patchInstance; |
| 3763 exports.patchProto = patchProto; |
| 3764 exports.patchInteriorProto = patchInteriorProto; |
| 3765 exports.makeLeafDispatchRecord = makeLeafDispatchRecord; |
| 3766 exports.makeDefaultDispatchRecord = makeDefaultDispatchRecord; |
| 3767 exports.setNativeSubclassDispatchRecord = setNativeSubclassDispatchRecord; |
| 3768 exports.constructorNameFallback = constructorNameFallback; |
| 3769 exports.initNativeDispatch = initNativeDispatch; |
| 3770 exports.initNativeDispatchContinue = initNativeDispatchContinue; |
| 3771 exports.initHooks = initHooks; |
| 3772 exports.applyHooksTransformer = applyHooksTransformer; |
| 3773 exports.regExpGetNative = regExpGetNative; |
| 3774 exports.regExpGetGlobalNative = regExpGetGlobalNative; |
| 3775 exports.regExpCaptureCount = regExpCaptureCount; |
| 3776 exports.JSSyntaxRegExp = JSSyntaxRegExp; |
| 3777 exports.firstMatchAfter = firstMatchAfter; |
| 3778 exports.StringMatch = StringMatch; |
| 3779 exports.allMatchesInStringUnchecked = allMatchesInStringUnchecked; |
| 3780 exports.stringContainsUnchecked = stringContainsUnchecked; |
| 3781 exports.stringReplaceJS = stringReplaceJS; |
| 3782 exports.stringReplaceFirstRE = stringReplaceFirstRE; |
| 3783 exports.ESCAPE_REGEXP = ESCAPE_REGEXP; |
| 3784 exports.stringReplaceAllUnchecked = stringReplaceAllUnchecked; |
| 3785 exports.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked; |
| 3786 exports.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecke
d; |
| 3787 exports.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchec
ked; |
| 3788 exports.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked; |
| 3789 exports.stringJoinUnchecked = stringJoinUnchecked; |
| 3790 exports.createRuntimeType = createRuntimeType; |
| 3791 exports.TypeImpl = TypeImpl; |
| 3792 exports.TypeVariable = TypeVariable; |
| 3793 exports.getMangledTypeName = getMangledTypeName; |
| 3794 exports.setRuntimeTypeInfo = setRuntimeTypeInfo; |
| 3795 exports.getRuntimeTypeInfo = getRuntimeTypeInfo; |
| 3796 exports.getRuntimeTypeArguments = getRuntimeTypeArguments; |
| 3797 exports.getRuntimeTypeArgument = getRuntimeTypeArgument; |
| 3798 exports.getTypeArgumentByIndex = getTypeArgumentByIndex; |
| 3799 exports.copyTypeArguments = copyTypeArguments; |
| 3800 exports.getClassName = getClassName; |
| 3801 exports.getRuntimeTypeAsString = getRuntimeTypeAsString; |
| 3802 exports.getConstructorName = getConstructorName; |
| 3803 exports.runtimeTypeToString = runtimeTypeToString; |
| 3804 exports.joinArguments = joinArguments; |
| 3805 exports.getRuntimeTypeString = getRuntimeTypeString; |
| 3806 exports.getRuntimeType = getRuntimeType; |
| 3807 exports.substitute = substitute; |
| 3808 exports.checkSubtype = checkSubtype; |
| 3809 exports.computeTypeName = computeTypeName; |
| 3810 exports.subtypeCast = subtypeCast; |
| 3811 exports.assertSubtype = assertSubtype; |
| 3812 exports.assertIsSubtype = assertIsSubtype; |
| 3813 exports.throwTypeError = throwTypeError; |
| 3814 exports.checkArguments = checkArguments; |
| 3815 exports.areSubtypes = areSubtypes; |
| 3816 exports.computeSignature = computeSignature; |
| 3817 exports.isSupertypeOfNull = isSupertypeOfNull; |
| 3818 exports.checkSubtypeOfRuntimeType = checkSubtypeOfRuntimeType; |
| 3819 exports.subtypeOfRuntimeTypeCast = subtypeOfRuntimeTypeCast; |
| 3820 exports.assertSubtypeOfRuntimeType = assertSubtypeOfRuntimeType; |
| 3821 exports.getArguments = getArguments; |
| 3822 exports.isSubtype = isSubtype; |
| 3823 exports.isAssignable = isAssignable; |
| 3824 exports.areAssignable = areAssignable; |
| 3825 exports.areAssignableMaps = areAssignableMaps; |
| 3826 exports.isFunctionSubtype = isFunctionSubtype; |
| 3827 exports.invoke = invoke; |
| 3828 exports.invokeOn = invokeOn; |
| 3829 exports.call = call; |
| 3830 exports.getField = getField; |
| 3831 exports.getIndex = getIndex; |
| 3832 exports.getLength = getLength; |
| 3833 exports.isJsArray = isJsArray; |
| 3834 exports.hasField = hasField; |
| 3835 exports.hasNoField = hasNoField; |
| 3836 exports.isJsFunction = isJsFunction; |
| 3837 exports.isJsObject = isJsObject; |
| 3838 exports.isIdentical = isIdentical; |
| 3839 exports.isNotIdentical = isNotIdentical; |
| 3727 exports.patch = patch; | 3840 exports.patch = patch; |
| 3728 exports.InternalMap = InternalMap; | 3841 exports.InternalMap = InternalMap; |
| 3729 exports.requiresPreamble = requiresPreamble; | 3842 exports.requiresPreamble = requiresPreamble; |
| 3730 exports.isJsIndexable = isJsIndexable; | 3843 exports.isJsIndexable = isJsIndexable; |
| 3731 exports.S = S; | 3844 exports.S = S; |
| 3732 exports.createInvocationMirror = createInvocationMirror; | 3845 exports.createInvocationMirror = createInvocationMirror; |
| 3733 exports.createUnmangledInvocationMirror = createUnmangledInvocationMirror; | 3846 exports.createUnmangledInvocationMirror = createUnmangledInvocationMirror; |
| 3734 exports.throwInvalidReflectionError = throwInvalidReflectionError; | 3847 exports.throwInvalidReflectionError = throwInvalidReflectionError; |
| 3735 exports.traceHelper = traceHelper; | 3848 exports.traceHelper = traceHelper; |
| 3736 exports.JSInvocationMirror = JSInvocationMirror; | 3849 exports.JSInvocationMirror = JSInvocationMirror; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3834 exports.FunctionTypeInfoDecoderRing = FunctionTypeInfoDecoderRing; | 3947 exports.FunctionTypeInfoDecoderRing = FunctionTypeInfoDecoderRing; |
| 3835 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; | 3948 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; |
| 3836 exports.random64 = random64; | 3949 exports.random64 = random64; |
| 3837 exports.jsonEncodeNative = jsonEncodeNative; | 3950 exports.jsonEncodeNative = jsonEncodeNative; |
| 3838 exports.getIsolateAffinityTag = getIsolateAffinityTag; | 3951 exports.getIsolateAffinityTag = getIsolateAffinityTag; |
| 3839 exports.loadDeferredLibrary = loadDeferredLibrary; | 3952 exports.loadDeferredLibrary = loadDeferredLibrary; |
| 3840 exports.MainError = MainError; | 3953 exports.MainError = MainError; |
| 3841 exports.missingMain = missingMain; | 3954 exports.missingMain = missingMain; |
| 3842 exports.badMain = badMain; | 3955 exports.badMain = badMain; |
| 3843 exports.mainHasTooManyParameters = mainHasTooManyParameters; | 3956 exports.mainHasTooManyParameters = mainHasTooManyParameters; |
| 3844 exports.NoSideEffects = NoSideEffects; | |
| 3845 exports.NoThrows = NoThrows; | |
| 3846 exports.NoInline = NoInline; | |
| 3847 exports.IrRepresentation = IrRepresentation; | |
| 3848 exports.Native = Native; | |
| 3849 exports.ConstantMap = ConstantMap; | |
| 3850 exports.ConstantMap$ = ConstantMap$; | |
| 3851 exports.ConstantStringMap = ConstantStringMap; | |
| 3852 exports.ConstantStringMap$ = ConstantStringMap$; | |
| 3853 exports.ConstantProtoMap = ConstantProtoMap; | |
| 3854 exports.ConstantProtoMap$ = ConstantProtoMap$; | |
| 3855 exports.GeneralConstantMap = GeneralConstantMap; | |
| 3856 exports.GeneralConstantMap$ = GeneralConstantMap$; | |
| 3857 exports.contains = contains; | |
| 3858 exports.arrayLength = arrayLength; | |
| 3859 exports.arrayGet = arrayGet; | |
| 3860 exports.arraySet = arraySet; | |
| 3861 exports.propertyGet = propertyGet; | |
| 3862 exports.callHasOwnProperty = callHasOwnProperty; | |
| 3863 exports.propertySet = propertySet; | |
| 3864 exports.getPropertyFromPrototype = getPropertyFromPrototype; | |
| 3865 exports.toStringForNativeObject = toStringForNativeObject; | |
| 3866 exports.hashCodeForNativeObject = hashCodeForNativeObject; | |
| 3867 exports.defineProperty = defineProperty; | |
| 3868 exports.isDartObject = isDartObject; | |
| 3869 exports.interceptorsByTag = interceptorsByTag; | |
| 3870 exports.leafTags = leafTags; | |
| 3871 exports.findDispatchTagForInterceptorClass = findDispatchTagForInterceptorClas
s; | |
| 3872 exports.lookupInterceptor = lookupInterceptor; | |
| 3873 exports.UNCACHED_MARK = UNCACHED_MARK; | |
| 3874 exports.INSTANCE_CACHED_MARK = INSTANCE_CACHED_MARK; | |
| 3875 exports.LEAF_MARK = LEAF_MARK; | |
| 3876 exports.INTERIOR_MARK = INTERIOR_MARK; | |
| 3877 exports.DISCRIMINATED_MARK = DISCRIMINATED_MARK; | |
| 3878 exports.lookupAndCacheInterceptor = lookupAndCacheInterceptor; | |
| 3879 exports.patchInstance = patchInstance; | |
| 3880 exports.patchProto = patchProto; | |
| 3881 exports.patchInteriorProto = patchInteriorProto; | |
| 3882 exports.makeLeafDispatchRecord = makeLeafDispatchRecord; | |
| 3883 exports.makeDefaultDispatchRecord = makeDefaultDispatchRecord; | |
| 3884 exports.setNativeSubclassDispatchRecord = setNativeSubclassDispatchRecord; | |
| 3885 exports.constructorNameFallback = constructorNameFallback; | |
| 3886 exports.initNativeDispatch = initNativeDispatch; | |
| 3887 exports.initNativeDispatchContinue = initNativeDispatchContinue; | |
| 3888 exports.initHooks = initHooks; | |
| 3889 exports.applyHooksTransformer = applyHooksTransformer; | |
| 3890 exports.regExpGetNative = regExpGetNative; | |
| 3891 exports.regExpGetGlobalNative = regExpGetGlobalNative; | |
| 3892 exports.regExpCaptureCount = regExpCaptureCount; | |
| 3893 exports.JSSyntaxRegExp = JSSyntaxRegExp; | |
| 3894 exports.firstMatchAfter = firstMatchAfter; | |
| 3895 exports.StringMatch = StringMatch; | |
| 3896 exports.allMatchesInStringUnchecked = allMatchesInStringUnchecked; | |
| 3897 exports.stringContainsUnchecked = stringContainsUnchecked; | |
| 3898 exports.stringReplaceJS = stringReplaceJS; | |
| 3899 exports.stringReplaceFirstRE = stringReplaceFirstRE; | |
| 3900 exports.ESCAPE_REGEXP = ESCAPE_REGEXP; | |
| 3901 exports.stringReplaceAllUnchecked = stringReplaceAllUnchecked; | |
| 3902 exports.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked; | |
| 3903 exports.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecke
d; | |
| 3904 exports.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchec
ked; | |
| 3905 exports.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked; | |
| 3906 exports.stringJoinUnchecked = stringJoinUnchecked; | |
| 3907 exports.createRuntimeType = createRuntimeType; | |
| 3908 exports.TypeImpl = TypeImpl; | |
| 3909 exports.TypeVariable = TypeVariable; | |
| 3910 exports.getMangledTypeName = getMangledTypeName; | |
| 3911 exports.setRuntimeTypeInfo = setRuntimeTypeInfo; | |
| 3912 exports.getRuntimeTypeInfo = getRuntimeTypeInfo; | |
| 3913 exports.getRuntimeTypeArguments = getRuntimeTypeArguments; | |
| 3914 exports.getRuntimeTypeArgument = getRuntimeTypeArgument; | |
| 3915 exports.getTypeArgumentByIndex = getTypeArgumentByIndex; | |
| 3916 exports.copyTypeArguments = copyTypeArguments; | |
| 3917 exports.getClassName = getClassName; | |
| 3918 exports.getRuntimeTypeAsString = getRuntimeTypeAsString; | |
| 3919 exports.getConstructorName = getConstructorName; | |
| 3920 exports.runtimeTypeToString = runtimeTypeToString; | |
| 3921 exports.joinArguments = joinArguments; | |
| 3922 exports.getRuntimeTypeString = getRuntimeTypeString; | |
| 3923 exports.getRuntimeType = getRuntimeType; | |
| 3924 exports.substitute = substitute; | |
| 3925 exports.checkSubtype = checkSubtype; | |
| 3926 exports.computeTypeName = computeTypeName; | |
| 3927 exports.subtypeCast = subtypeCast; | |
| 3928 exports.assertSubtype = assertSubtype; | |
| 3929 exports.assertIsSubtype = assertIsSubtype; | |
| 3930 exports.throwTypeError = throwTypeError; | |
| 3931 exports.checkArguments = checkArguments; | |
| 3932 exports.areSubtypes = areSubtypes; | |
| 3933 exports.computeSignature = computeSignature; | |
| 3934 exports.isSupertypeOfNull = isSupertypeOfNull; | |
| 3935 exports.checkSubtypeOfRuntimeType = checkSubtypeOfRuntimeType; | |
| 3936 exports.subtypeOfRuntimeTypeCast = subtypeOfRuntimeTypeCast; | |
| 3937 exports.assertSubtypeOfRuntimeType = assertSubtypeOfRuntimeType; | |
| 3938 exports.getArguments = getArguments; | |
| 3939 exports.isSubtype = isSubtype; | |
| 3940 exports.isAssignable = isAssignable; | |
| 3941 exports.areAssignable = areAssignable; | |
| 3942 exports.areAssignableMaps = areAssignableMaps; | |
| 3943 exports.isFunctionSubtype = isFunctionSubtype; | |
| 3944 exports.invoke = invoke; | |
| 3945 exports.invokeOn = invokeOn; | |
| 3946 exports.call = call; | |
| 3947 exports.getField = getField; | |
| 3948 exports.getIndex = getIndex; | |
| 3949 exports.getLength = getLength; | |
| 3950 exports.isJsArray = isJsArray; | |
| 3951 exports.hasField = hasField; | |
| 3952 exports.hasNoField = hasNoField; | |
| 3953 exports.isJsFunction = isJsFunction; | |
| 3954 exports.isJsObject = isJsObject; | |
| 3955 exports.isIdentical = isIdentical; | |
| 3956 exports.isNotIdentical = isNotIdentical; | |
| 3957 })(_js_helper || (_js_helper = {})); | 3957 })(_js_helper || (_js_helper = {})); |
| OLD | NEW |