Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: test/codegen/expect/dart/_js_helper.js

Issue 1020043002: Replace dart_core.js with actual compiled SDK (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merge Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/codegen/expect/dart/_js_embedded_names.js ('k') | test/codegen/expect/dart/_js_names.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 var _js_helper;
2 (function(exports) {
3 'use strict';
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.closureWrap(((key) => this[_fetch](key)).bind(this), "(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', _js_embedded_names.IN TERCEPTORS_BY_TAG);
244 },
245 get leafTags() {
246 return _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', _js_embedded_names.LE AF_TAGS);
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, core.String['+'](INSTANCE_CACHED_MARK, tag), intercepto rClass);
395 propertySet(map, core.String['+'](UNCACHED_MARK, tag), interceptorClass) ;
396 propertySet(map, core.String['+'](LEAF_MARK, tag), interceptorClass);
397 propertySet(map, core.String['+'](INTERIOR_MARK, tag), interceptorClass) ;
398 propertySet(map, core.String['+'](DISCRIMINATED_MARK, tag), interceptorC lass);
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 {
1330 _Patch() {
1331 }
1332 }
1333 let patch = new _Patch();
1334 class InternalMap extends core.Object {
1335 }
1336 // Function requiresPreamble: () → dynamic
1337 function requiresPreamble() {
1338 }
1339 // Function isJsIndexable: (dynamic, dynamic) → bool
1340 function isJsIndexable(object, record) {
1341 if (record !== null) {
1342 let result = _interceptors.dispatchRecordIndexability(record);
1343 if (result !== null)
1344 return dart.as(result, core.bool);
1345 }
1346 return dart.is(object, exports.JavaScriptIndexingBehavior);
1347 }
1348 // Function S: (dynamic) → String
1349 function S(value) {
1350 if (typeof value == string)
1351 return dart.as(value, core.String);
1352 if (dart.is(value, core.num)) {
1353 if (!dart.equals(value, 0)) {
1354 return "" + value;
1355 }
1356 } else if (true === value) {
1357 return 'true';
1358 } else if (false === value) {
1359 return 'false';
1360 } else if (value === null) {
1361 return 'null';
1362 }
1363 let res = dart.dinvoke(value, 'toString');
1364 if (!(typeof res == string))
1365 throw new core.ArgumentError(value);
1366 return dart.as(res, core.String);
1367 }
1368 // Function createInvocationMirror: (String, dynamic, dynamic, dynamic, dynami c) → dynamic
1369 function createInvocationMirror(name, internalName, kind, arguments, argumentN ames) {
1370 return new JSInvocationMirror(name, dart.as(internalName, core.String), dart .as(kind, core.int), dart.as(arguments, core.List), dart.as(argumentNames, core. List));
1371 }
1372 // Function createUnmangledInvocationMirror: (Symbol, dynamic, dynamic, dynami c, dynamic) → dynamic
1373 function createUnmangledInvocationMirror(symbol, internalName, kind, arguments , argumentNames) {
1374 return new JSInvocationMirror(symbol, dart.as(internalName, core.String), da rt.as(kind, core.int), dart.as(arguments, core.List), dart.as(argumentNames, cor e.List));
1375 }
1376 // Function throwInvalidReflectionError: (String) → void
1377 function throwInvalidReflectionError(memberName) {
1378 throw new core.UnsupportedError(`Can't use '${memberName}' in reflection ` + "because it is not included in a @MirrorsUsed annotation.");
1379 }
1380 // Function traceHelper: (String) → void
1381 function traceHelper(method) {
1382 if (!this.cache) {
1383 this.cache = Object.create(null);
1384 }
1385 if (!this.cache[method]) {
1386 console.log(method);
1387 this.cache[method] = true;
1388 }
1389 }
1390 let _memberName = Symbol('_memberName');
1391 let _internalName = Symbol('_internalName');
1392 let _kind = Symbol('_kind');
1393 let _arguments = Symbol('_arguments');
1394 let _namedArgumentNames = Symbol('_namedArgumentNames');
1395 let _namedIndices = Symbol('_namedIndices');
1396 let _getCachedInvocation = Symbol('_getCachedInvocation');
1397 class JSInvocationMirror extends core.Object {
1398 JSInvocationMirror($_memberName, $_internalName, $_kind, $_arguments, $_name dArgumentNames) {
1399 this[_memberName] = $_memberName;
1400 this[_internalName] = $_internalName;
1401 this[_kind] = $_kind;
1402 this[_arguments] = $_arguments;
1403 this[_namedArgumentNames] = $_namedArgumentNames;
1404 this[_namedIndices] = null;
1405 }
1406 get memberName() {
1407 if (dart.is(this[_memberName], core.Symbol))
1408 return dart.as(this[_memberName], core.Symbol);
1409 let name = dart.as(this[_memberName], core.String);
1410 let unmangledName = _js_names.mangledNames.get(name);
1411 if (unmangledName !== null) {
1412 name = unmangledName.split(':').get(0);
1413 } else {
1414 if (_js_names.mangledNames.get(this[_internalName]) === null) {
1415 core.print(`Warning: '${name}' is used reflectively but not in Mirrors Used. ` + "This will break minified code.");
1416 }
1417 }
1418 this[_memberName] = new _internal.Symbol.unvalidated(name);
1419 return dart.as(this[_memberName], core.Symbol);
1420 }
1421 get isMethod() {
1422 return this[_kind] === JSInvocationMirror.METHOD;
1423 }
1424 get isGetter() {
1425 return this[_kind] === JSInvocationMirror.GETTER;
1426 }
1427 get isSetter() {
1428 return this[_kind] === JSInvocationMirror.SETTER;
1429 }
1430 get isAccessor() {
1431 return this[_kind] !== JSInvocationMirror.METHOD;
1432 }
1433 get positionalArguments() {
1434 if (this.isGetter)
1435 return /* Unimplemented const */new List.from([]);
1436 let argumentCount = dart.notNull(this[_arguments].length) - dart.notNull(t his[_namedArgumentNames].length);
1437 if (argumentCount === 0)
1438 return /* Unimplemented const */new List.from([]);
1439 let list = new List.from([]);
1440 for (let index = 0; dart.notNull(index) < dart.notNull(argumentCount); ind ex = dart.notNull(index) + 1) {
1441 list.add(this[_arguments].get(index));
1442 }
1443 return dart.as(makeLiteralListConst(list), core.List);
1444 }
1445 get namedArguments() {
1446 if (this.isAccessor)
1447 return dart.map();
1448 let namedArgumentCount = this[_namedArgumentNames].length;
1449 let namedArgumentsStartIndex = dart.notNull(this[_arguments].length) - dar t.notNull(namedArgumentCount);
1450 if (namedArgumentCount === 0)
1451 return dart.map();
1452 let map = new core.Map();
1453 for (let i = 0; dart.notNull(i) < dart.notNull(namedArgumentCount); i = da rt.notNull(i) + 1) {
1454 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName s].get(i), core.String)), this[_arguments].get(dart.notNull(namedArgumentsStartI ndex) + dart.notNull(i)));
1455 }
1456 return map;
1457 }
1458 [_getCachedInvocation](object) {
1459 let interceptor = _interceptors.getInterceptor(object);
1460 let receiver = object;
1461 let name = this[_internalName];
1462 let arguments = this[_arguments];
1463 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded _names.INTERCEPTED_NAMES);
1464 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames, name);
1465 if (isIntercepted) {
1466 receiver = interceptor;
1467 if (object === interceptor) {
1468 interceptor = null;
1469 }
1470 } else {
1471 interceptor = null;
1472 }
1473 let isCatchAll = false;
1474 let method = receiver[name];
1475 if (typeof method != "function") {
1476 let baseName = _internal.Symbol.getName(dart.as(this.memberName, _intern al.Symbol));
1477 method = receiver[baseName + "*"];
1478 if (method === null) {
1479 interceptor = _interceptors.getInterceptor(object);
1480 method = interceptor[baseName + "*"];
1481 if (method !== null) {
1482 isIntercepted = true;
1483 receiver = interceptor;
1484 } else {
1485 interceptor = null;
1486 }
1487 }
1488 isCatchAll = true;
1489 }
1490 if (typeof method == "function") {
1491 if (isCatchAll) {
1492 return new CachedCatchAllInvocation(name, method, isIntercepted, dart. as(interceptor, _interceptors.Interceptor));
1493 } else {
1494 return new CachedInvocation(name, method, isIntercepted, dart.as(inter ceptor, _interceptors.Interceptor));
1495 }
1496 } else {
1497 return new CachedNoSuchMethodInvocation(interceptor);
1498 }
1499 }
1500 static invokeFromMirror(invocation, victim) {
1501 let cached = invocation._getCachedInvocation(victim);
1502 if (dart.dload(cached, 'isNoSuchMethod')) {
1503 return dart.dinvoke(cached, 'invokeOn', victim, invocation);
1504 } else {
1505 return dart.dinvoke(cached, 'invokeOn', victim, invocation[_arguments]);
1506 }
1507 }
1508 static getCachedInvocation(invocation, victim) {
1509 return invocation._getCachedInvocation(victim);
1510 }
1511 }
1512 JSInvocationMirror.METHOD = 0;
1513 JSInvocationMirror.GETTER = 1;
1514 JSInvocationMirror.SETTER = 2;
1515 class CachedInvocation extends core.Object {
1516 CachedInvocation(mangledName, jsFunction, isIntercepted, cachedInterceptor) {
1517 this.mangledName = mangledName;
1518 this.jsFunction = jsFunction;
1519 this.isIntercepted = isIntercepted;
1520 this.cachedInterceptor = cachedInterceptor;
1521 }
1522 get isNoSuchMethod() {
1523 return false;
1524 }
1525 get isGetterStub() {
1526 return !!this.jsFunction.$getterStub;
1527 }
1528 invokeOn(victim, arguments) {
1529 let receiver = victim;
1530 if (!dart.notNull(this.isIntercepted)) {
1531 if (!dart.is(arguments, _interceptors.JSArray))
1532 arguments = new core.List.from(arguments);
1533 } else {
1534 arguments = new List.from([victim]);
1535 arguments.addAll(arguments);
1536 if (this.cachedInterceptor !== null)
1537 receiver = this.cachedInterceptor;
1538 }
1539 return this.jsFunction.apply(receiver, arguments);
1540 }
1541 }
1542 class CachedCatchAllInvocation extends CachedInvocation {
1543 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor) {
1544 this.info = new ReflectionInfo(jsFunction);
1545 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor) ;
1546 }
1547 get isGetterStub() {
1548 return false;
1549 }
1550 invokeOn(victim, arguments) {
1551 let receiver = victim;
1552 let providedArgumentCount = null;
1553 let fullParameterCount = dart.notNull(this.info.requiredParameterCount) + dart.notNull(this.info.optionalParameterCount);
1554 if (!dart.notNull(this.isIntercepted)) {
1555 if (dart.is(arguments, _interceptors.JSArray)) {
1556 providedArgumentCount = arguments.length;
1557 if (dart.notNull(providedArgumentCount) < dart.notNull(fullParameterCo unt)) {
1558 arguments = new core.List.from(arguments);
1559 }
1560 } else {
1561 arguments = new core.List.from(arguments);
1562 providedArgumentCount = arguments.length;
1563 }
1564 } else {
1565 arguments = new List.from([victim]);
1566 arguments.addAll(arguments);
1567 if (this.cachedInterceptor !== null)
1568 receiver = this.cachedInterceptor;
1569 providedArgumentCount = dart.notNull(arguments.length) - 1;
1570 }
1571 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) {
1572 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments.length} arguments.`);
1573 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) {
1574 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`);
1575 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) {
1576 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`);
1577 }
1578 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar ameterCount); i = dart.notNull(i) + 1) {
1579 arguments.add(getMetadata(this.info.defaultValue(i)));
1580 }
1581 return this.jsFunction.apply(receiver, arguments);
1582 }
1583 }
1584 class CachedNoSuchMethodInvocation extends core.Object {
1585 CachedNoSuchMethodInvocation(interceptor) {
1586 this.interceptor = interceptor;
1587 }
1588 get isNoSuchMethod() {
1589 return true;
1590 }
1591 get isGetterStub() {
1592 return false;
1593 }
1594 invokeOn(victim, invocation) {
1595 let receiver = this.interceptor === null ? victim : this.interceptor;
1596 return dart.dinvoke(receiver, 'noSuchMethod', invocation);
1597 }
1598 }
1599 class ReflectionInfo extends core.Object {
1600 ReflectionInfo$internal(jsFunction, data, isAccessor, requiredParameterCount , optionalParameterCount, areOptionalParametersNamed, functionType) {
1601 this.jsFunction = jsFunction;
1602 this.data = data;
1603 this.isAccessor = isAccessor;
1604 this.requiredParameterCount = requiredParameterCount;
1605 this.optionalParameterCount = optionalParameterCount;
1606 this.areOptionalParametersNamed = areOptionalParametersNamed;
1607 this.functionType = functionType;
1608 this.cachedSortedIndices = null;
1609 }
1610 ReflectionInfo(jsFunction) {
1611 let data = dart.as(jsFunction.$reflectionInfo, core.List);
1612 if (data === null)
1613 return null;
1614 data = _interceptors.JSArray.markFixedList(data);
1615 let requiredParametersInfo = data[ReflectionInfo.REQUIRED_PARAMETERS_INFO] ;
1616 let requiredParameterCount = requiredParametersInfo >> 1;
1617 let isAccessor = (dart.notNull(requiredParametersInfo) & 1) === 1;
1618 let optionalParametersInfo = data[ReflectionInfo.OPTIONAL_PARAMETERS_INFO] ;
1619 let optionalParameterCount = optionalParametersInfo >> 1;
1620 let areOptionalParametersNamed = (dart.notNull(optionalParametersInfo) & 1 ) === 1;
1621 let functionType = data[ReflectionInfo.FUNCTION_TYPE_INDEX];
1622 return new ReflectionInfo.internal(jsFunction, data, isAccessor, requiredP arameterCount, optionalParameterCount, areOptionalParametersNamed, functionType) ;
1623 }
1624 parameterName(parameter) {
1625 let metadataIndex = null;
1626 if (_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA')) {
1627 metadataIndex = this.data[2 * parameter + this.optionalParameterCount + ReflectionInfo.FIRST_DEFAULT_ARGUMENT];
1628 } else {
1629 metadataIndex = this.data[parameter + this.optionalParameterCount + Refl ectionInfo.FIRST_DEFAULT_ARGUMENT];
1630 }
1631 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.M ETADATA);
1632 return metadata[metadataIndex];
1633 }
1634 parameterMetadataAnnotations(parameter) {
1635 if (!dart.notNull(_foreign_helper.JS_GET_FLAG('MUST_RETAIN_METADATA'))) {
1636 throw new core.StateError('metadata has not been preserved');
1637 } else {
1638 return dart.as(this.data[2 * parameter + this.optionalParameterCount + R eflectionInfo.FIRST_DEFAULT_ARGUMENT + 1], core.List$(core.int));
1639 }
1640 }
1641 defaultValue(parameter) {
1642 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount))
1643 return null;
1644 return this.data[ReflectionInfo.FIRST_DEFAULT_ARGUMENT + parameter - this. requiredParameterCount];
1645 }
1646 defaultValueInOrder(parameter) {
1647 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount))
1648 return null;
1649 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet erCount === 1) {
1650 return this.defaultValue(parameter);
1651 }
1652 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r equiredParameterCount));
1653 return this.defaultValue(index);
1654 }
1655 parameterNameInOrder(parameter) {
1656 if (dart.notNull(parameter) < dart.notNull(this.requiredParameterCount))
1657 return null;
1658 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet erCount === 1) {
1659 return this.parameterName(parameter);
1660 }
1661 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r equiredParameterCount));
1662 return this.parameterName(index);
1663 }
1664 sortedIndex(unsortedIndex) {
1665 if (this.cachedSortedIndices === null) {
1666 this.cachedSortedIndices = new core.List(this.optionalParameterCount);
1667 let positions = dart.map();
1668 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) {
1669 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i );
1670 positions.set(this.parameterName(index), index);
1671 }
1672 let index = 0;
1673 ((_) => {
1674 _.sort();
1675 return _;
1676 }).bind(this)(positions.keys.toList()).forEach(((name) => {
1677 this.cachedSortedIndices.set((($tmp) => index = dart.notNull($tmp) + 1 , $tmp)(index), positions.get(name));
1678 }).bind(this));
1679 }
1680 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int);
1681 }
1682 computeFunctionRti(jsConstructor) {
1683 if (typeof this.functionType == "number") {
1684 return getMetadata(dart.as(this.functionType, core.int));
1685 } else if (typeof this.functionType == "function") {
1686 let fakeInstance = new jsConstructor();
1687 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]);
1688 return this.functionType.apply({$receiver: fakeInstance});
1689 } else {
1690 throw new RuntimeError('Unexpected function type');
1691 }
1692 }
1693 get reflectionName() {
1694 return this.jsFunction.$reflectionName;
1695 }
1696 }
1697 dart.defineNamedConstructor(ReflectionInfo, 'internal');
1698 ReflectionInfo.REQUIRED_PARAMETERS_INFO = 0;
1699 ReflectionInfo.OPTIONAL_PARAMETERS_INFO = 1;
1700 ReflectionInfo.FUNCTION_TYPE_INDEX = 2;
1701 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3;
1702 // Function getMetadata: (int) → dynamic
1703 function getMetadata(index) {
1704 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA);
1705 return metadata[index];
1706 }
1707 let _throwFormatException = Symbol('_throwFormatException');
1708 let _fromCharCodeApply = Symbol('_fromCharCodeApply');
1709 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
1710 class Primitives extends core.Object {
1711 static initializeStatics(id) {
1712 mirrorFunctionCacheName = `_${id}`;
1713 mirrorInvokeCacheName = `_${id}`;
1714 }
1715 static objectHashCode(object) {
1716 let hash = dart.as(object.$identityHash, core.int);
1717 if (hash === null) {
1718 hash = Math.random() * 0x3fffffff | 0;
1719 object.$identityHash = hash;
1720 }
1721 return hash;
1722 }
1723 static [_throwFormatException](string) {
1724 throw new core.FormatException(string);
1725 }
1726 static parseInt(source, radix, handleError) {
1727 if (handleError === null)
1728 handleError = dart.closureWrap(_throwFormatException, "(String) → int");
1729 checkString(source);
1730 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
1731 let digitsIndex = 1;
1732 let hexIndex = 2;
1733 let decimalIndex = 3;
1734 let nonDecimalHexIndex = 4;
1735 if (radix === null) {
1736 radix = 10;
1737 if (match !== null) {
1738 if (dart.dindex(match, hexIndex) !== null) {
1739 return parseInt(source, 16);
1740 }
1741 if (dart.dindex(match, decimalIndex) !== null) {
1742 return parseInt(source, 10);
1743 }
1744 return handleError(source);
1745 }
1746 } else {
1747 if (!(typeof radix == number))
1748 throw new core.ArgumentError("Radix is not an integer");
1749 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) {
1750 throw new core.RangeError(`Radix ${radix} not in range 2..36`);
1751 }
1752 if (match !== null) {
1753 if (radix === 10 && dart.notNull(dart.dindex(match, decimalIndex) !== null)) {
1754 return parseInt(source, 10);
1755 }
1756 if (dart.notNull(radix) < 10 || dart.notNull(dart.dindex(match, decima lIndex) === null)) {
1757 let maxCharCode = null;
1758 if (dart.notNull(radix) <= 10) {
1759 maxCharCode = 48 + dart.notNull(radix) - 1;
1760 } else {
1761 maxCharCode = 97 + dart.notNull(radix) - 10 - 1;
1762 }
1763 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin g);
1764 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); i = dart.notNull(i) + 1) {
1765 let characterCode = dart.notNull(digitsPart.codeUnitAt(0)) | 32;
1766 if (dart.notNull(digitsPart.codeUnitAt(i)) > dart.notNull(maxCharC ode)) {
1767 return handleError(source);
1768 }
1769 }
1770 }
1771 }
1772 }
1773 if (match === null)
1774 return handleError(source);
1775 return parseInt(source, radix);
1776 }
1777 static parseDouble(source, handleError) {
1778 checkString(source);
1779 if (handleError === null)
1780 handleError = dart.closureWrap(_throwFormatException, "(String) → double ");
1781 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) {
1782 return handleError(source);
1783 }
1784 let result = parseFloat(source);
1785 if (result.isNaN) {
1786 let trimmed = source.trim();
1787 if (dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNull(dart.equal s(trimmed, '+NaN')) || dart.notNull(dart.equals(trimmed, '-NaN'))) {
1788 return result;
1789 }
1790 return handleError(source);
1791 }
1792 return result;
1793 }
1794 static formatType(className, typeArguments) {
1795 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j oinArguments(typeArguments, 0)}`);
1796 }
1797 static objectTypeName(object) {
1798 let name = constructorNameFallback(_interceptors.getInterceptor(object));
1799 if (dart.equals(name, 'Object')) {
1800 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\ s*\(/)[1];
1801 if (typeof decompiled == string)
1802 if (/^\w+$/.test(decompiled))
1803 name = dart.as(decompiled, core.String);
1804 }
1805 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code UnitAt(0), Primitives.DOLLAR_CHAR_VALUE))) {
1806 name = name.substring(1);
1807 }
1808 return formatType(name, dart.as(getRuntimeTypeInfo(object), core.List));
1809 }
1810 static objectToString(object) {
1811 let name = objectTypeName(object);
1812 return `Instance of '${name}'`;
1813 }
1814 static dateNow() {
1815 return Date.now();
1816 }
1817 static initTicker() {
1818 if (timerFrequency !== null)
1819 return;
1820 timerFrequency = 1000;
1821 timerTicks = dateNow;
1822 if (typeof window == "undefined")
1823 return;
1824 let window = window;
1825 if (window === null)
1826 return;
1827 let performance = window.performance;
1828 if (performance === null)
1829 return;
1830 if (typeof performance.now != "function")
1831 return;
1832 timerFrequency = 1000000;
1833 timerTicks = (() => (1000 * performance.now()).floor()).bind(this);
1834 }
1835 static get isD8() {
1836 return typeof version == "function" && typeof os == "object" && "system" i n os;
1837 }
1838 static get isJsshell() {
1839 return typeof version == "function" && typeof system == "function";
1840 }
1841 static currentUri() {
1842 requiresPreamble();
1843 if (!!self.location) {
1844 return self.location.href;
1845 }
1846 return null;
1847 }
1848 static [_fromCharCodeApply](array) {
1849 let result = "";
1850 let kMaxApply = 500;
1851 let end = array.length;
1852 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) {
1853 let subarray = null;
1854 if (dart.notNull(end) <= dart.notNull(kMaxApply)) {
1855 subarray = array;
1856 } else {
1857 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end);
1858 }
1859 result = result + String.fromCharCode.apply(null, subarray);
1860 }
1861 return result;
1862 }
1863 static stringFromCodePoints(codePoints) {
1864 let a = new List.from([]);
1865 for (let i of codePoints) {
1866 if (!(typeof i == number))
1867 throw new core.ArgumentError(i);
1868 if (dart.dbinary(i, '<=', 65535)) {
1869 a.add(dart.as(i, core.int));
1870 } else if (dart.dbinary(i, '<=', 1114111)) {
1871 a.add(55296['+'](dart.dbinary(dart.dbinary(dart.dbinary(i, '-', 65536) , '>>', 10), '&', 1023)));
1872 a.add(56320['+'](dart.dbinary(i, '&', 1023)));
1873 } else {
1874 throw new core.ArgumentError(i);
1875 }
1876 }
1877 return _fromCharCodeApply(a);
1878 }
1879 static stringFromCharCodes(charCodes) {
1880 for (let i of charCodes) {
1881 if (!(typeof i == number))
1882 throw new core.ArgumentError(i);
1883 if (dart.dbinary(i, '<', 0))
1884 throw new core.ArgumentError(i);
1885 if (dart.dbinary(i, '>', 65535))
1886 return stringFromCodePoints(charCodes);
1887 }
1888 return _fromCharCodeApply(dart.as(charCodes, core.List$(core.int)));
1889 }
1890 static stringFromCharCode(charCode) {
1891 if (0['<='](charCode)) {
1892 if (dart.dbinary(charCode, '<=', 65535)) {
1893 return String.fromCharCode(charCode);
1894 }
1895 if (dart.dbinary(charCode, '<=', 1114111)) {
1896 let bits = dart.dbinary(charCode, '-', 65536);
1897 let low = 56320['|'](dart.dbinary(bits, '&', 1023));
1898 let high = 55296['|'](dart.dbinary(bits, '>>', 10));
1899 return String.fromCharCode(high, low);
1900 }
1901 }
1902 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111);
1903 }
1904 static stringConcatUnchecked(string1, string2) {
1905 return _foreign_helper.JS_STRING_CONCAT(string1, string2);
1906 }
1907 static flattenString(str) {
1908 return str.charCodeAt(0) == 0 ? str : str;
1909 }
1910 static getTimeZoneName(receiver) {
1911 let d = lazyAsJsDate(receiver);
1912 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List);
1913 if (match !== null)
1914 return dart.as(match.get(1), core.String);
1915 match = dart.as(/^[A-Z,a-z]{3}\s[A-Z,a-z]{3}\s\d+\s\d{2}:\d{2}:\d{2}\s([A- Z]{3,5})\s\d{4}$/.exec(d.toString()), core.List);
1916 if (match !== null)
1917 return dart.as(match.get(1), core.String);
1918 match = dart.as(/(?:GMT|UTC)[+-]\d{4}/.exec(d.toString()), core.List);
1919 if (match !== null)
1920 return dart.as(match.get(0), core.String);
1921 return "";
1922 }
1923 static getTimeZoneOffsetInMinutes(receiver) {
1924 return -lazyAsJsDate(receiver).getTimezoneOffset();
1925 }
1926 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m illiseconds, isUtc) {
1927 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
1928 checkInt(years);
1929 checkInt(month);
1930 checkInt(day);
1931 checkInt(hours);
1932 checkInt(minutes);
1933 checkInt(seconds);
1934 checkInt(milliseconds);
1935 checkBool(isUtc);
1936 let jsMonth = dart.dbinary(month, '-', 1);
1937 let value = null;
1938 if (isUtc) {
1939 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds);
1940 } else {
1941 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf();
1942 }
1943 if (core.bool['||'](dart.dbinary(dart.dload(value, 'isNaN'), '||', dart.db inary(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH))), dart.dbinary(va lue, '>', MAX_MILLISECONDS_SINCE_EPOCH))) {
1944 return null;
1945 }
1946 if (dart.dbinary(dart.dbinary(years, '<=', 0), '||', dart.dbinary(years, ' <', 100)))
1947 return patchUpY2K(value, years, isUtc);
1948 return value;
1949 }
1950 static patchUpY2K(value, years, isUtc) {
1951 let date = new Date(value);
1952 if (isUtc) {
1953 date.setUTCFullYear(years);
1954 } else {
1955 date.setFullYear(years);
1956 }
1957 return date.valueOf();
1958 }
1959 static lazyAsJsDate(receiver) {
1960 if (receiver.date === void 0) {
1961 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch')) ;
1962 }
1963 return receiver.date;
1964 }
1965 static getYear(receiver) {
1966 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCFullYe ar() + 0 : lazyAsJsDate(receiver).getFullYear() + 0;
1967 }
1968 static getMonth(receiver) {
1969 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMonth( ) + 1 : lazyAsJsDate(receiver).getMonth() + 1;
1970 }
1971 static getDay(receiver) {
1972 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCDate() + 0 : lazyAsJsDate(receiver).getDate() + 0;
1973 }
1974 static getHours(receiver) {
1975 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCHours( ) + 0 : lazyAsJsDate(receiver).getHours() + 0;
1976 }
1977 static getMinutes(receiver) {
1978 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMinute s() + 0 : lazyAsJsDate(receiver).getMinutes() + 0;
1979 }
1980 static getSeconds(receiver) {
1981 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCSecond s() + 0 : lazyAsJsDate(receiver).getSeconds() + 0;
1982 }
1983 static getMilliseconds(receiver) {
1984 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMillis econds() + 0 : lazyAsJsDate(receiver).getMilliseconds() + 0;
1985 }
1986 static getWeekday(receiver) {
1987 let weekday = dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUT CDay() + 0 : lazyAsJsDate(receiver).getDay() + 0;
1988 return (dart.notNull(weekday) + 6) % 7 + 1;
1989 }
1990 static valueFromDateString(str) {
1991 if (!(typeof str == string))
1992 throw new core.ArgumentError(str);
1993 let value = Date.parse(str);
1994 if (value.isNaN)
1995 throw new core.ArgumentError(str);
1996 return value;
1997 }
1998 static getProperty(object, key) {
1999 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) {
2000 throw new core.ArgumentError(object);
2001 }
2002 return object[key];
2003 }
2004 static setProperty(object, key, value) {
2005 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) {
2006 throw new core.ArgumentError(object);
2007 }
2008 object[key] = value;
2009 }
2010 static functionNoSuchMethod(function, positionalArguments, namedArguments) {
2011 let argumentCount = 0;
2012 let arguments = new List.from([]);
2013 let namedArgumentList = new List.from([]);
2014 if (positionalArguments !== null) {
2015 argumentCount = positionalArguments.length;
2016 arguments.addAll(positionalArguments);
2017 }
2018 let names = '';
2019 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) {
2020 namedArguments.forEach(((name, argument) => {
2021 names = `${names}$${name}`;
2022 namedArgumentList.add(name);
2023 arguments.add(argument);
2024 argumentCount = dart.notNull(argumentCount) + 1;
2025 }).bind(this));
2026 }
2027 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`;
2028 return dart.dinvoke(function, 'noSuchMethod', createUnmangledInvocationMir ror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocatio nMirror.METHOD, arguments, namedArgumentList));
2029 }
2030 static applyFunction(function, positionalArguments, namedArguments) {
2031 return namedArguments === null ? applyFunctionWithPositionalArguments(func tion, positionalArguments) : applyFunctionWithNamedArguments(function, positiona lArguments, namedArguments);
2032 }
2033 static applyFunctionWithPositionalArguments(function, positionalArguments) {
2034 let argumentCount = 0;
2035 let arguments = null;
2036 if (positionalArguments !== null) {
2037 if (positionalArguments instanceof Array) {
2038 arguments = positionalArguments;
2039 } else {
2040 arguments = new core.List.from(positionalArguments);
2041 }
2042 argumentCount = arguments.length;
2043 } else {
2044 arguments = new List.from([]);
2045 }
2046 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}`;
2047 let jsFunction = function[selectorName];
2048 if (jsFunction === null) {
2049 return functionNoSuchMethod(function, positionalArguments, null);
2050 }
2051 return jsFunction.apply(function, arguments);
2052 }
2053 static applyFunctionWithNamedArguments(function, positionalArguments, namedA rguments) {
2054 if (namedArguments.isEmpty) {
2055 return applyFunctionWithPositionalArguments(function, positionalArgument s);
2056 }
2057 let interceptor = _interceptors.getInterceptor(function);
2058 let jsFunction = interceptor["call*"];
2059 if (jsFunction === null) {
2060 return functionNoSuchMethod(function, positionalArguments, namedArgument s);
2061 }
2062 let info = new ReflectionInfo(jsFunction);
2063 if (dart.notNull(info === null) || !dart.notNull(info.areOptionalParameter sNamed)) {
2064 return functionNoSuchMethod(function, positionalArguments, namedArgument s);
2065 }
2066 if (positionalArguments !== null) {
2067 positionalArguments = new core.List.from(positionalArguments);
2068 } else {
2069 positionalArguments = new List.from([]);
2070 }
2071 if (info.requiredParameterCount !== positionalArguments.length) {
2072 return functionNoSuchMethod(function, positionalArguments, namedArgument s);
2073 }
2074 let defaultArguments = new core.Map();
2075 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) {
2076 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount);
2077 let parameterName = info.parameterNameInOrder(index);
2078 let value = info.defaultValueInOrder(index);
2079 let defaultValue = getMetadata(value);
2080 defaultArguments.set(parameterName, defaultValue);
2081 }
2082 let bad = false;
2083 namedArguments.forEach(((parameter, value) => {
2084 if (defaultArguments.containsKey(parameter)) {
2085 defaultArguments.set(parameter, value);
2086 } else {
2087 bad = true;
2088 }
2089 }).bind(this));
2090 if (bad) {
2091 return functionNoSuchMethod(function, positionalArguments, namedArgument s);
2092 }
2093 positionalArguments.addAll(defaultArguments.values);
2094 return jsFunction.apply(function, positionalArguments);
2095 }
2096 static [_mangledNameMatchesType](mangledName, type) {
2097 return mangledName == type[_typeName];
2098 }
2099 static identicalImplementation(a, b) {
2100 return a == null ? b == null : a === b;
2101 }
2102 static extractStackTrace(error) {
2103 return getTraceFromException(error.$thrownJsError);
2104 }
2105 }
2106 Primitives.mirrorFunctionCacheName = '$cachedFunction';
2107 Primitives.mirrorInvokeCacheName = '$cachedInvocation';
2108 Primitives.DOLLAR_CHAR_VALUE = 36;
2109 Primitives.timerFrequency = null;
2110 Primitives.timerTicks = null;
2111 class JsCache extends core.Object {
2112 static allocate() {
2113 let result = Object.create(null);
2114 result.x = 0;
2115 delete result.x;
2116 return result;
2117 }
2118 static fetch(cache, key) {
2119 return cache[key];
2120 }
2121 static update(cache, key, value) {
2122 cache[key] = value;
2123 }
2124 }
2125 // Function iae: (dynamic) → dynamic
2126 function iae(argument) {
2127 throw new core.ArgumentError(argument);
2128 }
2129 // Function ioore: (dynamic, dynamic) → dynamic
2130 function ioore(receiver, index) {
2131 if (receiver === null)
2132 dart.dload(receiver, 'length');
2133 if (!(typeof index == number))
2134 iae(index);
2135 throw new core.RangeError.value(dart.as(index, core.num));
2136 }
2137 // Function stringLastIndexOfUnchecked: (dynamic, dynamic, dynamic) → dynamic
2138 function stringLastIndexOfUnchecked(receiver, element, start) {
2139 return receiver.lastIndexOf(element, start);
2140 }
2141 // Function checkNull: (dynamic) → dynamic
2142 function checkNull(object) {
2143 if (object === null)
2144 throw new core.ArgumentError(null);
2145 return object;
2146 }
2147 // Function checkNum: (dynamic) → dynamic
2148 function checkNum(value) {
2149 if (!dart.is(value, core.num)) {
2150 throw new core.ArgumentError(value);
2151 }
2152 return value;
2153 }
2154 // Function checkInt: (dynamic) → dynamic
2155 function checkInt(value) {
2156 if (!(typeof value == number)) {
2157 throw new core.ArgumentError(value);
2158 }
2159 return value;
2160 }
2161 // Function checkBool: (dynamic) → dynamic
2162 function checkBool(value) {
2163 if (!(typeof value == boolean)) {
2164 throw new core.ArgumentError(value);
2165 }
2166 return value;
2167 }
2168 // Function checkString: (dynamic) → dynamic
2169 function checkString(value) {
2170 if (!(typeof value == string)) {
2171 throw new core.ArgumentError(value);
2172 }
2173 return value;
2174 }
2175 // Function wrapException: (dynamic) → dynamic
2176 function wrapException(ex) {
2177 if (ex === null)
2178 ex = new core.NullThrownError();
2179 let wrapper = new Error();
2180 wrapper.dartException = ex;
2181 if ("defineProperty" in Object) {
2182 Object.defineProperty(wrapper, "message", {get: _foreign_helper.DART_CLOSU RE_TO_JS(toStringWrapper)});
2183 wrapper.name = "";
2184 } else {
2185 wrapper.toString = _foreign_helper.DART_CLOSURE_TO_JS(toStringWrapper);
2186 }
2187 return wrapper;
2188 }
2189 // Function toStringWrapper: () → dynamic
2190 function toStringWrapper() {
2191 return dart.dinvoke(this.dartException, 'toString');
2192 }
2193 // Function throwExpression: (dynamic) → dynamic
2194 function throwExpression(ex) {
2195 throw wrapException(ex);
2196 }
2197 // Function makeLiteralListConst: (dynamic) → dynamic
2198 function makeLiteralListConst(list) {
2199 list.immutable$list = true;
2200 list.fixed$length = true;
2201 return list;
2202 }
2203 // Function throwRuntimeError: (dynamic) → dynamic
2204 function throwRuntimeError(message) {
2205 throw new RuntimeError(message);
2206 }
2207 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic
2208 function throwAbstractClassInstantiationError(className) {
2209 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin g));
2210 }
2211 let _argumentsExpr = Symbol('_argumentsExpr');
2212 let _expr = Symbol('_expr');
2213 let _method = Symbol('_method');
2214 let _receiver = Symbol('_receiver');
2215 let _pattern = Symbol('_pattern');
2216 class TypeErrorDecoder extends core.Object {
2217 TypeErrorDecoder($_arguments, $_argumentsExpr, $_expr, $_method, $_receiver, $_pattern) {
2218 this[_arguments] = $_arguments;
2219 this[_argumentsExpr] = $_argumentsExpr;
2220 this[_expr] = $_expr;
2221 this[_method] = $_method;
2222 this[_receiver] = $_receiver;
2223 this[_pattern] = $_pattern;
2224 }
2225 matchTypeError(message) {
2226 let match = new RegExp(this[_pattern]).exec(message);
2227 if (match === null)
2228 return null;
2229 let result = Object.create(null);
2230 if (this[_arguments] !== -1) {
2231 result.arguments = match[this[_arguments] + 1];
2232 }
2233 if (this[_argumentsExpr] !== -1) {
2234 result.argumentsExpr = match[this[_argumentsExpr] + 1];
2235 }
2236 if (this[_expr] !== -1) {
2237 result.expr = match[this[_expr] + 1];
2238 }
2239 if (this[_method] !== -1) {
2240 result.method = match[this[_method] + 1];
2241 }
2242 if (this[_receiver] !== -1) {
2243 result.receiver = match[this[_receiver] + 1];
2244 }
2245 return result;
2246 }
2247 static buildJavaScriptObject() {
2248 return {
2249 toString: function() {
2250 return "$receiver$";
2251 }
2252 };
2253 }
2254 static buildJavaScriptObjectWithNonClosure() {
2255 return {
2256 $method$: null,
2257 toString: function() {
2258 return "$receiver$";
2259 }
2260 };
2261 }
2262 static extractPattern(message) {
2263 message = message.replace(String({}), '$receiver$');
2264 message = message.replace(new RegExp(ESCAPE_REGEXP, 'g'), '\\$&');
2265 let match = dart.as(message.match(/\\\$[a-zA-Z]+\\\$/g), core.List$(core.S tring));
2266 if (match === null)
2267 match = dart.as(new List.from([]), core.List$(core.String));
2268 let arguments = match.indexOf('\\$arguments\\$');
2269 let argumentsExpr = match.indexOf('\\$argumentsExpr\\$');
2270 let expr = match.indexOf('\\$expr\\$');
2271 let method = match.indexOf('\\$method\\$');
2272 let receiver = match.indexOf('\\$receiver\\$');
2273 let pattern = message.replace('\\$arguments\\$', '((?:x|[^x])*)').replace( '\\$argumentsExpr\\$', '((?:x|[^x])*)').replace('\\$expr\\$', '((?:x|[^x])*)').r eplace('\\$method\\$', '((?:x|[^x])*)').replace('\\$receiver\\$', '((?:x|[^x])*) ');
2274 return new TypeErrorDecoder(arguments, argumentsExpr, expr, method, receiv er, pattern);
2275 }
2276 static provokeCallErrorOn(expression) {
2277 let function = function($expr$) {
2278 var $argumentsExpr$ = '$arguments$';
2279 try {
2280 $expr$.$method$($argumentsExpr$);
2281 } catch (e) {
2282 return e.message;
2283 }
2284
2285 };
2286 return function(expression);
2287 }
2288 static provokeCallErrorOnNull() {
2289 let function = function() {
2290 var $argumentsExpr$ = '$arguments$';
2291 try {
2292 null.$method$($argumentsExpr$);
2293 } catch (e) {
2294 return e.message;
2295 }
2296
2297 };
2298 return function();
2299 }
2300 static provokeCallErrorOnUndefined() {
2301 let function = function() {
2302 var $argumentsExpr$ = '$arguments$';
2303 try {
2304 (void 0).$method$($argumentsExpr$);
2305 } catch (e) {
2306 return e.message;
2307 }
2308
2309 };
2310 return function();
2311 }
2312 static provokePropertyErrorOn(expression) {
2313 let function = function($expr$) {
2314 try {
2315 $expr$.$method$;
2316 } catch (e) {
2317 return e.message;
2318 }
2319
2320 };
2321 return function(expression);
2322 }
2323 static provokePropertyErrorOnNull() {
2324 let function = function() {
2325 try {
2326 null.$method$;
2327 } catch (e) {
2328 return e.message;
2329 }
2330
2331 };
2332 return function();
2333 }
2334 static provokePropertyErrorOnUndefined() {
2335 let function = function() {
2336 try {
2337 (void 0).$method$;
2338 } catch (e) {
2339 return e.message;
2340 }
2341
2342 };
2343 return function();
2344 }
2345 }
2346 dart.defineLazyProperties(TypeErrorDecoder, {
2347 get noSuchMethodPattern() {
2348 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObject())) , TypeErrorDecoder);
2349 },
2350 get notClosurePattern() {
2351 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObjectWith NonClosure())), TypeErrorDecoder);
2352 },
2353 get nullCallPattern() {
2354 return dart.as(extractPattern(provokeCallErrorOn(null)), TypeErrorDecoder) ;
2355 },
2356 get nullLiteralCallPattern() {
2357 return dart.as(extractPattern(provokeCallErrorOnNull()), TypeErrorDecoder) ;
2358 },
2359 get undefinedCallPattern() {
2360 return dart.as(extractPattern(provokeCallErrorOn(void 0)), TypeErrorDecode r);
2361 },
2362 get undefinedLiteralCallPattern() {
2363 return dart.as(extractPattern(provokeCallErrorOnUndefined()), TypeErrorDec oder);
2364 },
2365 get nullPropertyPattern() {
2366 return dart.as(extractPattern(provokePropertyErrorOn(null)), TypeErrorDeco der);
2367 },
2368 get nullLiteralPropertyPattern() {
2369 return dart.as(extractPattern(provokePropertyErrorOnNull()), TypeErrorDeco der);
2370 },
2371 get undefinedPropertyPattern() {
2372 return dart.as(extractPattern(provokePropertyErrorOn(void 0)), TypeErrorDe coder);
2373 },
2374 get undefinedLiteralPropertyPattern() {
2375 return dart.as(extractPattern(provokePropertyErrorOnUndefined()), TypeErro rDecoder);
2376 }
2377 });
2378 let _message = Symbol('_message');
2379 class NullError extends core.Error {
2380 NullError($_message, match) {
2381 this[_message] = $_message;
2382 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
2383 super.Error();
2384 }
2385 toString() {
2386 if (this[_method] === null)
2387 return `NullError: ${this[_message]}`;
2388 return `NullError: Cannot call "${this[_method]}" on null`;
2389 }
2390 }
2391 class JsNoSuchMethodError extends core.Error {
2392 JsNoSuchMethodError($_message, match) {
2393 this[_message] = $_message;
2394 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
2395 this[_receiver] = dart.as(match === null ? null : match.receiver, core.Str ing);
2396 super.Error();
2397 }
2398 toString() {
2399 if (this[_method] === null)
2400 return `NoSuchMethodError: ${this[_message]}`;
2401 if (this[_receiver] === null) {
2402 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa ge]})`;
2403 }
2404 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece iver]}" ` + `(${this[_message]})`;
2405 }
2406 }
2407 class UnknownJsTypeError extends core.Error {
2408 UnknownJsTypeError($_message) {
2409 this[_message] = $_message;
2410 super.Error();
2411 }
2412 toString() {
2413 return this[_message].isEmpty ? 'Error' : `Error: ${this[_message]}`;
2414 }
2415 }
2416 // Function unwrapException: (dynamic) → dynamic
2417 function unwrapException(ex) {
2418 // Function saveStackTrace: (dynamic) → dynamic
2419 function saveStackTrace(error) {
2420 if (dart.is(error, core.Error)) {
2421 let thrownStackTrace = error.$thrownJsError;
2422 if (thrownStackTrace === null) {
2423 error.$thrownJsError = ex;
2424 }
2425 }
2426 return error;
2427 }
2428 if (ex === null)
2429 return null;
2430 if (typeof ex !== "object")
2431 return ex;
2432 if ("dartException" in ex) {
2433 return saveStackTrace(ex.dartException);
2434 } else if (!("message" in ex)) {
2435 return ex;
2436 }
2437 let message = ex.message;
2438 if ("number" in ex && typeof ex.number == "number") {
2439 let number = ex.number;
2440 let ieErrorCode = dart.notNull(number) & 65535;
2441 let ieFacilityNumber = dart.notNull(number) >> 16 & 8191;
2442 if (ieFacilityNumber === 10) {
2443 switch (ieErrorCode) {
2444 case 438:
2445 return saveStackTrace(new JsNoSuchMethodError(`${message} (Error ${i eErrorCode})`, null));
2446 case 445:
2447 case 5007:
2448 return saveStackTrace(new NullError(`${message} (Error ${ieErrorCode })`, null));
2449 }
2450 }
2451 }
2452 if (ex instanceof TypeError) {
2453 let match = null;
2454 let nsme = TypeErrorDecoder.noSuchMethodPattern;
2455 let notClosure = TypeErrorDecoder.notClosurePattern;
2456 let nullCall = TypeErrorDecoder.nullCallPattern;
2457 let nullLiteralCall = TypeErrorDecoder.nullLiteralCallPattern;
2458 let undefCall = TypeErrorDecoder.undefinedCallPattern;
2459 let undefLiteralCall = TypeErrorDecoder.undefinedLiteralCallPattern;
2460 let nullProperty = TypeErrorDecoder.nullPropertyPattern;
2461 let nullLiteralProperty = TypeErrorDecoder.nullLiteralPropertyPattern;
2462 let undefProperty = TypeErrorDecoder.undefinedPropertyPattern;
2463 let undefLiteralProperty = TypeErrorDecoder.undefinedLiteralPropertyPatter n;
2464 if ((match = dart.dinvoke(nsme, 'matchTypeError', message)) !== null) {
2465 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri ng), match));
2466 } else if ((match = dart.dinvoke(notClosure, 'matchTypeError', message)) ! == null) {
2467 match.method = "call";
2468 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri ng), match));
2469 } else if (dart.notNull((match = dart.dinvoke(nullCall, 'matchTypeError', message)) !== null) || dart.notNull((match = dart.dinvoke(nullLiteralCall, 'matc hTypeError', message)) !== null) || dart.notNull((match = dart.dinvoke(undefCall , 'matchTypeError', message)) !== null) || dart.notNull((match = dart.dinvoke(un defLiteralCall, 'matchTypeError', message)) !== null) || dart.notNull((match = d art.dinvoke(nullProperty, 'matchTypeError', message)) !== null) || dart.notNull( (match = dart.dinvoke(nullLiteralCall, 'matchTypeError', message)) !== null) || dart.notNull((match = dart.dinvoke(undefProperty, 'matchTypeError', message)) != = null) || dart.notNull((match = dart.dinvoke(undefLiteralProperty, 'matchTypeEr ror', message)) !== null)) {
2470 return saveStackTrace(new NullError(dart.as(message, core.String), match ));
2471 }
2472 return saveStackTrace(new UnknownJsTypeError(dart.as(typeof message == str ing ? message : '', core.String)));
2473 }
2474 if (ex instanceof RangeError) {
2475 if (dart.notNull(typeof message == string) && dart.notNull(contains(dart.a s(message, core.String), 'call stack'))) {
2476 return new core.StackOverflowError();
2477 }
2478 return saveStackTrace(new core.ArgumentError());
2479 }
2480 if (typeof InternalError == "function" && ex instanceof InternalError) {
2481 if (dart.notNull(typeof message == string) && dart.notNull(dart.equals(mes sage, 'too much recursion'))) {
2482 return new core.StackOverflowError();
2483 }
2484 }
2485 return ex;
2486 }
2487 // Function getTraceFromException: (dynamic) → StackTrace
2488 function getTraceFromException(exception) {
2489 return new _StackTrace(exception);
2490 }
2491 let _exception = Symbol('_exception');
2492 let _trace = Symbol('_trace');
2493 class _StackTrace extends core.Object {
2494 _StackTrace($_exception) {
2495 this[_exception] = $_exception;
2496 this[_trace] = null;
2497 }
2498 toString() {
2499 if (this[_trace] !== null)
2500 return this[_trace];
2501 let trace = null;
2502 if (typeof this[_exception] === "object") {
2503 trace = dart.as(this[_exception].stack, core.String);
2504 }
2505 return this[_trace] = trace === null ? '' : trace;
2506 }
2507 }
2508 // Function objectHashCode: (dynamic) → int
2509 function objectHashCode(object) {
2510 if (dart.notNull(object === null) || typeof object != 'object') {
2511 return dart.as(dart.dload(object, 'hashCode'), core.int);
2512 } else {
2513 return Primitives.objectHashCode(object);
2514 }
2515 }
2516 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic
2517 function fillLiteralMap(keyValuePairs, result) {
2518 let index = 0;
2519 let length = getLength(keyValuePairs);
2520 while (dart.notNull(index) < dart.notNull(length)) {
2521 let key = getIndex(keyValuePairs, (($tmp) => index = dart.notNull($tmp) + 1, $tmp)(index));
2522 let value = getIndex(keyValuePairs, (($tmp) => index = dart.notNull($tmp) + 1, $tmp)(index));
2523 result.set(key, value);
2524 }
2525 return result;
2526 }
2527 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
2528 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
2529 if (numberOfArguments === 0) {
2530 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure));
2531 } else if (numberOfArguments === 1) {
2532 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1));
2533 } else if (numberOfArguments === 2) {
2534 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2));
2535 } else if (numberOfArguments === 3) {
2536 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3));
2537 } else if (numberOfArguments === 4) {
2538 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3, arg4));
2539 } else {
2540 throw new core.Exception('Unsupported number of arguments for wrapped clos ure');
2541 }
2542 }
2543 // Function convertDartClosureToJS: (dynamic, int) → dynamic
2544 function convertDartClosureToJS(closure, arity) {
2545 if (closure === null)
2546 return null;
2547 let function = closure.$identity;
2548 if (!!function)
2549 return function;
2550 function = function(closure, arity, context, invoke) {
2551 return function(a1, a2, a3, a4) {
2552 return invoke(closure, context, arity, a1, a2, a3, a4);
2553 };
2554 }(closure, arity, _foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _foreign_hel per.DART_CLOSURE_TO_JS(invokeClosure));
2555 closure.$identity = function;
2556 return function;
2557 }
2558 class Closure extends core.Object {
2559 Closure() {
2560 }
2561 static fromTearOff(receiver, functions, reflectionInfo, isStatic, jsArgument s, propertyName) {
2562 _foreign_helper.JS_EFFECT(() => {
2563 BoundClosure.receiverOf(dart.as(void 0, BoundClosure));
2564 BoundClosure.selfOf(dart.as(void 0, BoundClosure));
2565 });
2566 let function = functions[0];
2567 let name = dart.as(function.$stubName, core.String);
2568 let callName = dart.as(function.$callName, core.String);
2569 function.$reflectionInfo = reflectionInfo;
2570 let info = new ReflectionInfo(function);
2571 let functionType = info.functionType;
2572 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
2573 prototype.$initialize = prototype.constructor;
2574 let constructor = isStatic ? function() {
2575 this.$initialize();
2576 } : isCsp ? function(a, b, c, d) {
2577 this.$initialize(a, b, c, d);
2578 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + (($tmp ) => functionCounter = dart.notNull($tmp) + 1, $tmp)(functionCounter));
2579 prototype.constructor = constructor;
2580 constructor.prototype = prototype;
2581 let trampoline = function;
2582 let isIntercepted = false;
2583 if (!dart.notNull(isStatic)) {
2584 if (jsArguments.length == 1) {
2585 isIntercepted = true;
2586 }
2587 trampoline = forwardCallTo(receiver, function, isIntercepted);
2588 trampoline.$reflectionInfo = reflectionInfo;
2589 } else {
2590 prototype.$name = propertyName;
2591 }
2592 let signatureFunction = null;
2593 if (typeof functionType == "number") {
2594 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .METADATA);
2595 signatureFunction = function(s) {
2596 return function() {
2597 return metadata[s];
2598 };
2599 }(functionType);
2600 } else if (!dart.notNull(isStatic) && typeof functionType == "function") {
2601 let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF( BoundClosure.receiverOf) : _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.se lfOf);
2602 signatureFunction = function(f, r) {
2603 return function() {
2604 return f.apply({$receiver: r(this)}, arguments);
2605 };
2606 }(functionType, getReceiver);
2607 } else {
2608 throw 'Error in reflectionInfo.';
2609 }
2610 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction;
2611 prototype[callName] = trampoline;
2612 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); i = dart .notNull(i) + 1) {
2613 let stub = functions.get(i);
2614 let stubCallName = stub.$callName;
2615 if (stubCallName !== null) {
2616 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st ub, isIntercepted);
2617 }
2618 }
2619 prototype["call*"] = trampoline;
2620 return constructor;
2621 }
2622 static cspForwardCall(arity, isSuperCall, stubName, function) {
2623 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2624 if (isSuperCall)
2625 arity = -1;
2626 switch (arity) {
2627 case 0:
2628 return function(n, S) {
2629 return function() {
2630 return S(this)[n]();
2631 };
2632 }(stubName, getSelf);
2633 case 1:
2634 return function(n, S) {
2635 return function(a) {
2636 return S(this)[n](a);
2637 };
2638 }(stubName, getSelf);
2639 case 2:
2640 return function(n, S) {
2641 return function(a, b) {
2642 return S(this)[n](a, b);
2643 };
2644 }(stubName, getSelf);
2645 case 3:
2646 return function(n, S) {
2647 return function(a, b, c) {
2648 return S(this)[n](a, b, c);
2649 };
2650 }(stubName, getSelf);
2651 case 4:
2652 return function(n, S) {
2653 return function(a, b, c, d) {
2654 return S(this)[n](a, b, c, d);
2655 };
2656 }(stubName, getSelf);
2657 case 5:
2658 return function(n, S) {
2659 return function(a, b, c, d, e) {
2660 return S(this)[n](a, b, c, d, e);
2661 };
2662 }(stubName, getSelf);
2663 default:
2664 return function(f, s) {
2665 return function() {
2666 return f.apply(s(this), arguments);
2667 };
2668 }(function, getSelf);
2669 }
2670 }
2671 static get isCsp() {
2672 return typeof dart_precompiled == "function";
2673 }
2674 static forwardCallTo(receiver, function, isIntercepted) {
2675 if (isIntercepted)
2676 return forwardInterceptedCallTo(receiver, function);
2677 let stubName = dart.as(function.$stubName, core.String);
2678 let arity = function.length;
2679 let lookedUpFunction = receiver[stubName];
2680 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) );
2681 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) {
2682 return cspForwardCall(arity, isSuperCall, stubName, function);
2683 }
2684 if (arity === 0) {
2685 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${(($tmp) => functionCounter = dart.notNull($ tmp) + 1, $tmp)(functionCounter)}` + '}')();
2686 }
2687 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
2688 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(",");
2689 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${(($tmp) => functionCo unter = dart.notNull($tmp) + 1, $tmp)(functionCounter)}` + '}')();
2690 }
2691 static cspForwardInterceptedCall(arity, isSuperCall, name, function) {
2692 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2693 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
2694 if (isSuperCall)
2695 arity = -1;
2696 switch (arity) {
2697 case 0:
2698 throw new RuntimeError('Intercepted function with no arguments.');
2699 case 1:
2700 return function(n, s, r) {
2701 return function() {
2702 return s(this)[n](r(this));
2703 };
2704 }(name, getSelf, getReceiver);
2705 case 2:
2706 return function(n, s, r) {
2707 return function(a) {
2708 return s(this)[n](r(this), a);
2709 };
2710 }(name, getSelf, getReceiver);
2711 case 3:
2712 return function(n, s, r) {
2713 return function(a, b) {
2714 return s(this)[n](r(this), a, b);
2715 };
2716 }(name, getSelf, getReceiver);
2717 case 4:
2718 return function(n, s, r) {
2719 return function(a, b, c) {
2720 return s(this)[n](r(this), a, b, c);
2721 };
2722 }(name, getSelf, getReceiver);
2723 case 5:
2724 return function(n, s, r) {
2725 return function(a, b, c, d) {
2726 return s(this)[n](r(this), a, b, c, d);
2727 };
2728 }(name, getSelf, getReceiver);
2729 case 6:
2730 return function(n, s, r) {
2731 return function(a, b, c, d, e) {
2732 return s(this)[n](r(this), a, b, c, d, e);
2733 };
2734 }(name, getSelf, getReceiver);
2735 default:
2736 return function(f, s, r, a) {
2737 return function() {
2738 a = [r(this)];
2739 Array.prototype.push.apply(a, arguments);
2740 return f.apply(s(this), a);
2741 };
2742 }(function, getSelf, getReceiver);
2743 }
2744 }
2745 static forwardInterceptedCallTo(receiver, function) {
2746 let selfField = BoundClosure.selfFieldName();
2747 let receiverField = BoundClosure.receiverFieldName();
2748 let stubName = dart.as(function.$stubName, core.String);
2749 let arity = function.length;
2750 let isCsp = typeof dart_precompiled == "function";
2751 let lookedUpFunction = receiver[stubName];
2752 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) );
2753 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
2754 return cspForwardInterceptedCall(arity, isSuperCall, stubName, function) ;
2755 }
2756 if (arity === 1) {
2757 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${(($tmp) => functionCounter = dart.notNull ($tmp) + 1, $tmp)(functionCounter)}` + '}')();
2758 }
2759 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
2760 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(",");
2761 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${(($tmp) => functi onCounter = dart.notNull($tmp) + 1, $tmp)(functionCounter)}` + '}')();
2762 }
2763 toString() {
2764 return "Closure";
2765 }
2766 }
2767 Closure.FUNCTION_INDEX = 0;
2768 Closure.NAME_INDEX = 1;
2769 Closure.CALL_NAME_INDEX = 2;
2770 Closure.REQUIRED_PARAMETER_INDEX = 3;
2771 Closure.OPTIONAL_PARAMETER_INDEX = 4;
2772 Closure.DEFAULT_ARGUMENTS_INDEX = 5;
2773 Closure.functionCounter = 0;
2774 // Function closureFromTearOff: (dynamic, dynamic, dynamic, dynamic, dynamic, dynamic) → dynamic
2775 function closureFromTearOff(receiver, functions, reflectionInfo, isStatic, jsA rguments, name) {
2776 return Closure.fromTearOff(receiver, _interceptors.JSArray.markFixedList(dar t.as(functions, core.List)), _interceptors.JSArray.markFixedList(dart.as(reflect ionInfo, core.List)), !!isStatic, jsArguments, name);
2777 }
2778 class TearOffClosure extends Closure {
2779 }
2780 let _self = Symbol('_self');
2781 let _target = Symbol('_target');
2782 let _name = Symbol('_name');
2783 class BoundClosure extends TearOffClosure {
2784 BoundClosure($_self, $_target, $_receiver, $_name) {
2785 this[_self] = $_self;
2786 this[_target] = $_target;
2787 this[_receiver] = $_receiver;
2788 this[_name] = $_name;
2789 super.TearOffClosure();
2790 }
2791 ['=='](other) {
2792 if (core.identical(this, other))
2793 return true;
2794 if (!dart.is(other, BoundClosure))
2795 return false;
2796 return this[_self] === dart.dload(other, '_self') && this[_target] === dar t.dload(other, '_target') && this[_receiver] === dart.dload(other, '_receiver');
2797 }
2798 get hashCode() {
2799 let receiverHashCode = null;
2800 if (this[_receiver] === null) {
2801 receiverHashCode = Primitives.objectHashCode(this[_self]);
2802 } else if (!dart.equals(typeof this[_receiver], 'object')) {
2803 receiverHashCode = dart.as(dart.dload(this[_receiver], 'hashCode'), core .int);
2804 } else {
2805 receiverHashCode = Primitives.objectHashCode(this[_receiver]);
2806 }
2807 return dart.notNull(receiverHashCode) ^ dart.notNull(Primitives.objectHash Code(this[_target]));
2808 }
2809 static selfOf(closure) {
2810 return closure[_self];
2811 }
2812 static targetOf(closure) {
2813 return closure[_target];
2814 }
2815 static receiverOf(closure) {
2816 return closure[_receiver];
2817 }
2818 static nameOf(closure) {
2819 return closure[_name];
2820 }
2821 static selfFieldName() {
2822 if (selfFieldNameCache === null) {
2823 selfFieldNameCache = computeFieldNamed('self');
2824 }
2825 return selfFieldNameCache;
2826 }
2827 static receiverFieldName() {
2828 if (receiverFieldNameCache === null) {
2829 receiverFieldNameCache = computeFieldNamed('receiver');
2830 }
2831 return receiverFieldNameCache;
2832 }
2833 static computeFieldNamed(fieldName) {
2834 let template = new BoundClosure('self', 'target', 'receiver', 'name');
2835 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope rtyNames(template), core.List));
2836 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.not Null(i) + 1) {
2837 let name = names.get(i);
2838 if (template[name] === fieldName) {
2839 return name;
2840 }
2841 }
2842 }
2843 }
2844 BoundClosure.selfFieldNameCache = null;
2845 BoundClosure.receiverFieldNameCache = null;
2846 // Function jsHasOwnProperty: (dynamic, String) → bool
2847 function jsHasOwnProperty(jsObject, property) {
2848 return jsObject.hasOwnProperty(property);
2849 }
2850 // Function jsPropertyAccess: (dynamic, String) → dynamic
2851 function jsPropertyAccess(jsObject, property) {
2852 return jsObject[property];
2853 }
2854 // Function getFallThroughError: () → dynamic
2855 function getFallThroughError() {
2856 return new FallThroughErrorImplementation();
2857 }
2858 class Creates extends core.Object {
2859 Creates(types) {
2860 this.types = types;
2861 }
2862 }
2863 class Returns extends core.Object {
2864 Returns(types) {
2865 this.types = types;
2866 }
2867 }
2868 class JSName extends core.Object {
2869 JSName(name) {
2870 this.name = name;
2871 }
2872 }
2873 // Function boolConversionCheck: (dynamic) → dynamic
2874 function boolConversionCheck(value) {
2875 if (typeof value == boolean)
2876 return value;
2877 boolTypeCheck(value);
2878 dart.assert(value !== null);
2879 return false;
2880 }
2881 // Function stringTypeCheck: (dynamic) → dynamic
2882 function stringTypeCheck(value) {
2883 if (value === null)
2884 return value;
2885 if (typeof value == string)
2886 return value;
2887 throw new TypeErrorImplementation(value, 'String');
2888 }
2889 // Function stringTypeCast: (dynamic) → dynamic
2890 function stringTypeCast(value) {
2891 if (dart.notNull(typeof value == string) || dart.notNull(value === null))
2892 return value;
2893 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'String' );
2894 }
2895 // Function doubleTypeCheck: (dynamic) → dynamic
2896 function doubleTypeCheck(value) {
2897 if (value === null)
2898 return value;
2899 if (typeof value == number)
2900 return value;
2901 throw new TypeErrorImplementation(value, 'double');
2902 }
2903 // Function doubleTypeCast: (dynamic) → dynamic
2904 function doubleTypeCast(value) {
2905 if (dart.notNull(typeof value == number) || dart.notNull(value === null))
2906 return value;
2907 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'double' );
2908 }
2909 // Function numTypeCheck: (dynamic) → dynamic
2910 function numTypeCheck(value) {
2911 if (value === null)
2912 return value;
2913 if (dart.is(value, core.num))
2914 return value;
2915 throw new TypeErrorImplementation(value, 'num');
2916 }
2917 // Function numTypeCast: (dynamic) → dynamic
2918 function numTypeCast(value) {
2919 if (dart.notNull(dart.is(value, core.num)) || dart.notNull(value === null))
2920 return value;
2921 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'num');
2922 }
2923 // Function boolTypeCheck: (dynamic) → dynamic
2924 function boolTypeCheck(value) {
2925 if (value === null)
2926 return value;
2927 if (typeof value == boolean)
2928 return value;
2929 throw new TypeErrorImplementation(value, 'bool');
2930 }
2931 // Function boolTypeCast: (dynamic) → dynamic
2932 function boolTypeCast(value) {
2933 if (dart.notNull(typeof value == boolean) || dart.notNull(value === null))
2934 return value;
2935 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'bool');
2936 }
2937 // Function intTypeCheck: (dynamic) → dynamic
2938 function intTypeCheck(value) {
2939 if (value === null)
2940 return value;
2941 if (typeof value == number)
2942 return value;
2943 throw new TypeErrorImplementation(value, 'int');
2944 }
2945 // Function intTypeCast: (dynamic) → dynamic
2946 function intTypeCast(value) {
2947 if (dart.notNull(typeof value == number) || dart.notNull(value === null))
2948 return value;
2949 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'int');
2950 }
2951 // Function propertyTypeError: (dynamic, dynamic) → void
2952 function propertyTypeError(value, property) {
2953 let name = dart.as(dart.dinvoke(property, 'substring', 3, dart.dload(propert y, 'length')), core.String);
2954 throw new TypeErrorImplementation(value, name);
2955 }
2956 // Function propertyTypeCastError: (dynamic, dynamic) → void
2957 function propertyTypeCastError(value, property) {
2958 let actualType = Primitives.objectTypeName(value);
2959 let expectedType = dart.as(dart.dinvoke(property, 'substring', 3, dart.dload (property, 'length')), core.String);
2960 throw new CastErrorImplementation(actualType, expectedType);
2961 }
2962 // Function propertyTypeCheck: (dynamic, dynamic) → dynamic
2963 function propertyTypeCheck(value, property) {
2964 if (value === null)
2965 return value;
2966 if (!!value[property])
2967 return value;
2968 propertyTypeError(value, property);
2969 }
2970 // Function propertyTypeCast: (dynamic, dynamic) → dynamic
2971 function propertyTypeCast(value, property) {
2972 if (dart.notNull(value === null) || !!value[property])
2973 return value;
2974 propertyTypeCastError(value, property);
2975 }
2976 // Function interceptedTypeCheck: (dynamic, dynamic) → dynamic
2977 function interceptedTypeCheck(value, property) {
2978 if (value === null)
2979 return value;
2980 if (dart.notNull(core.identical(typeof value, 'object')) && _interceptors.ge tInterceptor(value)[property]) {
2981 return value;
2982 }
2983 propertyTypeError(value, property);
2984 }
2985 // Function interceptedTypeCast: (dynamic, dynamic) → dynamic
2986 function interceptedTypeCast(value, property) {
2987 if (dart.notNull(value === null) || typeof value === "object" && _intercepto rs.getInterceptor(value)[property]) {
2988 return value;
2989 }
2990 propertyTypeCastError(value, property);
2991 }
2992 // Function numberOrStringSuperTypeCheck: (dynamic, dynamic) → dynamic
2993 function numberOrStringSuperTypeCheck(value, property) {
2994 if (value === null)
2995 return value;
2996 if (typeof value == string)
2997 return value;
2998 if (dart.is(value, core.num))
2999 return value;
3000 if (!!value[property])
3001 return value;
3002 propertyTypeError(value, property);
3003 }
3004 // Function numberOrStringSuperTypeCast: (dynamic, dynamic) → dynamic
3005 function numberOrStringSuperTypeCast(value, property) {
3006 if (typeof value == string)
3007 return value;
3008 if (dart.is(value, core.num))
3009 return value;
3010 return propertyTypeCast(value, property);
3011 }
3012 // Function numberOrStringSuperNativeTypeCheck: (dynamic, dynamic) → dynamic
3013 function numberOrStringSuperNativeTypeCheck(value, property) {
3014 if (value === null)
3015 return value;
3016 if (typeof value == string)
3017 return value;
3018 if (dart.is(value, core.num))
3019 return value;
3020 if (_interceptors.getInterceptor(value)[property])
3021 return value;
3022 propertyTypeError(value, property);
3023 }
3024 // Function numberOrStringSuperNativeTypeCast: (dynamic, dynamic) → dynamic
3025 function numberOrStringSuperNativeTypeCast(value, property) {
3026 if (value === null)
3027 return value;
3028 if (typeof value == string)
3029 return value;
3030 if (dart.is(value, core.num))
3031 return value;
3032 if (_interceptors.getInterceptor(value)[property])
3033 return value;
3034 propertyTypeCastError(value, property);
3035 }
3036 // Function stringSuperTypeCheck: (dynamic, dynamic) → dynamic
3037 function stringSuperTypeCheck(value, property) {
3038 if (value === null)
3039 return value;
3040 if (typeof value == string)
3041 return value;
3042 if (!!value[property])
3043 return value;
3044 propertyTypeError(value, property);
3045 }
3046 // Function stringSuperTypeCast: (dynamic, dynamic) → dynamic
3047 function stringSuperTypeCast(value, property) {
3048 if (typeof value == string)
3049 return value;
3050 return propertyTypeCast(value, property);
3051 }
3052 // Function stringSuperNativeTypeCheck: (dynamic, dynamic) → dynamic
3053 function stringSuperNativeTypeCheck(value, property) {
3054 if (value === null)
3055 return value;
3056 if (typeof value == string)
3057 return value;
3058 if (_interceptors.getInterceptor(value)[property])
3059 return value;
3060 propertyTypeError(value, property);
3061 }
3062 // Function stringSuperNativeTypeCast: (dynamic, dynamic) → dynamic
3063 function stringSuperNativeTypeCast(value, property) {
3064 if (dart.notNull(typeof value == string) || dart.notNull(value === null))
3065 return value;
3066 if (_interceptors.getInterceptor(value)[property])
3067 return value;
3068 propertyTypeCastError(value, property);
3069 }
3070 // Function listTypeCheck: (dynamic) → dynamic
3071 function listTypeCheck(value) {
3072 if (value === null)
3073 return value;
3074 if (dart.is(value, core.List))
3075 return value;
3076 throw new TypeErrorImplementation(value, 'List');
3077 }
3078 // Function listTypeCast: (dynamic) → dynamic
3079 function listTypeCast(value) {
3080 if (dart.notNull(dart.is(value, core.List)) || dart.notNull(value === null))
3081 return value;
3082 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'List');
3083 }
3084 // Function listSuperTypeCheck: (dynamic, dynamic) → dynamic
3085 function listSuperTypeCheck(value, property) {
3086 if (value === null)
3087 return value;
3088 if (dart.is(value, core.List))
3089 return value;
3090 if (!!value[property])
3091 return value;
3092 propertyTypeError(value, property);
3093 }
3094 // Function listSuperTypeCast: (dynamic, dynamic) → dynamic
3095 function listSuperTypeCast(value, property) {
3096 if (dart.is(value, core.List))
3097 return value;
3098 return propertyTypeCast(value, property);
3099 }
3100 // Function listSuperNativeTypeCheck: (dynamic, dynamic) → dynamic
3101 function listSuperNativeTypeCheck(value, property) {
3102 if (value === null)
3103 return value;
3104 if (dart.is(value, core.List))
3105 return value;
3106 if (_interceptors.getInterceptor(value)[property])
3107 return value;
3108 propertyTypeError(value, property);
3109 }
3110 // Function listSuperNativeTypeCast: (dynamic, dynamic) → dynamic
3111 function listSuperNativeTypeCast(value, property) {
3112 if (dart.notNull(dart.is(value, core.List)) || dart.notNull(value === null))
3113 return value;
3114 if (_interceptors.getInterceptor(value)[property])
3115 return value;
3116 propertyTypeCastError(value, property);
3117 }
3118 // Function voidTypeCheck: (dynamic) → dynamic
3119 function voidTypeCheck(value) {
3120 if (value === null)
3121 return value;
3122 throw new TypeErrorImplementation(value, 'void');
3123 }
3124 // Function checkMalformedType: (dynamic, dynamic) → dynamic
3125 function checkMalformedType(value, message) {
3126 if (value === null)
3127 return value;
3128 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String)) ;
3129 }
3130 // Function checkDeferredIsLoaded: (String, String) → void
3131 function checkDeferredIsLoaded(loadId, uri) {
3132 if (!dart.notNull(exports._loadedLibraries.contains(loadId))) {
3133 throw new DeferredNotLoadedError(uri);
3134 }
3135 }
3136 dart.defineLazyClass(exports, {
3137 get JavaScriptIndexingBehavior() {
3138 class JavaScriptIndexingBehavior extends _interceptors.JSMutableIndexable {
3139 }
3140 return JavaScriptIndexingBehavior;
3141 }
3142 });
3143 class TypeErrorImplementation extends core.Error {
3144 TypeErrorImplementation(value, type) {
3145 this.message = `type '${Primitives.objectTypeName(value)}' is not a subtyp e ` + `of type '${type}'`;
3146 super.Error();
3147 }
3148 TypeErrorImplementation$fromMessage(message) {
3149 this.message = message;
3150 super.Error();
3151 }
3152 toString() {
3153 return this.message;
3154 }
3155 }
3156 dart.defineNamedConstructor(TypeErrorImplementation, 'fromMessage');
3157 class CastErrorImplementation extends core.Error {
3158 CastErrorImplementation(actualType, expectedType) {
3159 this.message = `CastError: Casting value of type ${actualType} to` + ` inc ompatible type ${expectedType}`;
3160 super.Error();
3161 }
3162 toString() {
3163 return this.message;
3164 }
3165 }
3166 class FallThroughErrorImplementation extends core.FallThroughError {
3167 FallThroughErrorImplementation() {
3168 super.FallThroughError();
3169 }
3170 toString() {
3171 return "Switch case fall-through.";
3172 }
3173 }
3174 // Function assertHelper: (dynamic) → void
3175 function assertHelper(condition) {
3176 if (!(typeof condition == boolean)) {
3177 if (dart.is(condition, core.Function))
3178 condition = dart.dinvokef(condition);
3179 if (!(typeof condition == boolean)) {
3180 throw new TypeErrorImplementation(condition, 'bool');
3181 }
3182 }
3183 if (true !== condition)
3184 throw new core.AssertionError();
3185 }
3186 // Function throwNoSuchMethod: (dynamic, dynamic, dynamic, dynamic) → void
3187 function throwNoSuchMethod(obj, name, arguments, expectedArgumentNames) {
3188 let memberName = new _internal.Symbol.unvalidated(dart.as(name, core.String) );
3189 throw new core.NoSuchMethodError(obj, memberName, dart.as(arguments, core.Li st), new core.Map(), dart.as(expectedArgumentNames, core.List));
3190 }
3191 // Function throwCyclicInit: (String) → void
3192 function throwCyclicInit(staticName) {
3193 throw new core.CyclicInitializationError(`Cyclic initialization for static $ {staticName}`);
3194 }
3195 class RuntimeError extends core.Error {
3196 RuntimeError(message) {
3197 this.message = message;
3198 super.Error();
3199 }
3200 toString() {
3201 return `RuntimeError: ${this.message}`;
3202 }
3203 }
3204 class DeferredNotLoadedError extends core.Error {
3205 DeferredNotLoadedError(libraryName) {
3206 this.libraryName = libraryName;
3207 super.Error();
3208 }
3209 toString() {
3210 return `Deferred library ${this.libraryName} was not loaded.`;
3211 }
3212 }
3213 class RuntimeType extends core.Object {
3214 RuntimeType() {
3215 }
3216 }
3217 let _isTest = Symbol('_isTest');
3218 let _extractFunctionTypeObjectFrom = Symbol('_extractFunctionTypeObjectFrom');
3219 let _asCheck = Symbol('_asCheck');
3220 let _check = Symbol('_check');
3221 let _assertCheck = Symbol('_assertCheck');
3222 class RuntimeFunctionType extends RuntimeType {
3223 RuntimeFunctionType(returnType, parameterTypes, optionalParameterTypes, name dParameters) {
3224 this.returnType = returnType;
3225 this.parameterTypes = parameterTypes;
3226 this.optionalParameterTypes = optionalParameterTypes;
3227 this.namedParameters = namedParameters;
3228 super.RuntimeType();
3229 }
3230 get isVoid() {
3231 return dart.is(this.returnType, VoidRuntimeType);
3232 }
3233 [_isTest](expression) {
3234 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression);
3235 return functionTypeObject === null ? false : isFunctionSubtype(functionTyp eObject, this.toRti());
3236 }
3237 [_asCheck](expression) {
3238 return this[_check](expression, true);
3239 }
3240 [_assertCheck](expression) {
3241 if (inAssert)
3242 return null;
3243 inAssert = true;
3244 try {
3245 return this[_check](expression, false);
3246 } finally {
3247 inAssert = false;
3248 }
3249 }
3250 [_check](expression, isCast) {
3251 if (expression === null)
3252 return null;
3253 if (this[_isTest](expression))
3254 return expression;
3255 let self = new FunctionTypeInfoDecoderRing(this.toRti()).toString();
3256 if (isCast) {
3257 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression );
3258 let pretty = null;
3259 if (functionTypeObject !== null) {
3260 pretty = new FunctionTypeInfoDecoderRing(functionTypeObject).toString( );
3261 } else {
3262 pretty = Primitives.objectTypeName(expression);
3263 }
3264 throw new CastErrorImplementation(pretty, self);
3265 } else {
3266 throw new TypeErrorImplementation(expression, self);
3267 }
3268 }
3269 [_extractFunctionTypeObjectFrom](o) {
3270 let interceptor = _interceptors.getInterceptor(o);
3271 return _foreign_helper.JS_SIGNATURE_NAME() in interceptor ? interceptor[_f oreign_helper.JS_SIGNATURE_NAME()]() : null;
3272 }
3273 toRti() {
3274 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"};
3275 if (this.isVoid) {
3276 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true;
3277 } else {
3278 if (!dart.is(this.returnType, DynamicRuntimeType)) {
3279 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu rnType.toRti();
3280 }
3281 }
3282 if (dart.notNull(this.parameterTypes !== null) && !dart.notNull(this.param eterTypes.isEmpty)) {
3283 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = lis tToRti(this.parameterTypes);
3284 }
3285 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) {
3286 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = lis tToRti(this.optionalParameterTypes);
3287 }
3288 if (this.namedParameters !== null) {
3289 let namedRti = Object.create(null);
3290 let keys = _js_names.extractKeys(this.namedParameters);
3291 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.no tNull(i) + 1) {
3292 let name = keys.get(i);
3293 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
3294 namedRti[name] = rti;
3295 }
3296 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti;
3297 }
3298 return result;
3299 }
3300 static listToRti(list) {
3301 list = list;
3302 let result = [];
3303 for (let i = 0; i['<'](dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
3304 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti'));
3305 }
3306 return result;
3307 }
3308 toString() {
3309 let result = '(';
3310 let needsComma = false;
3311 if (this.parameterTypes !== null) {
3312 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes.lengt h); i = dart.notNull(i) + 1) {
3313 let type = this.parameterTypes.get(i);
3314 if (needsComma)
3315 result = ', ';
3316 result = `${type}`;
3317 needsComma = true;
3318 }
3319 }
3320 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) {
3321 if (needsComma)
3322 result = ', ';
3323 needsComma = false;
3324 result = '[';
3325 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp es.length); i = dart.notNull(i) + 1) {
3326 let type = this.optionalParameterTypes.get(i);
3327 if (needsComma)
3328 result = ', ';
3329 result = `${type}`;
3330 needsComma = true;
3331 }
3332 result = ']';
3333 } else if (this.namedParameters !== null) {
3334 if (needsComma)
3335 result = ', ';
3336 needsComma = false;
3337 result = '{';
3338 let keys = _js_names.extractKeys(this.namedParameters);
3339 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.no tNull(i) + 1) {
3340 let name = keys.get(i);
3341 if (needsComma)
3342 result = ', ';
3343 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
3344 result = `${rti} ${name}`;
3345 needsComma = true;
3346 }
3347 result = '}';
3348 }
3349 result = `) -> ${this.returnType}`;
3350 return result;
3351 }
3352 }
3353 RuntimeFunctionType.inAssert = false;
3354 // Function buildFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunctionTy pe
3355 function buildFunctionType(returnType, parameterTypes, optionalParameterTypes) {
3356 return new RuntimeFunctionType(dart.as(returnType, RuntimeType), dart.as(par ameterTypes, core.List$(RuntimeType)), dart.as(optionalParameterTypes, core.List $(RuntimeType)), null);
3357 }
3358 // Function buildNamedFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunct ionType
3359 function buildNamedFunctionType(returnType, parameterTypes, namedParameters) {
3360 return new RuntimeFunctionType(dart.as(returnType, RuntimeType), dart.as(par ameterTypes, core.List$(RuntimeType)), null, namedParameters);
3361 }
3362 // Function buildInterfaceType: (dynamic, dynamic) → RuntimeType
3363 function buildInterfaceType(rti, typeArguments) {
3364 let name = dart.as(rti.name, core.String);
3365 if (core.bool['||'](typeArguments === null, dart.dload(typeArguments, 'isEmp ty'))) {
3366 return new RuntimeTypePlain(name);
3367 }
3368 return new RuntimeTypeGeneric(name, dart.as(typeArguments, core.List$(Runtim eType)), null);
3369 }
3370 class DynamicRuntimeType extends RuntimeType {
3371 DynamicRuntimeType() {
3372 super.RuntimeType();
3373 }
3374 toString() {
3375 return 'dynamic';
3376 }
3377 toRti() {
3378 return null;
3379 }
3380 }
3381 // Function getDynamicRuntimeType: () → RuntimeType
3382 function getDynamicRuntimeType() {
3383 return new DynamicRuntimeType();
3384 }
3385 class VoidRuntimeType extends RuntimeType {
3386 VoidRuntimeType() {
3387 super.RuntimeType();
3388 }
3389 toString() {
3390 return 'void';
3391 }
3392 toRti() {
3393 return dart.throw_('internal error');
3394 }
3395 }
3396 // Function getVoidRuntimeType: () → RuntimeType
3397 function getVoidRuntimeType() {
3398 return new VoidRuntimeType();
3399 }
3400 // Function functionTypeTestMetaHelper: () → dynamic
3401 function functionTypeTestMetaHelper() {
3402 let dyn = x;
3403 let dyn2 = x;
3404 let fixedListOrNull = dart.as(x, core.List);
3405 let fixedListOrNull2 = dart.as(x, core.List);
3406 let fixedList = dart.as(x, core.List);
3407 let jsObject = x;
3408 buildFunctionType(dyn, fixedListOrNull, fixedListOrNull2);
3409 buildNamedFunctionType(dyn, fixedList, jsObject);
3410 buildInterfaceType(dyn, fixedListOrNull);
3411 getDynamicRuntimeType();
3412 getVoidRuntimeType();
3413 convertRtiToRuntimeType(dyn);
3414 dart.dinvoke(dyn, '_isTest', dyn2);
3415 dart.dinvoke(dyn, '_asCheck', dyn2);
3416 dart.dinvoke(dyn, '_assertCheck', dyn2);
3417 }
3418 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType
3419 function convertRtiToRuntimeType(rti) {
3420 if (rti === null) {
3421 return getDynamicRuntimeType();
3422 } else if (typeof rti == "function") {
3423 return new RuntimeTypePlain(rti.name);
3424 } else if (rti.constructor == Array) {
3425 let list = dart.as(rti, core.List);
3426 let name = list.get(0).name;
3427 let arguments = new List.from([]);
3428 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notN ull(i) + 1) {
3429 arguments.add(convertRtiToRuntimeType(list.get(i)));
3430 }
3431 return new RuntimeTypeGeneric(name, dart.as(arguments, core.List$(RuntimeT ype)), rti);
3432 } else if ("func" in rti) {
3433 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType();
3434 } else {
3435 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru ntimeType.`);
3436 }
3437 }
3438 class RuntimeTypePlain extends RuntimeType {
3439 RuntimeTypePlain(name) {
3440 this.name = name;
3441 super.RuntimeType();
3442 }
3443 toRti() {
3444 let allClasses = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .ALL_CLASSES);
3445 let rti = allClasses[this.name];
3446 if (rti === null)
3447 throw `no type for '${this.name}'`;
3448 return rti;
3449 }
3450 toString() {
3451 return this.name;
3452 }
3453 }
3454 class RuntimeTypeGeneric extends RuntimeType {
3455 RuntimeTypeGeneric(name, arguments, rti) {
3456 this.name = name;
3457 this.arguments = arguments;
3458 this.rti = rti;
3459 super.RuntimeType();
3460 }
3461 toRti() {
3462 if (this.rti !== null)
3463 return this.rti;
3464 let allClasses = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .ALL_CLASSES);
3465 let result = [allClasses[this.name]];
3466 if (dart.dindex(result, 0) === null) {
3467 throw `no type for '${this.name}<...>'`;
3468 }
3469 for (let argument of this.arguments) {
3470 result.push(argument.toRti());
3471 }
3472 return this.rti = result;
3473 }
3474 toString() {
3475 return `${this.name}<${this.arguments.join(", ")}>`;
3476 }
3477 }
3478 let _typeData = Symbol('_typeData');
3479 let _cachedToString = Symbol('_cachedToString');
3480 let _hasReturnType = Symbol('_hasReturnType');
3481 let _returnType = Symbol('_returnType');
3482 let _isVoid = Symbol('_isVoid');
3483 let _hasArguments = Symbol('_hasArguments');
3484 let _hasOptionalArguments = Symbol('_hasOptionalArguments');
3485 let _optionalArguments = Symbol('_optionalArguments');
3486 let _hasNamedArguments = Symbol('_hasNamedArguments');
3487 let _namedArguments = Symbol('_namedArguments');
3488 let _convert = Symbol('_convert');
3489 class FunctionTypeInfoDecoderRing extends core.Object {
3490 FunctionTypeInfoDecoderRing($_typeData) {
3491 this[_typeData] = $_typeData;
3492 this[_cachedToString] = null;
3493 }
3494 get [_hasReturnType]() {
3495 return "ret" in this[_typeData];
3496 }
3497 get [_returnType]() {
3498 return this[_typeData].ret;
3499 }
3500 get [_isVoid]() {
3501 return !!this[_typeData]["void"];
3502 }
3503 get [_hasArguments]() {
3504 return "args" in this[_typeData];
3505 }
3506 get [_arguments]() {
3507 return dart.as(this[_typeData].args, core.List);
3508 }
3509 get [_hasOptionalArguments]() {
3510 return "opt" in this[_typeData];
3511 }
3512 get [_optionalArguments]() {
3513 return dart.as(this[_typeData].opt, core.List);
3514 }
3515 get [_hasNamedArguments]() {
3516 return "named" in this[_typeData];
3517 }
3518 get [_namedArguments]() {
3519 return this[_typeData].named;
3520 }
3521 toRuntimeType() {
3522 return new DynamicRuntimeType();
3523 }
3524 [_convert](type) {
3525 let result = runtimeTypeToString(type);
3526 if (result !== null)
3527 return result;
3528 if ("func" in type) {
3529 return new FunctionTypeInfoDecoderRing(type).toString();
3530 } else {
3531 throw 'bad type';
3532 }
3533 }
3534 toString() {
3535 if (this[_cachedToString] !== null)
3536 return this[_cachedToString];
3537 let s = "(";
3538 let sep = '';
3539 if (this[_hasArguments]) {
3540 for (let argument of this[_arguments]) {
3541 s = sep;
3542 s = this[_convert](argument);
3543 sep = ', ';
3544 }
3545 }
3546 if (this[_hasOptionalArguments]) {
3547 s = `${sep}[`;
3548 sep = '';
3549 for (let argument of this[_optionalArguments]) {
3550 s = sep;
3551 s = this[_convert](argument);
3552 sep = ', ';
3553 }
3554 s = ']';
3555 }
3556 if (this[_hasNamedArguments]) {
3557 s = `${sep}{`;
3558 sep = '';
3559 for (let name of _js_names.extractKeys(this[_namedArguments])) {
3560 s = sep;
3561 s = `${name}: `;
3562 s = this[_convert](this[_namedArguments][name]);
3563 sep = ', ';
3564 }
3565 s = '}';
3566 }
3567 s = ') -> ';
3568 if (this[_isVoid]) {
3569 s = 'void';
3570 } else if (this[_hasReturnType]) {
3571 s = this[_convert](this[_returnType]);
3572 } else {
3573 s = 'dynamic';
3574 }
3575 return this[_cachedToString] = `${s}`;
3576 }
3577 }
3578 class UnimplementedNoSuchMethodError extends core.Error {
3579 UnimplementedNoSuchMethodError($_message) {
3580 this[_message] = $_message;
3581 super.Error();
3582 }
3583 toString() {
3584 return `Unsupported operation: ${this[_message]}`;
3585 }
3586 }
3587 // Function random64: () → int
3588 function random64() {
3589 let int32a = Math.random() * 0x100000000 >>> 0;
3590 let int32b = Math.random() * 0x100000000 >>> 0;
3591 return dart.notNull(int32a) + dart.notNull(int32b) * 4294967296;
3592 }
3593 // Function jsonEncodeNative: (String) → String
3594 function jsonEncodeNative(string) {
3595 return JSON.stringify(string);
3596 }
3597 // Function getIsolateAffinityTag: (String) → String
3598 function getIsolateAffinityTag(name) {
3599 let isolateTagGetter = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_n ames.GET_ISOLATE_TAG);
3600 return isolateTagGetter(name);
3601 }
3602 // Function _loadLibraryWrapper: (String) → () → Future<Null>
3603 function _loadLibraryWrapper(loadId) {
3604 return () => loadDeferredLibrary(loadId);
3605 }
3606 dart.defineLazyProperties(exports, {
3607 get _loadingLibraries() {
3608 return dart.map();
3609 },
3610 get _loadedLibraries() {
3611 return new core.Set();
3612 }
3613 });
3614 exports.deferredLoadHook = null;
3615 // Function loadDeferredLibrary: (String) → Future<Null>
3616 function loadDeferredLibrary(loadId) {
3617 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DEFE RRED_LIBRARY_URIS);
3618 let uris = dart.as(urisMap[loadId], core.List$(core.String));
3619 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DE FERRED_LIBRARY_HASHES);
3620 let hashes = dart.as(hashesMap[loadId], core.List$(core.String));
3621 if (uris === null)
3622 return dart.as(new async.Future.value(null), async.Future$(core.Null));
3623 let indices = dart.as(new core.List.generate(uris.length, dart.closureWrap(( i) => i, "(int) → dynamic")), core.List$(core.int));
3624 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .IS_HUNK_LOADED);
3625 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_ names.IS_HUNK_INITIALIZED);
3626 let indicesToLoad = indices.where((i) => !isHunkLoaded(hashes.get(i))).toLis t();
3627 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk( uris.get(i))), core.Iterable$(async.Future))).then(dart.closureWrap((_) => {
3628 let indicesToInitialize = indices.where((i) => !isHunkInitialized(hashes.g et(i))).toList();
3629 for (let i of indicesToInitialize) {
3630 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_na mes.INITIALIZE_LOADED_HUNK);
3631 initializer(hashes.get(i));
3632 }
3633 let updated = exports._loadedLibraries.add(loadId);
3634 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook !== nul l)) {
3635 exports.deferredLoadHook();
3636 }
3637 }, "(List<dynamic>) → dynamic")), async.Future$(core.Null));
3638 }
3639 // Function _loadHunk: (String) → Future<Null>
3640 function _loadHunk(hunkName) {
3641 let future = exports._loadingLibraries.get(hunkName);
3642 if (future !== null) {
3643 return dart.as(future.then(dart.closureWrap((_) => null, "(Null) → dynamic ")), async.Future$(core.Null));
3644 }
3645 let uri = _isolate_helper.IsolateNatives.thisScript;
3646 let index = uri.lastIndexOf('/');
3647 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`;
3648 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) {
3649 return exports._loadingLibraries.set(hunkName, new async.Future(() => {
3650 try {
3651 new Function(`load("${uri}")`)();
3652 } catch (error) {
3653 let stackTrace = dart.stackTrace(error);
3654 throw new async.DeferredLoadException(`Loading ${uri} failed.`);
3655 }
3656
3657 return null;
3658 }));
3659 } else if (_isolate_helper.isWorker()) {
3660 return exports._loadingLibraries.set(hunkName, new async.Future(() => {
3661 let completer = new async.Completer();
3662 _isolate_helper.enterJsAsync();
3663 let leavingFuture = dart.as(completer.future.whenComplete(() => {
3664 _isolate_helper.leaveJsAsync();
3665 }), async.Future$(core.Null));
3666 let index = uri.lastIndexOf('/');
3667 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`;
3668 let xhr = new XMLHttpRequest();
3669 xhr.open("GET", uri);
3670 xhr.addEventListener("load", convertDartClosureToJS((event) => {
3671 if (xhr.status !== 200) {
3672 completer.completeError(new async.DeferredLoadException(`Loading ${u ri} failed.`));
3673 return;
3674 }
3675 let code = xhr.responseText;
3676 try {
3677 new Function(code)();
3678 } catch (error) {
3679 let stackTrace = dart.stackTrace(error);
3680 completer.completeError(new async.DeferredLoadException(`Evaluating ${uri} failed.`));
3681 return;
3682 }
3683
3684 completer.complete(null);
3685 }, 1), false);
3686 let fail = convertDartClosureToJS((event) => {
3687 new async.DeferredLoadException(`Loading ${uri} failed.`);
3688 }, 1);
3689 xhr.addEventListener("error", fail, false);
3690 xhr.addEventListener("abort", fail, false);
3691 xhr.send();
3692 return leavingFuture;
3693 }));
3694 }
3695 return exports._loadingLibraries.set(hunkName, new async.Future(() => {
3696 let completer = new async.Completer();
3697 let script = document.createElement("script");
3698 script.type = "text/javascript";
3699 script.src = uri;
3700 script.addEventListener("load", convertDartClosureToJS((event) => {
3701 completer.complete(null);
3702 }, 1), false);
3703 script.addEventListener("error", convertDartClosureToJS((event) => {
3704 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`));
3705 }, 1), false);
3706 document.body.appendChild(script);
3707 return completer.future;
3708 }));
3709 }
3710 class MainError extends core.Error {
3711 MainError($_message) {
3712 this[_message] = $_message;
3713 super.Error();
3714 }
3715 toString() {
3716 return `NoSuchMethodError: ${this[_message]}`;
3717 }
3718 }
3719 // Function missingMain: () → void
3720 function missingMain() {
3721 throw new MainError("No top-level function named 'main'.");
3722 }
3723 // Function badMain: () → void
3724 function badMain() {
3725 throw new MainError("'main' is not a function.");
3726 }
3727 // Function mainHasTooManyParameters: () → void
3728 function mainHasTooManyParameters() {
3729 throw new MainError("'main' expects too many parameters.");
3730 }
3731 // Exports:
3732 exports.NoSideEffects = NoSideEffects;
3733 exports.NoThrows = NoThrows;
3734 exports.NoInline = NoInline;
3735 exports.IrRepresentation = IrRepresentation;
3736 exports.Native = Native;
3737 exports.ConstantMap = ConstantMap;
3738 exports.ConstantMap$ = ConstantMap$;
3739 exports.ConstantStringMap = ConstantStringMap;
3740 exports.ConstantStringMap$ = ConstantStringMap$;
3741 exports.ConstantProtoMap = ConstantProtoMap;
3742 exports.ConstantProtoMap$ = ConstantProtoMap$;
3743 exports.GeneralConstantMap = GeneralConstantMap;
3744 exports.GeneralConstantMap$ = GeneralConstantMap$;
3745 exports.contains = contains;
3746 exports.arrayLength = arrayLength;
3747 exports.arrayGet = arrayGet;
3748 exports.arraySet = arraySet;
3749 exports.propertyGet = propertyGet;
3750 exports.callHasOwnProperty = callHasOwnProperty;
3751 exports.propertySet = propertySet;
3752 exports.getPropertyFromPrototype = getPropertyFromPrototype;
3753 exports.toStringForNativeObject = toStringForNativeObject;
3754 exports.hashCodeForNativeObject = hashCodeForNativeObject;
3755 exports.defineProperty = defineProperty;
3756 exports.isDartObject = isDartObject;
3757 exports.interceptorsByTag = interceptorsByTag;
3758 exports.leafTags = leafTags;
3759 exports.findDispatchTagForInterceptorClass = findDispatchTagForInterceptorClas s;
3760 exports.lookupInterceptor = lookupInterceptor;
3761 exports.UNCACHED_MARK = UNCACHED_MARK;
3762 exports.INSTANCE_CACHED_MARK = INSTANCE_CACHED_MARK;
3763 exports.LEAF_MARK = LEAF_MARK;
3764 exports.INTERIOR_MARK = INTERIOR_MARK;
3765 exports.DISCRIMINATED_MARK = DISCRIMINATED_MARK;
3766 exports.lookupAndCacheInterceptor = lookupAndCacheInterceptor;
3767 exports.patchInstance = patchInstance;
3768 exports.patchProto = patchProto;
3769 exports.patchInteriorProto = patchInteriorProto;
3770 exports.makeLeafDispatchRecord = makeLeafDispatchRecord;
3771 exports.makeDefaultDispatchRecord = makeDefaultDispatchRecord;
3772 exports.setNativeSubclassDispatchRecord = setNativeSubclassDispatchRecord;
3773 exports.constructorNameFallback = constructorNameFallback;
3774 exports.initNativeDispatch = initNativeDispatch;
3775 exports.initNativeDispatchContinue = initNativeDispatchContinue;
3776 exports.initHooks = initHooks;
3777 exports.applyHooksTransformer = applyHooksTransformer;
3778 exports.regExpGetNative = regExpGetNative;
3779 exports.regExpGetGlobalNative = regExpGetGlobalNative;
3780 exports.regExpCaptureCount = regExpCaptureCount;
3781 exports.JSSyntaxRegExp = JSSyntaxRegExp;
3782 exports.firstMatchAfter = firstMatchAfter;
3783 exports.StringMatch = StringMatch;
3784 exports.allMatchesInStringUnchecked = allMatchesInStringUnchecked;
3785 exports.stringContainsUnchecked = stringContainsUnchecked;
3786 exports.stringReplaceJS = stringReplaceJS;
3787 exports.stringReplaceFirstRE = stringReplaceFirstRE;
3788 exports.ESCAPE_REGEXP = ESCAPE_REGEXP;
3789 exports.stringReplaceAllUnchecked = stringReplaceAllUnchecked;
3790 exports.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked;
3791 exports.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecke d;
3792 exports.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchec ked;
3793 exports.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked;
3794 exports.stringJoinUnchecked = stringJoinUnchecked;
3795 exports.createRuntimeType = createRuntimeType;
3796 exports.TypeImpl = TypeImpl;
3797 exports.TypeVariable = TypeVariable;
3798 exports.getMangledTypeName = getMangledTypeName;
3799 exports.setRuntimeTypeInfo = setRuntimeTypeInfo;
3800 exports.getRuntimeTypeInfo = getRuntimeTypeInfo;
3801 exports.getRuntimeTypeArguments = getRuntimeTypeArguments;
3802 exports.getRuntimeTypeArgument = getRuntimeTypeArgument;
3803 exports.getTypeArgumentByIndex = getTypeArgumentByIndex;
3804 exports.copyTypeArguments = copyTypeArguments;
3805 exports.getClassName = getClassName;
3806 exports.getRuntimeTypeAsString = getRuntimeTypeAsString;
3807 exports.getConstructorName = getConstructorName;
3808 exports.runtimeTypeToString = runtimeTypeToString;
3809 exports.joinArguments = joinArguments;
3810 exports.getRuntimeTypeString = getRuntimeTypeString;
3811 exports.getRuntimeType = getRuntimeType;
3812 exports.substitute = substitute;
3813 exports.checkSubtype = checkSubtype;
3814 exports.computeTypeName = computeTypeName;
3815 exports.subtypeCast = subtypeCast;
3816 exports.assertSubtype = assertSubtype;
3817 exports.assertIsSubtype = assertIsSubtype;
3818 exports.throwTypeError = throwTypeError;
3819 exports.checkArguments = checkArguments;
3820 exports.areSubtypes = areSubtypes;
3821 exports.computeSignature = computeSignature;
3822 exports.isSupertypeOfNull = isSupertypeOfNull;
3823 exports.checkSubtypeOfRuntimeType = checkSubtypeOfRuntimeType;
3824 exports.subtypeOfRuntimeTypeCast = subtypeOfRuntimeTypeCast;
3825 exports.assertSubtypeOfRuntimeType = assertSubtypeOfRuntimeType;
3826 exports.getArguments = getArguments;
3827 exports.isSubtype = isSubtype;
3828 exports.isAssignable = isAssignable;
3829 exports.areAssignable = areAssignable;
3830 exports.areAssignableMaps = areAssignableMaps;
3831 exports.isFunctionSubtype = isFunctionSubtype;
3832 exports.invoke = invoke;
3833 exports.invokeOn = invokeOn;
3834 exports.call = call;
3835 exports.getField = getField;
3836 exports.getIndex = getIndex;
3837 exports.getLength = getLength;
3838 exports.isJsArray = isJsArray;
3839 exports.hasField = hasField;
3840 exports.hasNoField = hasNoField;
3841 exports.isJsFunction = isJsFunction;
3842 exports.isJsObject = isJsObject;
3843 exports.isIdentical = isIdentical;
3844 exports.isNotIdentical = isNotIdentical;
3845 exports.patch = patch;
3846 exports.InternalMap = InternalMap;
3847 exports.requiresPreamble = requiresPreamble;
3848 exports.isJsIndexable = isJsIndexable;
3849 exports.S = S;
3850 exports.createInvocationMirror = createInvocationMirror;
3851 exports.createUnmangledInvocationMirror = createUnmangledInvocationMirror;
3852 exports.throwInvalidReflectionError = throwInvalidReflectionError;
3853 exports.traceHelper = traceHelper;
3854 exports.JSInvocationMirror = JSInvocationMirror;
3855 exports.CachedInvocation = CachedInvocation;
3856 exports.CachedCatchAllInvocation = CachedCatchAllInvocation;
3857 exports.CachedNoSuchMethodInvocation = CachedNoSuchMethodInvocation;
3858 exports.ReflectionInfo = ReflectionInfo;
3859 exports.getMetadata = getMetadata;
3860 exports.Primitives = Primitives;
3861 exports.JsCache = JsCache;
3862 exports.iae = iae;
3863 exports.ioore = ioore;
3864 exports.stringLastIndexOfUnchecked = stringLastIndexOfUnchecked;
3865 exports.checkNull = checkNull;
3866 exports.checkNum = checkNum;
3867 exports.checkInt = checkInt;
3868 exports.checkBool = checkBool;
3869 exports.checkString = checkString;
3870 exports.wrapException = wrapException;
3871 exports.toStringWrapper = toStringWrapper;
3872 exports.throwExpression = throwExpression;
3873 exports.makeLiteralListConst = makeLiteralListConst;
3874 exports.throwRuntimeError = throwRuntimeError;
3875 exports.throwAbstractClassInstantiationError = throwAbstractClassInstantiation Error;
3876 exports.TypeErrorDecoder = TypeErrorDecoder;
3877 exports.NullError = NullError;
3878 exports.JsNoSuchMethodError = JsNoSuchMethodError;
3879 exports.UnknownJsTypeError = UnknownJsTypeError;
3880 exports.unwrapException = unwrapException;
3881 exports.getTraceFromException = getTraceFromException;
3882 exports.objectHashCode = objectHashCode;
3883 exports.fillLiteralMap = fillLiteralMap;
3884 exports.invokeClosure = invokeClosure;
3885 exports.convertDartClosureToJS = convertDartClosureToJS;
3886 exports.Closure = Closure;
3887 exports.closureFromTearOff = closureFromTearOff;
3888 exports.TearOffClosure = TearOffClosure;
3889 exports.BoundClosure = BoundClosure;
3890 exports.jsHasOwnProperty = jsHasOwnProperty;
3891 exports.jsPropertyAccess = jsPropertyAccess;
3892 exports.getFallThroughError = getFallThroughError;
3893 exports.Creates = Creates;
3894 exports.Returns = Returns;
3895 exports.JSName = JSName;
3896 exports.boolConversionCheck = boolConversionCheck;
3897 exports.stringTypeCheck = stringTypeCheck;
3898 exports.stringTypeCast = stringTypeCast;
3899 exports.doubleTypeCheck = doubleTypeCheck;
3900 exports.doubleTypeCast = doubleTypeCast;
3901 exports.numTypeCheck = numTypeCheck;
3902 exports.numTypeCast = numTypeCast;
3903 exports.boolTypeCheck = boolTypeCheck;
3904 exports.boolTypeCast = boolTypeCast;
3905 exports.intTypeCheck = intTypeCheck;
3906 exports.intTypeCast = intTypeCast;
3907 exports.propertyTypeError = propertyTypeError;
3908 exports.propertyTypeCastError = propertyTypeCastError;
3909 exports.propertyTypeCheck = propertyTypeCheck;
3910 exports.propertyTypeCast = propertyTypeCast;
3911 exports.interceptedTypeCheck = interceptedTypeCheck;
3912 exports.interceptedTypeCast = interceptedTypeCast;
3913 exports.numberOrStringSuperTypeCheck = numberOrStringSuperTypeCheck;
3914 exports.numberOrStringSuperTypeCast = numberOrStringSuperTypeCast;
3915 exports.numberOrStringSuperNativeTypeCheck = numberOrStringSuperNativeTypeChec k;
3916 exports.numberOrStringSuperNativeTypeCast = numberOrStringSuperNativeTypeCast;
3917 exports.stringSuperTypeCheck = stringSuperTypeCheck;
3918 exports.stringSuperTypeCast = stringSuperTypeCast;
3919 exports.stringSuperNativeTypeCheck = stringSuperNativeTypeCheck;
3920 exports.stringSuperNativeTypeCast = stringSuperNativeTypeCast;
3921 exports.listTypeCheck = listTypeCheck;
3922 exports.listTypeCast = listTypeCast;
3923 exports.listSuperTypeCheck = listSuperTypeCheck;
3924 exports.listSuperTypeCast = listSuperTypeCast;
3925 exports.listSuperNativeTypeCheck = listSuperNativeTypeCheck;
3926 exports.listSuperNativeTypeCast = listSuperNativeTypeCast;
3927 exports.voidTypeCheck = voidTypeCheck;
3928 exports.checkMalformedType = checkMalformedType;
3929 exports.checkDeferredIsLoaded = checkDeferredIsLoaded;
3930 exports.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior;
3931 exports.TypeErrorImplementation = TypeErrorImplementation;
3932 exports.CastErrorImplementation = CastErrorImplementation;
3933 exports.FallThroughErrorImplementation = FallThroughErrorImplementation;
3934 exports.assertHelper = assertHelper;
3935 exports.throwNoSuchMethod = throwNoSuchMethod;
3936 exports.throwCyclicInit = throwCyclicInit;
3937 exports.RuntimeError = RuntimeError;
3938 exports.DeferredNotLoadedError = DeferredNotLoadedError;
3939 exports.RuntimeType = RuntimeType;
3940 exports.RuntimeFunctionType = RuntimeFunctionType;
3941 exports.buildFunctionType = buildFunctionType;
3942 exports.buildNamedFunctionType = buildNamedFunctionType;
3943 exports.buildInterfaceType = buildInterfaceType;
3944 exports.DynamicRuntimeType = DynamicRuntimeType;
3945 exports.getDynamicRuntimeType = getDynamicRuntimeType;
3946 exports.VoidRuntimeType = VoidRuntimeType;
3947 exports.getVoidRuntimeType = getVoidRuntimeType;
3948 exports.functionTypeTestMetaHelper = functionTypeTestMetaHelper;
3949 exports.convertRtiToRuntimeType = convertRtiToRuntimeType;
3950 exports.RuntimeTypePlain = RuntimeTypePlain;
3951 exports.RuntimeTypeGeneric = RuntimeTypeGeneric;
3952 exports.FunctionTypeInfoDecoderRing = FunctionTypeInfoDecoderRing;
3953 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError;
3954 exports.random64 = random64;
3955 exports.jsonEncodeNative = jsonEncodeNative;
3956 exports.getIsolateAffinityTag = getIsolateAffinityTag;
3957 exports.loadDeferredLibrary = loadDeferredLibrary;
3958 exports.MainError = MainError;
3959 exports.missingMain = missingMain;
3960 exports.badMain = badMain;
3961 exports.mainHasTooManyParameters = mainHasTooManyParameters;
3962 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « test/codegen/expect/dart/_js_embedded_names.js ('k') | test/codegen/expect/dart/_js_names.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698