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

Side by Side Diff: lib/runtime/dart/_js_helper.js

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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 | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 let _fetch = Symbol('_fetch'); 67 let _fetch = Symbol('_fetch');
68 let ConstantStringMap$ = dart.generic(function(K, V) { 68 let ConstantStringMap$ = dart.generic(function(K, V) {
69 class ConstantStringMap extends ConstantMap$(K, V) { 69 class ConstantStringMap extends ConstantMap$(K, V) {
70 [_$](length, jsObject$, keys$) { 70 [_$](length, jsObject$, keys$) {
71 this.length = length; 71 this.length = length;
72 this[_jsObject] = jsObject$; 72 this[_jsObject] = jsObject$;
73 this[_keys] = keys$; 73 this[_keys] = keys$;
74 super[_$](); 74 super[_$]();
75 } 75 }
76 containsValue(needle) { 76 containsValue(needle) {
77 return this.values[core.$any]((value) => dart.equals(value, needle)); 77 return this.values[core.$any](value => dart.equals(value, needle));
78 } 78 }
79 containsKey(key) { 79 containsKey(key) {
80 if (!(typeof key == 'string')) 80 if (!(typeof key == 'string'))
81 return false; 81 return false;
82 if (dart.equals('__proto__', key)) 82 if (dart.equals('__proto__', key))
83 return false; 83 return false;
84 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); 84 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
85 } 85 }
86 get(key) { 86 get(key) {
87 if (!dart.notNull(this.containsKey(key))) 87 if (!dart.notNull(this.containsKey(key)))
88 return null; 88 return null;
89 return dart.as(this[_fetch](key), V); 89 return dart.as(this[_fetch](key), V);
90 } 90 }
91 [_fetch](key) { 91 [_fetch](key) {
92 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); 92 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String));
93 } 93 }
94 forEach(f) { 94 forEach(f) {
95 let keys = this[_keys]; 95 let keys = this[_keys];
96 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) { 96 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
97 let key = dart.dindex(keys, i); 97 let key = dart.dindex(keys, i);
98 f(dart.as(key, K), dart.as(this[_fetch](key), V)); 98 f(dart.as(key, K), dart.as(this[_fetch](key), V));
99 } 99 }
100 } 100 }
101 get keys() { 101 get keys() {
102 return new (_ConstantMapKeyIterable$(K))(this); 102 return new (_ConstantMapKeyIterable$(K))(this);
103 } 103 }
104 get values() { 104 get values() {
105 return new (_internal.MappedIterable$(K, V))(this[_keys], dart.as(((key) => this[_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); 105 return new (_internal.MappedIterable$(K, V))(this[_keys], dart.as((key = > this[_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V")));
106 } 106 }
107 } 107 }
108 ConstantStringMap[dart.implements] = () => [_internal.EfficientLength]; 108 ConstantStringMap[dart.implements] = () => [_internal.EfficientLength];
109 dart.defineNamedConstructor(ConstantStringMap, _$); 109 dart.defineNamedConstructor(ConstantStringMap, _$);
110 return ConstantStringMap; 110 return ConstantStringMap;
111 }); 111 });
112 let ConstantStringMap = ConstantStringMap$(); 112 let ConstantStringMap = ConstantStringMap$();
113 let _protoValue = Symbol('_protoValue'); 113 let _protoValue = Symbol('_protoValue');
114 let ConstantProtoMap$ = dart.generic(function(K, V) { 114 let ConstantProtoMap$ = dart.generic(function(K, V) {
115 class ConstantProtoMap extends ConstantStringMap$(K, V) { 115 class ConstantProtoMap extends ConstantStringMap$(K, V) {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 let transformer = transformers[i]; 423 let transformer = transformers[i];
424 if (typeof transformer == "function") { 424 if (typeof transformer == "function") {
425 hooks = applyHooksTransformer(transformer, hooks); 425 hooks = applyHooksTransformer(transformer, hooks);
426 } 426 }
427 } 427 }
428 } 428 }
429 } 429 }
430 let getTag = hooks.getTag; 430 let getTag = hooks.getTag;
431 let getUnknownTag = hooks.getUnknownTag; 431 let getUnknownTag = hooks.getUnknownTag;
432 let prototypeForTag = hooks.prototypeForTag; 432 let prototypeForTag = hooks.prototypeForTag;
433 exports.getTagFunction = (o) => getTag(o); 433 exports.getTagFunction = o => getTag(o);
434 exports.alternateTagFunction = (o, tag) => getUnknownTag(o, tag); 434 exports.alternateTagFunction = (o, tag) => getUnknownTag(o, tag);
435 exports.prototypeForTagFunction = (tag) => prototypeForTag(tag); 435 exports.prototypeForTagFunction = tag => prototypeForTag(tag);
436 } 436 }
437 // Function applyHooksTransformer: (dynamic, dynamic) → dynamic 437 // Function applyHooksTransformer: (dynamic, dynamic) → dynamic
438 function applyHooksTransformer(transformer, hooks) { 438 function applyHooksTransformer(transformer, hooks) {
439 let newHooks = transformer(hooks); 439 let newHooks = transformer(hooks);
440 return newHooks || hooks; 440 return newHooks || hooks;
441 } 441 }
442 let _baseHooks = new _foreign_helper.JS_CONST('function() {\n function typeNa meInChrome(o) {\n var constructor = o.constructor;\n if (constructor) {\n var name = constructor.name;\n if (name) return name;\n }\n var s = Object.prototype.toString.call(o);\n return s.substring(8, s.length - 1); \n }\n function getUnknownTag(object, tag) {\n // This code really belongs in [getUnknownTagGenericBrowser] but having it\n // here allows [getUnknownTa g] to be tested on d8.\n if (/^HTML[A-Z].*Element$/.test(tag)) {\n // Ch eck that it is not a simple JavaScript object.\n var name = Object.prototyp e.toString.call(object);\n if (name == "[object Object]") return null;\n return "HTMLElement";\n }\n }\n function getUnknownTagGenericBrowser(obj ect, tag) {\n if (self.HTMLElement && object instanceof HTMLElement) return " HTMLElement";\n return getUnknownTag(object, tag);\n }\n function prototype ForTag(tag) {\n if (typeof window == "undefined") return null;\n if (typeo f window[tag] == "undefined") return null;\n var constructor = window[tag];\n if (typeof constructor != "function") return null;\n return constructor.p rototype;\n }\n function discriminator(tag) { return null; }\n\n var isBrowse r = typeof navigator == "object";\n\n return {\n getTag: typeNameInChrome,\n getUnknownTag: isBrowser ? getUnknownTagGenericBrowser : getUnknownTag,\n prototypeForTag: prototypeForTag,\n discriminator: discriminator };\n}'); 442 let _baseHooks = new _foreign_helper.JS_CONST('function() {\n function typeNa meInChrome(o) {\n var constructor = o.constructor;\n if (constructor) {\n var name = constructor.name;\n if (name) return name;\n }\n var s = Object.prototype.toString.call(o);\n return s.substring(8, s.length - 1); \n }\n function getUnknownTag(object, tag) {\n // This code really belongs in [getUnknownTagGenericBrowser] but having it\n // here allows [getUnknownTa g] to be tested on d8.\n if (/^HTML[A-Z].*Element$/.test(tag)) {\n // Ch eck that it is not a simple JavaScript object.\n var name = Object.prototyp e.toString.call(object);\n if (name == "[object Object]") return null;\n return "HTMLElement";\n }\n }\n function getUnknownTagGenericBrowser(obj ect, tag) {\n if (self.HTMLElement && object instanceof HTMLElement) return " HTMLElement";\n return getUnknownTag(object, tag);\n }\n function prototype ForTag(tag) {\n if (typeof window == "undefined") return null;\n if (typeo f window[tag] == "undefined") return null;\n var constructor = window[tag];\n if (typeof constructor != "function") return null;\n return constructor.p rototype;\n }\n function discriminator(tag) { return null; }\n\n var isBrowse r = typeof navigator == "object";\n\n return {\n getTag: typeNameInChrome,\n getUnknownTag: isBrowser ? getUnknownTagGenericBrowser : getUnknownTag,\n prototypeForTag: prototypeForTag,\n discriminator: discriminator };\n}');
443 let _constructorNameFallback = new _foreign_helper.JS_CONST('function getTagFa llback(o) {\n var constructor = o.constructor;\n if (typeof constructor == "fu nction") {\n var name = constructor.name;\n // If the name is a non-empty string, we use that as the type name of this\n // object. There are various cases where that does not work, so we have to\n // detect them and fall throu gh 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 for \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 retu rn s.substring(8, s.length - 1);\n}'); 443 let _constructorNameFallback = new _foreign_helper.JS_CONST('function getTagFa llback(o) {\n var constructor = o.constructor;\n if (typeof constructor == "fu nction") {\n var name = constructor.name;\n // If the name is a non-empty string, we use that as the type name of this\n // object. There are various cases where that does not work, so we have to\n // detect them and fall throu gh 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 for \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 retu rn s.substring(8, s.length - 1);\n}');
444 let _fallbackConstructorHooksTransformerGenerator = new _foreign_helper.JS_CON ST('function(getTagFallback) {\n return function(hooks) {\n // If we are not in a browser, assume we are in d8.\n // TODO(sra): Recognize jsshell.\n i f (typeof navigator != "object") return hooks;\n\n var ua = navigator.userAge nt;\n // TODO(antonm): remove a reference to DumpRenderTree.\n if (ua.inde xOf("DumpRenderTree") >= 0) return hooks;\n if (ua.indexOf("Chrome") >= 0) {\ n // Confirm constructor name is usable for dispatch.\n function confi rm(p) {\n return typeof window == "object" && window[p] && window[p].name == p;\n }\n if (confirm("Window") && confirm("HTMLElement")) return h ooks;\n }\n\n hooks.getTag = getTagFallback;\n };\n}'); 444 let _fallbackConstructorHooksTransformerGenerator = new _foreign_helper.JS_CON ST('function(getTagFallback) {\n return function(hooks) {\n // If we are not in a browser, assume we are in d8.\n // TODO(sra): Recognize jsshell.\n i f (typeof navigator != "object") return hooks;\n\n var ua = navigator.userAge nt;\n // TODO(antonm): remove a reference to DumpRenderTree.\n if (ua.inde xOf("DumpRenderTree") >= 0) return hooks;\n if (ua.indexOf("Chrome") >= 0) {\ n // Confirm constructor name is usable for dispatch.\n function confi rm(p) {\n return typeof window == "object" && window[p] && window[p].name == p;\n }\n if (confirm("Window") && confirm("HTMLElement")) return h ooks;\n }\n\n hooks.getTag = getTagFallback;\n };\n}');
445 let _ieHooksTransformer = new _foreign_helper.JS_CONST('function(hooks) {\n v ar userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if (u serAgent.indexOf("Trident/") == -1) return hooks;\n\n var getTag = hooks.getTag ;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTransfer": "Clipboard",\n "HTMLDDElement": "HTMLElement",\n "HTMLDTElement": "HTMLEle ment",\n "HTMLPhraseElement": "HTMLElement",\n "Position": "Geoposition"\n };\n\n function getTagIE(o) {\n var tag = getTag(o);\n var newTag = qui ckMap[tag];\n if (newTag) return newTag;\n // Patches for types which repo rt themselves as Objects.\n if (tag == "Object") {\n if (window.DataView && (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} '); 445 let _ieHooksTransformer = new _foreign_helper.JS_CONST('function(hooks) {\n v ar userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if (u serAgent.indexOf("Trident/") == -1) return hooks;\n\n var getTag = hooks.getTag ;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTransfer": "Clipboard",\n "HTMLDDElement": "HTMLElement",\n "HTMLDTElement": "HTMLEle ment",\n "HTMLPhraseElement": "HTMLElement",\n "Position": "Geoposition"\n };\n\n function getTagIE(o) {\n var tag = getTag(o);\n var newTag = qui ckMap[tag];\n if (newTag) return newTag;\n // Patches for types which repo rt themselves as Objects.\n if (tag == "Object") {\n if (window.DataView && (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} ');
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g))); 553 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
554 } 554 }
555 [_execAnchored](string, start) { 555 [_execAnchored](string, start) {
556 let regexp = this[_nativeAnchoredVersion]; 556 let regexp = this[_nativeAnchoredVersion];
557 regexp.lastIndex = start; 557 regexp.lastIndex = start;
558 let match = dart.as(regexp.exec(string), core.List); 558 let match = dart.as(regexp.exec(string), core.List);
559 if (match == null) 559 if (match == null)
560 return null; 560 return null;
561 if (match[core.$get](dart.notNull(match[core.$length]) - 1) != null) 561 if (match[core.$get](dart.notNull(match[core.$length]) - 1) != null)
562 return null; 562 return null;
563 match[core.$length] = 1; 563 match[core.$length] = dart.notNull(match[core.$length]) - 1;
564 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g))); 564 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
565 } 565 }
566 matchAsPrefix(string, start) { 566 matchAsPrefix(string, start) {
567 if (start === void 0) 567 if (start === void 0)
568 start = 0; 568 start = 0;
569 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l ength)) { 569 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l ength)) {
570 throw new core.RangeError.range(start, 0, string.length); 570 throw new core.RangeError.range(start, 0, string.length);
571 } 571 }
572 return this[_execAnchored](string, start); 572 return this[_execAnchored](string, start);
573 } 573 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 let length = dart.as(dart.dload(receiver, 'length'), core.int); 811 let length = dart.as(dart.dload(receiver, 'length'), core.int);
812 let i = 0; 812 let i = 0;
813 buffer.write(dart.dinvokef(onNonMatch, "")); 813 buffer.write(dart.dinvokef(onNonMatch, ""));
814 while (dart.notNull(i) < dart.notNull(length)) { 814 while (dart.notNull(i) < dart.notNull(length)) {
815 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c ore.String), ""))); 815 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c ore.String), "")));
816 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); 816 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int);
817 if ((dart.notNull(code) & ~1023) == 55296 && dart.notNull(length) > dart.n otNull(i) + 1) { 817 if ((dart.notNull(code) & ~1023) == 55296 && dart.notNull(length) > dart.n otNull(i) + 1) {
818 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1) , core.int); 818 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1) , core.int);
819 if ((dart.notNull(code) & ~1023) == 56320) { 819 if ((dart.notNull(code) & ~1023) == 56320) {
820 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri ng', i, dart.notNull(i) + 2))); 820 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri ng', i, dart.notNull(i) + 2)));
821 i = 2; 821 i = dart.notNull(i) + 2;
822 continue; 822 continue;
823 } 823 }
824 } 824 }
825 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); 825 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i)));
826 i = dart.notNull(i) + 1; 826 i = dart.notNull(i) + 1;
827 } 827 }
828 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor e.String), ""))); 828 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor e.String), "")));
829 buffer.write(dart.dinvokef(onNonMatch, "")); 829 buffer.write(dart.dinvokef(onNonMatch, ""));
830 return buffer.toString(); 830 return buffer.toString();
831 } 831 }
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 } 1532 }
1533 get isGetterStub() { 1533 get isGetterStub() {
1534 return !!this.jsFunction.$getterStub; 1534 return !!this.jsFunction.$getterStub;
1535 } 1535 }
1536 invokeOn(victim, arguments$) { 1536 invokeOn(victim, arguments$) {
1537 let receiver = victim; 1537 let receiver = victim;
1538 if (!dart.notNull(this.isIntercepted)) { 1538 if (!dart.notNull(this.isIntercepted)) {
1539 if (!dart.is(arguments$, _interceptors.JSArray)) 1539 if (!dart.is(arguments$, _interceptors.JSArray))
1540 arguments$ = new core.List.from(arguments$); 1540 arguments$ = new core.List.from(arguments$);
1541 } else { 1541 } else {
1542 arguments$ = new core.List.from([victim]); 1542 let _$ = new core.List.from([victim]);
1543 arguments$[core.$addAll](arguments$); 1543 _$[core.$addAll](arguments$);
1544 arguments$ = _$;
1544 if (this.cachedInterceptor != null) 1545 if (this.cachedInterceptor != null)
1545 receiver = this.cachedInterceptor; 1546 receiver = this.cachedInterceptor;
1546 } 1547 }
1547 return this.jsFunction.apply(receiver, arguments$); 1548 return this.jsFunction.apply(receiver, arguments$);
1548 } 1549 }
1549 } 1550 }
1550 class CachedCatchAllInvocation extends CachedInvocation { 1551 class CachedCatchAllInvocation extends CachedInvocation {
1551 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor) { 1552 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor) {
1552 this.info = new ReflectionInfo(jsFunction); 1553 this.info = new ReflectionInfo(jsFunction);
1553 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor) ; 1554 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor) ;
1554 } 1555 }
1555 get isGetterStub() { 1556 get isGetterStub() {
1556 return false; 1557 return false;
1557 } 1558 }
1558 invokeOn(victim, arguments$) { 1559 invokeOn(victim, arguments$) {
1559 let receiver = victim; 1560 let receiver = victim;
1560 let providedArgumentCount = null; 1561 let providedArgumentCount = null;
1561 let fullParameterCount = dart.notNull(this.info.requiredParameterCount) + dart.notNull(this.info.optionalParameterCount); 1562 let fullParameterCount = dart.notNull(this.info.requiredParameterCount) + dart.notNull(this.info.optionalParameterCount);
1562 if (!dart.notNull(this.isIntercepted)) { 1563 if (!dart.notNull(this.isIntercepted)) {
1563 if (dart.is(arguments$, _interceptors.JSArray)) { 1564 if (dart.is(arguments$, _interceptors.JSArray)) {
1564 providedArgumentCount = arguments$[core.$length]; 1565 providedArgumentCount = arguments$[core.$length];
1565 if (dart.notNull(providedArgumentCount) < dart.notNull(fullParameterCo unt)) { 1566 if (dart.notNull(providedArgumentCount) < dart.notNull(fullParameterCo unt)) {
1566 arguments$ = new core.List.from(arguments$); 1567 arguments$ = new core.List.from(arguments$);
1567 } 1568 }
1568 } else { 1569 } else {
1569 arguments$ = new core.List.from(arguments$); 1570 arguments$ = new core.List.from(arguments$);
1570 providedArgumentCount = arguments$[core.$length]; 1571 providedArgumentCount = arguments$[core.$length];
1571 } 1572 }
1572 } else { 1573 } else {
1573 arguments$ = new core.List.from([victim]); 1574 let _$ = new core.List.from([victim]);
1574 arguments$[core.$addAll](arguments$); 1575 _$[core.$addAll](arguments$);
1576 arguments$ = _$;
1575 if (this.cachedInterceptor != null) 1577 if (this.cachedInterceptor != null)
1576 receiver = this.cachedInterceptor; 1578 receiver = this.cachedInterceptor;
1577 providedArgumentCount = dart.notNull(arguments$[core.$length]) - 1; 1579 providedArgumentCount = dart.notNull(arguments$[core.$length]) - 1;
1578 } 1580 }
1579 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) { 1581 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) {
1580 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments$[core.$length]} arguments.` ); 1582 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments$[core.$length]} arguments.` );
1581 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) { 1583 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) {
1582 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`); 1584 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`);
1583 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) { 1585 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) {
1584 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`); 1586 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 } 1673 }
1672 sortedIndex(unsortedIndex) { 1674 sortedIndex(unsortedIndex) {
1673 if (this.cachedSortedIndices == null) { 1675 if (this.cachedSortedIndices == null) {
1674 this.cachedSortedIndices = new core.List(this.optionalParameterCount); 1676 this.cachedSortedIndices = new core.List(this.optionalParameterCount);
1675 let positions = dart.map(); 1677 let positions = dart.map();
1676 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) { 1678 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) {
1677 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i ); 1679 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i );
1678 positions.set(this.parameterName(index), index); 1680 positions.set(this.parameterName(index), index);
1679 } 1681 }
1680 let index = 0; 1682 let index = 0;
1681 ((_$) => { 1683 (() => {
1684 let _$ = positions.keys[core.$toList]();
1682 _$[core.$sort](); 1685 _$[core.$sort]();
1683 return _$; 1686 return _$;
1684 })(positions.keys[core.$toList]())[core.$forEach](((name) => { 1687 })()[core.$forEach]((name => {
1685 this.cachedSortedIndices[core.$set](((x$) => index = dart.notNull(x$) + 1, x$)(index), positions.get(name)); 1688 this.cachedSortedIndices[core.$set]((() => {
1689 let x$ = index;
1690 index = dart.notNull(x$) + 1;
1691 return x$;
1692 })(), positions.get(name));
1686 }).bind(this)); 1693 }).bind(this));
1687 } 1694 }
1688 return dart.as(this.cachedSortedIndices[core.$get](unsortedIndex), core.in t); 1695 return dart.as(this.cachedSortedIndices[core.$get](unsortedIndex), core.in t);
1689 } 1696 }
1690 computeFunctionRti(jsConstructor) { 1697 computeFunctionRti(jsConstructor) {
1691 if (typeof this.functionType == "number") { 1698 if (typeof this.functionType == "number") {
1692 return getMetadata(dart.as(this.functionType, core.int)); 1699 return getMetadata(dart.as(this.functionType, core.int));
1693 } else if (typeof this.functionType == "function") { 1700 } else if (typeof this.functionType == "function") {
1694 let fakeInstance = new jsConstructor(); 1701 let fakeInstance = new jsConstructor();
1695 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); 1702 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]);
(...skipping 14 matching lines...) Expand all
1710 // Function getMetadata: (int) → dynamic 1717 // Function getMetadata: (int) → dynamic
1711 function getMetadata(index) { 1718 function getMetadata(index) {
1712 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA); 1719 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA);
1713 return metadata[index]; 1720 return metadata[index];
1714 } 1721 }
1715 let _throwFormatException = Symbol('_throwFormatException'); 1722 let _throwFormatException = Symbol('_throwFormatException');
1716 let _fromCharCodeApply = Symbol('_fromCharCodeApply'); 1723 let _fromCharCodeApply = Symbol('_fromCharCodeApply');
1717 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType'); 1724 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
1718 class Primitives extends core.Object { 1725 class Primitives extends core.Object {
1719 static initializeStatics(id) { 1726 static initializeStatics(id) {
1720 Primitives.mirrorFunctionCacheName = `_${id}`; 1727 Primitives.mirrorFunctionCacheName = core.String['+'](Primitives.mirrorFun ctionCacheName, `_${id}`);
1721 Primitives.mirrorInvokeCacheName = `_${id}`; 1728 Primitives.mirrorInvokeCacheName = core.String['+'](Primitives.mirrorInvok eCacheName, `_${id}`);
1722 } 1729 }
1723 static objectHashCode(object) { 1730 static objectHashCode(object) {
1724 let hash = dart.as(object.$identityHash, core.int); 1731 let hash = dart.as(object.$identityHash, core.int);
1725 if (hash == null) { 1732 if (hash == null) {
1726 hash = Math.random() * 0x3fffffff | 0; 1733 hash = Math.random() * 0x3fffffff | 0;
1727 object.$identityHash = hash; 1734 object.$identityHash = hash;
1728 } 1735 }
1729 return hash; 1736 return hash;
1730 } 1737 }
1731 static [_throwFormatException](string) { 1738 static [_throwFormatException](string) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 requiresPreamble(); 1857 requiresPreamble();
1851 if (!!self.location) { 1858 if (!!self.location) {
1852 return self.location.href; 1859 return self.location.href;
1853 } 1860 }
1854 return null; 1861 return null;
1855 } 1862 }
1856 static [_fromCharCodeApply](array) { 1863 static [_fromCharCodeApply](array) {
1857 let result = ""; 1864 let result = "";
1858 let kMaxApply = 500; 1865 let kMaxApply = 500;
1859 let end = array[core.$length]; 1866 let end = array[core.$length];
1860 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) { 1867 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + dart.notNull(kMaxApply)) {
1861 let subarray = null; 1868 let subarray = null;
1862 if (dart.notNull(end) <= dart.notNull(kMaxApply)) { 1869 if (dart.notNull(end) <= dart.notNull(kMaxApply)) {
1863 subarray = array; 1870 subarray = array;
1864 } else { 1871 } else {
1865 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); 1872 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end);
1866 } 1873 }
1867 result = result + String.fromCharCode.apply(null, subarray); 1874 result = result + String.fromCharCode.apply(null, subarray);
1868 } 1875 }
1869 return result; 1876 return result;
1870 } 1877 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 if (dart.notNull(object == null) || dart.notNull(typeof object == 'boolean ') || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == ' string')) { 2020 if (dart.notNull(object == null) || dart.notNull(typeof object == 'boolean ') || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == ' string')) {
2014 throw new core.ArgumentError(object); 2021 throw new core.ArgumentError(object);
2015 } 2022 }
2016 object[key] = value; 2023 object[key] = value;
2017 } 2024 }
2018 static functionNoSuchMethod(func, positionalArguments, namedArguments) { 2025 static functionNoSuchMethod(func, positionalArguments, namedArguments) {
2019 let argumentCount = 0; 2026 let argumentCount = 0;
2020 let arguments$ = new core.List.from([]); 2027 let arguments$ = new core.List.from([]);
2021 let namedArgumentList = new core.List.from([]); 2028 let namedArgumentList = new core.List.from([]);
2022 if (positionalArguments != null) { 2029 if (positionalArguments != null) {
2023 argumentCount = positionalArguments[core.$length]; 2030 argumentCount = dart.notNull(argumentCount) + dart.notNull(positionalArg uments[core.$length]);
2024 arguments$[core.$addAll](positionalArguments); 2031 arguments$[core.$addAll](positionalArguments);
2025 } 2032 }
2026 let names = ''; 2033 let names = '';
2027 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) { 2034 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) {
2028 namedArguments.forEach((name, argument) => { 2035 namedArguments.forEach((name, argument) => {
2029 names = `${names}$${name}`; 2036 names = `${names}$${name}`;
2030 namedArgumentList[core.$add](name); 2037 namedArgumentList[core.$add](name);
2031 arguments$[core.$add](argument); 2038 arguments$[core.$add](argument);
2032 argumentCount = dart.notNull(argumentCount) + 1; 2039 argumentCount = dart.notNull(argumentCount) + 1;
2033 }); 2040 });
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 return object.hashCode; 2533 return object.hashCode;
2527 } else { 2534 } else {
2528 return Primitives.objectHashCode(object); 2535 return Primitives.objectHashCode(object);
2529 } 2536 }
2530 } 2537 }
2531 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic 2538 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic
2532 function fillLiteralMap(keyValuePairs, result) { 2539 function fillLiteralMap(keyValuePairs, result) {
2533 let index = 0; 2540 let index = 0;
2534 let length = getLength(keyValuePairs); 2541 let length = getLength(keyValuePairs);
2535 while (dart.notNull(index) < dart.notNull(length)) { 2542 while (dart.notNull(index) < dart.notNull(length)) {
2536 let key = getIndex(keyValuePairs, ((x$) => index = dart.notNull(x$) + 1, x $)(index)); 2543 let key = getIndex(keyValuePairs, (() => {
2537 let value = getIndex(keyValuePairs, ((x$) => index = dart.notNull(x$) + 1, x$)(index)); 2544 let x$ = index;
2545 index = dart.notNull(x$) + 1;
2546 return x$;
2547 })());
2548 let value = getIndex(keyValuePairs, (() => {
2549 let x$ = index;
2550 index = dart.notNull(x$) + 1;
2551 return x$;
2552 })());
2538 result.set(key, value); 2553 result.set(key, value);
2539 } 2554 }
2540 return result; 2555 return result;
2541 } 2556 }
2542 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic 2557 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
2543 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) { 2558 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
2544 if (numberOfArguments == 0) { 2559 if (numberOfArguments == 0) {
2545 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure)); 2560 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure));
2546 } else if (numberOfArguments == 1) { 2561 } else if (numberOfArguments == 1) {
2547 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1)); 2562 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 let callName = dart.as(func.$callName, core.String); 2598 let callName = dart.as(func.$callName, core.String);
2584 func.$reflectionInfo = reflectionInfo; 2599 func.$reflectionInfo = reflectionInfo;
2585 let info = new ReflectionInfo(func); 2600 let info = new ReflectionInfo(func);
2586 let functionType = info.functionType; 2601 let functionType = info.functionType;
2587 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype); 2602 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
2588 prototype.$initialize = prototype.constructor; 2603 prototype.$initialize = prototype.constructor;
2589 let constructor = isStatic ? function() { 2604 let constructor = isStatic ? function() {
2590 this.$initialize(); 2605 this.$initialize();
2591 } : Closure.isCsp ? function(a, b, c, d) { 2606 } : Closure.isCsp ? function(a, b, c, d) {
2592 this.$initialize(a, b, c, d); 2607 this.$initialize(a, b, c, d);
2593 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x$) => Closure.functionCounter = dart.notNull(x$) + 1, x$)(Closure.functionCounter)) ; 2608 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + (() => {
2609 let x$ = Closure.functionCounter;
2610 Closure.functionCounter = dart.notNull(x$) + 1;
2611 return x$;
2612 })());
2594 prototype.constructor = constructor; 2613 prototype.constructor = constructor;
2595 constructor.prototype = prototype; 2614 constructor.prototype = prototype;
2596 let trampoline = func; 2615 let trampoline = func;
2597 let isIntercepted = false; 2616 let isIntercepted = false;
2598 if (!dart.notNull(isStatic)) { 2617 if (!dart.notNull(isStatic)) {
2599 if (jsArguments.length == 1) { 2618 if (jsArguments.length == 1) {
2600 isIntercepted = true; 2619 isIntercepted = true;
2601 } 2620 }
2602 trampoline = Closure.forwardCallTo(receiver, func, isIntercepted); 2621 trampoline = Closure.forwardCallTo(receiver, func, isIntercepted);
2603 trampoline.$reflectionInfo = reflectionInfo; 2622 trampoline.$reflectionInfo = reflectionInfo;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 if (isIntercepted) 2723 if (isIntercepted)
2705 return Closure.forwardInterceptedCallTo(receiver, func); 2724 return Closure.forwardInterceptedCallTo(receiver, func);
2706 let stubName = dart.as(func.$stubName, core.String); 2725 let stubName = dart.as(func.$stubName, core.String);
2707 let arity = func.length; 2726 let arity = func.length;
2708 let lookedUpFunction = receiver[stubName]; 2727 let lookedUpFunction = receiver[stubName];
2709 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2728 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2710 if (dart.notNull(Closure.isCsp) || dart.notNull(isSuperCall) || dart.notNu ll(arity) >= 27) { 2729 if (dart.notNull(Closure.isCsp) || dart.notNull(isSuperCall) || dart.notNu ll(arity) >= 27) {
2711 return Closure.cspForwardCall(arity, isSuperCall, stubName, func); 2730 return Closure.cspForwardCall(arity, isSuperCall, stubName, func);
2712 } 2731 }
2713 if (arity == 0) { 2732 if (arity == 0) {
2714 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x$) => Closure.functionCounter = dart.not Null(x$) + 1, x$)(Closure.functionCounter)}` + '}')(); 2733 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${(() => {
2734 let x$ = Closure.functionCounter;
2735 Closure.functionCounter = dart.notNull(x$) + 1;
2736 return x$;
2737 })()}` + '}')();
2715 } 2738 }
2716 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); 2739 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
2717 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).j oin(","); 2740 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).j oin(",");
2718 return new Function(`return function(${arguments$}){` + `return this.${Bou ndClosure.selfFieldName()}.${stubName}(${arguments$});` + `${((x$) => Closure.fu nctionCounter = dart.notNull(x$) + 1, x$)(Closure.functionCounter)}` + '}')(); 2741 return new Function(`return function(${arguments$}){` + `return this.${Bou ndClosure.selfFieldName()}.${stubName}(${arguments$});` + `${(() => {
2742 let x$ = Closure.functionCounter;
2743 Closure.functionCounter = dart.notNull(x$) + 1;
2744 return x$;
2745 })()}` + '}')();
2719 } 2746 }
2720 static cspForwardInterceptedCall(arity, isSuperCall, name, func) { 2747 static cspForwardInterceptedCall(arity, isSuperCall, name, func) {
2721 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2748 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2722 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf); 2749 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
2723 if (isSuperCall) 2750 if (isSuperCall)
2724 arity = -1; 2751 arity = -1;
2725 switch (arity) { 2752 switch (arity) {
2726 case 0: 2753 case 0:
2727 { 2754 {
2728 throw new RuntimeError('Intercepted function with no arguments.'); 2755 throw new RuntimeError('Intercepted function with no arguments.');
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 let receiverField = BoundClosure.receiverFieldName(); 2819 let receiverField = BoundClosure.receiverFieldName();
2793 let stubName = dart.as(func.$stubName, core.String); 2820 let stubName = dart.as(func.$stubName, core.String);
2794 let arity = func.length; 2821 let arity = func.length;
2795 let isCsp = typeof dart_precompiled == "function"; 2822 let isCsp = typeof dart_precompiled == "function";
2796 let lookedUpFunction = receiver[stubName]; 2823 let lookedUpFunction = receiver[stubName];
2797 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2824 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2798 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) { 2825 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
2799 return Closure.cspForwardInterceptedCall(arity, isSuperCall, stubName, f unc); 2826 return Closure.cspForwardInterceptedCall(arity, isSuperCall, stubName, f unc);
2800 } 2827 }
2801 if (arity == 1) { 2828 if (arity == 1) {
2802 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x$) => Closure.functionCounter = dart.n otNull(x$) + 1, x$)(Closure.functionCounter)}` + '}')(); 2829 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${(() => {
2830 let x$ = Closure.functionCounter;
2831 Closure.functionCounter = dart.notNull(x$) + 1;
2832 return x$;
2833 })()}` + '}')();
2803 } 2834 }
2804 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); 2835 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
2805 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.not Null(arity) - 1).join(","); 2836 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.not Null(arity) - 1).join(",");
2806 return new Function(`return function(${arguments$}){` + `return this.${sel fField}.${stubName}(this.${receiverField}, ${arguments$});` + `${((x$) => Closur e.functionCounter = dart.notNull(x$) + 1, x$)(Closure.functionCounter)}` + '}')( ); 2837 return new Function(`return function(${arguments$}){` + `return this.${sel fField}.${stubName}(this.${receiverField}, ${arguments$});` + `${(() => {
2838 let x$ = Closure.functionCounter;
2839 Closure.functionCounter = dart.notNull(x$) + 1;
2840 return x$;
2841 })()}` + '}')();
2807 } 2842 }
2808 toString() { 2843 toString() {
2809 return "Closure"; 2844 return "Closure";
2810 } 2845 }
2811 } 2846 }
2812 Closure[dart.implements] = () => [core.Function]; 2847 Closure[dart.implements] = () => [core.Function];
2813 Closure.FUNCTION_INDEX = 0; 2848 Closure.FUNCTION_INDEX = 0;
2814 Closure.NAME_INDEX = 1; 2849 Closure.NAME_INDEX = 1;
2815 Closure.CALL_NAME_INDEX = 2; 2850 Closure.CALL_NAME_INDEX = 2;
2816 Closure.REQUIRED_PARAMETER_INDEX = 3; 2851 Closure.REQUIRED_PARAMETER_INDEX = 3;
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti')); 3386 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti'));
3352 } 3387 }
3353 return result; 3388 return result;
3354 } 3389 }
3355 toString() { 3390 toString() {
3356 let result = '('; 3391 let result = '(';
3357 let needsComma = false; 3392 let needsComma = false;
3358 if (this.parameterTypes != null) { 3393 if (this.parameterTypes != null) {
3359 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core. $length]); i = dart.notNull(i) + 1) { 3394 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core. $length]); i = dart.notNull(i) + 1) {
3360 let type = this.parameterTypes[core.$get](i); 3395 let type = this.parameterTypes[core.$get](i);
3361 if (needsComma) 3396 if (needsComma) {
3362 result = ', '; 3397 result = core.String['+'](result, ', ');
3363 result = `${type}`; 3398 }
3399 result = core.String['+'](result, `${type}`);
3364 needsComma = true; 3400 needsComma = true;
3365 } 3401 }
3366 } 3402 }
3367 if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(thi s.optionalParameterTypes[core.$isEmpty])) { 3403 if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(thi s.optionalParameterTypes[core.$isEmpty])) {
3368 if (needsComma) 3404 if (needsComma) {
3369 result = ', '; 3405 result = core.String['+'](result, ', ');
3406 }
3370 needsComma = false; 3407 needsComma = false;
3371 result = '['; 3408 result = core.String['+'](result, '[');
3372 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp es[core.$length]); i = dart.notNull(i) + 1) { 3409 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp es[core.$length]); i = dart.notNull(i) + 1) {
3373 let type = this.optionalParameterTypes[core.$get](i); 3410 let type = this.optionalParameterTypes[core.$get](i);
3374 if (needsComma) 3411 if (needsComma) {
3375 result = ', '; 3412 result = core.String['+'](result, ', ');
3376 result = `${type}`; 3413 }
3414 result = core.String['+'](result, `${type}`);
3377 needsComma = true; 3415 needsComma = true;
3378 } 3416 }
3379 result = ']'; 3417 result = core.String['+'](result, ']');
3380 } else if (this.namedParameters != null) { 3418 } else if (this.namedParameters != null) {
3381 if (needsComma) 3419 if (needsComma) {
3382 result = ', '; 3420 result = core.String['+'](result, ', ');
3421 }
3383 needsComma = false; 3422 needsComma = false;
3384 result = '{'; 3423 result = core.String['+'](result, '{');
3385 let keys = _js_names.extractKeys(this.namedParameters); 3424 let keys = _js_names.extractKeys(this.namedParameters);
3386 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) { 3425 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
3387 let name = keys[core.$get](i); 3426 let name = keys[core.$get](i);
3388 if (needsComma) 3427 if (needsComma) {
3389 result = ', '; 3428 result = core.String['+'](result, ', ');
3429 }
3390 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 3430 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
3391 result = `${rti} ${name}`; 3431 result = core.String['+'](result, `${rti} ${name}`);
3392 needsComma = true; 3432 needsComma = true;
3393 } 3433 }
3394 result = '}'; 3434 result = core.String['+'](result, '}');
3395 } 3435 }
3396 result = `) -> ${this.returnType}`; 3436 result = core.String['+'](result, `) -> ${this.returnType}`);
3397 return result; 3437 return result;
3398 } 3438 }
3399 } 3439 }
3400 RuntimeFunctionType.inAssert = false; 3440 RuntimeFunctionType.inAssert = false;
3401 // Function buildFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunctionTy pe 3441 // Function buildFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunctionTy pe
3402 function buildFunctionType(returnType, parameterTypes, optionalParameterTypes) { 3442 function buildFunctionType(returnType, parameterTypes, optionalParameterTypes) {
3403 return new RuntimeFunctionType(dart.as(returnType, RuntimeType), dart.as(par ameterTypes, core.List$(RuntimeType)), dart.as(optionalParameterTypes, core.List $(RuntimeType)), null); 3443 return new RuntimeFunctionType(dart.as(returnType, RuntimeType), dart.as(par ameterTypes, core.List$(RuntimeType)), dart.as(optionalParameterTypes, core.List $(RuntimeType)), null);
3404 } 3444 }
3405 // Function buildNamedFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunct ionType 3445 // Function buildNamedFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunct ionType
3406 function buildNamedFunctionType(returnType, parameterTypes, namedParameters) { 3446 function buildNamedFunctionType(returnType, parameterTypes, namedParameters) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3578 throw 'bad type'; 3618 throw 'bad type';
3579 } 3619 }
3580 } 3620 }
3581 toString() { 3621 toString() {
3582 if (this[_cachedToString] != null) 3622 if (this[_cachedToString] != null)
3583 return this[_cachedToString]; 3623 return this[_cachedToString];
3584 let s = "("; 3624 let s = "(";
3585 let sep = ''; 3625 let sep = '';
3586 if (this[_hasArguments]) { 3626 if (this[_hasArguments]) {
3587 for (let argument of this[_arguments]) { 3627 for (let argument of this[_arguments]) {
3588 s = sep; 3628 s = core.String['+'](s, sep);
3589 s = this[_convert](argument); 3629 s = core.String['+'](s, this[_convert](argument));
3590 sep = ', '; 3630 sep = ', ';
3591 } 3631 }
3592 } 3632 }
3593 if (this[_hasOptionalArguments]) { 3633 if (this[_hasOptionalArguments]) {
3594 s = `${sep}[`; 3634 s = core.String['+'](s, `${sep}[`);
3595 sep = ''; 3635 sep = '';
3596 for (let argument of this[_optionalArguments]) { 3636 for (let argument of this[_optionalArguments]) {
3597 s = sep; 3637 s = core.String['+'](s, sep);
3598 s = this[_convert](argument); 3638 s = core.String['+'](s, this[_convert](argument));
3599 sep = ', '; 3639 sep = ', ';
3600 } 3640 }
3601 s = ']'; 3641 s = core.String['+'](s, ']');
3602 } 3642 }
3603 if (this[_hasNamedArguments]) { 3643 if (this[_hasNamedArguments]) {
3604 s = `${sep}{`; 3644 s = core.String['+'](s, `${sep}{`);
3605 sep = ''; 3645 sep = '';
3606 for (let name of _js_names.extractKeys(this[_namedArguments])) { 3646 for (let name of _js_names.extractKeys(this[_namedArguments])) {
3607 s = sep; 3647 s = core.String['+'](s, sep);
3608 s = `${name}: `; 3648 s = core.String['+'](s, `${name}: `);
3609 s = this[_convert](this[_namedArguments][name]); 3649 s = core.String['+'](s, this[_convert](this[_namedArguments][name]));
3610 sep = ', '; 3650 sep = ', ';
3611 } 3651 }
3612 s = '}'; 3652 s = core.String['+'](s, '}');
3613 } 3653 }
3614 s = ') -> '; 3654 s = core.String['+'](s, ') -> ');
3615 if (this[_isVoid]) { 3655 if (this[_isVoid]) {
3616 s = 'void'; 3656 s = core.String['+'](s, 'void');
3617 } else if (this[_hasReturnType]) { 3657 } else if (this[_hasReturnType]) {
3618 s = this[_convert](this[_returnType]); 3658 s = core.String['+'](s, this[_convert](this[_returnType]));
3619 } else { 3659 } else {
3620 s = 'dynamic'; 3660 s = core.String['+'](s, 'dynamic');
3621 } 3661 }
3622 return this[_cachedToString] = `${s}`; 3662 return this[_cachedToString] = `${s}`;
3623 } 3663 }
3624 } 3664 }
3625 class UnimplementedNoSuchMethodError extends core.Error { 3665 class UnimplementedNoSuchMethodError extends core.Error {
3626 UnimplementedNoSuchMethodError(message$) { 3666 UnimplementedNoSuchMethodError(message$) {
3627 this[_message] = message$; 3667 this[_message] = message$;
3628 super.Error(); 3668 super.Error();
3629 } 3669 }
3630 toString() { 3670 toString() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3663 class DeferredLoadCallback extends core.Function {} 3703 class DeferredLoadCallback extends core.Function {}
3664 exports.deferredLoadHook = null; 3704 exports.deferredLoadHook = null;
3665 // Function loadDeferredLibrary: (String) → Future<Null> 3705 // Function loadDeferredLibrary: (String) → Future<Null>
3666 function loadDeferredLibrary(loadId) { 3706 function loadDeferredLibrary(loadId) {
3667 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DEFE RRED_LIBRARY_URIS); 3707 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DEFE RRED_LIBRARY_URIS);
3668 let uris = dart.as(urisMap[loadId], core.List$(core.String)); 3708 let uris = dart.as(urisMap[loadId], core.List$(core.String));
3669 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DE FERRED_LIBRARY_HASHES); 3709 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DE FERRED_LIBRARY_HASHES);
3670 let hashes = dart.as(hashesMap[loadId], core.List$(core.String)); 3710 let hashes = dart.as(hashesMap[loadId], core.List$(core.String));
3671 if (uris == null) 3711 if (uris == null)
3672 return dart.as(new async.Future.value(null), async.Future$(core.Null)); 3712 return dart.as(new async.Future.value(null), async.Future$(core.Null));
3673 let indices = dart.as(new core.List.generate(uris[core.$length], dart.as((i) => i, dart.throw_("Unimplemented type (int) → dynamic"))), core.List$(core.int) ); 3713 let indices = dart.as(new core.List.generate(uris[core.$length], dart.as(i = > i, dart.throw_("Unimplemented type (int) → dynamic"))), core.List$(core.int));
3674 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .IS_HUNK_LOADED); 3714 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .IS_HUNK_LOADED);
3675 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_ names.IS_HUNK_INITIALIZED); 3715 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_ names.IS_HUNK_INITIALIZED);
3676 let indicesToLoad = indices[core.$where]((i) => !isHunkLoaded(hashes[core.$g et](i)))[core.$toList](); 3716 let indicesToLoad = indices[core.$where](i => !isHunkLoaded(hashes[core.$get ](i)))[core.$toList]();
3677 return dart.as(async.Future.wait(dart.as(indicesToLoad[core.$map]((i) => _lo adHunk(uris[core.$get](i))), core.Iterable$(async.Future))).then(dart.as((_) => { 3717 return dart.as(async.Future.wait(dart.as(indicesToLoad[core.$map](i => _load Hunk(uris[core.$get](i))), core.Iterable$(async.Future))).then(dart.as(_ => {
3678 let indicesToInitialize = indices[core.$where]((i) => !isHunkInitialized(h ashes[core.$get](i)))[core.$toList](); 3718 let indicesToInitialize = indices[core.$where](i => !isHunkInitialized(has hes[core.$get](i)))[core.$toList]();
3679 for (let i of indicesToInitialize) { 3719 for (let i of indicesToInitialize) {
3680 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_na mes.INITIALIZE_LOADED_HUNK); 3720 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_na mes.INITIALIZE_LOADED_HUNK);
3681 initializer(hashes[core.$get](i)); 3721 initializer(hashes[core.$get](i));
3682 } 3722 }
3683 let updated = exports._loadedLibraries.add(loadId); 3723 let updated = exports._loadedLibraries.add(loadId);
3684 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook != null )) { 3724 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook != null )) {
3685 exports.deferredLoadHook(); 3725 exports.deferredLoadHook();
3686 } 3726 }
3687 }, dart.throw_("Unimplemented type (List<dynamic>) → dynamic"))), async.Futu re$(core.Null)); 3727 }, dart.throw_("Unimplemented type (List<dynamic>) → dynamic"))), async.Futu re$(core.Null));
3688 } 3728 }
3689 // Function _loadHunk: (String) → Future<Null> 3729 // Function _loadHunk: (String) → Future<Null>
3690 function _loadHunk(hunkName) { 3730 function _loadHunk(hunkName) {
3691 let future = exports._loadingLibraries.get(hunkName); 3731 let future = exports._loadingLibraries.get(hunkName);
3692 if (future != null) { 3732 if (future != null) {
3693 return dart.as(future.then(dart.as((_) => null, dart.throw_("Unimplemented type (Null) → dynamic"))), async.Future$(core.Null)); 3733 return dart.as(future.then(dart.as(_ => null, dart.throw_("Unimplemented t ype (Null) → dynamic"))), async.Future$(core.Null));
3694 } 3734 }
3695 let uri = _isolate_helper.IsolateNatives.thisScript; 3735 let uri = _isolate_helper.IsolateNatives.thisScript;
3696 let index = uri.lastIndexOf('/'); 3736 let index = uri.lastIndexOf('/');
3697 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`; 3737 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`;
3698 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) { 3738 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) {
3699 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Nul l))(() => { 3739 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Nul l))(() => {
3700 try { 3740 try {
3701 new Function(`load("${uri}")`)(); 3741 new Function(`load("${uri}")`)();
3702 } catch (error) { 3742 } catch (error) {
3703 let stackTrace = dart.stackTrace(error); 3743 let stackTrace = dart.stackTrace(error);
3704 throw new async.DeferredLoadException(`Loading ${uri} failed.`); 3744 throw new async.DeferredLoadException(`Loading ${uri} failed.`);
3705 } 3745 }
3706 3746
3707 return null; 3747 return null;
3708 })); 3748 }));
3709 } else if (_isolate_helper.isWorker()) { 3749 } else if (_isolate_helper.isWorker()) {
3710 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Nul l))(() => { 3750 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Nul l))(() => {
3711 let completer = new (async.Completer$(core.Null))(); 3751 let completer = new (async.Completer$(core.Null))();
3712 _isolate_helper.enterJsAsync(); 3752 _isolate_helper.enterJsAsync();
3713 let leavingFuture = dart.as(completer.future.whenComplete(() => { 3753 let leavingFuture = dart.as(completer.future.whenComplete(() => {
3714 _isolate_helper.leaveJsAsync(); 3754 _isolate_helper.leaveJsAsync();
3715 }), async.Future$(core.Null)); 3755 }), async.Future$(core.Null));
3716 let index = uri.lastIndexOf('/'); 3756 let index = uri.lastIndexOf('/');
3717 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`; 3757 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`;
3718 let xhr = new XMLHttpRequest(); 3758 let xhr = new XMLHttpRequest();
3719 xhr.open("GET", uri); 3759 xhr.open("GET", uri);
3720 xhr.addEventListener("load", convertDartClosureToJS((event) => { 3760 xhr.addEventListener("load", convertDartClosureToJS(event => {
3721 if (xhr.status != 200) { 3761 if (xhr.status != 200) {
3722 completer.completeError(new async.DeferredLoadException(`Loading ${u ri} failed.`)); 3762 completer.completeError(new async.DeferredLoadException(`Loading ${u ri} failed.`));
3723 return; 3763 return;
3724 } 3764 }
3725 let code = xhr.responseText; 3765 let code = xhr.responseText;
3726 try { 3766 try {
3727 new Function(code)(); 3767 new Function(code)();
3728 } catch (error) { 3768 } catch (error) {
3729 let stackTrace = dart.stackTrace(error); 3769 let stackTrace = dart.stackTrace(error);
3730 completer.completeError(new async.DeferredLoadException(`Evaluating ${uri} failed.`)); 3770 completer.completeError(new async.DeferredLoadException(`Evaluating ${uri} failed.`));
3731 return; 3771 return;
3732 } 3772 }
3733 3773
3734 completer.complete(null); 3774 completer.complete(null);
3735 }, 1), false); 3775 }, 1), false);
3736 let fail = convertDartClosureToJS((event) => { 3776 let fail = convertDartClosureToJS(event => {
3737 new async.DeferredLoadException(`Loading ${uri} failed.`); 3777 new async.DeferredLoadException(`Loading ${uri} failed.`);
3738 }, 1); 3778 }, 1);
3739 xhr.addEventListener("error", fail, false); 3779 xhr.addEventListener("error", fail, false);
3740 xhr.addEventListener("abort", fail, false); 3780 xhr.addEventListener("abort", fail, false);
3741 xhr.send(); 3781 xhr.send();
3742 return leavingFuture; 3782 return leavingFuture;
3743 })); 3783 }));
3744 } 3784 }
3745 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Null) )(() => { 3785 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Null) )(() => {
3746 let completer = new (async.Completer$(core.Null))(); 3786 let completer = new (async.Completer$(core.Null))();
3747 let script = document.createElement("script"); 3787 let script = document.createElement("script");
3748 script.type = "text/javascript"; 3788 script.type = "text/javascript";
3749 script.src = uri; 3789 script.src = uri;
3750 script.addEventListener("load", convertDartClosureToJS((event) => { 3790 script.addEventListener("load", convertDartClosureToJS(event => {
3751 completer.complete(null); 3791 completer.complete(null);
3752 }, 1), false); 3792 }, 1), false);
3753 script.addEventListener("error", convertDartClosureToJS((event) => { 3793 script.addEventListener("error", convertDartClosureToJS(event => {
3754 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`)); 3794 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`));
3755 }, 1), false); 3795 }, 1), false);
3756 document.body.appendChild(script); 3796 document.body.appendChild(script);
3757 return completer.future; 3797 return completer.future;
3758 })); 3798 }));
3759 } 3799 }
3760 class MainError extends core.Error { 3800 class MainError extends core.Error {
3761 MainError(message$) { 3801 MainError(message$) {
3762 this[_message] = message$; 3802 this[_message] = message$;
3763 super.Error(); 3803 super.Error();
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 exports.jsonEncodeNative = jsonEncodeNative; 4043 exports.jsonEncodeNative = jsonEncodeNative;
4004 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4044 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4005 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4045 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4006 exports.DeferredLoadCallback = DeferredLoadCallback; 4046 exports.DeferredLoadCallback = DeferredLoadCallback;
4007 exports.loadDeferredLibrary = loadDeferredLibrary; 4047 exports.loadDeferredLibrary = loadDeferredLibrary;
4008 exports.MainError = MainError; 4048 exports.MainError = MainError;
4009 exports.missingMain = missingMain; 4049 exports.missingMain = missingMain;
4010 exports.badMain = badMain; 4050 exports.badMain = badMain;
4011 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4051 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4012 })(_js_helper || (_js_helper = {})); 4052 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698