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

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

Issue 1034273003: fix for static methods and names banned in strict mode (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
11 } 11 }
12 class NoInline extends core.Object { 12 class NoInline extends core.Object {
13 NoInline() { 13 NoInline() {
14 } 14 }
15 } 15 }
16 class IrRepresentation extends core.Object { 16 class IrRepresentation extends core.Object {
17 IrRepresentation(value) { 17 IrRepresentation(value) {
18 this.value = value; 18 this.value = value;
19 } 19 }
20 } 20 }
21 class Native extends core.Object { 21 class Native extends core.Object {
22 Native(name) { 22 Native(name) {
23 this.name = name; 23 this.name = name;
24 } 24 }
25 } 25 }
26 let _throwUnmodifiable = Symbol('_throwUnmodifiable'); 26 let _throwUnmodifiable = Symbol('_throwUnmodifiable');
27 let _$ = Symbol('_');
27 let ConstantMap$ = dart.generic(function(K, V) { 28 let ConstantMap$ = dart.generic(function(K, V) {
28 class ConstantMap extends core.Object { 29 class ConstantMap extends core.Object {
29 ConstantMap$_() { 30 ConstantMap$_() {
30 } 31 }
31 get isEmpty() { 32 get isEmpty() {
32 return this.length === 0; 33 return this.length === 0;
33 } 34 }
34 get isNotEmpty() { 35 get isNotEmpty() {
35 return !dart.notNull(this.isEmpty); 36 return !dart.notNull(this.isEmpty);
36 } 37 }
(...skipping 12 matching lines...) Expand all
49 remove(key) { 50 remove(key) {
50 return dart.as(this[_throwUnmodifiable](), V); 51 return dart.as(this[_throwUnmodifiable](), V);
51 } 52 }
52 clear() { 53 clear() {
53 return this[_throwUnmodifiable](); 54 return this[_throwUnmodifiable]();
54 } 55 }
55 addAll(other) { 56 addAll(other) {
56 return this[_throwUnmodifiable](); 57 return this[_throwUnmodifiable]();
57 } 58 }
58 } 59 }
59 dart.defineNamedConstructor(ConstantMap, '_'); 60 dart.defineNamedConstructor(ConstantMap, _$);
60 return ConstantMap; 61 return ConstantMap;
61 }); 62 });
62 let ConstantMap = ConstantMap$(dart.dynamic, dart.dynamic); 63 let ConstantMap = ConstantMap$(dart.dynamic, dart.dynamic);
63 let _jsObject = Symbol('_jsObject'); 64 let _jsObject = Symbol('_jsObject');
64 let _keys = Symbol('_keys'); 65 let _keys = Symbol('_keys');
65 let _fetch = Symbol('_fetch'); 66 let _fetch = Symbol('_fetch');
66 let ConstantStringMap$ = dart.generic(function(K, V) { 67 let ConstantStringMap$ = dart.generic(function(K, V) {
67 class ConstantStringMap extends ConstantMap$(K, V) { 68 class ConstantStringMap extends ConstantMap$(K, V) {
68 ConstantStringMap$_(length, jsObject$, keys$) { 69 ConstantStringMap$_(length, jsObject$, keys$) {
69 this.length = length; 70 this.length = length;
(...skipping 26 matching lines...) Expand all
96 f(dart.as(key, K), dart.as(this[_fetch](key), V)); 97 f(dart.as(key, K), dart.as(this[_fetch](key), V));
97 } 98 }
98 } 99 }
99 get keys() { 100 get keys() {
100 return new _ConstantMapKeyIterable(this); 101 return new _ConstantMapKeyIterable(this);
101 } 102 }
102 get values() { 103 get values() {
103 return new _internal.MappedIterable(this[_keys], dart.closureWrap(((key) => this[_fetch](key)).bind(this), "(K) → V")); 104 return new _internal.MappedIterable(this[_keys], dart.closureWrap(((key) => this[_fetch](key)).bind(this), "(K) → V"));
104 } 105 }
105 } 106 }
106 dart.defineNamedConstructor(ConstantStringMap, '_'); 107 dart.defineNamedConstructor(ConstantStringMap, _$);
107 return ConstantStringMap; 108 return ConstantStringMap;
108 }); 109 });
109 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic); 110 let ConstantStringMap = ConstantStringMap$(dart.dynamic, dart.dynamic);
110 let _protoValue = Symbol('_protoValue'); 111 let _protoValue = Symbol('_protoValue');
111 let ConstantProtoMap$ = dart.generic(function(K, V) { 112 let ConstantProtoMap$ = dart.generic(function(K, V) {
112 class ConstantProtoMap extends ConstantStringMap$(K, V) { 113 class ConstantProtoMap extends ConstantStringMap$(K, V) {
113 ConstantProtoMap$_(length, jsObject, keys, protoValue) { 114 ConstantProtoMap$_(length, jsObject, keys, protoValue) {
114 this[_protoValue] = protoValue; 115 this[_protoValue] = protoValue;
115 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k eys, core.List$(K))); 116 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k eys, core.List$(K)));
116 } 117 }
117 containsKey(key) { 118 containsKey(key) {
118 if (!(typeof key == string)) 119 if (!(typeof key == string))
119 return false; 120 return false;
120 if (dart.equals('__proto__', key)) 121 if (dart.equals('__proto__', key))
121 return true; 122 return true;
122 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); 123 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
123 } 124 }
124 [_fetch](key) { 125 [_fetch](key) {
125 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc ess(this[_jsObject], dart.as(key, core.String)); 126 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc ess(this[_jsObject], dart.as(key, core.String));
126 } 127 }
127 } 128 }
128 dart.defineNamedConstructor(ConstantProtoMap, '_'); 129 dart.defineNamedConstructor(ConstantProtoMap, _$);
129 return ConstantProtoMap; 130 return ConstantProtoMap;
130 }); 131 });
131 let ConstantProtoMap = ConstantProtoMap$(dart.dynamic, dart.dynamic); 132 let ConstantProtoMap = ConstantProtoMap$(dart.dynamic, dart.dynamic);
132 let _map = Symbol('_map'); 133 let _map = Symbol('_map');
133 let _ConstantMapKeyIterable$ = dart.generic(function(K) { 134 let _ConstantMapKeyIterable$ = dart.generic(function(K) {
134 class _ConstantMapKeyIterable extends collection.IterableBase$(K) { 135 class _ConstantMapKeyIterable extends collection.IterableBase$(K) {
135 _ConstantMapKeyIterable(map$) { 136 _ConstantMapKeyIterable(map$) {
136 this[_map] = map$; 137 this[_map] = map$;
137 super.IterableBase(); 138 super.IterableBase();
138 } 139 }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 let _execGlobal = Symbol('_execGlobal'); 472 let _execGlobal = Symbol('_execGlobal');
472 let _execAnchored = Symbol('_execAnchored'); 473 let _execAnchored = Symbol('_execAnchored');
473 class JSSyntaxRegExp extends core.Object { 474 class JSSyntaxRegExp extends core.Object {
474 toString() { 475 toString() {
475 return `RegExp/${this.pattern}/`; 476 return `RegExp/${this.pattern}/`;
476 } 477 }
477 JSSyntaxRegExp(source, opts) { 478 JSSyntaxRegExp(source, opts) {
478 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false; 479 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
479 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true; 480 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true;
480 this.pattern = source; 481 this.pattern = source;
481 this[_nativeRegExp] = makeNative(source, multiLine, caseSensitive, false); 482 this[_nativeRegExp] = JSSyntaxRegExp.makeNative(source, multiLine, caseSen sitive, false);
482 this[_nativeGlobalRegExp] = null; 483 this[_nativeGlobalRegExp] = null;
483 this[_nativeAnchoredRegExp] = null; 484 this[_nativeAnchoredRegExp] = null;
484 } 485 }
485 get [_nativeGlobalVersion]() { 486 get [_nativeGlobalVersion]() {
486 if (this[_nativeGlobalRegExp] !== null) 487 if (this[_nativeGlobalRegExp] !== null)
487 return this[_nativeGlobalRegExp]; 488 return this[_nativeGlobalRegExp];
488 return this[_nativeGlobalRegExp] = makeNative(this.pattern, this[_isMultiL ine], this[_isCaseSensitive], true); 489 return this[_nativeGlobalRegExp] = JSSyntaxRegExp.makeNative(this.pattern, this[_isMultiLine], this[_isCaseSensitive], true);
489 } 490 }
490 get [_nativeAnchoredVersion]() { 491 get [_nativeAnchoredVersion]() {
491 if (this[_nativeAnchoredRegExp] !== null) 492 if (this[_nativeAnchoredRegExp] !== null)
492 return this[_nativeAnchoredRegExp]; 493 return this[_nativeAnchoredRegExp];
493 return this[_nativeAnchoredRegExp] = makeNative(`${this.pattern}|()`, this [_isMultiLine], this[_isCaseSensitive], true); 494 return this[_nativeAnchoredRegExp] = JSSyntaxRegExp.makeNative(`${this.pat tern}|()`, this[_isMultiLine], this[_isCaseSensitive], true);
494 } 495 }
495 get [_isMultiLine]() { 496 get [_isMultiLine]() {
496 return this[_nativeRegExp].multiline; 497 return this[_nativeRegExp].multiline;
497 } 498 }
498 get [_isCaseSensitive]() { 499 get [_isCaseSensitive]() {
499 return !this[_nativeRegExp].ignoreCase; 500 return !this[_nativeRegExp].ignoreCase;
500 } 501 }
501 static makeNative(source, multiLine, caseSensitive, global) { 502 static makeNative(source, multiLine, caseSensitive, global) {
502 checkString(source); 503 checkString(source);
503 let m = multiLine ? 'm' : ''; 504 let m = multiLine ? 'm' : '';
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 return null; 912 return null;
912 return target.$builtinTypeInfo; 913 return target.$builtinTypeInfo;
913 } 914 }
914 // Function getRuntimeTypeArguments: (dynamic, dynamic) → dynamic 915 // Function getRuntimeTypeArguments: (dynamic, dynamic) → dynamic
915 function getRuntimeTypeArguments(target, substitutionName) { 916 function getRuntimeTypeArguments(target, substitutionName) {
916 let substitution = getField(target, `${_foreign_helper.JS_OPERATOR_AS_PREFIX ()}${substitutionName}`); 917 let substitution = getField(target, `${_foreign_helper.JS_OPERATOR_AS_PREFIX ()}${substitutionName}`);
917 return substitute(substitution, getRuntimeTypeInfo(target)); 918 return substitute(substitution, getRuntimeTypeInfo(target));
918 } 919 }
919 // Function getRuntimeTypeArgument: (Object, String, int) → dynamic 920 // Function getRuntimeTypeArgument: (Object, String, int) → dynamic
920 function getRuntimeTypeArgument(target, substitutionName, index) { 921 function getRuntimeTypeArgument(target, substitutionName, index) {
921 let arguments = getRuntimeTypeArguments(target, substitutionName); 922 let arguments$ = getRuntimeTypeArguments(target, substitutionName);
922 return arguments === null ? null : getIndex(arguments, index); 923 return arguments$ === null ? null : getIndex(arguments$, index);
923 } 924 }
924 // Function getTypeArgumentByIndex: (Object, int) → dynamic 925 // Function getTypeArgumentByIndex: (Object, int) → dynamic
925 function getTypeArgumentByIndex(target, index) { 926 function getTypeArgumentByIndex(target, index) {
926 let rti = getRuntimeTypeInfo(target); 927 let rti = getRuntimeTypeInfo(target);
927 return rti === null ? null : getIndex(rti, index); 928 return rti === null ? null : getIndex(rti, index);
928 } 929 }
929 // Function copyTypeArguments: (Object, Object) → void 930 // Function copyTypeArguments: (Object, Object) → void
930 function copyTypeArguments(source, target) { 931 function copyTypeArguments(source, target) {
931 target.$builtinTypeInfo = source.$builtinTypeInfo; 932 target.$builtinTypeInfo = source.$builtinTypeInfo;
932 } 933 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 return className; 995 return className;
995 let typeInfo = object.$builtinTypeInfo; 996 let typeInfo = object.$builtinTypeInfo;
996 return `${className}${joinArguments(typeInfo, 0)}`; 997 return `${className}${joinArguments(typeInfo, 0)}`;
997 } 998 }
998 // Function getRuntimeType: (dynamic) → Type 999 // Function getRuntimeType: (dynamic) → Type
999 function getRuntimeType(object) { 1000 function getRuntimeType(object) {
1000 let type = getRuntimeTypeString(object); 1001 let type = getRuntimeTypeString(object);
1001 return new TypeImpl(type); 1002 return new TypeImpl(type);
1002 } 1003 }
1003 // Function substitute: (dynamic, dynamic) → dynamic 1004 // Function substitute: (dynamic, dynamic) → dynamic
1004 function substitute(substitution, arguments) { 1005 function substitute(substitution, arguments$) {
1005 dart.assert(dart.notNull(substitution === null) || dart.notNull(isJsFunction (substitution))); 1006 dart.assert(dart.notNull(substitution === null) || dart.notNull(isJsFunction (substitution)));
1006 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum ents))); 1007 dart.assert(dart.notNull(arguments$ === null) || dart.notNull(isJsArray(argu ments$)));
1007 if (isJsFunction(substitution)) { 1008 if (isJsFunction(substitution)) {
1008 substitution = invoke(substitution, arguments); 1009 substitution = invoke(substitution, arguments$);
1009 if (isJsArray(substitution)) { 1010 if (isJsArray(substitution)) {
1010 arguments = substitution; 1011 arguments$ = substitution;
1011 } else if (isJsFunction(substitution)) { 1012 } else if (isJsFunction(substitution)) {
1012 arguments = invoke(substitution, arguments); 1013 arguments$ = invoke(substitution, arguments$);
1013 } 1014 }
1014 } 1015 }
1015 return arguments; 1016 return arguments$;
1016 } 1017 }
1017 // Function checkSubtype: (Object, String, List<dynamic>, String) → bool 1018 // Function checkSubtype: (Object, String, List<dynamic>, String) → bool
1018 function checkSubtype(object, isField, checks, asField) { 1019 function checkSubtype(object, isField, checks, asField) {
1019 if (object === null) 1020 if (object === null)
1020 return false; 1021 return false;
1021 let arguments = getRuntimeTypeInfo(object); 1022 let arguments$ = getRuntimeTypeInfo(object);
1022 let interceptor = _interceptors.getInterceptor(object); 1023 let interceptor = _interceptors.getInterceptor(object);
1023 let isSubclass = getField(interceptor, isField); 1024 let isSubclass = getField(interceptor, isField);
1024 if (isSubclass === null) 1025 if (isSubclass === null)
1025 return false; 1026 return false;
1026 let substitution = getField(interceptor, asField); 1027 let substitution = getField(interceptor, asField);
1027 return checkArguments(substitution, arguments, checks); 1028 return checkArguments(substitution, arguments$, checks);
1028 } 1029 }
1029 // Function computeTypeName: (String, List<dynamic>) → String 1030 // Function computeTypeName: (String, List<dynamic>) → String
1030 function computeTypeName(isField, arguments) { 1031 function computeTypeName(isField, arguments$) {
1031 let prefixLength = _foreign_helper.JS_OPERATOR_IS_PREFIX().length; 1032 let prefixLength = _foreign_helper.JS_OPERATOR_IS_PREFIX().length;
1032 return Primitives.formatType(isField.substring(prefixLength, isField.length) , arguments); 1033 return Primitives.formatType(isField.substring(prefixLength, isField.length) , arguments$);
1033 } 1034 }
1034 // Function subtypeCast: (Object, String, List<dynamic>, String) → Object 1035 // Function subtypeCast: (Object, String, List<dynamic>, String) → Object
1035 function subtypeCast(object, isField, checks, asField) { 1036 function subtypeCast(object, isField, checks, asField) {
1036 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi eld, checks, asField))) { 1037 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi eld, checks, asField))) {
1037 let actualType = Primitives.objectTypeName(object); 1038 let actualType = Primitives.objectTypeName(object);
1038 let typeName = computeTypeName(isField, checks); 1039 let typeName = computeTypeName(isField, checks);
1039 throw new CastErrorImplementation(actualType, typeName); 1040 throw new CastErrorImplementation(actualType, typeName);
1040 } 1041 }
1041 return object; 1042 return object;
1042 } 1043 }
1043 // Function assertSubtype: (Object, String, List<dynamic>, String) → Object 1044 // Function assertSubtype: (Object, String, List<dynamic>, String) → Object
1044 function assertSubtype(object, isField, checks, asField) { 1045 function assertSubtype(object, isField, checks, asField) {
1045 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi eld, checks, asField))) { 1046 if (dart.notNull(object !== null) && !dart.notNull(checkSubtype(object, isFi eld, checks, asField))) {
1046 let typeName = computeTypeName(isField, checks); 1047 let typeName = computeTypeName(isField, checks);
1047 throw new TypeErrorImplementation(object, typeName); 1048 throw new TypeErrorImplementation(object, typeName);
1048 } 1049 }
1049 return object; 1050 return object;
1050 } 1051 }
1051 // Function assertIsSubtype: (dynamic, dynamic, String) → dynamic 1052 // Function assertIsSubtype: (dynamic, dynamic, String) → dynamic
1052 function assertIsSubtype(subtype, supertype, message) { 1053 function assertIsSubtype(subtype, supertype, message) {
1053 if (!dart.notNull(isSubtype(subtype, supertype))) { 1054 if (!dart.notNull(isSubtype(subtype, supertype))) {
1054 throwTypeError(message); 1055 throwTypeError(message);
1055 } 1056 }
1056 } 1057 }
1057 // Function throwTypeError: (dynamic) → dynamic 1058 // Function throwTypeError: (dynamic) → dynamic
1058 function throwTypeError(message) { 1059 function throwTypeError(message) {
1059 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String)) ; 1060 throw new TypeErrorImplementation.fromMessage(dart.as(message, core.String)) ;
1060 } 1061 }
1061 // Function checkArguments: (dynamic, dynamic, dynamic) → bool 1062 // Function checkArguments: (dynamic, dynamic, dynamic) → bool
1062 function checkArguments(substitution, arguments, checks) { 1063 function checkArguments(substitution, arguments$, checks) {
1063 return areSubtypes(substitute(substitution, arguments), checks); 1064 return areSubtypes(substitute(substitution, arguments$), checks);
1064 } 1065 }
1065 // Function areSubtypes: (dynamic, dynamic) → bool 1066 // Function areSubtypes: (dynamic, dynamic) → bool
1066 function areSubtypes(s, t) { 1067 function areSubtypes(s, t) {
1067 if (dart.notNull(s === null) || dart.notNull(t === null)) 1068 if (dart.notNull(s === null) || dart.notNull(t === null))
1068 return true; 1069 return true;
1069 dart.assert(isJsArray(s)); 1070 dart.assert(isJsArray(s));
1070 dart.assert(isJsArray(t)); 1071 dart.assert(isJsArray(t));
1071 dart.assert(getLength(s) === getLength(t)); 1072 dart.assert(getLength(s) === getLength(t));
1072 let len = getLength(s); 1073 let len = getLength(s);
1073 for (let i = 0; dart.notNull(i) < dart.notNull(len); i = dart.notNull(i) + 1 ) { 1074 for (let i = 0; dart.notNull(i) < dart.notNull(len); i = dart.notNull(i) + 1 ) {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tOptionalParameterTypes, tPos)))) { 1265 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tOptionalParameterTypes, tPos)))) {
1265 return false; 1266 return false;
1266 } 1267 }
1267 } 1268 }
1268 } 1269 }
1269 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`); 1270 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`);
1270 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`); 1271 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`);
1271 return areAssignableMaps(sNamedParameters, tNamedParameters); 1272 return areAssignableMaps(sNamedParameters, tNamedParameters);
1272 } 1273 }
1273 // Function invoke: (dynamic, dynamic) → dynamic 1274 // Function invoke: (dynamic, dynamic) → dynamic
1274 function invoke(func, arguments) { 1275 function invoke(func, arguments$) {
1275 return invokeOn(func, null, arguments); 1276 return invokeOn(func, null, arguments$);
1276 } 1277 }
1277 // Function invokeOn: (dynamic, dynamic, dynamic) → Object 1278 // Function invokeOn: (dynamic, dynamic, dynamic) → Object
1278 function invokeOn(func, receiver, arguments) { 1279 function invokeOn(func, receiver, arguments$) {
1279 dart.assert(isJsFunction(func)); 1280 dart.assert(isJsFunction(func));
1280 dart.assert(dart.notNull(arguments === null) || dart.notNull(isJsArray(argum ents))); 1281 dart.assert(dart.notNull(arguments$ === null) || dart.notNull(isJsArray(argu ments$)));
1281 return func.apply(receiver, arguments); 1282 return func.apply(receiver, arguments$);
1282 } 1283 }
1283 // Function call: (dynamic, String) → dynamic 1284 // Function call: (dynamic, String) → dynamic
1284 function call(object, name) { 1285 function call(object, name) {
1285 return object[name](); 1286 return object[name]();
1286 } 1287 }
1287 // Function getField: (dynamic, String) → dynamic 1288 // Function getField: (dynamic, String) → dynamic
1288 function getField(object, name) { 1289 function getField(object, name) {
1289 return object[name]; 1290 return object[name];
1290 } 1291 }
1291 // Function getIndex: (dynamic, int) → dynamic 1292 // Function getIndex: (dynamic, int) → dynamic
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 return 'false'; 1360 return 'false';
1360 } else if (value === null) { 1361 } else if (value === null) {
1361 return 'null'; 1362 return 'null';
1362 } 1363 }
1363 let res = dart.dinvoke(value, 'toString'); 1364 let res = dart.dinvoke(value, 'toString');
1364 if (!(typeof res == string)) 1365 if (!(typeof res == string))
1365 throw new core.ArgumentError(value); 1366 throw new core.ArgumentError(value);
1366 return dart.as(res, core.String); 1367 return dart.as(res, core.String);
1367 } 1368 }
1368 // Function createInvocationMirror: (String, dynamic, dynamic, dynamic, dynami c) → dynamic 1369 // Function createInvocationMirror: (String, dynamic, dynamic, dynamic, dynami c) → dynamic
1369 function createInvocationMirror(name, internalName, kind, arguments, argumentN ames) { 1370 function createInvocationMirror(name, internalName, kind, arguments$, argument Names) {
1370 return new JSInvocationMirror(name, dart.as(internalName, core.String), dart .as(kind, core.int), dart.as(arguments, core.List), dart.as(argumentNames, core. List)); 1371 return new JSInvocationMirror(name, dart.as(internalName, core.String), dart .as(kind, core.int), dart.as(arguments$, core.List), dart.as(argumentNames, core .List));
1371 } 1372 }
1372 // Function createUnmangledInvocationMirror: (Symbol, dynamic, dynamic, dynami c, dynamic) → dynamic 1373 // Function createUnmangledInvocationMirror: (Symbol, dynamic, dynamic, dynami c, dynamic) → dynamic
1373 function createUnmangledInvocationMirror(symbol, internalName, kind, arguments , argumentNames) { 1374 function createUnmangledInvocationMirror(symbol, internalName, kind, arguments $, argumentNames) {
1374 return new JSInvocationMirror(symbol, dart.as(internalName, core.String), da rt.as(kind, core.int), dart.as(arguments, core.List), dart.as(argumentNames, cor e.List)); 1375 return new JSInvocationMirror(symbol, dart.as(internalName, core.String), da rt.as(kind, core.int), dart.as(arguments$, core.List), dart.as(argumentNames, co re.List));
1375 } 1376 }
1376 // Function throwInvalidReflectionError: (String) → void 1377 // Function throwInvalidReflectionError: (String) → void
1377 function throwInvalidReflectionError(memberName) { 1378 function throwInvalidReflectionError(memberName) {
1378 throw new core.UnsupportedError(`Can't use '${memberName}' in reflection ` + "because it is not included in a @MirrorsUsed annotation."); 1379 throw new core.UnsupportedError(`Can't use '${memberName}' in reflection ` + "because it is not included in a @MirrorsUsed annotation.");
1379 } 1380 }
1380 // Function traceHelper: (String) → void 1381 // Function traceHelper: (String) → void
1381 function traceHelper(method) { 1382 function traceHelper(method) {
1382 if (!this.cache) { 1383 if (!this.cache) {
1383 this.cache = Object.create(null); 1384 this.cache = Object.create(null);
1384 } 1385 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 let map = new core.Map(); 1453 let map = new core.Map();
1453 for (let i = 0; dart.notNull(i) < dart.notNull(namedArgumentCount); i = da rt.notNull(i) + 1) { 1454 for (let i = 0; dart.notNull(i) < dart.notNull(namedArgumentCount); i = da rt.notNull(i) + 1) {
1454 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName s].get(i), core.String)), this[_arguments].get(dart.notNull(namedArgumentsStartI ndex) + dart.notNull(i))); 1455 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName s].get(i), core.String)), this[_arguments].get(dart.notNull(namedArgumentsStartI ndex) + dart.notNull(i)));
1455 } 1456 }
1456 return map; 1457 return map;
1457 } 1458 }
1458 [_getCachedInvocation](object) { 1459 [_getCachedInvocation](object) {
1459 let interceptor = _interceptors.getInterceptor(object); 1460 let interceptor = _interceptors.getInterceptor(object);
1460 let receiver = object; 1461 let receiver = object;
1461 let name = this[_internalName]; 1462 let name = this[_internalName];
1462 let arguments = this[_arguments]; 1463 let arguments$ = this[_arguments];
1463 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded _names.INTERCEPTED_NAMES); 1464 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded _names.INTERCEPTED_NAMES);
1464 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames, name); 1465 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames, name);
1465 if (isIntercepted) { 1466 if (isIntercepted) {
1466 receiver = interceptor; 1467 receiver = interceptor;
1467 if (object === interceptor) { 1468 if (object === interceptor) {
1468 interceptor = null; 1469 interceptor = null;
1469 } 1470 }
1470 } else { 1471 } else {
1471 interceptor = null; 1472 interceptor = null;
1472 } 1473 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 this.jsFunction = jsFunction; 1519 this.jsFunction = jsFunction;
1519 this.isIntercepted = isIntercepted; 1520 this.isIntercepted = isIntercepted;
1520 this.cachedInterceptor = cachedInterceptor; 1521 this.cachedInterceptor = cachedInterceptor;
1521 } 1522 }
1522 get isNoSuchMethod() { 1523 get isNoSuchMethod() {
1523 return false; 1524 return false;
1524 } 1525 }
1525 get isGetterStub() { 1526 get isGetterStub() {
1526 return !!this.jsFunction.$getterStub; 1527 return !!this.jsFunction.$getterStub;
1527 } 1528 }
1528 invokeOn(victim, arguments) { 1529 invokeOn(victim, arguments$) {
1529 let receiver = victim; 1530 let receiver = victim;
1530 if (!dart.notNull(this.isIntercepted)) { 1531 if (!dart.notNull(this.isIntercepted)) {
1531 if (!dart.is(arguments, _interceptors.JSArray)) 1532 if (!dart.is(arguments$, _interceptors.JSArray))
1532 arguments = new core.List.from(arguments); 1533 arguments$ = new core.List.from(arguments$);
1533 } else { 1534 } else {
1534 arguments = new List.from([victim]); 1535 arguments$ = new List.from([victim]);
1535 arguments.addAll(arguments); 1536 arguments$.addAll(arguments$);
1536 if (this.cachedInterceptor !== null) 1537 if (this.cachedInterceptor !== null)
1537 receiver = this.cachedInterceptor; 1538 receiver = this.cachedInterceptor;
1538 } 1539 }
1539 return this.jsFunction.apply(receiver, arguments); 1540 return this.jsFunction.apply(receiver, arguments$);
1540 } 1541 }
1541 } 1542 }
1542 class CachedCatchAllInvocation extends CachedInvocation { 1543 class CachedCatchAllInvocation extends CachedInvocation {
1543 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor) { 1544 CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor) {
1544 this.info = new ReflectionInfo(jsFunction); 1545 this.info = new ReflectionInfo(jsFunction);
1545 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor) ; 1546 super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor) ;
1546 } 1547 }
1547 get isGetterStub() { 1548 get isGetterStub() {
1548 return false; 1549 return false;
1549 } 1550 }
1550 invokeOn(victim, arguments) { 1551 invokeOn(victim, arguments$) {
1551 let receiver = victim; 1552 let receiver = victim;
1552 let providedArgumentCount = null; 1553 let providedArgumentCount = null;
1553 let fullParameterCount = dart.notNull(this.info.requiredParameterCount) + dart.notNull(this.info.optionalParameterCount); 1554 let fullParameterCount = dart.notNull(this.info.requiredParameterCount) + dart.notNull(this.info.optionalParameterCount);
1554 if (!dart.notNull(this.isIntercepted)) { 1555 if (!dart.notNull(this.isIntercepted)) {
1555 if (dart.is(arguments, _interceptors.JSArray)) { 1556 if (dart.is(arguments$, _interceptors.JSArray)) {
1556 providedArgumentCount = arguments.length; 1557 providedArgumentCount = arguments$.length;
1557 if (dart.notNull(providedArgumentCount) < dart.notNull(fullParameterCo unt)) { 1558 if (dart.notNull(providedArgumentCount) < dart.notNull(fullParameterCo unt)) {
1558 arguments = new core.List.from(arguments); 1559 arguments$ = new core.List.from(arguments$);
1559 } 1560 }
1560 } else { 1561 } else {
1561 arguments = new core.List.from(arguments); 1562 arguments$ = new core.List.from(arguments$);
1562 providedArgumentCount = arguments.length; 1563 providedArgumentCount = arguments$.length;
1563 } 1564 }
1564 } else { 1565 } else {
1565 arguments = new List.from([victim]); 1566 arguments$ = new List.from([victim]);
1566 arguments.addAll(arguments); 1567 arguments$.addAll(arguments$);
1567 if (this.cachedInterceptor !== null) 1568 if (this.cachedInterceptor !== null)
1568 receiver = this.cachedInterceptor; 1569 receiver = this.cachedInterceptor;
1569 providedArgumentCount = dart.notNull(arguments.length) - 1; 1570 providedArgumentCount = dart.notNull(arguments$.length) - 1;
1570 } 1571 }
1571 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) { 1572 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) {
1572 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments.length} arguments.`); 1573 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments$.length} arguments.`);
1573 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) { 1574 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) {
1574 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`); 1575 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`);
1575 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) { 1576 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) {
1576 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`); 1577 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`);
1577 } 1578 }
1578 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar ameterCount); i = dart.notNull(i) + 1) { 1579 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar ameterCount); i = dart.notNull(i) + 1) {
1579 arguments.add(getMetadata(this.info.defaultValue(i))); 1580 arguments$.add(getMetadata(this.info.defaultValue(i)));
1580 } 1581 }
1581 return this.jsFunction.apply(receiver, arguments); 1582 return this.jsFunction.apply(receiver, arguments$);
1582 } 1583 }
1583 } 1584 }
1584 class CachedNoSuchMethodInvocation extends core.Object { 1585 class CachedNoSuchMethodInvocation extends core.Object {
1585 CachedNoSuchMethodInvocation(interceptor) { 1586 CachedNoSuchMethodInvocation(interceptor) {
1586 this.interceptor = interceptor; 1587 this.interceptor = interceptor;
1587 } 1588 }
1588 get isNoSuchMethod() { 1589 get isNoSuchMethod() {
1589 return true; 1590 return true;
1590 } 1591 }
1591 get isGetterStub() { 1592 get isGetterStub() {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 dart.defineNamedConstructor(ReflectionInfo, 'internal'); 1698 dart.defineNamedConstructor(ReflectionInfo, 'internal');
1698 ReflectionInfo.REQUIRED_PARAMETERS_INFO = 0; 1699 ReflectionInfo.REQUIRED_PARAMETERS_INFO = 0;
1699 ReflectionInfo.OPTIONAL_PARAMETERS_INFO = 1; 1700 ReflectionInfo.OPTIONAL_PARAMETERS_INFO = 1;
1700 ReflectionInfo.FUNCTION_TYPE_INDEX = 2; 1701 ReflectionInfo.FUNCTION_TYPE_INDEX = 2;
1701 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3; 1702 ReflectionInfo.FIRST_DEFAULT_ARGUMENT = 3;
1702 // Function getMetadata: (int) → dynamic 1703 // Function getMetadata: (int) → dynamic
1703 function getMetadata(index) { 1704 function getMetadata(index) {
1704 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA); 1705 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.MET ADATA);
1705 return metadata[index]; 1706 return metadata[index];
1706 } 1707 }
1707 let _throwFormatException$ = Symbol('_throwFormatException'); 1708 let _throwFormatException = Symbol('_throwFormatException');
1708 let _fromCharCodeApply$ = Symbol('_fromCharCodeApply'); 1709 let _fromCharCodeApply = Symbol('_fromCharCodeApply');
1709 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType'); 1710 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
1710 class Primitives extends core.Object { 1711 class Primitives extends core.Object {
1711 static initializeStatics(id) { 1712 static initializeStatics(id) {
1712 mirrorFunctionCacheName = `_${id}`; 1713 Primitives.mirrorFunctionCacheName = `_${id}`;
1713 mirrorInvokeCacheName = `_${id}`; 1714 Primitives.mirrorInvokeCacheName = `_${id}`;
1714 } 1715 }
1715 static objectHashCode(object) { 1716 static objectHashCode(object) {
1716 let hash = dart.as(object.$identityHash, core.int); 1717 let hash = dart.as(object.$identityHash, core.int);
1717 if (hash === null) { 1718 if (hash === null) {
1718 hash = Math.random() * 0x3fffffff | 0; 1719 hash = Math.random() * 0x3fffffff | 0;
1719 object.$identityHash = hash; 1720 object.$identityHash = hash;
1720 } 1721 }
1721 return hash; 1722 return hash;
1722 } 1723 }
1723 static [_throwFormatException$](string) { 1724 static [_throwFormatException](string) {
1724 throw new core.FormatException(string); 1725 throw new core.FormatException(string);
1725 } 1726 }
1726 static parseInt(source, radix, handleError) { 1727 static parseInt(source, radix, handleError) {
1727 if (handleError === null) 1728 if (handleError === null)
1728 handleError = dart.closureWrap(_throwFormatException, "(String) → int"); 1729 handleError = dart.closureWrap(Primitives[_throwFormatException], "(Stri ng) → int");
1729 checkString(source); 1730 checkString(source);
1730 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ; 1731 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
1731 let digitsIndex = 1; 1732 let digitsIndex = 1;
1732 let hexIndex = 2; 1733 let hexIndex = 2;
1733 let decimalIndex = 3; 1734 let decimalIndex = 3;
1734 let nonDecimalHexIndex = 4; 1735 let nonDecimalHexIndex = 4;
1735 if (radix === null) { 1736 if (radix === null) {
1736 radix = 10; 1737 radix = 10;
1737 if (match !== null) { 1738 if (match !== null) {
1738 if (dart.dindex(match, hexIndex) !== null) { 1739 if (dart.dindex(match, hexIndex) !== null) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 } 1771 }
1771 } 1772 }
1772 } 1773 }
1773 if (match === null) 1774 if (match === null)
1774 return handleError(source); 1775 return handleError(source);
1775 return parseInt(source, radix); 1776 return parseInt(source, radix);
1776 } 1777 }
1777 static parseDouble(source, handleError) { 1778 static parseDouble(source, handleError) {
1778 checkString(source); 1779 checkString(source);
1779 if (handleError === null) 1780 if (handleError === null)
1780 handleError = dart.closureWrap(_throwFormatException, "(String) → double "); 1781 handleError = dart.closureWrap(Primitives[_throwFormatException], "(Stri ng) → double");
1781 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) { 1782 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) {
1782 return handleError(source); 1783 return handleError(source);
1783 } 1784 }
1784 let result = parseFloat(source); 1785 let result = parseFloat(source);
1785 if (result.isNaN) { 1786 if (result.isNaN) {
1786 let trimmed = source.trim(); 1787 let trimmed = source.trim();
1787 if (dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNull(dart.equal s(trimmed, '+NaN')) || dart.notNull(dart.equals(trimmed, '-NaN'))) { 1788 if (dart.notNull(dart.equals(trimmed, 'NaN')) || dart.notNull(dart.equal s(trimmed, '+NaN')) || dart.notNull(dart.equals(trimmed, '-NaN'))) {
1788 return result; 1789 return result;
1789 } 1790 }
1790 return handleError(source); 1791 return handleError(source);
1791 } 1792 }
1792 return result; 1793 return result;
1793 } 1794 }
1794 static formatType(className, typeArguments) { 1795 static formatType(className, typeArguments) {
1795 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j oinArguments(typeArguments, 0)}`); 1796 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j oinArguments(typeArguments, 0)}`);
1796 } 1797 }
1797 static objectTypeName(object) { 1798 static objectTypeName(object) {
1798 let name = constructorNameFallback(_interceptors.getInterceptor(object)); 1799 let name = constructorNameFallback(_interceptors.getInterceptor(object));
1799 if (dart.equals(name, 'Object')) { 1800 if (dart.equals(name, 'Object')) {
1800 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\ s*\(/)[1]; 1801 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\ s*\(/)[1];
1801 if (typeof decompiled == string) 1802 if (typeof decompiled == string)
1802 if (/^\w+$/.test(decompiled)) 1803 if (/^\w+$/.test(decompiled))
1803 name = dart.as(decompiled, core.String); 1804 name = dart.as(decompiled, core.String);
1804 } 1805 }
1805 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code UnitAt(0), Primitives.DOLLAR_CHAR_VALUE))) { 1806 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code UnitAt(0), Primitives.DOLLAR_CHAR_VALUE))) {
1806 name = name.substring(1); 1807 name = name.substring(1);
1807 } 1808 }
1808 return formatType(name, dart.as(getRuntimeTypeInfo(object), core.List)); 1809 return Primitives.formatType(name, dart.as(getRuntimeTypeInfo(object), cor e.List));
1809 } 1810 }
1810 static objectToString(object) { 1811 static objectToString(object) {
1811 let name = objectTypeName(object); 1812 let name = Primitives.objectTypeName(object);
1812 return `Instance of '${name}'`; 1813 return `Instance of '${name}'`;
1813 } 1814 }
1814 static dateNow() { 1815 static dateNow() {
1815 return Date.now(); 1816 return Date.now();
1816 } 1817 }
1817 static initTicker() { 1818 static initTicker() {
1818 if (timerFrequency !== null) 1819 if (Primitives.timerFrequency !== null)
1819 return; 1820 return;
1820 timerFrequency = 1000; 1821 Primitives.timerFrequency = 1000;
1821 timerTicks = dateNow; 1822 Primitives.timerTicks = Primitives.dateNow;
1822 if (typeof window == "undefined") 1823 if (typeof window == "undefined")
1823 return; 1824 return;
1824 let window = window; 1825 let window = window;
1825 if (window === null) 1826 if (window === null)
1826 return; 1827 return;
1827 let performance = window.performance; 1828 let performance = window.performance;
1828 if (performance === null) 1829 if (performance === null)
1829 return; 1830 return;
1830 if (typeof performance.now != "function") 1831 if (typeof performance.now != "function")
1831 return; 1832 return;
1832 timerFrequency = 1000000; 1833 Primitives.timerFrequency = 1000000;
1833 timerTicks = (() => (1000 * performance.now()).floor()).bind(this); 1834 Primitives.timerTicks = (() => (1000 * performance.now()).floor()).bind(th is);
1834 } 1835 }
1835 static get isD8() { 1836 static get isD8() {
1836 return typeof version == "function" && typeof os == "object" && "system" i n os; 1837 return typeof version == "function" && typeof os == "object" && "system" i n os;
1837 } 1838 }
1838 static get isJsshell() { 1839 static get isJsshell() {
1839 return typeof version == "function" && typeof system == "function"; 1840 return typeof version == "function" && typeof system == "function";
1840 } 1841 }
1841 static currentUri() { 1842 static currentUri() {
1842 requiresPreamble(); 1843 requiresPreamble();
1843 if (!!self.location) { 1844 if (!!self.location) {
1844 return self.location.href; 1845 return self.location.href;
1845 } 1846 }
1846 return null; 1847 return null;
1847 } 1848 }
1848 static [_fromCharCodeApply$](array) { 1849 static [_fromCharCodeApply](array) {
1849 let result = ""; 1850 let result = "";
1850 let kMaxApply = 500; 1851 let kMaxApply = 500;
1851 let end = array.length; 1852 let end = array.length;
1852 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) { 1853 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = kMaxApply) {
1853 let subarray = null; 1854 let subarray = null;
1854 if (dart.notNull(end) <= dart.notNull(kMaxApply)) { 1855 if (dart.notNull(end) <= dart.notNull(kMaxApply)) {
1855 subarray = array; 1856 subarray = array;
1856 } else { 1857 } else {
1857 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); 1858 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end);
1858 } 1859 }
1859 result = result + String.fromCharCode.apply(null, subarray); 1860 result = result + String.fromCharCode.apply(null, subarray);
1860 } 1861 }
1861 return result; 1862 return result;
1862 } 1863 }
1863 static stringFromCodePoints(codePoints) { 1864 static stringFromCodePoints(codePoints) {
1864 let a = new List.from([]); 1865 let a = new List.from([]);
1865 for (let i of codePoints) { 1866 for (let i of codePoints) {
1866 if (!(typeof i == number)) 1867 if (!(typeof i == number))
1867 throw new core.ArgumentError(i); 1868 throw new core.ArgumentError(i);
1868 if (dart.dbinary(i, '<=', 65535)) { 1869 if (dart.dbinary(i, '<=', 65535)) {
1869 a.add(dart.as(i, core.int)); 1870 a.add(dart.as(i, core.int));
1870 } else if (dart.dbinary(i, '<=', 1114111)) { 1871 } else if (dart.dbinary(i, '<=', 1114111)) {
1871 a.add(55296['+'](dart.dbinary(dart.dbinary(dart.dbinary(i, '-', 65536) , '>>', 10), '&', 1023))); 1872 a.add(55296['+'](dart.dbinary(dart.dbinary(dart.dbinary(i, '-', 65536) , '>>', 10), '&', 1023)));
1872 a.add(56320['+'](dart.dbinary(i, '&', 1023))); 1873 a.add(56320['+'](dart.dbinary(i, '&', 1023)));
1873 } else { 1874 } else {
1874 throw new core.ArgumentError(i); 1875 throw new core.ArgumentError(i);
1875 } 1876 }
1876 } 1877 }
1877 return _fromCharCodeApply(a); 1878 return Primitives[_fromCharCodeApply](a);
1878 } 1879 }
1879 static stringFromCharCodes(charCodes) { 1880 static stringFromCharCodes(charCodes) {
1880 for (let i of charCodes) { 1881 for (let i of charCodes) {
1881 if (!(typeof i == number)) 1882 if (!(typeof i == number))
1882 throw new core.ArgumentError(i); 1883 throw new core.ArgumentError(i);
1883 if (dart.dbinary(i, '<', 0)) 1884 if (dart.dbinary(i, '<', 0))
1884 throw new core.ArgumentError(i); 1885 throw new core.ArgumentError(i);
1885 if (dart.dbinary(i, '>', 65535)) 1886 if (dart.dbinary(i, '>', 65535))
1886 return stringFromCodePoints(charCodes); 1887 return Primitives.stringFromCodePoints(charCodes);
1887 } 1888 }
1888 return _fromCharCodeApply(dart.as(charCodes, core.List$(core.int))); 1889 return Primitives[_fromCharCodeApply](dart.as(charCodes, core.List$(core.i nt)));
1889 } 1890 }
1890 static stringFromCharCode(charCode) { 1891 static stringFromCharCode(charCode) {
1891 if (0['<='](charCode)) { 1892 if (0['<='](charCode)) {
1892 if (dart.dbinary(charCode, '<=', 65535)) { 1893 if (dart.dbinary(charCode, '<=', 65535)) {
1893 return String.fromCharCode(charCode); 1894 return String.fromCharCode(charCode);
1894 } 1895 }
1895 if (dart.dbinary(charCode, '<=', 1114111)) { 1896 if (dart.dbinary(charCode, '<=', 1114111)) {
1896 let bits = dart.dbinary(charCode, '-', 65536); 1897 let bits = dart.dbinary(charCode, '-', 65536);
1897 let low = 56320['|'](dart.dbinary(bits, '&', 1023)); 1898 let low = 56320['|'](dart.dbinary(bits, '&', 1023));
1898 let high = 55296['|'](dart.dbinary(bits, '>>', 10)); 1899 let high = 55296['|'](dart.dbinary(bits, '>>', 10));
1899 return String.fromCharCode(high, low); 1900 return String.fromCharCode(high, low);
1900 } 1901 }
1901 } 1902 }
1902 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111); 1903 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111);
1903 } 1904 }
1904 static stringConcatUnchecked(string1, string2) { 1905 static stringConcatUnchecked(string1, string2) {
1905 return _foreign_helper.JS_STRING_CONCAT(string1, string2); 1906 return _foreign_helper.JS_STRING_CONCAT(string1, string2);
1906 } 1907 }
1907 static flattenString(str) { 1908 static flattenString(str) {
1908 return str.charCodeAt(0) == 0 ? str : str; 1909 return str.charCodeAt(0) == 0 ? str : str;
1909 } 1910 }
1910 static getTimeZoneName(receiver) { 1911 static getTimeZoneName(receiver) {
1911 let d = lazyAsJsDate(receiver); 1912 let d = Primitives.lazyAsJsDate(receiver);
1912 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List); 1913 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List);
1913 if (match !== null) 1914 if (match !== null)
1914 return dart.as(match.get(1), core.String); 1915 return dart.as(match.get(1), core.String);
1915 match = dart.as(/^[A-Z,a-z]{3}\s[A-Z,a-z]{3}\s\d+\s\d{2}:\d{2}:\d{2}\s([A- Z]{3,5})\s\d{4}$/.exec(d.toString()), core.List); 1916 match = dart.as(/^[A-Z,a-z]{3}\s[A-Z,a-z]{3}\s\d+\s\d{2}:\d{2}:\d{2}\s([A- Z]{3,5})\s\d{4}$/.exec(d.toString()), core.List);
1916 if (match !== null) 1917 if (match !== null)
1917 return dart.as(match.get(1), core.String); 1918 return dart.as(match.get(1), core.String);
1918 match = dart.as(/(?:GMT|UTC)[+-]\d{4}/.exec(d.toString()), core.List); 1919 match = dart.as(/(?:GMT|UTC)[+-]\d{4}/.exec(d.toString()), core.List);
1919 if (match !== null) 1920 if (match !== null)
1920 return dart.as(match.get(0), core.String); 1921 return dart.as(match.get(0), core.String);
1921 return ""; 1922 return "";
1922 } 1923 }
1923 static getTimeZoneOffsetInMinutes(receiver) { 1924 static getTimeZoneOffsetInMinutes(receiver) {
1924 return -lazyAsJsDate(receiver).getTimezoneOffset(); 1925 return -Primitives.lazyAsJsDate(receiver).getTimezoneOffset();
1925 } 1926 }
1926 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m illiseconds, isUtc) { 1927 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m illiseconds, isUtc) {
1927 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; 1928 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
1928 checkInt(years); 1929 checkInt(years);
1929 checkInt(month); 1930 checkInt(month);
1930 checkInt(day); 1931 checkInt(day);
1931 checkInt(hours); 1932 checkInt(hours);
1932 checkInt(minutes); 1933 checkInt(minutes);
1933 checkInt(seconds); 1934 checkInt(seconds);
1934 checkInt(milliseconds); 1935 checkInt(milliseconds);
1935 checkBool(isUtc); 1936 checkBool(isUtc);
1936 let jsMonth = dart.dbinary(month, '-', 1); 1937 let jsMonth = dart.dbinary(month, '-', 1);
1937 let value = null; 1938 let value = null;
1938 if (isUtc) { 1939 if (isUtc) {
1939 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds); 1940 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds);
1940 } else { 1941 } else {
1941 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf(); 1942 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf();
1942 } 1943 }
1943 if (core.bool['||'](dart.dbinary(dart.dload(value, 'isNaN'), '||', dart.db inary(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH))), dart.dbinary(va lue, '>', MAX_MILLISECONDS_SINCE_EPOCH))) { 1944 if (core.bool['||'](dart.dbinary(dart.dload(value, 'isNaN'), '||', dart.db inary(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH))), dart.dbinary(va lue, '>', MAX_MILLISECONDS_SINCE_EPOCH))) {
1944 return null; 1945 return null;
1945 } 1946 }
1946 if (dart.dbinary(dart.dbinary(years, '<=', 0), '||', dart.dbinary(years, ' <', 100))) 1947 if (dart.dbinary(dart.dbinary(years, '<=', 0), '||', dart.dbinary(years, ' <', 100)))
1947 return patchUpY2K(value, years, isUtc); 1948 return Primitives.patchUpY2K(value, years, isUtc);
1948 return value; 1949 return value;
1949 } 1950 }
1950 static patchUpY2K(value, years, isUtc) { 1951 static patchUpY2K(value, years, isUtc) {
1951 let date = new Date(value); 1952 let date = new Date(value);
1952 if (isUtc) { 1953 if (isUtc) {
1953 date.setUTCFullYear(years); 1954 date.setUTCFullYear(years);
1954 } else { 1955 } else {
1955 date.setFullYear(years); 1956 date.setFullYear(years);
1956 } 1957 }
1957 return date.valueOf(); 1958 return date.valueOf();
1958 } 1959 }
1959 static lazyAsJsDate(receiver) { 1960 static lazyAsJsDate(receiver) {
1960 if (receiver.date === void 0) { 1961 if (receiver.date === void 0) {
1961 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch')) ; 1962 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch')) ;
1962 } 1963 }
1963 return receiver.date; 1964 return receiver.date;
1964 } 1965 }
1965 static getYear(receiver) { 1966 static getYear(receiver) {
1966 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCFullYe ar() + 0 : lazyAsJsDate(receiver).getFullYear() + 0; 1967 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCFullYear() + 0 : Primitives.lazyAsJsDate(receiver).getFullYear() + 0;
1967 } 1968 }
1968 static getMonth(receiver) { 1969 static getMonth(receiver) {
1969 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMonth( ) + 1 : lazyAsJsDate(receiver).getMonth() + 1; 1970 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCMonth() + 1 : Primitives.lazyAsJsDate(receiver).getMonth() + 1;
1970 } 1971 }
1971 static getDay(receiver) { 1972 static getDay(receiver) {
1972 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCDate() + 0 : lazyAsJsDate(receiver).getDate() + 0; 1973 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCDate() + 0 : Primitives.lazyAsJsDate(receiver).getDate() + 0;
1973 } 1974 }
1974 static getHours(receiver) { 1975 static getHours(receiver) {
1975 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCHours( ) + 0 : lazyAsJsDate(receiver).getHours() + 0; 1976 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCHours() + 0 : Primitives.lazyAsJsDate(receiver).getHours() + 0;
1976 } 1977 }
1977 static getMinutes(receiver) { 1978 static getMinutes(receiver) {
1978 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMinute s() + 0 : lazyAsJsDate(receiver).getMinutes() + 0; 1979 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCMinutes() + 0 : Primitives.lazyAsJsDate(receiver).getMinutes() + 0;
1979 } 1980 }
1980 static getSeconds(receiver) { 1981 static getSeconds(receiver) {
1981 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCSecond s() + 0 : lazyAsJsDate(receiver).getSeconds() + 0; 1982 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCSeconds() + 0 : Primitives.lazyAsJsDate(receiver).getSeconds() + 0;
1982 } 1983 }
1983 static getMilliseconds(receiver) { 1984 static getMilliseconds(receiver) {
1984 return dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUTCMillis econds() + 0 : lazyAsJsDate(receiver).getMilliseconds() + 0; 1985 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCMilliseconds() + 0 : Primitives.lazyAsJsDate(receiver).getMilliseconds() + 0;
1985 } 1986 }
1986 static getWeekday(receiver) { 1987 static getWeekday(receiver) {
1987 let weekday = dart.dload(receiver, 'isUtc') ? lazyAsJsDate(receiver).getUT CDay() + 0 : lazyAsJsDate(receiver).getDay() + 0; 1988 let weekday = dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(rece iver).getUTCDay() + 0 : Primitives.lazyAsJsDate(receiver).getDay() + 0;
1988 return (dart.notNull(weekday) + 6) % 7 + 1; 1989 return (dart.notNull(weekday) + 6) % 7 + 1;
1989 } 1990 }
1990 static valueFromDateString(str) { 1991 static valueFromDateString(str) {
1991 if (!(typeof str == string)) 1992 if (!(typeof str == string))
1992 throw new core.ArgumentError(str); 1993 throw new core.ArgumentError(str);
1993 let value = Date.parse(str); 1994 let value = Date.parse(str);
1994 if (value.isNaN) 1995 if (value.isNaN)
1995 throw new core.ArgumentError(str); 1996 throw new core.ArgumentError(str);
1996 return value; 1997 return value;
1997 } 1998 }
1998 static getProperty(object, key) { 1999 static getProperty(object, key) {
1999 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) { 2000 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) {
2000 throw new core.ArgumentError(object); 2001 throw new core.ArgumentError(object);
2001 } 2002 }
2002 return object[key]; 2003 return object[key];
2003 } 2004 }
2004 static setProperty(object, key, value) { 2005 static setProperty(object, key, value) {
2005 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) { 2006 if (dart.notNull(object === null) || dart.notNull(typeof object == boolean ) || dart.notNull(dart.is(object, core.num)) || dart.notNull(typeof object == st ring)) {
2006 throw new core.ArgumentError(object); 2007 throw new core.ArgumentError(object);
2007 } 2008 }
2008 object[key] = value; 2009 object[key] = value;
2009 } 2010 }
2010 static functionNoSuchMethod(func, positionalArguments, namedArguments) { 2011 static functionNoSuchMethod(func, positionalArguments, namedArguments) {
2011 let argumentCount = 0; 2012 let argumentCount = 0;
2012 let arguments = new List.from([]); 2013 let arguments$ = new List.from([]);
2013 let namedArgumentList = new List.from([]); 2014 let namedArgumentList = new List.from([]);
2014 if (positionalArguments !== null) { 2015 if (positionalArguments !== null) {
2015 argumentCount = positionalArguments.length; 2016 argumentCount = positionalArguments.length;
2016 arguments.addAll(positionalArguments); 2017 arguments$.addAll(positionalArguments);
2017 } 2018 }
2018 let names = ''; 2019 let names = '';
2019 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) { 2020 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) {
2020 namedArguments.forEach(((name, argument) => { 2021 namedArguments.forEach(((name, argument) => {
2021 names = `${names}$${name}`; 2022 names = `${names}$${name}`;
2022 namedArgumentList.add(name); 2023 namedArgumentList.add(name);
2023 arguments.add(argument); 2024 arguments$.add(argument);
2024 argumentCount = dart.notNull(argumentCount) + 1; 2025 argumentCount = dart.notNull(argumentCount) + 1;
2025 }).bind(this)); 2026 }).bind(this));
2026 } 2027 }
2027 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`; 2028 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`;
2028 return dart.dinvoke(func, 'noSuchMethod', createUnmangledInvocationMirror( dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMir ror.METHOD, arguments, namedArgumentList)); 2029 return dart.dinvoke(func, 'noSuchMethod', createUnmangledInvocationMirror( dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMir ror.METHOD, arguments$, namedArgumentList));
2029 } 2030 }
2030 static applyFunction(func, positionalArguments, namedArguments) { 2031 static applyFunction(func, positionalArguments, namedArguments) {
2031 return namedArguments === null ? applyFunctionWithPositionalArguments(func , positionalArguments) : applyFunctionWithNamedArguments(func, positionalArgumen ts, namedArguments); 2032 return namedArguments === null ? Primitives.applyFunctionWithPositionalArg uments(func, positionalArguments) : Primitives.applyFunctionWithNamedArguments(f unc, positionalArguments, namedArguments);
2032 } 2033 }
2033 static applyFunctionWithPositionalArguments(func, positionalArguments) { 2034 static applyFunctionWithPositionalArguments(func, positionalArguments) {
2034 let argumentCount = 0; 2035 let argumentCount = 0;
2035 let arguments = null; 2036 let arguments$ = null;
2036 if (positionalArguments !== null) { 2037 if (positionalArguments !== null) {
2037 if (positionalArguments instanceof Array) { 2038 if (positionalArguments instanceof Array) {
2038 arguments = positionalArguments; 2039 arguments$ = positionalArguments;
2039 } else { 2040 } else {
2040 arguments = new core.List.from(positionalArguments); 2041 arguments$ = new core.List.from(positionalArguments);
2041 } 2042 }
2042 argumentCount = arguments.length; 2043 argumentCount = arguments$.length;
2043 } else { 2044 } else {
2044 arguments = new List.from([]); 2045 arguments$ = new List.from([]);
2045 } 2046 }
2046 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}`; 2047 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}`;
2047 let jsFunction = func[selectorName]; 2048 let jsFunction = func[selectorName];
2048 if (jsFunction === null) { 2049 if (jsFunction === null) {
2049 return functionNoSuchMethod(func, positionalArguments, null); 2050 return Primitives.functionNoSuchMethod(func, positionalArguments, null);
2050 } 2051 }
2051 return jsFunction.apply(func, arguments); 2052 return jsFunction.apply(func, arguments$);
2052 } 2053 }
2053 static applyFunctionWithNamedArguments(func, positionalArguments, namedArgum ents) { 2054 static applyFunctionWithNamedArguments(func, positionalArguments, namedArgum ents) {
2054 if (namedArguments.isEmpty) { 2055 if (namedArguments.isEmpty) {
2055 return applyFunctionWithPositionalArguments(func, positionalArguments); 2056 return Primitives.applyFunctionWithPositionalArguments(func, positionalA rguments);
2056 } 2057 }
2057 let interceptor = _interceptors.getInterceptor(func); 2058 let interceptor = _interceptors.getInterceptor(func);
2058 let jsFunction = interceptor["call*"]; 2059 let jsFunction = interceptor["call*"];
2059 if (jsFunction === null) { 2060 if (jsFunction === null) {
2060 return functionNoSuchMethod(func, positionalArguments, namedArguments); 2061 return Primitives.functionNoSuchMethod(func, positionalArguments, namedA rguments);
2061 } 2062 }
2062 let info = new ReflectionInfo(jsFunction); 2063 let info = new ReflectionInfo(jsFunction);
2063 if (dart.notNull(info === null) || !dart.notNull(info.areOptionalParameter sNamed)) { 2064 if (dart.notNull(info === null) || !dart.notNull(info.areOptionalParameter sNamed)) {
2064 return functionNoSuchMethod(func, positionalArguments, namedArguments); 2065 return Primitives.functionNoSuchMethod(func, positionalArguments, namedA rguments);
2065 } 2066 }
2066 if (positionalArguments !== null) { 2067 if (positionalArguments !== null) {
2067 positionalArguments = new core.List.from(positionalArguments); 2068 positionalArguments = new core.List.from(positionalArguments);
2068 } else { 2069 } else {
2069 positionalArguments = new List.from([]); 2070 positionalArguments = new List.from([]);
2070 } 2071 }
2071 if (info.requiredParameterCount !== positionalArguments.length) { 2072 if (info.requiredParameterCount !== positionalArguments.length) {
2072 return functionNoSuchMethod(func, positionalArguments, namedArguments); 2073 return Primitives.functionNoSuchMethod(func, positionalArguments, namedA rguments);
2073 } 2074 }
2074 let defaultArguments = new core.Map(); 2075 let defaultArguments = new core.Map();
2075 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) { 2076 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) {
2076 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount); 2077 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount);
2077 let parameterName = info.parameterNameInOrder(index); 2078 let parameterName = info.parameterNameInOrder(index);
2078 let value = info.defaultValueInOrder(index); 2079 let value = info.defaultValueInOrder(index);
2079 let defaultValue = getMetadata(value); 2080 let defaultValue = getMetadata(value);
2080 defaultArguments.set(parameterName, defaultValue); 2081 defaultArguments.set(parameterName, defaultValue);
2081 } 2082 }
2082 let bad = false; 2083 let bad = false;
2083 namedArguments.forEach(((parameter, value) => { 2084 namedArguments.forEach(((parameter, value) => {
2084 if (defaultArguments.containsKey(parameter)) { 2085 if (defaultArguments.containsKey(parameter)) {
2085 defaultArguments.set(parameter, value); 2086 defaultArguments.set(parameter, value);
2086 } else { 2087 } else {
2087 bad = true; 2088 bad = true;
2088 } 2089 }
2089 }).bind(this)); 2090 }).bind(this));
2090 if (bad) { 2091 if (bad) {
2091 return functionNoSuchMethod(func, positionalArguments, namedArguments); 2092 return Primitives.functionNoSuchMethod(func, positionalArguments, namedA rguments);
2092 } 2093 }
2093 positionalArguments.addAll(defaultArguments.values); 2094 positionalArguments.addAll(defaultArguments.values);
2094 return jsFunction.apply(func, positionalArguments); 2095 return jsFunction.apply(func, positionalArguments);
2095 } 2096 }
2096 static [_mangledNameMatchesType](mangledName, type) { 2097 static [_mangledNameMatchesType](mangledName, type) {
2097 return mangledName == type[_typeName]; 2098 return mangledName == type[_typeName];
2098 } 2099 }
2099 static identicalImplementation(a, b) { 2100 static identicalImplementation(a, b) {
2100 return a == null ? b == null : a === b; 2101 return a == null ? b == null : a === b;
2101 } 2102 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 return "$receiver$"; 2259 return "$receiver$";
2259 } 2260 }
2260 }; 2261 };
2261 } 2262 }
2262 static extractPattern(message) { 2263 static extractPattern(message) {
2263 message = message.replace(String({}), '$receiver$'); 2264 message = message.replace(String({}), '$receiver$');
2264 message = message.replace(new RegExp(ESCAPE_REGEXP, 'g'), '\\$&'); 2265 message = message.replace(new RegExp(ESCAPE_REGEXP, 'g'), '\\$&');
2265 let match = dart.as(message.match(/\\\$[a-zA-Z]+\\\$/g), core.List$(core.S tring)); 2266 let match = dart.as(message.match(/\\\$[a-zA-Z]+\\\$/g), core.List$(core.S tring));
2266 if (match === null) 2267 if (match === null)
2267 match = dart.as(new List.from([]), core.List$(core.String)); 2268 match = dart.as(new List.from([]), core.List$(core.String));
2268 let arguments = match.indexOf('\\$arguments\\$'); 2269 let arguments$ = match.indexOf('\\$arguments\\$');
2269 let argumentsExpr = match.indexOf('\\$argumentsExpr\\$'); 2270 let argumentsExpr = match.indexOf('\\$argumentsExpr\\$');
2270 let expr = match.indexOf('\\$expr\\$'); 2271 let expr = match.indexOf('\\$expr\\$');
2271 let method = match.indexOf('\\$method\\$'); 2272 let method = match.indexOf('\\$method\\$');
2272 let receiver = match.indexOf('\\$receiver\\$'); 2273 let receiver = match.indexOf('\\$receiver\\$');
2273 let pattern = message.replace('\\$arguments\\$', '((?:x|[^x])*)').replace( '\\$argumentsExpr\\$', '((?:x|[^x])*)').replace('\\$expr\\$', '((?:x|[^x])*)').r eplace('\\$method\\$', '((?:x|[^x])*)').replace('\\$receiver\\$', '((?:x|[^x])*) '); 2274 let pattern = message.replace('\\$arguments\\$', '((?:x|[^x])*)').replace( '\\$argumentsExpr\\$', '((?:x|[^x])*)').replace('\\$expr\\$', '((?:x|[^x])*)').r eplace('\\$method\\$', '((?:x|[^x])*)').replace('\\$receiver\\$', '((?:x|[^x])*) ');
2274 return new TypeErrorDecoder(arguments, argumentsExpr, expr, method, receiv er, pattern); 2275 return new TypeErrorDecoder(arguments$, argumentsExpr, expr, method, recei ver, pattern);
2275 } 2276 }
2276 static provokeCallErrorOn(expression) { 2277 static provokeCallErrorOn(expression) {
2277 let func = function($expr$) { 2278 let func = function($expr$) {
2278 var $argumentsExpr$ = '$arguments$'; 2279 var $argumentsExpr$ = '$arguments$';
2279 try { 2280 try {
2280 $expr$.$method$($argumentsExpr$); 2281 $expr$.$method$($argumentsExpr$);
2281 } catch (e) { 2282 } catch (e) {
2282 return e.message; 2283 return e.message;
2283 } 2284 }
2284 2285
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 } catch (e) { 2339 } catch (e) {
2339 return e.message; 2340 return e.message;
2340 } 2341 }
2341 2342
2342 }; 2343 };
2343 return func(); 2344 return func();
2344 } 2345 }
2345 } 2346 }
2346 dart.defineLazyProperties(TypeErrorDecoder, { 2347 dart.defineLazyProperties(TypeErrorDecoder, {
2347 get noSuchMethodPattern() { 2348 get noSuchMethodPattern() {
2348 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObject())) , TypeErrorDecoder); 2349 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokeCal lErrorOn(TypeErrorDecoder.buildJavaScriptObject())), TypeErrorDecoder);
2349 }, 2350 },
2350 get notClosurePattern() { 2351 get notClosurePattern() {
2351 return dart.as(extractPattern(provokeCallErrorOn(buildJavaScriptObjectWith NonClosure())), TypeErrorDecoder); 2352 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokeCal lErrorOn(TypeErrorDecoder.buildJavaScriptObjectWithNonClosure())), TypeErrorDeco der);
2352 }, 2353 },
2353 get nullCallPattern() { 2354 get nullCallPattern() {
2354 return dart.as(extractPattern(provokeCallErrorOn(null)), TypeErrorDecoder) ; 2355 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokeCal lErrorOn(null)), TypeErrorDecoder);
2355 }, 2356 },
2356 get nullLiteralCallPattern() { 2357 get nullLiteralCallPattern() {
2357 return dart.as(extractPattern(provokeCallErrorOnNull()), TypeErrorDecoder) ; 2358 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokeCal lErrorOnNull()), TypeErrorDecoder);
2358 }, 2359 },
2359 get undefinedCallPattern() { 2360 get undefinedCallPattern() {
2360 return dart.as(extractPattern(provokeCallErrorOn(void 0)), TypeErrorDecode r); 2361 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokeCal lErrorOn(void 0)), TypeErrorDecoder);
2361 }, 2362 },
2362 get undefinedLiteralCallPattern() { 2363 get undefinedLiteralCallPattern() {
2363 return dart.as(extractPattern(provokeCallErrorOnUndefined()), TypeErrorDec oder); 2364 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokeCal lErrorOnUndefined()), TypeErrorDecoder);
2364 }, 2365 },
2365 get nullPropertyPattern() { 2366 get nullPropertyPattern() {
2366 return dart.as(extractPattern(provokePropertyErrorOn(null)), TypeErrorDeco der); 2367 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokePro pertyErrorOn(null)), TypeErrorDecoder);
2367 }, 2368 },
2368 get nullLiteralPropertyPattern() { 2369 get nullLiteralPropertyPattern() {
2369 return dart.as(extractPattern(provokePropertyErrorOnNull()), TypeErrorDeco der); 2370 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokePro pertyErrorOnNull()), TypeErrorDecoder);
2370 }, 2371 },
2371 get undefinedPropertyPattern() { 2372 get undefinedPropertyPattern() {
2372 return dart.as(extractPattern(provokePropertyErrorOn(void 0)), TypeErrorDe coder); 2373 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokePro pertyErrorOn(void 0)), TypeErrorDecoder);
2373 }, 2374 },
2374 get undefinedLiteralPropertyPattern() { 2375 get undefinedLiteralPropertyPattern() {
2375 return dart.as(extractPattern(provokePropertyErrorOnUndefined()), TypeErro rDecoder); 2376 return dart.as(TypeErrorDecoder.extractPattern(TypeErrorDecoder.provokePro pertyErrorOnUndefined()), TypeErrorDecoder);
2376 } 2377 }
2377 }); 2378 });
2378 let _message = Symbol('_message'); 2379 let _message = Symbol('_message');
2379 class NullError extends core.Error { 2380 class NullError extends core.Error {
2380 NullError(message$, match) { 2381 NullError(message$, match) {
2381 this[_message] = message$; 2382 this[_message] = message$;
2382 this[_method] = dart.as(match === null ? null : match.method, core.String) ; 2383 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
2383 super.Error(); 2384 super.Error();
2384 } 2385 }
2385 toString() { 2386 toString() {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 let func = functions[0]; 2567 let func = functions[0];
2567 let name = dart.as(func.$stubName, core.String); 2568 let name = dart.as(func.$stubName, core.String);
2568 let callName = dart.as(func.$callName, core.String); 2569 let callName = dart.as(func.$callName, core.String);
2569 func.$reflectionInfo = reflectionInfo; 2570 func.$reflectionInfo = reflectionInfo;
2570 let info = new ReflectionInfo(func); 2571 let info = new ReflectionInfo(func);
2571 let functionType = info.functionType; 2572 let functionType = info.functionType;
2572 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype); 2573 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
2573 prototype.$initialize = prototype.constructor; 2574 prototype.$initialize = prototype.constructor;
2574 let constructor = isStatic ? function() { 2575 let constructor = isStatic ? function() {
2575 this.$initialize(); 2576 this.$initialize();
2576 } : isCsp ? function(a, b, c, d) { 2577 } : Closure.isCsp ? function(a, b, c, d) {
2577 this.$initialize(a, b, c, d); 2578 this.$initialize(a, b, c, d);
2578 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x$) => functionCounter = dart.notNull(x$) + 1, x$)(functionCounter)); 2579 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + ((x$) => Closure.functionCounter = dart.notNull(x$) + 1, x$)(Closure.functionCounter)) ;
2579 prototype.constructor = constructor; 2580 prototype.constructor = constructor;
2580 constructor.prototype = prototype; 2581 constructor.prototype = prototype;
2581 let trampoline = func; 2582 let trampoline = func;
2582 let isIntercepted = false; 2583 let isIntercepted = false;
2583 if (!dart.notNull(isStatic)) { 2584 if (!dart.notNull(isStatic)) {
2584 if (jsArguments.length == 1) { 2585 if (jsArguments.length == 1) {
2585 isIntercepted = true; 2586 isIntercepted = true;
2586 } 2587 }
2587 trampoline = forwardCallTo(receiver, func, isIntercepted); 2588 trampoline = Closure.forwardCallTo(receiver, func, isIntercepted);
2588 trampoline.$reflectionInfo = reflectionInfo; 2589 trampoline.$reflectionInfo = reflectionInfo;
2589 } else { 2590 } else {
2590 prototype.$name = propertyName; 2591 prototype.$name = propertyName;
2591 } 2592 }
2592 let signatureFunction = null; 2593 let signatureFunction = null;
2593 if (typeof functionType == "number") { 2594 if (typeof functionType == "number") {
2594 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .METADATA); 2595 let metadata = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .METADATA);
2595 signatureFunction = function(s) { 2596 signatureFunction = function(s) {
2596 return function() { 2597 return function() {
2597 return metadata[s]; 2598 return metadata[s];
2598 }; 2599 };
2599 }(functionType); 2600 }(functionType);
2600 } else if (!dart.notNull(isStatic) && typeof functionType == "function") { 2601 } else if (!dart.notNull(isStatic) && typeof functionType == "function") {
2601 let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF( BoundClosure.receiverOf) : _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.se lfOf); 2602 let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF( BoundClosure.receiverOf) : _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.se lfOf);
2602 signatureFunction = function(f, r) { 2603 signatureFunction = function(f, r) {
2603 return function() { 2604 return function() {
2604 return f.apply({$receiver: r(this)}, arguments); 2605 return f.apply({$receiver: r(this)}, arguments$);
2605 }; 2606 };
2606 }(functionType, getReceiver); 2607 }(functionType, getReceiver);
2607 } else { 2608 } else {
2608 throw 'Error in reflectionInfo.'; 2609 throw 'Error in reflectionInfo.';
2609 } 2610 }
2610 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction; 2611 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction;
2611 prototype[callName] = trampoline; 2612 prototype[callName] = trampoline;
2612 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); i = dart .notNull(i) + 1) { 2613 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); i = dart .notNull(i) + 1) {
2613 let stub = functions.get(i); 2614 let stub = functions.get(i);
2614 let stubCallName = stub.$callName; 2615 let stubCallName = stub.$callName;
2615 if (stubCallName !== null) { 2616 if (stubCallName !== null) {
2616 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st ub, isIntercepted); 2617 prototype[stubCallName] = isStatic ? stub : Closure.forwardCallTo(rece iver, stub, isIntercepted);
2617 } 2618 }
2618 } 2619 }
2619 prototype["call*"] = trampoline; 2620 prototype["call*"] = trampoline;
2620 return constructor; 2621 return constructor;
2621 } 2622 }
2622 static cspForwardCall(arity, isSuperCall, stubName, func) { 2623 static cspForwardCall(arity, isSuperCall, stubName, func) {
2623 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2624 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2624 if (isSuperCall) 2625 if (isSuperCall)
2625 arity = -1; 2626 arity = -1;
2626 switch (arity) { 2627 switch (arity) {
(...skipping 29 matching lines...) Expand all
2656 }(stubName, getSelf); 2657 }(stubName, getSelf);
2657 case 5: 2658 case 5:
2658 return function(n, S) { 2659 return function(n, S) {
2659 return function(a, b, c, d, e) { 2660 return function(a, b, c, d, e) {
2660 return S(this)[n](a, b, c, d, e); 2661 return S(this)[n](a, b, c, d, e);
2661 }; 2662 };
2662 }(stubName, getSelf); 2663 }(stubName, getSelf);
2663 default: 2664 default:
2664 return function(f, s) { 2665 return function(f, s) {
2665 return function() { 2666 return function() {
2666 return f.apply(s(this), arguments); 2667 return f.apply(s(this), arguments$);
2667 }; 2668 };
2668 }(func, getSelf); 2669 }(func, getSelf);
2669 } 2670 }
2670 } 2671 }
2671 static get isCsp() { 2672 static get isCsp() {
2672 return typeof dart_precompiled == "function"; 2673 return typeof dart_precompiled == "function";
2673 } 2674 }
2674 static forwardCallTo(receiver, func, isIntercepted) { 2675 static forwardCallTo(receiver, func, isIntercepted) {
2675 if (isIntercepted) 2676 if (isIntercepted)
2676 return forwardInterceptedCallTo(receiver, func); 2677 return Closure.forwardInterceptedCallTo(receiver, func);
2677 let stubName = dart.as(func.$stubName, core.String); 2678 let stubName = dart.as(func.$stubName, core.String);
2678 let arity = func.length; 2679 let arity = func.length;
2679 let lookedUpFunction = receiver[stubName]; 2680 let lookedUpFunction = receiver[stubName];
2680 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2681 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2681 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) { 2682 if (dart.notNull(Closure.isCsp) || dart.notNull(isSuperCall) || dart.notNu ll(arity) >= 27) {
2682 return cspForwardCall(arity, isSuperCall, stubName, func); 2683 return Closure.cspForwardCall(arity, isSuperCall, stubName, func);
2683 } 2684 }
2684 if (arity === 0) { 2685 if (arity === 0) {
2685 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x$) => functionCounter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')(); 2686 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${((x$) => Closure.functionCounter = dart.not Null(x$) + 1, x$)(Closure.functionCounter)}` + '}')();
2686 } 2687 }
2687 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); 2688 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
2688 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(","); 2689 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).j oin(",");
2689 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${((x$) => functionCoun ter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')(); 2690 return new Function(`return function(${arguments$}){` + `return this.${Bou ndClosure.selfFieldName()}.${stubName}(${arguments$});` + `${((x$) => Closure.fu nctionCounter = dart.notNull(x$) + 1, x$)(Closure.functionCounter)}` + '}')();
2690 } 2691 }
2691 static cspForwardInterceptedCall(arity, isSuperCall, name, func) { 2692 static cspForwardInterceptedCall(arity, isSuperCall, name, func) {
2692 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 2693 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2693 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf); 2694 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
2694 if (isSuperCall) 2695 if (isSuperCall)
2695 arity = -1; 2696 arity = -1;
2696 switch (arity) { 2697 switch (arity) {
2697 case 0: 2698 case 0:
2698 throw new RuntimeError('Intercepted function with no arguments.'); 2699 throw new RuntimeError('Intercepted function with no arguments.');
2699 case 1: 2700 case 1:
(...skipping 29 matching lines...) Expand all
2729 case 6: 2730 case 6:
2730 return function(n, s, r) { 2731 return function(n, s, r) {
2731 return function(a, b, c, d, e) { 2732 return function(a, b, c, d, e) {
2732 return s(this)[n](r(this), a, b, c, d, e); 2733 return s(this)[n](r(this), a, b, c, d, e);
2733 }; 2734 };
2734 }(name, getSelf, getReceiver); 2735 }(name, getSelf, getReceiver);
2735 default: 2736 default:
2736 return function(f, s, r, a) { 2737 return function(f, s, r, a) {
2737 return function() { 2738 return function() {
2738 a = [r(this)]; 2739 a = [r(this)];
2739 Array.prototype.push.apply(a, arguments); 2740 Array.prototype.push.apply(a, arguments$);
2740 return f.apply(s(this), a); 2741 return f.apply(s(this), a);
2741 }; 2742 };
2742 }(func, getSelf, getReceiver); 2743 }(func, getSelf, getReceiver);
2743 } 2744 }
2744 } 2745 }
2745 static forwardInterceptedCallTo(receiver, func) { 2746 static forwardInterceptedCallTo(receiver, func) {
2746 let selfField = BoundClosure.selfFieldName(); 2747 let selfField = BoundClosure.selfFieldName();
2747 let receiverField = BoundClosure.receiverFieldName(); 2748 let receiverField = BoundClosure.receiverFieldName();
2748 let stubName = dart.as(func.$stubName, core.String); 2749 let stubName = dart.as(func.$stubName, core.String);
2749 let arity = func.length; 2750 let arity = func.length;
2750 let isCsp = typeof dart_precompiled == "function"; 2751 let isCsp = typeof dart_precompiled == "function";
2751 let lookedUpFunction = receiver[stubName]; 2752 let lookedUpFunction = receiver[stubName];
2752 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction)); 2753 let isSuperCall = !dart.notNull(core.identical(func, lookedUpFunction));
2753 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) { 2754 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
2754 return cspForwardInterceptedCall(arity, isSuperCall, stubName, func); 2755 return Closure.cspForwardInterceptedCall(arity, isSuperCall, stubName, f unc);
2755 } 2756 }
2756 if (arity === 1) { 2757 if (arity === 1) {
2757 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x$) => functionCounter = dart.notNull(x $) + 1, x$)(functionCounter)}` + '}')(); 2758 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${((x$) => Closure.functionCounter = dart.n otNull(x$) + 1, x$)(Closure.functionCounter)}` + '}')();
2758 } 2759 }
2759 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); 2760 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
2760 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(","); 2761 let arguments$ = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.not Null(arity) - 1).join(",");
2761 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${((x$) => function Counter = dart.notNull(x$) + 1, x$)(functionCounter)}` + '}')(); 2762 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)}` + '}')( );
2762 } 2763 }
2763 toString() { 2764 toString() {
2764 return "Closure"; 2765 return "Closure";
2765 } 2766 }
2766 } 2767 }
2767 Closure.FUNCTION_INDEX = 0; 2768 Closure.FUNCTION_INDEX = 0;
2768 Closure.NAME_INDEX = 1; 2769 Closure.NAME_INDEX = 1;
2769 Closure.CALL_NAME_INDEX = 2; 2770 Closure.CALL_NAME_INDEX = 2;
2770 Closure.REQUIRED_PARAMETER_INDEX = 3; 2771 Closure.REQUIRED_PARAMETER_INDEX = 3;
2771 Closure.OPTIONAL_PARAMETER_INDEX = 4; 2772 Closure.OPTIONAL_PARAMETER_INDEX = 4;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 static targetOf(closure) { 2813 static targetOf(closure) {
2813 return closure[_target]; 2814 return closure[_target];
2814 } 2815 }
2815 static receiverOf(closure) { 2816 static receiverOf(closure) {
2816 return closure[_receiver]; 2817 return closure[_receiver];
2817 } 2818 }
2818 static nameOf(closure) { 2819 static nameOf(closure) {
2819 return closure[_name]; 2820 return closure[_name];
2820 } 2821 }
2821 static selfFieldName() { 2822 static selfFieldName() {
2822 if (selfFieldNameCache === null) { 2823 if (BoundClosure.selfFieldNameCache === null) {
2823 selfFieldNameCache = computeFieldNamed('self'); 2824 BoundClosure.selfFieldNameCache = BoundClosure.computeFieldNamed('self') ;
2824 } 2825 }
2825 return selfFieldNameCache; 2826 return BoundClosure.selfFieldNameCache;
2826 } 2827 }
2827 static receiverFieldName() { 2828 static receiverFieldName() {
2828 if (receiverFieldNameCache === null) { 2829 if (BoundClosure.receiverFieldNameCache === null) {
2829 receiverFieldNameCache = computeFieldNamed('receiver'); 2830 BoundClosure.receiverFieldNameCache = BoundClosure.computeFieldNamed('re ceiver');
2830 } 2831 }
2831 return receiverFieldNameCache; 2832 return BoundClosure.receiverFieldNameCache;
2832 } 2833 }
2833 static computeFieldNamed(fieldName) { 2834 static computeFieldNamed(fieldName) {
2834 let template = new BoundClosure('self', 'target', 'receiver', 'name'); 2835 let template = new BoundClosure('self', 'target', 'receiver', 'name');
2835 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope rtyNames(template), core.List)); 2836 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope rtyNames(template), core.List));
2836 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.not Null(i) + 1) { 2837 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.not Null(i) + 1) {
2837 let name = names.get(i); 2838 let name = names.get(i);
2838 if (template[name] === fieldName) { 2839 if (template[name] === fieldName) {
2839 return name; 2840 return name;
2840 } 2841 }
2841 } 2842 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 if (dart.is(condition, core.Function)) 3178 if (dart.is(condition, core.Function))
3178 condition = dart.dinvokef(condition); 3179 condition = dart.dinvokef(condition);
3179 if (!(typeof condition == boolean)) { 3180 if (!(typeof condition == boolean)) {
3180 throw new TypeErrorImplementation(condition, 'bool'); 3181 throw new TypeErrorImplementation(condition, 'bool');
3181 } 3182 }
3182 } 3183 }
3183 if (true !== condition) 3184 if (true !== condition)
3184 throw new core.AssertionError(); 3185 throw new core.AssertionError();
3185 } 3186 }
3186 // Function throwNoSuchMethod: (dynamic, dynamic, dynamic, dynamic) → void 3187 // Function throwNoSuchMethod: (dynamic, dynamic, dynamic, dynamic) → void
3187 function throwNoSuchMethod(obj, name, arguments, expectedArgumentNames) { 3188 function throwNoSuchMethod(obj, name, arguments$, expectedArgumentNames) {
3188 let memberName = new _internal.Symbol.unvalidated(dart.as(name, core.String) ); 3189 let memberName = new _internal.Symbol.unvalidated(dart.as(name, core.String) );
3189 throw new core.NoSuchMethodError(obj, memberName, dart.as(arguments, core.Li st), new core.Map(), dart.as(expectedArgumentNames, core.List)); 3190 throw new core.NoSuchMethodError(obj, memberName, dart.as(arguments$, core.L ist), new core.Map(), dart.as(expectedArgumentNames, core.List));
3190 } 3191 }
3191 // Function throwCyclicInit: (String) → void 3192 // Function throwCyclicInit: (String) → void
3192 function throwCyclicInit(staticName) { 3193 function throwCyclicInit(staticName) {
3193 throw new core.CyclicInitializationError(`Cyclic initialization for static $ {staticName}`); 3194 throw new core.CyclicInitializationError(`Cyclic initialization for static $ {staticName}`);
3194 } 3195 }
3195 class RuntimeError extends core.Error { 3196 class RuntimeError extends core.Error {
3196 RuntimeError(message) { 3197 RuntimeError(message) {
3197 this.message = message; 3198 this.message = message;
3198 super.Error(); 3199 super.Error();
3199 } 3200 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3231 return dart.is(this.returnType, VoidRuntimeType); 3232 return dart.is(this.returnType, VoidRuntimeType);
3232 } 3233 }
3233 [_isTest](expression) { 3234 [_isTest](expression) {
3234 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression); 3235 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression);
3235 return functionTypeObject === null ? false : isFunctionSubtype(functionTyp eObject, this.toRti()); 3236 return functionTypeObject === null ? false : isFunctionSubtype(functionTyp eObject, this.toRti());
3236 } 3237 }
3237 [_asCheck](expression) { 3238 [_asCheck](expression) {
3238 return this[_check](expression, true); 3239 return this[_check](expression, true);
3239 } 3240 }
3240 [_assertCheck](expression) { 3241 [_assertCheck](expression) {
3241 if (inAssert) 3242 if (RuntimeFunctionType.inAssert)
3242 return null; 3243 return null;
3243 inAssert = true; 3244 RuntimeFunctionType.inAssert = true;
3244 try { 3245 try {
3245 return this[_check](expression, false); 3246 return this[_check](expression, false);
3246 } finally { 3247 } finally {
3247 inAssert = false; 3248 RuntimeFunctionType.inAssert = false;
3248 } 3249 }
3249 } 3250 }
3250 [_check](expression, isCast) { 3251 [_check](expression, isCast) {
3251 if (expression === null) 3252 if (expression === null)
3252 return null; 3253 return null;
3253 if (this[_isTest](expression)) 3254 if (this[_isTest](expression))
3254 return expression; 3255 return expression;
3255 let self = new FunctionTypeInfoDecoderRing(this.toRti()).toString(); 3256 let self = new FunctionTypeInfoDecoderRing(this.toRti()).toString();
3256 if (isCast) { 3257 if (isCast) {
3257 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression ); 3258 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression );
(...skipping 15 matching lines...) Expand all
3273 toRti() { 3274 toRti() {
3274 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"}; 3275 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"};
3275 if (this.isVoid) { 3276 if (this.isVoid) {
3276 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true; 3277 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true;
3277 } else { 3278 } else {
3278 if (!dart.is(this.returnType, DynamicRuntimeType)) { 3279 if (!dart.is(this.returnType, DynamicRuntimeType)) {
3279 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu rnType.toRti(); 3280 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu rnType.toRti();
3280 } 3281 }
3281 } 3282 }
3282 if (dart.notNull(this.parameterTypes !== null) && !dart.notNull(this.param eterTypes.isEmpty)) { 3283 if (dart.notNull(this.parameterTypes !== null) && !dart.notNull(this.param eterTypes.isEmpty)) {
3283 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = lis tToRti(this.parameterTypes); 3284 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = Run timeFunctionType.listToRti(this.parameterTypes);
3284 } 3285 }
3285 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) { 3286 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) {
3286 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = lis tToRti(this.optionalParameterTypes); 3287 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = Run timeFunctionType.listToRti(this.optionalParameterTypes);
3287 } 3288 }
3288 if (this.namedParameters !== null) { 3289 if (this.namedParameters !== null) {
3289 let namedRti = Object.create(null); 3290 let namedRti = Object.create(null);
3290 let keys = _js_names.extractKeys(this.namedParameters); 3291 let keys = _js_names.extractKeys(this.namedParameters);
3291 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.no tNull(i) + 1) { 3292 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.no tNull(i) + 1) {
3292 let name = keys.get(i); 3293 let name = keys.get(i);
3293 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 3294 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
3294 namedRti[name] = rti; 3295 namedRti[name] = rti;
3295 } 3296 }
3296 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti; 3297 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 } 3418 }
3418 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType 3419 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType
3419 function convertRtiToRuntimeType(rti) { 3420 function convertRtiToRuntimeType(rti) {
3420 if (rti === null) { 3421 if (rti === null) {
3421 return getDynamicRuntimeType(); 3422 return getDynamicRuntimeType();
3422 } else if (typeof rti == "function") { 3423 } else if (typeof rti == "function") {
3423 return new RuntimeTypePlain(rti.name); 3424 return new RuntimeTypePlain(rti.name);
3424 } else if (rti.constructor == Array) { 3425 } else if (rti.constructor == Array) {
3425 let list = dart.as(rti, core.List); 3426 let list = dart.as(rti, core.List);
3426 let name = list.get(0).name; 3427 let name = list.get(0).name;
3427 let arguments = new List.from([]); 3428 let arguments$ = new List.from([]);
3428 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notN ull(i) + 1) { 3429 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notN ull(i) + 1) {
3429 arguments.add(convertRtiToRuntimeType(list.get(i))); 3430 arguments$.add(convertRtiToRuntimeType(list.get(i)));
3430 } 3431 }
3431 return new RuntimeTypeGeneric(name, dart.as(arguments, core.List$(RuntimeT ype)), rti); 3432 return new RuntimeTypeGeneric(name, dart.as(arguments$, core.List$(Runtime Type)), rti);
3432 } else if ("func" in rti) { 3433 } else if ("func" in rti) {
3433 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType(); 3434 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType();
3434 } else { 3435 } else {
3435 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru ntimeType.`); 3436 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru ntimeType.`);
3436 } 3437 }
3437 } 3438 }
3438 class RuntimeTypePlain extends RuntimeType { 3439 class RuntimeTypePlain extends RuntimeType {
3439 RuntimeTypePlain(name) { 3440 RuntimeTypePlain(name) {
3440 this.name = name; 3441 this.name = name;
3441 super.RuntimeType(); 3442 super.RuntimeType();
3442 } 3443 }
3443 toRti() { 3444 toRti() {
3444 let allClasses = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .ALL_CLASSES); 3445 let allClasses = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .ALL_CLASSES);
3445 let rti = allClasses[this.name]; 3446 let rti = allClasses[this.name];
3446 if (rti === null) 3447 if (rti === null)
3447 throw `no type for '${this.name}'`; 3448 throw `no type for '${this.name}'`;
3448 return rti; 3449 return rti;
3449 } 3450 }
3450 toString() { 3451 toString() {
3451 return this.name; 3452 return this.name;
3452 } 3453 }
3453 } 3454 }
3454 class RuntimeTypeGeneric extends RuntimeType { 3455 class RuntimeTypeGeneric extends RuntimeType {
3455 RuntimeTypeGeneric(name, arguments, rti) { 3456 RuntimeTypeGeneric(name, arguments$, rti) {
3456 this.name = name; 3457 this.name = name;
3457 this.arguments = arguments; 3458 this.arguments = arguments$;
3458 this.rti = rti; 3459 this.rti = rti;
3459 super.RuntimeType(); 3460 super.RuntimeType();
3460 } 3461 }
3461 toRti() { 3462 toRti() {
3462 if (this.rti !== null) 3463 if (this.rti !== null)
3463 return this.rti; 3464 return this.rti;
3464 let allClasses = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .ALL_CLASSES); 3465 let allClasses = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .ALL_CLASSES);
3465 let result = [allClasses[this.name]]; 3466 let result = [allClasses[this.name]];
3466 if (dart.dindex(result, 0) === null) { 3467 if (dart.dindex(result, 0) === null) {
3467 throw `no type for '${this.name}<...>'`; 3468 throw `no type for '${this.name}<...>'`;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError; 3951 exports.UnimplementedNoSuchMethodError = UnimplementedNoSuchMethodError;
3951 exports.random64 = random64; 3952 exports.random64 = random64;
3952 exports.jsonEncodeNative = jsonEncodeNative; 3953 exports.jsonEncodeNative = jsonEncodeNative;
3953 exports.getIsolateAffinityTag = getIsolateAffinityTag; 3954 exports.getIsolateAffinityTag = getIsolateAffinityTag;
3954 exports.loadDeferredLibrary = loadDeferredLibrary; 3955 exports.loadDeferredLibrary = loadDeferredLibrary;
3955 exports.MainError = MainError; 3956 exports.MainError = MainError;
3956 exports.missingMain = missingMain; 3957 exports.missingMain = missingMain;
3957 exports.badMain = badMain; 3958 exports.badMain = badMain;
3958 exports.mainHasTooManyParameters = mainHasTooManyParameters; 3959 exports.mainHasTooManyParameters = mainHasTooManyParameters;
3959 })(_js_helper || (_js_helper = {})); 3960 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698