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

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

Issue 1030063004: more care around generated names, fixes #60 #82 and #97 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 dart.defineNamedConstructor(ConstantMap, '_'); 59 dart.defineNamedConstructor(ConstantMap, '_');
60 return ConstantMap; 60 return ConstantMap;
61 }); 61 });
62 let ConstantMap = ConstantMap$(dart.dynamic, dart.dynamic); 62 let ConstantMap = ConstantMap$(dart.dynamic, dart.dynamic);
63 let _jsObject = Symbol('_jsObject'); 63 let _jsObject = Symbol('_jsObject');
64 let _keys = Symbol('_keys'); 64 let _keys = Symbol('_keys');
65 let _fetch = Symbol('_fetch'); 65 let _fetch = Symbol('_fetch');
66 let ConstantStringMap$ = dart.generic(function(K, V) { 66 let ConstantStringMap$ = dart.generic(function(K, V) {
67 class ConstantStringMap extends ConstantMap$(K, V) { 67 class ConstantStringMap extends ConstantMap$(K, V) {
68 ConstantStringMap$_(length, $_jsObject, $_keys) { 68 ConstantStringMap$_(length, jsObject$, keys$) {
69 this.length = length; 69 this.length = length;
70 this[_jsObject] = $_jsObject; 70 this[_jsObject] = jsObject$;
71 this[_keys] = $_keys; 71 this[_keys] = keys$;
72 super.ConstantMap$_(); 72 super.ConstantMap$_();
73 } 73 }
74 containsValue(needle) { 74 containsValue(needle) {
75 return this.values.any((value) => dart.equals(value, needle)); 75 return this.values.any((value) => dart.equals(value, needle));
76 } 76 }
77 containsKey(key) { 77 containsKey(key) {
78 if (!(typeof key == string)) 78 if (!(typeof key == string))
79 return false; 79 return false;
80 if (dart.equals('__proto__', key)) 80 if (dart.equals('__proto__', key))
81 return false; 81 return false;
(...skipping 21 matching lines...) Expand all
103 return new _internal.MappedIterable(this[_keys], dart.closureWrap(((key) => this[_fetch](key)).bind(this), "(K) → V")); 103 return new _internal.MappedIterable(this[_keys], dart.closureWrap(((key) => this[_fetch](key)).bind(this), "(K) → V"));
104 } 104 }
105 } 105 }
106 dart.defineNamedConstructor(ConstantStringMap, '_'); 106 dart.defineNamedConstructor(ConstantStringMap, '_');
107 return ConstantStringMap; 107 return ConstantStringMap;
108 }); 108 });
109 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic); 109 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic);
110 let _protoValue = Symbol('_protoValue'); 110 let _protoValue = Symbol('_protoValue');
111 let ConstantProtoMap$ = dart.generic(function(K, V) { 111 let ConstantProtoMap$ = dart.generic(function(K, V) {
112 class ConstantProtoMap extends ConstantStringMap$(K, V) { 112 class ConstantProtoMap extends ConstantStringMap$(K, V) {
113 ConstantProtoMap$_(length, jsObject, keys, $_protoValue) { 113 ConstantProtoMap$_(length, jsObject, keys, protoValue) {
114 this[_protoValue] = $_protoValue; 114 this[_protoValue] = protoValue;
115 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k eys, core.List$(K))); 115 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k eys, core.List$(K)));
116 } 116 }
117 containsKey(key) { 117 containsKey(key) {
118 if (!(typeof key == string)) 118 if (!(typeof key == string))
119 return false; 119 return false;
120 if (dart.equals('__proto__', key)) 120 if (dart.equals('__proto__', key))
121 return true; 121 return true;
122 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); 122 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
123 } 123 }
124 [_fetch](key) { 124 [_fetch](key) {
125 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc ess(this[_jsObject], dart.as(key, core.String)); 125 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc ess(this[_jsObject], dart.as(key, core.String));
126 } 126 }
127 } 127 }
128 dart.defineNamedConstructor(ConstantProtoMap, '_'); 128 dart.defineNamedConstructor(ConstantProtoMap, '_');
129 return ConstantProtoMap; 129 return ConstantProtoMap;
130 }); 130 });
131 let ConstantProtoMap = ConstantProtoMap$(dart.dynamic, dart.dynamic); 131 let ConstantProtoMap = ConstantProtoMap$(dart.dynamic, dart.dynamic);
132 let _map = Symbol('_map'); 132 let _map = Symbol('_map');
133 let _ConstantMapKeyIterable$ = dart.generic(function(K) { 133 let _ConstantMapKeyIterable$ = dart.generic(function(K) {
134 class _ConstantMapKeyIterable extends collection.IterableBase$(K) { 134 class _ConstantMapKeyIterable extends collection.IterableBase$(K) {
135 _ConstantMapKeyIterable($_map) { 135 _ConstantMapKeyIterable(map$) {
136 this[_map] = $_map; 136 this[_map] = map$;
137 super.IterableBase(); 137 super.IterableBase();
138 } 138 }
139 get iterator() { 139 get iterator() {
140 return this[_map][_keys].iterator; 140 return this[_map][_keys].iterator;
141 } 141 }
142 get length() { 142 get length() {
143 return this[_map][_keys].length; 143 return this[_map][_keys].length;
144 } 144 }
145 } 145 }
146 return _ConstantMapKeyIterable; 146 return _ConstantMapKeyIterable;
147 }); 147 });
148 let _ConstantMapKeyIterable = _ConstantMapKeyIterable$(dart.dynamic); 148 let _ConstantMapKeyIterable = _ConstantMapKeyIterable$(dart.dynamic);
149 let _jsData = Symbol('_jsData'); 149 let _jsData = Symbol('_jsData');
150 let _getMap = Symbol('_getMap'); 150 let _getMap = Symbol('_getMap');
151 let GeneralConstantMap$ = dart.generic(function(K, V) { 151 let GeneralConstantMap$ = dart.generic(function(K, V) {
152 class GeneralConstantMap extends ConstantMap$(K, V) { 152 class GeneralConstantMap extends ConstantMap$(K, V) {
153 GeneralConstantMap($_jsData) { 153 GeneralConstantMap(jsData) {
154 this[_jsData] = $_jsData; 154 this[_jsData] = jsData;
155 super.ConstantMap$_(); 155 super.ConstantMap$_();
156 } 156 }
157 [_getMap]() { 157 [_getMap]() {
158 if (!this.$map) { 158 if (!this.$map) {
159 let backingMap = new collection.LinkedHashMap(); 159 let backingMap = new collection.LinkedHashMap();
160 this.$map = fillLiteralMap(this[_jsData], backingMap); 160 this.$map = fillLiteralMap(this[_jsData], backingMap);
161 } 161 }
162 return this.$map; 162 return this.$map;
163 } 163 }
164 containsValue(needle) { 164 containsValue(needle) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 // Function arraySet: (List<dynamic>, int, dynamic) → void 201 // Function arraySet: (List<dynamic>, int, dynamic) → void
202 function arraySet(array, index, value) { 202 function arraySet(array, index, value) {
203 array[index] = value; 203 array[index] = value;
204 } 204 }
205 // Function propertyGet: (dynamic, String) → dynamic 205 // Function propertyGet: (dynamic, String) → dynamic
206 function propertyGet(object, property) { 206 function propertyGet(object, property) {
207 return object[property]; 207 return object[property];
208 } 208 }
209 // Function callHasOwnProperty: (dynamic, dynamic, String) → bool 209 // Function callHasOwnProperty: (dynamic, dynamic, String) → bool
210 function callHasOwnProperty(function, object, property) { 210 function callHasOwnProperty(func, object, property) {
211 return function.call(object, property); 211 return func.call(object, property);
212 } 212 }
213 // Function propertySet: (dynamic, String, dynamic) → void 213 // Function propertySet: (dynamic, String, dynamic) → void
214 function propertySet(object, property, value) { 214 function propertySet(object, property, value) {
215 object[property] = value; 215 object[property] = value;
216 } 216 }
217 // Function getPropertyFromPrototype: (dynamic, String) → dynamic 217 // Function getPropertyFromPrototype: (dynamic, String) → dynamic
218 function getPropertyFromPrototype(object, name) { 218 function getPropertyFromPrototype(object, name) {
219 return Object.getPrototypeOf(object)[name]; 219 return Object.getPrototypeOf(object)[name];
220 } 220 }
221 exports.getTagFunction = null; 221 exports.getTagFunction = null;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp'); 467 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp');
468 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp'); 468 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp');
469 let _isMultiLine = Symbol('_isMultiLine'); 469 let _isMultiLine = Symbol('_isMultiLine');
470 let _isCaseSensitive = Symbol('_isCaseSensitive'); 470 let _isCaseSensitive = Symbol('_isCaseSensitive');
471 let _execGlobal = Symbol('_execGlobal'); 471 let _execGlobal = Symbol('_execGlobal');
472 let _execAnchored = Symbol('_execAnchored'); 472 let _execAnchored = Symbol('_execAnchored');
473 class JSSyntaxRegExp extends core.Object { 473 class JSSyntaxRegExp extends core.Object {
474 toString() { 474 toString() {
475 return `RegExp/${this.pattern}/`; 475 return `RegExp/${this.pattern}/`;
476 } 476 }
477 JSSyntaxRegExp(source, opt$) { 477 JSSyntaxRegExp(source, opts) {
478 let multiLine = opt$ && 'multiLine' in opt$ ? opt$.multiLine : false; 478 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
479 let caseSensitive = opt$ && 'caseSensitive' in opt$ ? opt$.caseSensitive : true; 479 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true;
480 this.pattern = source; 480 this.pattern = source;
481 this[_nativeRegExp] = makeNative(source, multiLine, caseSensitive, false); 481 this[_nativeRegExp] = makeNative(source, multiLine, caseSensitive, false);
482 this[_nativeGlobalRegExp] = null; 482 this[_nativeGlobalRegExp] = null;
483 this[_nativeAnchoredRegExp] = null; 483 this[_nativeAnchoredRegExp] = null;
484 } 484 }
485 get [_nativeGlobalVersion]() { 485 get [_nativeGlobalVersion]() {
486 if (this[_nativeGlobalRegExp] !== null) 486 if (this[_nativeGlobalRegExp] !== null)
487 return this[_nativeGlobalRegExp]; 487 return this[_nativeGlobalRegExp];
488 return this[_nativeGlobalRegExp] = makeNative(this.pattern, this[_isMultiL ine], this[_isCaseSensitive], true); 488 return this[_nativeGlobalRegExp] = makeNative(this.pattern, this[_isMultiL ine], this[_isCaseSensitive], true);
489 } 489 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 570 }
571 get isMultiLine() { 571 get isMultiLine() {
572 return this[_isMultiLine]; 572 return this[_isMultiLine];
573 } 573 }
574 get isCaseSensitive() { 574 get isCaseSensitive() {
575 return this[_isCaseSensitive]; 575 return this[_isCaseSensitive];
576 } 576 }
577 } 577 }
578 let _match = Symbol('_match'); 578 let _match = Symbol('_match');
579 class _MatchImplementation extends core.Object { 579 class _MatchImplementation extends core.Object {
580 _MatchImplementation(pattern, $_match) { 580 _MatchImplementation(pattern, match$) {
581 this.pattern = pattern; 581 this.pattern = pattern;
582 this[_match] = $_match; 582 this[_match] = match$;
583 dart.assert(typeof this[_match].input == string); 583 dart.assert(typeof this[_match].input == string);
584 dart.assert(typeof this[_match].index == number); 584 dart.assert(typeof this[_match].index == number);
585 } 585 }
586 get input() { 586 get input() {
587 return this[_match].input; 587 return this[_match].input;
588 } 588 }
589 get start() { 589 get start() {
590 return this[_match].index; 590 return this[_match].index;
591 } 591 }
592 get end() { 592 get end() {
(...skipping 13 matching lines...) Expand all
606 for (let i of groups) { 606 for (let i of groups) {
607 out.add(this.group(i)); 607 out.add(this.group(i));
608 } 608 }
609 return out; 609 return out;
610 } 610 }
611 } 611 }
612 let _re = Symbol('_re'); 612 let _re = Symbol('_re');
613 let _string = Symbol('_string'); 613 let _string = Symbol('_string');
614 let _start = Symbol('_start'); 614 let _start = Symbol('_start');
615 class _AllMatchesIterable extends collection.IterableBase$(core.Match) { 615 class _AllMatchesIterable extends collection.IterableBase$(core.Match) {
616 _AllMatchesIterable($_re, $_string, $_start) { 616 _AllMatchesIterable(re$, string$, start$) {
617 this[_re] = $_re; 617 this[_re] = re$;
618 this[_string] = $_string; 618 this[_string] = string$;
619 this[_start] = $_start; 619 this[_start] = start$;
620 super.IterableBase(); 620 super.IterableBase();
621 } 621 }
622 get iterator() { 622 get iterator() {
623 return new _AllMatchesIterator(this[_re], this[_string], this[_start]); 623 return new _AllMatchesIterator(this[_re], this[_string], this[_start]);
624 } 624 }
625 } 625 }
626 let _regExp = Symbol('_regExp'); 626 let _regExp = Symbol('_regExp');
627 let _nextIndex = Symbol('_nextIndex'); 627 let _nextIndex = Symbol('_nextIndex');
628 let _current = Symbol('_current'); 628 let _current = Symbol('_current');
629 class _AllMatchesIterator extends core.Object { 629 class _AllMatchesIterator extends core.Object {
630 _AllMatchesIterator($_regExp, $_string, $_nextIndex) { 630 _AllMatchesIterator(regExp$, string$, nextIndex$) {
631 this[_regExp] = $_regExp; 631 this[_regExp] = regExp$;
632 this[_string] = $_string; 632 this[_string] = string$;
633 this[_nextIndex] = $_nextIndex; 633 this[_nextIndex] = nextIndex$;
634 this[_current] = null; 634 this[_current] = null;
635 } 635 }
636 get current() { 636 get current() {
637 return this[_current]; 637 return this[_current];
638 } 638 }
639 moveNext() { 639 moveNext() {
640 if (this[_string] === null) 640 if (this[_string] === null)
641 return false; 641 return false;
642 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length)) { 642 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length)) {
643 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]); 643 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 function stringJoinUnchecked(array, separator) { 863 function stringJoinUnchecked(array, separator) {
864 return array.join(separator); 864 return array.join(separator);
865 } 865 }
866 // Function createRuntimeType: (String) → Type 866 // Function createRuntimeType: (String) → Type
867 function createRuntimeType(name) { 867 function createRuntimeType(name) {
868 return new TypeImpl(name); 868 return new TypeImpl(name);
869 } 869 }
870 let _typeName = Symbol('_typeName'); 870 let _typeName = Symbol('_typeName');
871 let _unmangledName = Symbol('_unmangledName'); 871 let _unmangledName = Symbol('_unmangledName');
872 class TypeImpl extends core.Object { 872 class TypeImpl extends core.Object {
873 TypeImpl($_typeName) { 873 TypeImpl(typeName$) {
874 this[_typeName] = $_typeName; 874 this[_typeName] = typeName$;
875 this[_unmangledName] = null; 875 this[_unmangledName] = null;
876 } 876 }
877 toString() { 877 toString() {
878 if (this[_unmangledName] !== null) 878 if (this[_unmangledName] !== null)
879 return this[_unmangledName]; 879 return this[_unmangledName];
880 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi s[_typeName]); 880 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi s[_typeName]);
881 return this[_unmangledName] = unmangledName; 881 return this[_unmangledName] = unmangledName;
882 } 882 }
883 get hashCode() { 883 get hashCode() {
884 return this[_typeName].hashCode; 884 return this[_typeName].hashCode;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 928 }
929 // Function copyTypeArguments: (Object, Object) → void 929 // Function copyTypeArguments: (Object, Object) → void
930 function copyTypeArguments(source, target) { 930 function copyTypeArguments(source, target) {
931 target.$builtinTypeInfo = source.$builtinTypeInfo; 931 target.$builtinTypeInfo = source.$builtinTypeInfo;
932 } 932 }
933 // Function getClassName: (dynamic) → String 933 // Function getClassName: (dynamic) → String
934 function getClassName(object) { 934 function getClassName(object) {
935 return _interceptors.getInterceptor(object).constructor.builtin$cls; 935 return _interceptors.getInterceptor(object).constructor.builtin$cls;
936 } 936 }
937 // Function getRuntimeTypeAsString: (dynamic, {onTypeVariable: (int) → String} ) → String 937 // Function getRuntimeTypeAsString: (dynamic, {onTypeVariable: (int) → String} ) → String
938 function getRuntimeTypeAsString(runtimeType, opt$) { 938 function getRuntimeTypeAsString(runtimeType, opts) {
939 let onTypeVariable = opt$ && 'onTypeVariable' in opt$ ? opt$.onTypeVariable : null; 939 let onTypeVariable = opts && 'onTypeVariable' in opts ? opts.onTypeVariable : null;
940 dart.assert(isJsArray(runtimeType)); 940 dart.assert(isJsArray(runtimeType));
941 let className = getConstructorName(getIndex(runtimeType, 0)); 941 let className = getConstructorName(getIndex(runtimeType, 0));
942 return `${className}` + `${joinArguments(runtimeType, 1, {onTypeVariable: on TypeVariable})}`; 942 return `${className}` + `${joinArguments(runtimeType, 1, {onTypeVariable: on TypeVariable})}`;
943 } 943 }
944 // Function getConstructorName: (dynamic) → String 944 // Function getConstructorName: (dynamic) → String
945 function getConstructorName(type) { 945 function getConstructorName(type) {
946 return type.builtin$cls; 946 return type.builtin$cls;
947 } 947 }
948 // Function runtimeTypeToString: (dynamic, {onTypeVariable: (int) → String}) → String 948 // Function runtimeTypeToString: (dynamic, {onTypeVariable: (int) → String}) → String
949 function runtimeTypeToString(type, opt$) { 949 function runtimeTypeToString(type, opts) {
950 let onTypeVariable = opt$ && 'onTypeVariable' in opt$ ? opt$.onTypeVariable : null; 950 let onTypeVariable = opts && 'onTypeVariable' in opts ? opts.onTypeVariable : null;
951 if (type === null) { 951 if (type === null) {
952 return 'dynamic'; 952 return 'dynamic';
953 } else if (isJsArray(type)) { 953 } else if (isJsArray(type)) {
954 return getRuntimeTypeAsString(type, {onTypeVariable: onTypeVariable}); 954 return getRuntimeTypeAsString(type, {onTypeVariable: onTypeVariable});
955 } else if (isJsFunction(type)) { 955 } else if (isJsFunction(type)) {
956 return getConstructorName(type); 956 return getConstructorName(type);
957 } else if (typeof type == number) { 957 } else if (typeof type == number) {
958 if (onTypeVariable === null) { 958 if (onTypeVariable === null) {
959 return dart.as(dart.dinvoke(type, 'toString'), core.String); 959 return dart.as(dart.dinvoke(type, 'toString'), core.String);
960 } else { 960 } else {
961 return onTypeVariable(dart.as(type, core.int)); 961 return onTypeVariable(dart.as(type, core.int));
962 } 962 }
963 } else { 963 } else {
964 return null; 964 return null;
965 } 965 }
966 } 966 }
967 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) → String 967 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) → String
968 function joinArguments(types, startIndex, opt$) { 968 function joinArguments(types, startIndex, opts) {
969 let onTypeVariable = opt$ && 'onTypeVariable' in opt$ ? opt$.onTypeVariable : null; 969 let onTypeVariable = opts && 'onTypeVariable' in opts ? opts.onTypeVariable : null;
970 if (types === null) 970 if (types === null)
971 return ''; 971 return '';
972 dart.assert(isJsArray(types)); 972 dart.assert(isJsArray(types));
973 let firstArgument = true; 973 let firstArgument = true;
974 let allDynamic = true; 974 let allDynamic = true;
975 let buffer = new core.StringBuffer(); 975 let buffer = new core.StringBuffer();
976 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty pes)); index = dart.notNull(index) + 1) { 976 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty pes)); index = dart.notNull(index) + 1) {
977 if (firstArgument) { 977 if (firstArgument) {
978 firstArgument = false; 978 firstArgument = false;
979 } else { 979 } else {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tOptionalParameterTypes, tPos)))) { 1264 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tOptionalParameterTypes, tPos)))) {
1265 return false; 1265 return false;
1266 } 1266 }
1267 } 1267 }
1268 } 1268 }
1269 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`); 1269 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`);
1270 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`); 1270 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`);
1271 return areAssignableMaps(sNamedParameters, tNamedParameters); 1271 return areAssignableMaps(sNamedParameters, tNamedParameters);
1272 } 1272 }
1273 // Function invoke: (dynamic, dynamic) → dynamic 1273 // Function invoke: (dynamic, dynamic) → dynamic
1274 function invoke(function, arguments) { 1274 function invoke(func, arguments) {
1275 return invokeOn(function, null, arguments); 1275 return invokeOn(func, null, arguments);
1276 } 1276 }
1277 // Function invokeOn: (dynamic, dynamic, dynamic) → Object 1277 // Function invokeOn: (dynamic, dynamic, dynamic) → Object
1278 function invokeOn(function, receiver, arguments) { 1278 function invokeOn(func, receiver, arguments) {
1279 dart.assert(isJsFunction(function)); 1279 dart.assert(isJsFunction(func));
1280 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum ents))); 1280 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum ents)));
1281 return function.apply(receiver, arguments); 1281 return func.apply(receiver, arguments);
1282 } 1282 }
1283 // Function call: (dynamic, String) → dynamic 1283 // Function call: (dynamic, String) → dynamic
1284 function call(object, name) { 1284 function call(object, name) {
1285 return object[name](); 1285 return object[name]();
1286 } 1286 }
1287 // Function getField: (dynamic, String) → dynamic 1287 // Function getField: (dynamic, String) → dynamic
1288 function getField(object, name) { 1288 function getField(object, name) {
1289 return object[name]; 1289 return object[name];
1290 } 1290 }
1291 // Function getIndex: (dynamic, int) → dynamic 1291 // Function getIndex: (dynamic, int) → dynamic
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 } 1388 }
1389 } 1389 }
1390 let _memberName = Symbol('_memberName'); 1390 let _memberName = Symbol('_memberName');
1391 let _internalName = Symbol('_internalName'); 1391 let _internalName = Symbol('_internalName');
1392 let _kind = Symbol('_kind'); 1392 let _kind = Symbol('_kind');
1393 let _arguments = Symbol('_arguments'); 1393 let _arguments = Symbol('_arguments');
1394 let _namedArgumentNames = Symbol('_namedArgumentNames'); 1394 let _namedArgumentNames = Symbol('_namedArgumentNames');
1395 let _namedIndices = Symbol('_namedIndices'); 1395 let _namedIndices = Symbol('_namedIndices');
1396 let _getCachedInvocation = Symbol('_getCachedInvocation'); 1396 let _getCachedInvocation = Symbol('_getCachedInvocation');
1397 class JSInvocationMirror extends core.Object { 1397 class JSInvocationMirror extends core.Object {
1398 JSInvocationMirror($_memberName, $_internalName, $_kind, $_arguments, $_name dArgumentNames) { 1398 JSInvocationMirror(memberName$, internalName$, kind$, arguments$, namedArgum entNames) {
1399 this[_memberName] = $_memberName; 1399 this[_memberName] = memberName$;
1400 this[_internalName] = $_internalName; 1400 this[_internalName] = internalName$;
1401 this[_kind] = $_kind; 1401 this[_kind] = kind$;
1402 this[_arguments] = $_arguments; 1402 this[_arguments] = arguments$;
1403 this[_namedArgumentNames] = $_namedArgumentNames; 1403 this[_namedArgumentNames] = namedArgumentNames;
1404 this[_namedIndices] = null; 1404 this[_namedIndices] = null;
1405 } 1405 }
1406 get memberName() { 1406 get memberName() {
1407 if (dart.is(this[_memberName], core.Symbol)) 1407 if (dart.is(this[_memberName], core.Symbol))
1408 return dart.as(this[_memberName], core.Symbol); 1408 return dart.as(this[_memberName], core.Symbol);
1409 let name = dart.as(this[_memberName], core.String); 1409 let name = dart.as(this[_memberName], core.String);
1410 let unmangledName = _js_names.mangledNames.get(name); 1410 let unmangledName = _js_names.mangledNames.get(name);
1411 if (unmangledName !== null) { 1411 if (unmangledName !== null) {
1412 name = unmangledName.split(':').get(0); 1412 name = unmangledName.split(':').get(0);
1413 } else { 1413 } else {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 } 1663 }
1664 sortedIndex(unsortedIndex) { 1664 sortedIndex(unsortedIndex) {
1665 if (this.cachedSortedIndices === null) { 1665 if (this.cachedSortedIndices === null) {
1666 this.cachedSortedIndices = new core.List(this.optionalParameterCount); 1666 this.cachedSortedIndices = new core.List(this.optionalParameterCount);
1667 let positions = dart.map(); 1667 let positions = dart.map();
1668 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) { 1668 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) {
1669 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i ); 1669 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i );
1670 positions.set(this.parameterName(index), index); 1670 positions.set(this.parameterName(index), index);
1671 } 1671 }
1672 let index = 0; 1672 let index = 0;
1673 ((_) => { 1673 ((_$) => {
1674 _.sort(); 1674 _$.sort();
1675 return _; 1675 return _$;
1676 }).bind(this)(positions.keys.toList()).forEach(((name) => { 1676 }).bind(this)(positions.keys.toList()).forEach(((name) => {
1677 this.cachedSortedIndices.set((($tmp) => index = dart.notNull($tmp) + 1 , $tmp)(index), positions.get(name)); 1677 this.cachedSortedIndices.set(((x) => index = dart.notNull(x$) + 1, x$) (index), positions.get(name));
1678 }).bind(this)); 1678 }).bind(this));
1679 } 1679 }
1680 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int); 1680 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int);
1681 } 1681 }
1682 computeFunctionRti(jsConstructor) { 1682 computeFunctionRti(jsConstructor) {
1683 if (typeof this.functionType == "number") { 1683 if (typeof this.functionType == "number") {
1684 return getMetadata(dart.as(this.functionType, core.int)); 1684 return getMetadata(dart.as(this.functionType, core.int));
1685 } else if (typeof this.functionType == "function") { 1685 } else if (typeof this.functionType == "function") {
1686 let fakeInstance = new jsConstructor(); 1686 let fakeInstance = new jsConstructor();
1687 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); 1687 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]);
1688 return this.functionType.apply({$receiver: fakeInstance}); 1688 return this.functionType.apply({$receiver: fakeInstance});
1689 } else { 1689 } else {
1690 throw new RuntimeError('Unexpected function type'); 1690 throw new RuntimeError('Unexpected function type');
1691 } 1691 }
1692 } 1692 }
1693 get reflectionName() { 1693 get reflectionName() {
1694 return this.jsFunction.$reflectionName; 1694 return this.jsFunction.$reflectionName;
1695 } 1695 }
1696 } 1696 }
1697 dart.defineNamedConstructor(ReflectionInfo, 'internal'); 1697 dart.defineNamedConstructor(ReflectionInfo, 'internal');
1698 ReflectionInfo.REQUIRED_PARAMETERS_INFO = 0; 1698 ReflectionInfo.REQUIRED_PARAMETERS_INFO = 0;
1699 ReflectionInfo.OPTIONAL_PARAMETERS_INFO = 1; 1699 ReflectionInfo.OPTIONAL_PARAMETERS_INFO = 1;
1700 ReflectionInfo.FUNCTION_TYPE_INDEX = 2; 1700 ReflectionInfo.FUNCTION_TYPE_INDEX = 2;
1701 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3; 1701 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3;
1702 // Function getMetadata: (int) → dynamic 1702 // Function getMetadata: (int) → dynamic
1703 function getMetadata(index) { 1703 function getMetadata(index) {
1704 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA); 1704 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA);
1705 return metadata[index]; 1705 return metadata[index];
1706 } 1706 }
1707 let _throwFormatException = Symbol('_throwFormatException'); 1707 let _throwFormatException$ = Symbol('_throwFormatException');
1708 let _fromCharCodeApply = Symbol('_fromCharCodeApply'); 1708 let _fromCharCodeApply$ = Symbol('_fromCharCodeApply');
1709 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType'); 1709 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
1710 class Primitives extends core.Object { 1710 class Primitives extends core.Object {
1711 static initializeStatics(id) { 1711 static initializeStatics(id) {
1712 mirrorFunctionCacheName = `_${id}`; 1712 mirrorFunctionCacheName = `_${id}`;
1713 mirrorInvokeCacheName = `_${id}`; 1713 mirrorInvokeCacheName = `_${id}`;
1714 } 1714 }
1715 static objectHashCode(object) { 1715 static objectHashCode(object) {
1716 let hash = dart.as(object.$identityHash, core.int); 1716 let hash = dart.as(object.$identityHash, core.int);
1717 if (hash === null) { 1717 if (hash === null) {
1718 hash = Math.random() * 0x3fffffff | 0; 1718 hash = Math.random() * 0x3fffffff | 0;
1719 object.$identityHash = hash; 1719 object.$identityHash = hash;
1720 } 1720 }
1721 return hash; 1721 return hash;
1722 } 1722 }
1723 static [_throwFormatException](string) { 1723 static [_throwFormatException$](string) {
1724 throw new core.FormatException(string); 1724 throw new core.FormatException(string);
1725 } 1725 }
1726 static parseInt(source, radix, handleError) { 1726 static parseInt(source, radix, handleError) {
1727 if (handleError === null) 1727 if (handleError === null)
1728 handleError = dart.closureWrap(_throwFormatException, "(String) → int"); 1728 handleError = dart.closureWrap(_throwFormatException, "(String) → int");
1729 checkString(source); 1729 checkString(source);
1730 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ; 1730 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
1731 let digitsIndex = 1; 1731 let digitsIndex = 1;
1732 let hexIndex = 2; 1732 let hexIndex = 2;
1733 let decimalIndex = 3; 1733 let decimalIndex = 3;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 static get isJsshell() { 1838 static get isJsshell() {
1839 return typeof version == "function" && typeof system == "function"; 1839 return typeof version == "function" && typeof system == "function";
1840 } 1840 }
1841 static currentUri() { 1841 static currentUri() {
1842 requiresPreamble(); 1842 requiresPreamble();
1843 if (!!self.location) { 1843 if (!!self.location) {
1844 return self.location.href; 1844 return self.location.href;
1845 } 1845 }
1846 return null; 1846 return null;
1847 } 1847 }
1848 static [_fromCharCodeApply](array) { 1848 static [_fromCharCodeApply$](array) {
1849 let result = ""; 1849 let result = "";
1850 let kMaxApply = 500; 1850 let kMaxApply = 500;
1851 let end = array.length; 1851 let end = array.length;
1852 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) { 1852 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) {
1853 let subarray = null; 1853 let subarray = null;
1854 if (dart.notNull(end) <= dart.notNull(kMaxApply)) { 1854 if (dart.notNull(end) <= dart.notNull(kMaxApply)) {
1855 subarray = array; 1855 subarray = array;
1856 } else { 1856 } else {
1857 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); 1857 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end);
1858 } 1858 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 throw new core.ArgumentError(object); 2000 throw new core.ArgumentError(object);
2001 } 2001 }
2002 return object[key]; 2002 return object[key];
2003 } 2003 }
2004 static setProperty(object, key, value) { 2004 static setProperty(object, key, value) {
2005 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) { 2005 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) {
2006 throw new core.ArgumentError(object); 2006 throw new core.ArgumentError(object);
2007 } 2007 }
2008 object[key] = value; 2008 object[key] = value;
2009 } 2009 }
2010 static functionNoSuchMethod(function, positionalArguments, namedArguments) { 2010 static functionNoSuchMethod(func, positionalArguments, namedArguments) {
2011 let argumentCount = 0; 2011 let argumentCount = 0;
2012 let arguments = new List.from([]); 2012 let arguments = new List.from([]);
2013 let namedArgumentList = new List.from([]); 2013 let namedArgumentList = new List.from([]);
2014 if (positionalArguments !== null) { 2014 if (positionalArguments !== null) {
2015 argumentCount = positionalArguments.length; 2015 argumentCount = positionalArguments.length;
2016 arguments.addAll(positionalArguments); 2016 arguments.addAll(positionalArguments);
2017 } 2017 }
2018 let names = ''; 2018 let names = '';
2019 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) { 2019 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) {
2020 namedArguments.forEach(((name, argument) => { 2020 namedArguments.forEach(((name, argument) => {
2021 names = `${names}$${name}`; 2021 names = `${names}$${name}`;
2022 namedArgumentList.add(name); 2022 namedArgumentList.add(name);
2023 arguments.add(argument); 2023 arguments.add(argument);
2024 argumentCount = dart.notNull(argumentCount) + 1; 2024 argumentCount = dart.notNull(argumentCount) + 1;
2025 }).bind(this)); 2025 }).bind(this));
2026 } 2026 }
2027 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`; 2027 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`;
2028 return dart.dinvoke(function, 'noSuchMethod', createUnmangledInvocationMir ror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocatio nMirror.METHOD, arguments, namedArgumentList)); 2028 return dart.dinvoke(func, 'noSuchMethod', createUnmangledInvocationMirror( dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMir ror.METHOD, arguments, namedArgumentList));
2029 } 2029 }
2030 static applyFunction(function, positionalArguments, namedArguments) { 2030 static applyFunction(func, positionalArguments, namedArguments) {
2031 return namedArguments === null ? applyFunctionWithPositionalArguments(func tion, positionalArguments) : applyFunctionWithNamedArguments(function, positiona lArguments, namedArguments); 2031 return namedArguments === null ? applyFunctionWithPositionalArguments(func , positionalArguments) : applyFunctionWithNamedArguments(func, positionalArgumen ts, namedArguments);
2032 } 2032 }
2033 static applyFunctionWithPositionalArguments(function, positionalArguments) { 2033 static applyFunctionWithPositionalArguments(func, positionalArguments) {
2034 let argumentCount = 0; 2034 let argumentCount = 0;
2035 let arguments = null; 2035 let arguments = null;
2036 if (positionalArguments !== null) { 2036 if (positionalArguments !== null) {
2037 if (positionalArguments instanceof Array) { 2037 if (positionalArguments instanceof Array) {
2038 arguments = positionalArguments; 2038 arguments = positionalArguments;
2039 } else { 2039 } else {
2040 arguments = new core.List.from(positionalArguments); 2040 arguments = new core.List.from(positionalArguments);
2041 } 2041 }
2042 argumentCount = arguments.length; 2042 argumentCount = arguments.length;
2043 } else { 2043 } else {
2044 arguments = new List.from([]); 2044 arguments = new List.from([]);
2045 } 2045 }
2046 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}`; 2046 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}`;
2047 let jsFunction = function[selectorName]; 2047 let jsFunction = func[selectorName];
2048 if (jsFunction === null) { 2048 if (jsFunction === null) {
2049 return functionNoSuchMethod(function, positionalArguments, null); 2049 return functionNoSuchMethod(func, positionalArguments, null);
2050 } 2050 }
2051 return jsFunction.apply(function, arguments); 2051 return jsFunction.apply(func, arguments);
2052 } 2052 }
2053 static applyFunctionWithNamedArguments(function, positionalArguments, namedA rguments) { 2053 static applyFunctionWithNamedArguments(func, positionalArguments, namedArgum ents) {
2054 if (namedArguments.isEmpty) { 2054 if (namedArguments.isEmpty) {
2055 return applyFunctionWithPositionalArguments(function, positionalArgument s); 2055 return applyFunctionWithPositionalArguments(func, positionalArguments);
2056 } 2056 }
2057 let interceptor = _interceptors.getInterceptor(function); 2057 let interceptor = _interceptors.getInterceptor(func);
2058 let jsFunction = interceptor["call*"]; 2058 let jsFunction = interceptor["call*"];
2059 if (jsFunction === null) { 2059 if (jsFunction === null) {
2060 return functionNoSuchMethod(function, positionalArguments, namedArgument s); 2060 return functionNoSuchMethod(func, positionalArguments, namedArguments);
2061 } 2061 }
2062 let info = new ReflectionInfo(jsFunction); 2062 let info = new ReflectionInfo(jsFunction);
2063 if (dart.notNull(info === null) || !dart.notNull(info.areOptionalParameter sNamed)) { 2063 if (dart.notNull(info === null) || !dart.notNull(info.areOptionalParameter sNamed)) {
2064 return functionNoSuchMethod(function, positionalArguments, namedArgument s); 2064 return functionNoSuchMethod(func, positionalArguments, namedArguments);
2065 } 2065 }
2066 if (positionalArguments !== null) { 2066 if (positionalArguments !== null) {
2067 positionalArguments = new core.List.from(positionalArguments); 2067 positionalArguments = new core.List.from(positionalArguments);
2068 } else { 2068 } else {
2069 positionalArguments = new List.from([]); 2069 positionalArguments = new List.from([]);
2070 } 2070 }
2071 if (info.requiredParameterCount !== positionalArguments.length) { 2071 if (info.requiredParameterCount !== positionalArguments.length) {
2072 return functionNoSuchMethod(function, positionalArguments, namedArgument s); 2072 return functionNoSuchMethod(func, positionalArguments, namedArguments);
2073 } 2073 }
2074 let defaultArguments = new core.Map(); 2074 let defaultArguments = new core.Map();
2075 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) { 2075 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) {
2076 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount); 2076 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount);
2077 let parameterName = info.parameterNameInOrder(index); 2077 let parameterName = info.parameterNameInOrder(index);
2078 let value = info.defaultValueInOrder(index); 2078 let value = info.defaultValueInOrder(index);
2079 let defaultValue = getMetadata(value); 2079 let defaultValue = getMetadata(value);
2080 defaultArguments.set(parameterName, defaultValue); 2080 defaultArguments.set(parameterName, defaultValue);
2081 } 2081 }
2082 let bad = false; 2082 let bad = false;
2083 namedArguments.forEach(((parameter, value) => { 2083 namedArguments.forEach(((parameter, value) => {
2084 if (defaultArguments.containsKey(parameter)) { 2084 if (defaultArguments.containsKey(parameter)) {
2085 defaultArguments.set(parameter, value); 2085 defaultArguments.set(parameter, value);
2086 } else { 2086 } else {
2087 bad = true; 2087 bad = true;
2088 } 2088 }
2089 }).bind(this)); 2089 }).bind(this));
2090 if (bad) { 2090 if (bad) {
2091 return functionNoSuchMethod(function, positionalArguments, namedArgument s); 2091 return functionNoSuchMethod(func, positionalArguments, namedArguments);
2092 } 2092 }
2093 positionalArguments.addAll(defaultArguments.values); 2093 positionalArguments.addAll(defaultArguments.values);
2094 return jsFunction.apply(function, positionalArguments); 2094 return jsFunction.apply(func, positionalArguments);
2095 } 2095 }
2096 static [_mangledNameMatchesType](mangledName, type) { 2096 static [_mangledNameMatchesType](mangledName, type) {
2097 return mangledName == type[_typeName]; 2097 return mangledName == type[_typeName];
2098 } 2098 }
2099 static identicalImplementation(a, b) { 2099 static identicalImplementation(a, b) {
2100 return a == null ? b == null : a === b; 2100 return a == null ? b == null : a === b;
2101 } 2101 }
2102 static extractStackTrace(error) { 2102 static extractStackTrace(error) {
2103 return getTraceFromException(error.$thrownJsError); 2103 return getTraceFromException(error.$thrownJsError);
2104 } 2104 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic 2207 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic
2208 function throwAbstractClassInstantiationError(className) { 2208 function throwAbstractClassInstantiationError(className) {
2209 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin g)); 2209 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin g));
2210 } 2210 }
2211 let _argumentsExpr = Symbol('_argumentsExpr'); 2211 let _argumentsExpr = Symbol('_argumentsExpr');
2212 let _expr = Symbol('_expr'); 2212 let _expr = Symbol('_expr');
2213 let _method = Symbol('_method'); 2213 let _method = Symbol('_method');
2214 let _receiver = Symbol('_receiver'); 2214 let _receiver = Symbol('_receiver');
2215 let _pattern = Symbol('_pattern'); 2215 let _pattern = Symbol('_pattern');
2216 class TypeErrorDecoder extends core.Object { 2216 class TypeErrorDecoder extends core.Object {
2217 TypeErrorDecoder($_arguments, $_argumentsExpr, $_expr, $_method, $_receiver, $_pattern) { 2217 TypeErrorDecoder(arguments$, argumentsExpr$, expr$, method$, receiver$, patt ern$) {
2218 this[_arguments] = $_arguments; 2218 this[_arguments] = arguments$;
2219 this[_argumentsExpr] = $_argumentsExpr; 2219 this[_argumentsExpr] = argumentsExpr$;
2220 this[_expr] = $_expr; 2220 this[_expr] = expr$;
2221 this[_method] = $_method; 2221 this[_method] = method$;
2222 this[_receiver] = $_receiver; 2222 this[_receiver] = receiver$;
2223 this[_pattern] = $_pattern; 2223 this[_pattern] = pattern$;
2224 } 2224 }
2225 matchTypeError(message) { 2225 matchTypeError(message) {
2226 let match = new RegExp(this[_pattern]).exec(message); 2226 let match = new RegExp(this[_pattern]).exec(message);
2227 if (match === null) 2227 if (match === null)
2228 return null; 2228 return null;
2229 let result = Object.create(null); 2229 let result = Object.create(null);
2230 if (this[_arguments] !== -1) { 2230 if (this[_arguments] !== -1) {
2231 result.arguments = match[this[_arguments] + 1]; 2231 result.arguments = match[this[_arguments] + 1];
2232 } 2232 }
2233 if (this[_argumentsExpr] !== -1) { 2233 if (this[_argumentsExpr] !== -1) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 match = dart.as(new List.from([]), core.List$(core.String)); 2267 match = dart.as(new List.from([]), core.List$(core.String));
2268 let arguments = match.indexOf('\\$arguments\\$'); 2268 let arguments = match.indexOf('\\$arguments\\$');
2269 let argumentsExpr = match.indexOf('\\$argumentsExpr\\$'); 2269 let argumentsExpr = match.indexOf('\\$argumentsExpr\\$');
2270 let expr = match.indexOf('\\$expr\\$'); 2270 let expr = match.indexOf('\\$expr\\$');
2271 let method = match.indexOf('\\$method\\$'); 2271 let method = match.indexOf('\\$method\\$');
2272 let receiver = match.indexOf('\\$receiver\\$'); 2272 let receiver = match.indexOf('\\$receiver\\$');
2273 let pattern = message.replace('\\$arguments\\$', '((?:x|[^x])*)').replace( '\\$argumentsExpr\\$', '((?:x|[^x])*)').replace('\\$expr\\$', '((?:x|[^x])*)').r eplace('\\$method\\$', '((?:x|[^x])*)').replace('\\$receiver\\$', '((?:x|[^x])*) '); 2273 let pattern = message.replace('\\$arguments\\$', '((?:x|[^x])*)').replace( '\\$argumentsExpr\\$', '((?:x|[^x])*)').replace('\\$expr\\$', '((?:x|[^x])*)').r eplace('\\$method\\$', '((?:x|[^x])*)').replace('\\$receiver\\$', '((?:x|[^x])*) ');
2274 return new TypeErrorDecoder(arguments, argumentsExpr, expr, method, receiv er, pattern); 2274 return new TypeErrorDecoder(arguments, argumentsExpr, expr, method, receiv er, pattern);
2275 } 2275 }
2276 static provokeCallErrorOn(expression) { 2276 static provokeCallErrorOn(expression) {
2277 let function = function($expr$) { 2277 let func = function($expr$) {
2278 var $argumentsExpr$ = '$arguments$'; 2278 var $argumentsExpr$ = '$arguments$';
2279 try { 2279 try {
2280 $expr$.$method$($argumentsExpr$); 2280 $expr$.$method$($argumentsExpr$);
2281 } catch (e) { 2281 } catch (e) {
2282 return e.message; 2282 return e.message;
2283 } 2283 }
2284 2284
2285 }; 2285 };
2286 return function(expression); 2286 return func(expression);
2287 } 2287 }
2288 static provokeCallErrorOnNull() { 2288 static provokeCallErrorOnNull() {
2289 let function = function() { 2289 let func = function() {
2290 var $argumentsExpr$ = '$arguments$'; 2290 var $argumentsExpr$ = '$arguments$';
2291 try { 2291 try {
2292 null.$method$($argumentsExpr$); 2292 null.$method$($argumentsExpr$);
2293 } catch (e) { 2293 } catch (e) {
2294 return e.message; 2294 return e.message;
2295 } 2295 }
2296 2296
2297 }; 2297 };
2298 return function(); 2298 return func();
2299 } 2299 }
2300 static provokeCallErrorOnUndefined() { 2300 static provokeCallErrorOnUndefined() {
2301 let function = function() { 2301 let func = function() {
2302 var $argumentsExpr$ = '$arguments$'; 2302 var $argumentsExpr$ = '$arguments$';
2303 try { 2303 try {
2304 (void 0).$method$($argumentsExpr$); 2304 (void 0).$method$($argumentsExpr$);
2305 } catch (e) { 2305 } catch (e) {
2306 return e.message; 2306 return e.message;
2307 } 2307 }
2308 2308
2309 }; 2309 };
2310 return function(); 2310 return func();
2311 } 2311 }
2312 static provokePropertyErrorOn(expression) { 2312 static provokePropertyErrorOn(expression) {
2313 let function = function($expr$) { 2313 let func = function($expr$) {
2314 try { 2314 try {
2315 $expr$.$method$; 2315 $expr$.$method$;
2316 } catch (e) { 2316 } catch (e) {
2317 return e.message; 2317 return e.message;
2318 } 2318 }
2319 2319
2320 }; 2320 };
2321 return function(expression); 2321 return func(expression);
2322 } 2322 }
2323 static provokePropertyErrorOnNull() { 2323 static provokePropertyErrorOnNull() {
2324 let function = function() { 2324 let func = function() {
2325 try { 2325 try {
2326 null.$method$; 2326 null.$method$;
2327 } catch (e) { 2327 } catch (e) {
2328 return e.message; 2328 return e.message;
2329 } 2329 }
2330 2330
2331 }; 2331 };
2332 return function(); 2332 return func();
2333 } 2333 }
2334 static provokePropertyErrorOnUndefined() { 2334 static provokePropertyErrorOnUndefined() {
2335 let function = function() { 2335 let func = function() {
2336 try { 2336 try {
2337 (void 0).$method$; 2337 (void 0).$method$;
2338 } catch (e) { 2338 } catch (e) {
2339 return e.message; 2339 return e.message;
2340 } 2340 }
2341 2341
2342 }; 2342 };
2343 return function(); 2343 return func();
2344 } 2344 }
2345 } 2345 }
2346 dart.defineLazyProperties(TypeErrorDecoder, { 2346 dart.defineLazyProperties(TypeErrorDecoder, {
2347 get noSuchMethodPattern() { 2347 get noSuchMethodPattern() {
2348 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObject())) , TypeErrorDecoder); 2348 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObject())) , TypeErrorDecoder);
2349 }, 2349 },
2350 get notClosurePattern() { 2350 get notClosurePattern() {
2351 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObjectWith NonClosure())), TypeErrorDecoder); 2351 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObjectWith NonClosure())), TypeErrorDecoder);
2352 }, 2352 },
2353 get nullCallPattern() { 2353 get nullCallPattern() {
(...skipping 16 matching lines...) Expand all
2370 }, 2370 },
2371 get undefinedPropertyPattern() { 2371 get undefinedPropertyPattern() {
2372 return dart.as(extractPattern(provokePropertyErrorOn(void 0)), TypeErrorDe coder); 2372 return dart.as(extractPattern(provokePropertyErrorOn(void 0)), TypeErrorDe coder);
2373 }, 2373 },
2374 get undefinedLiteralPropertyPattern() { 2374 get undefinedLiteralPropertyPattern() {
2375 return dart.as(extractPattern(provokePropertyErrorOnUndefined()), TypeErro rDecoder); 2375 return dart.as(extractPattern(provokePropertyErrorOnUndefined()), TypeErro rDecoder);
2376 } 2376 }
2377 }); 2377 });
2378 let _message = Symbol('_message'); 2378 let _message = Symbol('_message');
2379 class NullError extends core.Error { 2379 class NullError extends core.Error {
2380 NullError($_message, match) { 2380 NullError(message$, match) {
2381 this[_message] = $_message; 2381 this[_message] = message$;
2382 this[_method] = dart.as(match === null ? null : match.method, core.String) ; 2382 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
2383 super.Error(); 2383 super.Error();
2384 } 2384 }
2385 toString() { 2385 toString() {
2386 if (this[_method] === null) 2386 if (this[_method] === null)
2387 return `NullError: ${this[_message]}`; 2387 return `NullError: ${this[_message]}`;
2388 return `NullError: Cannot call "${this[_method]}" on null`; 2388 return `NullError: Cannot call "${this[_method]}" on null`;
2389 } 2389 }
2390 } 2390 }
2391 class JsNoSuchMethodError extends core.Error { 2391 class JsNoSuchMethodError extends core.Error {
2392 JsNoSuchMethodError($_message, match) { 2392 JsNoSuchMethodError(message$, match) {
2393 this[_message] = $_message; 2393 this[_message] = message$;
2394 this[_method] = dart.as(match === null ? null : match.method, core.String) ; 2394 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
2395 this[_receiver] = dart.as(match === null ? null : match.receiver, core.Str ing); 2395 this[_receiver] = dart.as(match === null ? null : match.receiver, core.Str ing);
2396 super.Error(); 2396 super.Error();
2397 } 2397 }
2398 toString() { 2398 toString() {
2399 if (this[_method] === null) 2399 if (this[_method] === null)
2400 return `NoSuchMethodError: ${this[_message]}`; 2400 return `NoSuchMethodError: ${this[_message]}`;
2401 if (this[_receiver] === null) { 2401 if (this[_receiver] === null) {
2402 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa ge]})`; 2402 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa ge]})`;
2403 } 2403 }
2404 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece iver]}" ` + `(${this[_message]})`; 2404 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece iver]}" ` + `(${this[_message]})`;
2405 } 2405 }
2406 } 2406 }
2407 class UnknownJsTypeError extends core.Error { 2407 class UnknownJsTypeError extends core.Error {
2408 UnknownJsTypeError($_message) { 2408 UnknownJsTypeError(message$) {
2409 this[_message] = $_message; 2409 this[_message] = message$;
2410 super.Error(); 2410 super.Error();
2411 } 2411 }
2412 toString() { 2412 toString() {
2413 return this[_message].isEmpty ? 'Error' : `Error: ${this[_message]}`; 2413 return this[_message].isEmpty ? 'Error' : `Error: ${this[_message]}`;
2414 } 2414 }
2415 } 2415 }
2416 // Function unwrapException: (dynamic) → dynamic 2416 // Function unwrapException: (dynamic) → dynamic
2417 function unwrapException(ex) { 2417 function unwrapException(ex) {
2418 // Function saveStackTrace: (dynamic) → dynamic 2418 // Function saveStackTrace: (dynamic) → dynamic
2419 function saveStackTrace(error) { 2419 function saveStackTrace(error) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 } 2484 }
2485 return ex; 2485 return ex;
2486 } 2486 }
2487 // Function getTraceFromException: (dynamic) → StackTrace 2487 // Function getTraceFromException: (dynamic) → StackTrace
2488 function getTraceFromException(exception) { 2488 function getTraceFromException(exception) {
2489 return new _StackTrace(exception); 2489 return new _StackTrace(exception);
2490 } 2490 }
2491 let _exception = Symbol('_exception'); 2491 let _exception = Symbol('_exception');
2492 let _trace = Symbol('_trace'); 2492 let _trace = Symbol('_trace');
2493 class _StackTrace extends core.Object { 2493 class _StackTrace extends core.Object {
2494 _StackTrace($_exception) { 2494 _StackTrace(exception$) {
2495 this[_exception] = $_exception; 2495 this[_exception] = exception$;
2496 this[_trace] = null; 2496 this[_trace] = null;
2497 } 2497 }
2498 toString() { 2498 toString() {
2499 if (this[_trace] !== null) 2499 if (this[_trace] !== null)
2500 return this[_trace]; 2500 return this[_trace];
2501 let trace = null; 2501 let trace = null;
2502 if (typeof this[_exception] === "object") { 2502 if (typeof this[_exception] === "object") {
2503 trace = dart.as(this[_exception].stack, core.String); 2503 trace = dart.as(this[_exception].stack, core.String);
2504 } 2504 }
2505 return this[_trace] = trace === null ? '' : trace; 2505 return this[_trace] = trace === null ? '' : trace;
2506 } 2506 }
2507 } 2507 }
2508 // Function objectHashCode: (dynamic) → int 2508 // Function objectHashCode: (dynamic) → int
2509 function objectHashCode(object) { 2509 function objectHashCode(object) {
2510 if (dart.notNull(object === null) || typeof object != 'object') { 2510 if (dart.notNull(object === null) || typeof object != 'object') {
2511 return dart.as(dart.dload(object, 'hashCode'), core.int); 2511 return dart.as(dart.dload(object, 'hashCode'), core.int);
2512 } else { 2512 } else {
2513 return Primitives.objectHashCode(object); 2513 return Primitives.objectHashCode(object);
2514 } 2514 }
2515 } 2515 }
2516 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic 2516 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic
2517 function fillLiteralMap(keyValuePairs, result) { 2517 function fillLiteralMap(keyValuePairs, result) {
2518 let index = 0; 2518 let index = 0;
2519 let length = getLength(keyValuePairs); 2519 let length = getLength(keyValuePairs);
2520 while (dart.notNull(index) < dart.notNull(length)) { 2520 while (dart.notNull(index) < dart.notNull(length)) {
2521 let key = getIndex(keyValuePairs, (($tmp) => index = dart.notNull($tmp) + 1, $tmp)(index)); 2521 let key = getIndex(keyValuePairs, ((x) => index = dart.notNull(x$) + 1, x$ )(index));
2522 let value = getIndex(keyValuePairs, (($tmp) => index = dart.notNull($tmp) + 1, $tmp)(index)); 2522 let value = getIndex(keyValuePairs, ((x) => index = dart.notNull(x$) + 1, x$)(index));
2523 result.set(key, value); 2523 result.set(key, value);
2524 } 2524 }
2525 return result; 2525 return result;
2526 } 2526 }
2527 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic 2527 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
2528 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) { 2528 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
2529 if (numberOfArguments === 0) { 2529 if (numberOfArguments === 0) {
2530 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure)); 2530 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure));
2531 } else if (numberOfArguments === 1) { 2531 } else if (numberOfArguments === 1) {
2532 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1)); 2532 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1));
2533 } else if (numberOfArguments === 2) { 2533 } else if (numberOfArguments === 2) {
2534 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2)); 2534 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2));
2535 } else if (numberOfArguments === 3) { 2535 } else if (numberOfArguments === 3) {
2536 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3)); 2536 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3));
2537 } else if (numberOfArguments === 4) { 2537 } else if (numberOfArguments === 4) {
2538 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3, arg4)); 2538 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3, arg4));
2539 } else { 2539 } else {
2540 throw new core.Exception('Unsupported number of arguments for wrapped clos ure'); 2540 throw new core.Exception('Unsupported number of arguments for wrapped clos ure');
2541 } 2541 }
2542 } 2542 }
2543 // Function convertDartClosureToJS: (dynamic, int) → dynamic 2543 // Function convertDartClosureToJS: (dynamic, int) → dynamic
2544 function convertDartClosureToJS(closure, arity) { 2544 function convertDartClosureToJS(closure, arity) {
2545 if (closure === null) 2545 if (closure === null)
2546 return null; 2546 return null;
2547 let function = closure.$identity; 2547 let func = closure.$identity;
2548 if (!!function) 2548 if (!!func)
2549 return function; 2549 return func;
2550 function = function(closure, arity, context, invoke) { 2550 func = function(closure, arity, context, invoke) {
2551 return function(a1, a2, a3, a4) { 2551 return function(a1, a2, a3, a4) {
2552 return invoke(closure, context, arity, a1, a2, a3, a4); 2552 return invoke(closure, context, arity, a1, a2, a3, a4);
2553 }; 2553 };
2554 }(closure, arity, _foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _foreign_hel per.DART_CLOSURE_TO_JS(invokeClosure)); 2554 }(closure, arity, _foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _foreign_hel per.DART_CLOSURE_TO_JS(invokeClosure));
2555 closure.$identity = function; 2555 closure.$identity = func;
2556 return function; 2556 return func;
2557 } 2557 }
2558 class Closure extends core.Object { 2558 class Closure extends core.Object {
2559 Closure() { 2559 Closure() {
2560 } 2560 }
2561 static fromTearOff(receiver, functions, reflectionInfo, isStatic, jsArgument s, propertyName) { 2561 static fromTearOff(receiver, functions, reflectionInfo, isStatic, jsArgument s, propertyName) {
2562 _foreign_helper.JS_EFFECT(() => { 2562 _foreign_helper.JS_EFFECT(() => {
2563 BoundClosure.receiverOf(dart.as(void 0, BoundClosure)); 2563 BoundClosure.receiverOf(dart.as(void 0, BoundClosure));
2564 BoundClosure.selfOf(dart.as(void 0, BoundClosure)); 2564 BoundClosure.selfOf(dart.as(void 0, BoundClosure));
2565 }); 2565 });
2566 let function = functions[0]; 2566 let func = functions[0];
2567 let name = dart.as(function.$stubName, core.String); 2567 let name = dart.as(func.$stubName, core.String);
2568 let callName = dart.as(function.$callName, core.String); 2568 let callName = dart.as(func.$callName, core.String);
2569 function.$reflectionInfo = reflectionInfo; 2569 func.$reflectionInfo = reflectionInfo;
2570 let info = new ReflectionInfo(function); 2570 let info = new ReflectionInfo(func);
2571 let functionType = info.functionType; 2571 let functionType = info.functionType;
2572 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype); 2572 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
2573 prototype.$initialize = prototype.constructor; 2573 prototype.$initialize = prototype.constructor;
2574 let constructor = isStatic ? function() { 2574 let constructor = isStatic ? function() {
2575 this.$initialize(); 2575 this.$initialize();
2576 } : isCsp ? function(a, b, c, d) { 2576 } : isCsp ? function(a, b, c, d) {
2577 this.$initialize(a, b, c, d); 2577 this.$initialize(a, b, c, d);
2578 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + (($tmp ) => functionCounter = dart.notNull($tmp) + 1, $tmp)(functionCounter)); 2578 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x) = > functionCounter = dart.notNull(x$) + 1, x$)(functionCounter));
2579 prototype.constructor = constructor; 2579 prototype.constructor = constructor;
2580 constructor.prototype = prototype; 2580 constructor.prototype = prototype;
2581 let trampoline = function; 2581 let trampoline = func;
2582 let isIntercepted = false; 2582 let isIntercepted = false;
2583 if (!dart.notNull(isStatic)) { 2583 if (!dart.notNull(isStatic)) {
2584 if (jsArguments.length == 1) { 2584 if (jsArguments.length == 1) {
2585 isIntercepted = true; 2585 isIntercepted = true;
2586 } 2586 }
2587 trampoline = forwardCallTo(receiver, function, isIntercepted); 2587 trampoline = forwardCallTo(receiver, func, isIntercepted);
2588 trampoline.$reflectionInfo = reflectionInfo; 2588 trampoline.$reflectionInfo = reflectionInfo;
2589 } else { 2589 } else {
2590 prototype.$name = propertyName; 2590 prototype.$name = propertyName;
2591 } 2591 }
2592 let signatureFunction = null; 2592 let signatureFunction = null;
2593 if (typeof functionType == "number") { 2593 if (typeof functionType == "number") {
2594 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .METADATA); 2594 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .METADATA);
2595 signatureFunction = function(s) { 2595 signatureFunction = function(s) {
2596 return function() { 2596 return function() {
2597 return metadata[s]; 2597 return metadata[s];
(...skipping 14 matching lines...) Expand all
2612 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); i = dart .notNull(i) + 1) { 2612 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); i = dart .notNull(i) + 1) {
2613 let stub = functions.get(i); 2613 let stub = functions.get(i);
2614 let stubCallName = stub.$callName; 2614 let stubCallName = stub.$callName;
2615 if (stubCallName !== null) { 2615 if (stubCallName !== null) {
2616 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st ub, isIntercepted); 2616 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st ub, isIntercepted);
2617 } 2617 }
2618 } 2618 }
2619 prototype["call*"] = trampoline; 2619 prototype["call*"] = trampoline;
2620 return constructor; 2620 return constructor;
2621 } 2621 }
2622 static cspForwardCall(arity, isSuperCall, stubName, function) { 2622 static cspForwardCall(arity, isSuperCall, stubName, func) {
2623 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2623 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2624 if (isSuperCall) 2624 if (isSuperCall)
2625 arity = -1; 2625 arity = -1;
2626 switch (arity) { 2626 switch (arity) {
2627 case 0: 2627 case 0:
2628 return function(n, S) { 2628 return function(n, S) {
2629 return function() { 2629 return function() {
2630 return S(this)[n](); 2630 return S(this)[n]();
2631 }; 2631 };
2632 }(stubName, getSelf); 2632 }(stubName, getSelf);
(...skipping 25 matching lines...) Expand all
2658 return function(n, S) { 2658 return function(n, S) {
2659 return function(a, b, c, d, e) { 2659 return function(a, b, c, d, e) {
2660 return S(this)[n](a, b, c, d, e); 2660 return S(this)[n](a, b, c, d, e);
2661 }; 2661 };
2662 }(stubName, getSelf); 2662 }(stubName, getSelf);
2663 default: 2663 default:
2664 return function(f, s) { 2664 return function(f, s) {
2665 return function() { 2665 return function() {
2666 return f.apply(s(this), arguments); 2666 return f.apply(s(this), arguments);
2667 }; 2667 };
2668 }(function, getSelf); 2668 }(func, getSelf);
2669 } 2669 }
2670 } 2670 }
2671 static get isCsp() { 2671 static get isCsp() {
2672 return typeof dart_precompiled == "function"; 2672 return typeof dart_precompiled == "function";
2673 } 2673 }
2674 static forwardCallTo(receiver, function, isIntercepted) { 2674 static forwardCallTo(receiver, func, isIntercepted) {
2675 if (isIntercepted) 2675 if (isIntercepted)
2676 return forwardInterceptedCallTo(receiver, function); 2676 return forwardInterceptedCallTo(receiver, func);
2677 let stubName = dart.as(function.$stubName, core.String); 2677 let stubName = dart.as(func.$stubName, core.String);
2678 let arity = function.length; 2678 let arity = func.length;
2679 let lookedUpFunction = receiver[stubName]; 2679 let lookedUpFunction = receiver[stubName];
2680 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) ); 2680 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2681 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) { 2681 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) {
2682 return cspForwardCall(arity, isSuperCall, stubName, function); 2682 return cspForwardCall(arity, isSuperCall, stubName, func);
2683 } 2683 }
2684 if (arity === 0) { 2684 if (arity === 0) {
2685 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${(($tmp) => functionCounter = dart.notNull($ tmp) + 1, $tmp)(functionCounter)}` + '}')(); 2685 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x) => functionCounter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')();
2686 } 2686 }
2687 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); 2687 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
2688 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(","); 2688 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(",");
2689 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${(($tmp) => functionCo unter = dart.notNull($tmp) + 1, $tmp)(functionCounter)}` + '}')(); 2689 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${((x) => functionCount er = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')();
2690 } 2690 }
2691 static cspForwardInterceptedCall(arity, isSuperCall, name, function) { 2691 static cspForwardInterceptedCall(arity, isSuperCall, name, func) {
2692 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2692 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2693 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf); 2693 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
2694 if (isSuperCall) 2694 if (isSuperCall)
2695 arity = -1; 2695 arity = -1;
2696 switch (arity) { 2696 switch (arity) {
2697 case 0: 2697 case 0:
2698 throw new RuntimeError('Intercepted function with no arguments.'); 2698 throw new RuntimeError('Intercepted function with no arguments.');
2699 case 1: 2699 case 1:
2700 return function(n, s, r) { 2700 return function(n, s, r) {
2701 return function() { 2701 return function() {
(...skipping 30 matching lines...) Expand all
2732 return s(this)[n](r(this), a, b, c, d, e); 2732 return s(this)[n](r(this), a, b, c, d, e);
2733 }; 2733 };
2734 }(name, getSelf, getReceiver); 2734 }(name, getSelf, getReceiver);
2735 default: 2735 default:
2736 return function(f, s, r, a) { 2736 return function(f, s, r, a) {
2737 return function() { 2737 return function() {
2738 a = [r(this)]; 2738 a = [r(this)];
2739 Array.prototype.push.apply(a, arguments); 2739 Array.prototype.push.apply(a, arguments);
2740 return f.apply(s(this), a); 2740 return f.apply(s(this), a);
2741 }; 2741 };
2742 }(function, getSelf, getReceiver); 2742 }(func, getSelf, getReceiver);
2743 } 2743 }
2744 } 2744 }
2745 static forwardInterceptedCallTo(receiver, function) { 2745 static forwardInterceptedCallTo(receiver, func) {
2746 let selfField = BoundClosure.selfFieldName(); 2746 let selfField = BoundClosure.selfFieldName();
2747 let receiverField = BoundClosure.receiverFieldName(); 2747 let receiverField = BoundClosure.receiverFieldName();
2748 let stubName = dart.as(function.$stubName, core.String); 2748 let stubName = dart.as(func.$stubName, core.String);
2749 let arity = function.length; 2749 let arity = func.length;
2750 let isCsp = typeof dart_precompiled == "function"; 2750 let isCsp = typeof dart_precompiled == "function";
2751 let lookedUpFunction = receiver[stubName]; 2751 let lookedUpFunction = receiver[stubName];
2752 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) ); 2752 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2753 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) { 2753 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
2754 return cspForwardInterceptedCall(arity, isSuperCall, stubName, function) ; 2754 return cspForwardInterceptedCall(arity, isSuperCall, stubName, func);
2755 } 2755 }
2756 if (arity === 1) { 2756 if (arity === 1) {
2757 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${(($tmp) => functionCounter = dart.notNull ($tmp) + 1, $tmp)(functionCounter)}` + '}')(); 2757 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x) => functionCounter = dart.notNull(x$ ) + 1, x$)(functionCounter)}` + '}')();
2758 } 2758 }
2759 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); 2759 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
2760 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(","); 2760 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(",");
2761 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${(($tmp) => functi onCounter = dart.notNull($tmp) + 1, $tmp)(functionCounter)}` + '}')(); 2761 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${((x) => functionC ounter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')();
2762 } 2762 }
2763 toString() { 2763 toString() {
2764 return "Closure"; 2764 return "Closure";
2765 } 2765 }
2766 } 2766 }
2767 Closure.FUNCTION_INDEX = 0; 2767 Closure.FUNCTION_INDEX = 0;
2768 Closure.NAME_INDEX = 1; 2768 Closure.NAME_INDEX = 1;
2769 Closure.CALL_NAME_INDEX = 2; 2769 Closure.CALL_NAME_INDEX = 2;
2770 Closure.REQUIRED_PARAMETER_INDEX = 3; 2770 Closure.REQUIRED_PARAMETER_INDEX = 3;
2771 Closure.OPTIONAL_PARAMETER_INDEX = 4; 2771 Closure.OPTIONAL_PARAMETER_INDEX = 4;
2772 Closure.DEFAULT_ARGUMENTS_INDEX = 5; 2772 Closure.DEFAULT_ARGUMENTS_INDEX = 5;
2773 Closure.functionCounter = 0; 2773 Closure.functionCounter = 0;
2774 // Function closureFromTearOff: (dynamic, dynamic, dynamic, dynamic, dynamic, dynamic) → dynamic 2774 // Function closureFromTearOff: (dynamic, dynamic, dynamic, dynamic, dynamic, dynamic) → dynamic
2775 function closureFromTearOff(receiver, functions, reflectionInfo, isStatic, jsA rguments, name) { 2775 function closureFromTearOff(receiver, functions, reflectionInfo, isStatic, jsA rguments, name) {
2776 return Closure.fromTearOff(receiver, _interceptors.JSArray.markFixedList(dar t.as(functions, core.List)), _interceptors.JSArray.markFixedList(dart.as(reflect ionInfo, core.List)), !!isStatic, jsArguments, name); 2776 return Closure.fromTearOff(receiver, _interceptors.JSArray.markFixedList(dar t.as(functions, core.List)), _interceptors.JSArray.markFixedList(dart.as(reflect ionInfo, core.List)), !!isStatic, jsArguments, name);
2777 } 2777 }
2778 class TearOffClosure extends Closure { 2778 class TearOffClosure extends Closure {
2779 } 2779 }
2780 let _self = Symbol('_self'); 2780 let _self = Symbol('_self');
2781 let _target = Symbol('_target'); 2781 let _target = Symbol('_target');
2782 let _name = Symbol('_name'); 2782 let _name = Symbol('_name');
2783 class BoundClosure extends TearOffClosure { 2783 class BoundClosure extends TearOffClosure {
2784 BoundClosure($_self, $_target, $_receiver, $_name) { 2784 BoundClosure(self$, target$, receiver$, name$) {
2785 this[_self] = $_self; 2785 this[_self] = self$;
2786 this[_target] = $_target; 2786 this[_target] = target$;
2787 this[_receiver] = $_receiver; 2787 this[_receiver] = receiver$;
2788 this[_name] = $_name; 2788 this[_name] = name$;
2789 super.TearOffClosure(); 2789 super.TearOffClosure();
2790 } 2790 }
2791 ['=='](other) { 2791 ['=='](other) {
2792 if (core.identical(this, other)) 2792 if (core.identical(this, other))
2793 return true; 2793 return true;
2794 if (!dart.is(other, BoundClosure)) 2794 if (!dart.is(other, BoundClosure))
2795 return false; 2795 return false;
2796 return this[_self] === dart.dload(other, '_self') && this[_target] === dar t.dload(other, '_target') && this[_receiver] === dart.dload(other, '_receiver'); 2796 return this[_self] === dart.dload(other, '_self') && this[_target] === dar t.dload(other, '_target') && this[_receiver] === dart.dload(other, '_receiver');
2797 } 2797 }
2798 get hashCode() { 2798 get hashCode() {
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
3480 let _hasReturnType = Symbol('_hasReturnType'); 3480 let _hasReturnType = Symbol('_hasReturnType');
3481 let _returnType = Symbol('_returnType'); 3481 let _returnType = Symbol('_returnType');
3482 let _isVoid = Symbol('_isVoid'); 3482 let _isVoid = Symbol('_isVoid');
3483 let _hasArguments = Symbol('_hasArguments'); 3483 let _hasArguments = Symbol('_hasArguments');
3484 let _hasOptionalArguments = Symbol('_hasOptionalArguments'); 3484 let _hasOptionalArguments = Symbol('_hasOptionalArguments');
3485 let _optionalArguments = Symbol('_optionalArguments'); 3485 let _optionalArguments = Symbol('_optionalArguments');
3486 let _hasNamedArguments = Symbol('_hasNamedArguments'); 3486 let _hasNamedArguments = Symbol('_hasNamedArguments');
3487 let _namedArguments = Symbol('_namedArguments'); 3487 let _namedArguments = Symbol('_namedArguments');
3488 let _convert = Symbol('_convert'); 3488 let _convert = Symbol('_convert');
3489 class FunctionTypeInfoDecoderRing extends core.Object { 3489 class FunctionTypeInfoDecoderRing extends core.Object {
3490 FunctionTypeInfoDecoderRing($_typeData) { 3490 FunctionTypeInfoDecoderRing(typeData) {
3491 this[_typeData] = $_typeData; 3491 this[_typeData] = typeData;
3492 this[_cachedToString] = null; 3492 this[_cachedToString] = null;
3493 } 3493 }
3494 get [_hasReturnType]() { 3494 get [_hasReturnType]() {
3495 return "ret" in this[_typeData]; 3495 return "ret" in this[_typeData];
3496 } 3496 }
3497 get [_returnType]() { 3497 get [_returnType]() {
3498 return this[_typeData].ret; 3498 return this[_typeData].ret;
3499 } 3499 }
3500 get [_isVoid]() { 3500 get [_isVoid]() {
3501 return !!this[_typeData]["void"]; 3501 return !!this[_typeData].void;
3502 } 3502 }
3503 get [_hasArguments]() { 3503 get [_hasArguments]() {
3504 return "args" in this[_typeData]; 3504 return "args" in this[_typeData];
3505 } 3505 }
3506 get [_arguments]() { 3506 get [_arguments]() {
3507 return dart.as(this[_typeData].args, core.List); 3507 return dart.as(this[_typeData].args, core.List);
3508 } 3508 }
3509 get [_hasOptionalArguments]() { 3509 get [_hasOptionalArguments]() {
3510 return "opt" in this[_typeData]; 3510 return "opt" in this[_typeData];
3511 } 3511 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3569 s = 'void'; 3569 s = 'void';
3570 } else if (this[_hasReturnType]) { 3570 } else if (this[_hasReturnType]) {
3571 s = this[_convert](this[_returnType]); 3571 s = this[_convert](this[_returnType]);
3572 } else { 3572 } else {
3573 s = 'dynamic'; 3573 s = 'dynamic';
3574 } 3574 }
3575 return this[_cachedToString] = `${s}`; 3575 return this[_cachedToString] = `${s}`;
3576 } 3576 }
3577 } 3577 }
3578 class UnimplementedNoSuchMethodError extends core.Error { 3578 class UnimplementedNoSuchMethodError extends core.Error {
3579 UnimplementedNoSuchMethodError($_message) { 3579 UnimplementedNoSuchMethodError(message$) {
3580 this[_message] = $_message; 3580 this[_message] = message$;
3581 super.Error(); 3581 super.Error();
3582 } 3582 }
3583 toString() { 3583 toString() {
3584 return `Unsupported operation: ${this[_message]}`; 3584 return `Unsupported operation: ${this[_message]}`;
3585 } 3585 }
3586 } 3586 }
3587 // Function random64: () → int 3587 // Function random64: () → int
3588 function random64() { 3588 function random64() {
3589 let int32a = Math.random() * 0x100000000 >>> 0; 3589 let int32a = Math.random() * 0x100000000 >>> 0;
3590 let int32b = Math.random() * 0x100000000 >>> 0; 3590 let int32b = Math.random() * 0x100000000 >>> 0;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 completer.complete(null); 3701 completer.complete(null);
3702 }, 1), false); 3702 }, 1), false);
3703 script.addEventListener("error", convertDartClosureToJS((event) => { 3703 script.addEventListener("error", convertDartClosureToJS((event) => {
3704 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`)); 3704 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`));
3705 }, 1), false); 3705 }, 1), false);
3706 document.body.appendChild(script); 3706 document.body.appendChild(script);
3707 return completer.future; 3707 return completer.future;
3708 })); 3708 }));
3709 } 3709 }
3710 class MainError extends core.Error { 3710 class MainError extends core.Error {
3711 MainError($_message) { 3711 MainError(message$) {
3712 this[_message] = $_message; 3712 this[_message] = message$;
3713 super.Error(); 3713 super.Error();
3714 } 3714 }
3715 toString() { 3715 toString() {
3716 return `NoSuchMethodError: ${this[_message]}`; 3716 return `NoSuchMethodError: ${this[_message]}`;
3717 } 3717 }
3718 } 3718 }
3719 // Function missingMain: () → void 3719 // Function missingMain: () → void
3720 function missingMain() { 3720 function missingMain() {
3721 throw new MainError("No top-level function named 'main'."); 3721 throw new MainError("No top-level function named 'main'.");
3722 } 3722 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; 3950 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError;
3951 exports.random64 = random64; 3951 exports.random64 = random64;
3952 exports.jsonEncodeNative = jsonEncodeNative; 3952 exports.jsonEncodeNative = jsonEncodeNative;
3953 exports.getIsolateAffinityTag = getIsolateAffinityTag; 3953 exports.getIsolateAffinityTag = getIsolateAffinityTag;
3954 exports.loadDeferredLibrary = loadDeferredLibrary; 3954 exports.loadDeferredLibrary = loadDeferredLibrary;
3955 exports.MainError = MainError; 3955 exports.MainError = MainError;
3956 exports.missingMain = missingMain; 3956 exports.missingMain = missingMain;
3957 exports.badMain = badMain; 3957 exports.badMain = badMain;
3958 exports.mainHasTooManyParameters = mainHasTooManyParameters; 3958 exports.mainHasTooManyParameters = mainHasTooManyParameters;
3959 })(_js_helper || (_js_helper = {})); 3959 })(_js_helper || (_js_helper = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698