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

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
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 542 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 ((_$) => (_$ = positions.keys[core.$toList](), _$[core.$sort](), _$))()[ core.$forEach](((name) => {
1682 _$[core.$sort](); 1684 this.cachedSortedIndices[core.$set](((x$) => (x$ = index, index = dart .notNull(x$) + 1, x$))(), positions.get(name));
1683 return _$;
1684 })(positions.keys[core.$toList]())[core.$forEach](((name) => {
1685 this.cachedSortedIndices[core.$set](((x$) => index = dart.notNull(x$) + 1, x$)(index), positions.get(name));
1686 }).bind(this)); 1685 }).bind(this));
1687 } 1686 }
1688 return dart.as(this.cachedSortedIndices[core.$get](unsortedIndex), core.in t); 1687 return dart.as(this.cachedSortedIndices[core.$get](unsortedIndex), core.in t);
1689 } 1688 }
1690 computeFunctionRti(jsConstructor) { 1689 computeFunctionRti(jsConstructor) {
1691 if (typeof this.functionType == "number") { 1690 if (typeof this.functionType == "number") {
1692 return getMetadata(dart.as(this.functionType, core.int)); 1691 return getMetadata(dart.as(this.functionType, core.int));
1693 } else if (typeof this.functionType == "function") { 1692 } else if (typeof this.functionType == "function") {
1694 let fakeInstance = new jsConstructor(); 1693 let fakeInstance = new jsConstructor();
1695 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); 1694 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]);
(...skipping 14 matching lines...) Expand all
1710 // Function getMetadata: (int) → dynamic 1709 // Function getMetadata: (int) → dynamic
1711 function getMetadata(index) { 1710 function getMetadata(index) {
1712 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA); 1711 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA);
1713 return metadata[index]; 1712 return metadata[index];
1714 } 1713 }
1715 let _throwFormatException = Symbol('_throwFormatException'); 1714 let _throwFormatException = Symbol('_throwFormatException');
1716 let _fromCharCodeApply = Symbol('_fromCharCodeApply'); 1715 let _fromCharCodeApply = Symbol('_fromCharCodeApply');
1717 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType'); 1716 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
1718 class Primitives extends core.Object { 1717 class Primitives extends core.Object {
1719 static initializeStatics(id) { 1718 static initializeStatics(id) {
1720 Primitives.mirrorFunctionCacheName = `_${id}`; 1719 Primitives.mirrorFunctionCacheName = core.String['+'](Primitives.mirrorFun ctionCacheName, `_${id}`);
1721 Primitives.mirrorInvokeCacheName = `_${id}`; 1720 Primitives.mirrorInvokeCacheName = core.String['+'](Primitives.mirrorInvok eCacheName, `_${id}`);
1722 } 1721 }
1723 static objectHashCode(object) { 1722 static objectHashCode(object) {
1724 let hash = dart.as(object.$identityHash, core.int); 1723 let hash = dart.as(object.$identityHash, core.int);
1725 if (hash == null) { 1724 if (hash == null) {
1726 hash = Math.random() * 0x3fffffff | 0; 1725 hash = Math.random() * 0x3fffffff | 0;
1727 object.$identityHash = hash; 1726 object.$identityHash = hash;
1728 } 1727 }
1729 return hash; 1728 return hash;
1730 } 1729 }
1731 static [_throwFormatException](string) { 1730 static [_throwFormatException](string) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 requiresPreamble(); 1849 requiresPreamble();
1851 if (!!self.location) { 1850 if (!!self.location) {
1852 return self.location.href; 1851 return self.location.href;
1853 } 1852 }
1854 return null; 1853 return null;
1855 } 1854 }
1856 static [_fromCharCodeApply](array) { 1855 static [_fromCharCodeApply](array) {
1857 let result = ""; 1856 let result = "";
1858 let kMaxApply = 500; 1857 let kMaxApply = 500;
1859 let end = array[core.$length]; 1858 let end = array[core.$length];
1860 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) { 1859 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + dart.notNull(kMaxApply)) {
1861 let subarray = null; 1860 let subarray = null;
1862 if (dart.notNull(end) <= dart.notNull(kMaxApply)) { 1861 if (dart.notNull(end) <= dart.notNull(kMaxApply)) {
1863 subarray = array; 1862 subarray = array;
1864 } else { 1863 } else {
1865 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); 1864 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end);
1866 } 1865 }
1867 result = result + String.fromCharCode.apply(null, subarray); 1866 result = result + String.fromCharCode.apply(null, subarray);
1868 } 1867 }
1869 return result; 1868 return result;
1870 } 1869 }
(...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')) { 2012 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); 2013 throw new core.ArgumentError(object);
2015 } 2014 }
2016 object[key] = value; 2015 object[key] = value;
2017 } 2016 }
2018 static functionNoSuchMethod(func, positionalArguments, namedArguments) { 2017 static functionNoSuchMethod(func, positionalArguments, namedArguments) {
2019 let argumentCount = 0; 2018 let argumentCount = 0;
2020 let arguments$ = new core.List.from([]); 2019 let arguments$ = new core.List.from([]);
2021 let namedArgumentList = new core.List.from([]); 2020 let namedArgumentList = new core.List.from([]);
2022 if (positionalArguments != null) { 2021 if (positionalArguments != null) {
2023 argumentCount = positionalArguments[core.$length]; 2022 argumentCount = dart.notNull(argumentCount) + dart.notNull(positionalArg uments[core.$length]);
2024 arguments$[core.$addAll](positionalArguments); 2023 arguments$[core.$addAll](positionalArguments);
2025 } 2024 }
2026 let names = ''; 2025 let names = '';
2027 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) { 2026 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) {
2028 namedArguments.forEach((name, argument) => { 2027 namedArguments.forEach((name, argument) => {
2029 names = `${names}$${name}`; 2028 names = `${names}$${name}`;
2030 namedArgumentList[core.$add](name); 2029 namedArgumentList[core.$add](name);
2031 arguments$[core.$add](argument); 2030 arguments$[core.$add](argument);
2032 argumentCount = dart.notNull(argumentCount) + 1; 2031 argumentCount = dart.notNull(argumentCount) + 1;
2033 }); 2032 });
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 return dart.as(dart.dload(object, 'hashCode'), core.int); 2525 return dart.as(dart.dload(object, 'hashCode'), core.int);
2527 } else { 2526 } else {
2528 return Primitives.objectHashCode(object); 2527 return Primitives.objectHashCode(object);
2529 } 2528 }
2530 } 2529 }
2531 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic 2530 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic
2532 function fillLiteralMap(keyValuePairs, result) { 2531 function fillLiteralMap(keyValuePairs, result) {
2533 let index = 0; 2532 let index = 0;
2534 let length = getLength(keyValuePairs); 2533 let length = getLength(keyValuePairs);
2535 while (dart.notNull(index) < dart.notNull(length)) { 2534 while (dart.notNull(index) < dart.notNull(length)) {
2536 let key = getIndex(keyValuePairs, ((x$) => index = dart.notNull(x$) + 1, x $)(index)); 2535 let key = getIndex(keyValuePairs, ((x$) => (x$ = index, index = dart.notNu ll(x$) + 1, x$))());
2537 let value = getIndex(keyValuePairs, ((x$) => index = dart.notNull(x$) + 1, x$)(index)); 2536 let value = getIndex(keyValuePairs, ((x$) => (x$ = index, index = dart.not Null(x$) + 1, x$))());
2538 result.set(key, value); 2537 result.set(key, value);
2539 } 2538 }
2540 return result; 2539 return result;
2541 } 2540 }
2542 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic 2541 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
2543 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) { 2542 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
2544 if (numberOfArguments == 0) { 2543 if (numberOfArguments == 0) {
2545 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure)); 2544 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure));
2546 } else if (numberOfArguments == 1) { 2545 } else if (numberOfArguments == 1) {
2547 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1)); 2546 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); 2582 let callName = dart.as(func.$callName, core.String);
2584 func.$reflectionInfo = reflectionInfo; 2583 func.$reflectionInfo = reflectionInfo;
2585 let info = new ReflectionInfo(func); 2584 let info = new ReflectionInfo(func);
2586 let functionType = info.functionType; 2585 let functionType = info.functionType;
2587 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype); 2586 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
2588 prototype.$initialize = prototype.constructor; 2587 prototype.$initialize = prototype.constructor;
2589 let constructor = isStatic ? function() { 2588 let constructor = isStatic ? function() {
2590 this.$initialize(); 2589 this.$initialize();
2591 } : Closure.isCsp ? function(a, b, c, d) { 2590 } : Closure.isCsp ? function(a, b, c, d) {
2592 this.$initialize(a, b, c, d); 2591 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)) ; 2592 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x$) => (x$ = Closure.functionCounter, Closure.functionCounter = dart.notNull(x$) + 1 , x$))());
2594 prototype.constructor = constructor; 2593 prototype.constructor = constructor;
2595 constructor.prototype = prototype; 2594 constructor.prototype = prototype;
2596 let trampoline = func; 2595 let trampoline = func;
2597 let isIntercepted = false; 2596 let isIntercepted = false;
2598 if (!dart.notNull(isStatic)) { 2597 if (!dart.notNull(isStatic)) {
2599 if (jsArguments.length == 1) { 2598 if (jsArguments.length == 1) {
2600 isIntercepted = true; 2599 isIntercepted = true;
2601 } 2600 }
2602 trampoline = Closure.forwardCallTo(receiver, func, isIntercepted); 2601 trampoline = Closure.forwardCallTo(receiver, func, isIntercepted);
2603 trampoline.$reflectionInfo = reflectionInfo; 2602 trampoline.$reflectionInfo = reflectionInfo;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 if (isIntercepted) 2703 if (isIntercepted)
2705 return Closure.forwardInterceptedCallTo(receiver, func); 2704 return Closure.forwardInterceptedCallTo(receiver, func);
2706 let stubName = dart.as(func.$stubName, core.String); 2705 let stubName = dart.as(func.$stubName, core.String);
2707 let arity = func.length; 2706 let arity = func.length;
2708 let lookedUpFunction = receiver[stubName]; 2707 let lookedUpFunction = receiver[stubName];
2709 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2708 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2710 if (dart.notNull(Closure.isCsp) || dart.notNull(isSuperCall) || dart.notNu ll(arity) >= 27) { 2709 if (dart.notNull(Closure.isCsp) || dart.notNull(isSuperCall) || dart.notNu ll(arity) >= 27) {
2711 return Closure.cspForwardCall(arity, isSuperCall, stubName, func); 2710 return Closure.cspForwardCall(arity, isSuperCall, stubName, func);
2712 } 2711 }
2713 if (arity == 0) { 2712 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)}` + '}')(); 2713 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x$) => (x$ = Closure.functionCounter, Clo sure.functionCounter = dart.notNull(x$) + 1, x$))()}` + '}')();
2715 } 2714 }
2716 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); 2715 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
2717 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).j oin(","); 2716 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)}` + '}')(); 2717 return new Function(`return function(${arguments$}){` + `return this.${Bou ndClosure.selfFieldName()}.${stubName}(${arguments$});` + `${((x$) => (x$ = Clos ure.functionCounter, Closure.functionCounter = dart.notNull(x$) + 1, x$))()}` + '}')();
2719 } 2718 }
2720 static cspForwardInterceptedCall(arity, isSuperCall, name, func) { 2719 static cspForwardInterceptedCall(arity, isSuperCall, name, func) {
2721 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2720 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2722 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf); 2721 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
2723 if (isSuperCall) 2722 if (isSuperCall)
2724 arity = -1; 2723 arity = -1;
2725 switch (arity) { 2724 switch (arity) {
2726 case 0: 2725 case 0:
2727 { 2726 {
2728 throw new RuntimeError('Intercepted function with no arguments.'); 2727 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(); 2791 let receiverField = BoundClosure.receiverFieldName();
2793 let stubName = dart.as(func.$stubName, core.String); 2792 let stubName = dart.as(func.$stubName, core.String);
2794 let arity = func.length; 2793 let arity = func.length;
2795 let isCsp = typeof dart_precompiled == "function"; 2794 let isCsp = typeof dart_precompiled == "function";
2796 let lookedUpFunction = receiver[stubName]; 2795 let lookedUpFunction = receiver[stubName];
2797 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2796 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2798 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) { 2797 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
2799 return Closure.cspForwardInterceptedCall(arity, isSuperCall, stubName, f unc); 2798 return Closure.cspForwardInterceptedCall(arity, isSuperCall, stubName, f unc);
2800 } 2799 }
2801 if (arity == 1) { 2800 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)}` + '}')(); 2801 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x$) => (x$ = Closure.functionCounter, C losure.functionCounter = dart.notNull(x$) + 1, x$))()}` + '}')();
2803 } 2802 }
2804 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); 2803 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
2805 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.not Null(arity) - 1).join(","); 2804 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)}` + '}')( ); 2805 return new Function(`return function(${arguments$}){` + `return this.${sel fField}.${stubName}(this.${receiverField}, ${arguments$});` + `${((x$) => (x$ = Closure.functionCounter, Closure.functionCounter = dart.notNull(x$) + 1, x$))()} ` + '}')();
2807 } 2806 }
2808 toString() { 2807 toString() {
2809 return "Closure"; 2808 return "Closure";
2810 } 2809 }
2811 } 2810 }
2812 Closure[dart.implements] = () => [core.Function]; 2811 Closure[dart.implements] = () => [core.Function];
2813 Closure.FUNCTION_INDEX = 0; 2812 Closure.FUNCTION_INDEX = 0;
2814 Closure.NAME_INDEX = 1; 2813 Closure.NAME_INDEX = 1;
2815 Closure.CALL_NAME_INDEX = 2; 2814 Closure.CALL_NAME_INDEX = 2;
2816 Closure.REQUIRED_PARAMETER_INDEX = 3; 2815 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')); 3350 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti'));
3352 } 3351 }
3353 return result; 3352 return result;
3354 } 3353 }
3355 toString() { 3354 toString() {
3356 let result = '('; 3355 let result = '(';
3357 let needsComma = false; 3356 let needsComma = false;
3358 if (this.parameterTypes != null) { 3357 if (this.parameterTypes != null) {
3359 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core. $length]); i = dart.notNull(i) + 1) { 3358 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); 3359 let type = this.parameterTypes[core.$get](i);
3361 if (needsComma) 3360 if (needsComma) {
3362 result = ', '; 3361 result = core.String['+'](result, ', ');
3363 result = `${type}`; 3362 }
3363 result = core.String['+'](result, `${type}`);
3364 needsComma = true; 3364 needsComma = true;
3365 } 3365 }
3366 } 3366 }
3367 if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(thi s.optionalParameterTypes[core.$isEmpty])) { 3367 if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(thi s.optionalParameterTypes[core.$isEmpty])) {
3368 if (needsComma) 3368 if (needsComma) {
3369 result = ', '; 3369 result = core.String['+'](result, ', ');
3370 }
3370 needsComma = false; 3371 needsComma = false;
3371 result = '['; 3372 result = core.String['+'](result, '[');
3372 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp es[core.$length]); i = dart.notNull(i) + 1) { 3373 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); 3374 let type = this.optionalParameterTypes[core.$get](i);
3374 if (needsComma) 3375 if (needsComma) {
3375 result = ', '; 3376 result = core.String['+'](result, ', ');
3376 result = `${type}`; 3377 }
3378 result = core.String['+'](result, `${type}`);
3377 needsComma = true; 3379 needsComma = true;
3378 } 3380 }
3379 result = ']'; 3381 result = core.String['+'](result, ']');
3380 } else if (this.namedParameters != null) { 3382 } else if (this.namedParameters != null) {
3381 if (needsComma) 3383 if (needsComma) {
3382 result = ', '; 3384 result = core.String['+'](result, ', ');
3385 }
3383 needsComma = false; 3386 needsComma = false;
3384 result = '{'; 3387 result = core.String['+'](result, '{');
3385 let keys = _js_names.extractKeys(this.namedParameters); 3388 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) { 3389 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
3387 let name = keys[core.$get](i); 3390 let name = keys[core.$get](i);
3388 if (needsComma) 3391 if (needsComma) {
3389 result = ', '; 3392 result = core.String['+'](result, ', ');
3393 }
3390 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 3394 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
3391 result = `${rti} ${name}`; 3395 result = core.String['+'](result, `${rti} ${name}`);
3392 needsComma = true; 3396 needsComma = true;
3393 } 3397 }
3394 result = '}'; 3398 result = core.String['+'](result, '}');
3395 } 3399 }
3396 result = `) -> ${this.returnType}`; 3400 result = core.String['+'](result, `) -> ${this.returnType}`);
3397 return result; 3401 return result;
3398 } 3402 }
3399 } 3403 }
3400 RuntimeFunctionType.inAssert = false; 3404 RuntimeFunctionType.inAssert = false;
3401 // Function buildFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunctionTy pe 3405 // Function buildFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunctionTy pe
3402 function buildFunctionType(returnType, parameterTypes, optionalParameterTypes) { 3406 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); 3407 return new RuntimeFunctionType(dart.as(returnType, RuntimeType), dart.as(par ameterTypes, core.List$(RuntimeType)), dart.as(optionalParameterTypes, core.List $(RuntimeType)), null);
3404 } 3408 }
3405 // Function buildNamedFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunct ionType 3409 // Function buildNamedFunctionType: (dynamic, dynamic, dynamic) → RuntimeFunct ionType
3406 function buildNamedFunctionType(returnType, parameterTypes, namedParameters) { 3410 function buildNamedFunctionType(returnType, parameterTypes, namedParameters) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3578 throw 'bad type'; 3582 throw 'bad type';
3579 } 3583 }
3580 } 3584 }
3581 toString() { 3585 toString() {
3582 if (this[_cachedToString] != null) 3586 if (this[_cachedToString] != null)
3583 return this[_cachedToString]; 3587 return this[_cachedToString];
3584 let s = "("; 3588 let s = "(";
3585 let sep = ''; 3589 let sep = '';
3586 if (this[_hasArguments]) { 3590 if (this[_hasArguments]) {
3587 for (let argument of this[_arguments]) { 3591 for (let argument of this[_arguments]) {
3588 s = sep; 3592 s = core.String['+'](s, sep);
3589 s = this[_convert](argument); 3593 s = core.String['+'](s, this[_convert](argument));
3590 sep = ', '; 3594 sep = ', ';
3591 } 3595 }
3592 } 3596 }
3593 if (this[_hasOptionalArguments]) { 3597 if (this[_hasOptionalArguments]) {
3594 s = `${sep}[`; 3598 s = core.String['+'](s, `${sep}[`);
3595 sep = ''; 3599 sep = '';
3596 for (let argument of this[_optionalArguments]) { 3600 for (let argument of this[_optionalArguments]) {
3597 s = sep; 3601 s = core.String['+'](s, sep);
3598 s = this[_convert](argument); 3602 s = core.String['+'](s, this[_convert](argument));
3599 sep = ', '; 3603 sep = ', ';
3600 } 3604 }
3601 s = ']'; 3605 s = core.String['+'](s, ']');
3602 } 3606 }
3603 if (this[_hasNamedArguments]) { 3607 if (this[_hasNamedArguments]) {
3604 s = `${sep}{`; 3608 s = core.String['+'](s, `${sep}{`);
3605 sep = ''; 3609 sep = '';
3606 for (let name of _js_names.extractKeys(this[_namedArguments])) { 3610 for (let name of _js_names.extractKeys(this[_namedArguments])) {
3607 s = sep; 3611 s = core.String['+'](s, sep);
3608 s = `${name}: `; 3612 s = core.String['+'](s, `${name}: `);
3609 s = this[_convert](this[_namedArguments][name]); 3613 s = core.String['+'](s, this[_convert](this[_namedArguments][name]));
3610 sep = ', '; 3614 sep = ', ';
3611 } 3615 }
3612 s = '}'; 3616 s = core.String['+'](s, '}');
3613 } 3617 }
3614 s = ') -> '; 3618 s = core.String['+'](s, ') -> ');
3615 if (this[_isVoid]) { 3619 if (this[_isVoid]) {
3616 s = 'void'; 3620 s = core.String['+'](s, 'void');
3617 } else if (this[_hasReturnType]) { 3621 } else if (this[_hasReturnType]) {
3618 s = this[_convert](this[_returnType]); 3622 s = core.String['+'](s, this[_convert](this[_returnType]));
3619 } else { 3623 } else {
3620 s = 'dynamic'; 3624 s = core.String['+'](s, 'dynamic');
3621 } 3625 }
3622 return this[_cachedToString] = `${s}`; 3626 return this[_cachedToString] = `${s}`;
3623 } 3627 }
3624 } 3628 }
3625 class UnimplementedNoSuchMethodError extends core.Error { 3629 class UnimplementedNoSuchMethodError extends core.Error {
3626 UnimplementedNoSuchMethodError(message$) { 3630 UnimplementedNoSuchMethodError(message$) {
3627 this[_message] = message$; 3631 this[_message] = message$;
3628 super.Error(); 3632 super.Error();
3629 } 3633 }
3630 toString() { 3634 toString() {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 exports.jsonEncodeNative = jsonEncodeNative; 4007 exports.jsonEncodeNative = jsonEncodeNative;
4004 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4008 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4005 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4009 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4006 exports.DeferredLoadCallback = DeferredLoadCallback; 4010 exports.DeferredLoadCallback = DeferredLoadCallback;
4007 exports.loadDeferredLibrary = loadDeferredLibrary; 4011 exports.loadDeferredLibrary = loadDeferredLibrary;
4008 exports.MainError = MainError; 4012 exports.MainError = MainError;
4009 exports.missingMain = missingMain; 4013 exports.missingMain = missingMain;
4010 exports.badMain = badMain; 4014 exports.badMain = badMain;
4011 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4015 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4012 })(_js_helper || (_js_helper = {})); 4016 })(_js_helper || (_js_helper = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698