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

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

Issue 963343002: implement private members, fixes #74 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 let _memberName = Symbol('_memberName');
5 let _internalName = Symbol('_internalName');
6 let _kind = Symbol('_kind');
7 let _arguments = Symbol('_arguments');
8 let _namedArgumentNames = Symbol('_namedArgumentNames');
9 let _namedIndices = Symbol('_namedIndices');
10 let _getCachedInvocation = Symbol('_getCachedInvocation');
11 let _throwFormatException = Symbol('_throwFormatException');
12 let _fromCharCodeApply = Symbol('_fromCharCodeApply');
13 let _mangledNameMatchesType = Symbol('_mangledNameMatchesType');
14 let _typeName = Symbol('_typeName');
15 let _argumentsExpr = Symbol('_argumentsExpr');
16 let _expr = Symbol('_expr');
17 let _method = Symbol('_method');
18 let _receiver = Symbol('_receiver');
19 let _pattern = Symbol('_pattern');
20 let _message = Symbol('_message');
21 let _exception = Symbol('_exception');
22 let _trace = Symbol('_trace');
23 let _self = Symbol('_self');
24 let _target = Symbol('_target');
25 let _name = Symbol('_name');
26 let _isTest = Symbol('_isTest');
27 let _extractFunctionTypeObjectFrom = Symbol('_extractFunctionTypeObjectFrom');
28 let _asCheck = Symbol('_asCheck');
29 let _check = Symbol('_check');
30 let _assertCheck = Symbol('_assertCheck');
31 let _typeData = Symbol('_typeData');
32 let _cachedToString = Symbol('_cachedToString');
33 let _hasReturnType = Symbol('_hasReturnType');
34 let _returnType = Symbol('_returnType');
35 let _isVoid = Symbol('_isVoid');
36 let _hasArguments = Symbol('_hasArguments');
37 let _hasOptionalArguments = Symbol('_hasOptionalArguments');
38 let _optionalArguments = Symbol('_optionalArguments');
39 let _hasNamedArguments = Symbol('_hasNamedArguments');
40 let _namedArguments = Symbol('_namedArguments');
41 let _convert = Symbol('_convert');
42 let _throwUnmodifiable = Symbol('_throwUnmodifiable');
43 let _jsObject = Symbol('_jsObject');
44 let _keys = Symbol('_keys');
45 let _fetch = Symbol('_fetch');
46 let _protoValue = Symbol('_protoValue');
47 let _map = Symbol('_map');
48 let _jsData = Symbol('_jsData');
49 let _getMap = Symbol('_getMap');
50 let _nativeRegExp = Symbol('_nativeRegExp');
51 let _nativeGlobalVersion = Symbol('_nativeGlobalVersion');
52 let _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion');
53 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp');
54 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp');
55 let _isMultiLine = Symbol('_isMultiLine');
56 let _isCaseSensitive = Symbol('_isCaseSensitive');
57 let _execGlobal = Symbol('_execGlobal');
58 let _execAnchored = Symbol('_execAnchored');
59 let _match = Symbol('_match');
60 let _re = Symbol('_re');
61 let _string = Symbol('_string');
62 let _start = Symbol('_start');
63 let _regExp = Symbol('_regExp');
64 let _nextIndex = Symbol('_nextIndex');
65 let _current = Symbol('_current');
66 let _unmangledName = Symbol('_unmangledName');
4 class _Patch extends dart.Object { 67 class _Patch extends dart.Object {
5 _Patch() { 68 _Patch() {
6 } 69 }
7 } 70 }
8 let patch = new _Patch(); 71 let patch = new _Patch();
9 class InternalMap extends dart.Object { 72 class InternalMap extends dart.Object {
10 } 73 }
11 // Function requiresPreamble: () → dynamic 74 // Function requiresPreamble: () → dynamic
12 function requiresPreamble() { 75 function requiresPreamble() {
13 } 76 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 function traceHelper(method) { 119 function traceHelper(method) {
57 if (!this.cache) { 120 if (!this.cache) {
58 this.cache = Object.create(null); 121 this.cache = Object.create(null);
59 } 122 }
60 if (!this.cache[method]) { 123 if (!this.cache[method]) {
61 console.log(method); 124 console.log(method);
62 this.cache[method] = true; 125 this.cache[method] = true;
63 } 126 }
64 } 127 }
65 class JSInvocationMirror extends dart.Object { 128 class JSInvocationMirror extends dart.Object {
66 JSInvocationMirror(_memberName, _internalName, _kind, _arguments, _namedArgu mentNames) { 129 JSInvocationMirror($_memberName, $_internalName, $_kind, $_arguments, $_name dArgumentNames) {
67 this._memberName = _memberName; 130 this[_memberName] = $_memberName;
68 this._internalName = _internalName; 131 this[_internalName] = $_internalName;
69 this._kind = _kind; 132 this[_kind] = $_kind;
70 this._arguments = _arguments; 133 this[_arguments] = $_arguments;
71 this._namedArgumentNames = _namedArgumentNames; 134 this[_namedArgumentNames] = $_namedArgumentNames;
72 this._namedIndices = null; 135 this[_namedIndices] = null;
73 } 136 }
74 get memberName() { 137 get memberName() {
75 if (dart.is(this._memberName, core.Symbol)) 138 if (dart.is(this[_memberName], core.Symbol))
76 return dart.as(this._memberName, core.Symbol); 139 return dart.as(this[_memberName], core.Symbol);
77 let name = dart.as(this._memberName, core.String); 140 let name = dart.as(this[_memberName], core.String);
78 let unmangledName = _js_names.mangledNames.get(name); 141 let unmangledName = _js_names.mangledNames.get(name);
79 if (unmangledName !== null) { 142 if (unmangledName !== null) {
80 name = unmangledName.split(':').get(0); 143 name = unmangledName.split(':').get(0);
81 } else { 144 } else {
82 if (_js_names.mangledNames.get(this._internalName) === null) { 145 if (_js_names.mangledNames.get(this[_internalName]) === null) {
83 core.print(`Warning: '${name}' is used reflectively but not in Mirrors Used. ` + "This will break minified code."); 146 core.print(`Warning: '${name}' is used reflectively but not in Mirrors Used. ` + "This will break minified code.");
84 } 147 }
85 } 148 }
86 this._memberName = new _internal.Symbol.unvalidated(name); 149 this[_memberName] = new _internal.Symbol.unvalidated(name);
87 return dart.as(this._memberName, core.Symbol); 150 return dart.as(this[_memberName], core.Symbol);
88 } 151 }
89 get isMethod() { 152 get isMethod() {
90 return this._kind === METHOD; 153 return this[_kind] === METHOD;
91 } 154 }
92 get isGetter() { 155 get isGetter() {
93 return this._kind === GETTER; 156 return this[_kind] === GETTER;
94 } 157 }
95 get isSetter() { 158 get isSetter() {
96 return this._kind === SETTER; 159 return this[_kind] === SETTER;
97 } 160 }
98 get isAccessor() { 161 get isAccessor() {
99 return this._kind !== METHOD; 162 return this[_kind] !== METHOD;
100 } 163 }
101 get positionalArguments() { 164 get positionalArguments() {
102 if (this.isGetter) 165 if (this.isGetter)
103 return /* Unimplemented const */new List.from([]); 166 return /* Unimplemented const */new List.from([]);
104 let argumentCount = this._arguments.length - this._namedArgumentNames.leng th; 167 let argumentCount = this[_arguments].length - this[_namedArgumentNames].le ngth;
105 if (argumentCount === 0) 168 if (argumentCount === 0)
106 return /* Unimplemented const */new List.from([]); 169 return /* Unimplemented const */new List.from([]);
107 let list = new List.from([]); 170 let list = new List.from([]);
108 for (let index = 0; index < argumentCount; index++) { 171 for (let index = 0; index < argumentCount; index++) {
109 list.add(this._arguments.get(index)); 172 list.add(this[_arguments].get(index));
110 } 173 }
111 return dart.as(makeLiteralListConst(list), core.List); 174 return dart.as(makeLiteralListConst(list), core.List);
112 } 175 }
113 get namedArguments() { 176 get namedArguments() {
114 if (this.isAccessor) 177 if (this.isAccessor)
115 return dart.map(); 178 return dart.map();
116 let namedArgumentCount = this._namedArgumentNames.length; 179 let namedArgumentCount = this[_namedArgumentNames].length;
117 let namedArgumentsStartIndex = this._arguments.length - namedArgumentCount ; 180 let namedArgumentsStartIndex = this[_arguments].length - namedArgumentCoun t;
118 if (namedArgumentCount === 0) 181 if (namedArgumentCount === 0)
119 return dart.map(); 182 return dart.map();
120 let map = new core.Map(); 183 let map = new core.Map();
121 for (let i = 0; i < namedArgumentCount; i++) { 184 for (let i = 0; i < namedArgumentCount; i++) {
122 map.set(new _internal.Symbol.unvalidated(dart.as(this._namedArgumentName s.get(i), core.String)), this._arguments.get(namedArgumentsStartIndex + i)); 185 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName s].get(i), core.String)), this[_arguments].get(namedArgumentsStartIndex + i));
123 } 186 }
124 return map; 187 return map;
125 } 188 }
126 _getCachedInvocation(object) { 189 [_getCachedInvocation](object) {
127 let interceptor = _interceptors.getInterceptor(object); 190 let interceptor = _interceptors.getInterceptor(object);
128 let receiver = object; 191 let receiver = object;
129 let name = this._internalName; 192 let name = this[_internalName];
130 let arguments = this._arguments; 193 let arguments = this[_arguments];
131 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_ embedded_names.INTERCEPTED_NAMES, core.String)); 194 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_ embedded_names.INTERCEPTED_NAMES, core.String));
132 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames, name); 195 let isIntercepted = Object.prototype.hasOwnProperty.call(interceptedNames, name);
133 if (isIntercepted) { 196 if (isIntercepted) {
134 receiver = interceptor; 197 receiver = interceptor;
135 if (object === interceptor) { 198 if (object === interceptor) {
136 interceptor = null; 199 interceptor = null;
137 } 200 }
138 } else { 201 } else {
139 interceptor = null; 202 interceptor = null;
140 } 203 }
(...skipping 22 matching lines...) Expand all
163 } 226 }
164 } else { 227 } else {
165 return new CachedNoSuchMethodInvocation(interceptor); 228 return new CachedNoSuchMethodInvocation(interceptor);
166 } 229 }
167 } 230 }
168 static invokeFromMirror(invocation, victim) { 231 static invokeFromMirror(invocation, victim) {
169 let cached = invocation._getCachedInvocation(victim); 232 let cached = invocation._getCachedInvocation(victim);
170 if (dart.dload(cached, 'isNoSuchMethod')) { 233 if (dart.dload(cached, 'isNoSuchMethod')) {
171 return dart.dinvoke(cached, 'invokeOn', victim, invocation); 234 return dart.dinvoke(cached, 'invokeOn', victim, invocation);
172 } else { 235 } else {
173 return dart.dinvoke(cached, 'invokeOn', victim, invocation._arguments); 236 return dart.dinvoke(cached, 'invokeOn', victim, invocation[_arguments]);
174 } 237 }
175 } 238 }
176 static getCachedInvocation(invocation, victim) { 239 static getCachedInvocation(invocation, victim) {
177 return invocation._getCachedInvocation(victim); 240 return invocation._getCachedInvocation(victim);
178 } 241 }
179 } 242 }
180 JSInvocationMirror.METHOD = 0; 243 JSInvocationMirror.METHOD = 0;
181 JSInvocationMirror.GETTER = 1; 244 JSInvocationMirror.GETTER = 1;
182 JSInvocationMirror.SETTER = 2; 245 JSInvocationMirror.SETTER = 2;
183 class CachedInvocation extends dart.Object { 246 class CachedInvocation extends dart.Object {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 mirrorInvokeCacheName = `_${id}`; 441 mirrorInvokeCacheName = `_${id}`;
379 } 442 }
380 static objectHashCode(object) { 443 static objectHashCode(object) {
381 let hash = dart.as(object.$identityHash, core.int); 444 let hash = dart.as(object.$identityHash, core.int);
382 if (hash === null) { 445 if (hash === null) {
383 hash = Math.random() * 0x3fffffff | 0; 446 hash = Math.random() * 0x3fffffff | 0;
384 object.$identityHash = hash; 447 object.$identityHash = hash;
385 } 448 }
386 return hash; 449 return hash;
387 } 450 }
388 static _throwFormatException(string) { 451 static [_throwFormatException](string) {
389 throw new core.FormatException(string); 452 throw new core.FormatException(string);
390 } 453 }
391 static parseInt(source, radix, handleError) { 454 static parseInt(source, radix, handleError) {
392 if (handleError === null) 455 if (handleError === null)
393 handleError = dart.as(_throwFormatException, dart.throw_("Unimplemented type (String) → int")); 456 handleError = dart.as(_throwFormatException, dart.throw_("Unimplemented type (String) → int"));
394 checkString(source); 457 checkString(source);
395 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ; 458 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
396 let digitsIndex = 1; 459 let digitsIndex = 1;
397 let hexIndex = 2; 460 let hexIndex = 2;
398 let decimalIndex = 3; 461 let decimalIndex = 3;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 static get isJsshell() { 566 static get isJsshell() {
504 return typeof version == "function" && typeof system == "function"; 567 return typeof version == "function" && typeof system == "function";
505 } 568 }
506 static currentUri() { 569 static currentUri() {
507 requiresPreamble(); 570 requiresPreamble();
508 if (!!self.location) { 571 if (!!self.location) {
509 return self.location.href; 572 return self.location.href;
510 } 573 }
511 return null; 574 return null;
512 } 575 }
513 static _fromCharCodeApply(array) { 576 static [_fromCharCodeApply](array) {
514 let result = ""; 577 let result = "";
515 let kMaxApply = 500; 578 let kMaxApply = 500;
516 let end = array.length; 579 let end = array.length;
517 for (let i = 0; i < end; i = kMaxApply) { 580 for (let i = 0; i < end; i = kMaxApply) {
518 let subarray = null; 581 let subarray = null;
519 if (end <= kMaxApply) { 582 if (end <= kMaxApply) {
520 subarray = array; 583 subarray = array;
521 } else { 584 } else {
522 subarray = array.slice(i, i + kMaxApply < end ? i + kMaxApply : end); 585 subarray = array.slice(i, i + kMaxApply < end ? i + kMaxApply : end);
523 } 586 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 } else { 814 } else {
752 bad = true; 815 bad = true;
753 } 816 }
754 }).bind(this)); 817 }).bind(this));
755 if (bad) { 818 if (bad) {
756 return functionNoSuchMethod(function, positionalArguments, namedArgument s); 819 return functionNoSuchMethod(function, positionalArguments, namedArgument s);
757 } 820 }
758 positionalArguments.addAll(defaultArguments.values); 821 positionalArguments.addAll(defaultArguments.values);
759 return jsFunction.apply(function, positionalArguments); 822 return jsFunction.apply(function, positionalArguments);
760 } 823 }
761 static _mangledNameMatchesType(mangledName, type) { 824 static [_mangledNameMatchesType](mangledName, type) {
762 return mangledName == type._typeName; 825 return mangledName == type[_typeName];
763 } 826 }
764 static identicalImplementation(a, b) { 827 static identicalImplementation(a, b) {
765 return a == null ? b == null : a === b; 828 return a == null ? b == null : a === b;
766 } 829 }
767 static extractStackTrace(error) { 830 static extractStackTrace(error) {
768 return getTraceFromException(error.$thrownJsError); 831 return getTraceFromException(error.$thrownJsError);
769 } 832 }
770 } 833 }
771 Primitives.mirrorFunctionCacheName = '$cachedFunction'; 834 Primitives.mirrorFunctionCacheName = '$cachedFunction';
772 Primitives.mirrorInvokeCacheName = '$cachedInvocation'; 835 Primitives.mirrorInvokeCacheName = '$cachedInvocation';
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 930 }
868 // Function throwRuntimeError: (dynamic) → dynamic 931 // Function throwRuntimeError: (dynamic) → dynamic
869 function throwRuntimeError(message) { 932 function throwRuntimeError(message) {
870 throw new RuntimeError(message); 933 throw new RuntimeError(message);
871 } 934 }
872 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic 935 // Function throwAbstractClassInstantiationError: (dynamic) → dynamic
873 function throwAbstractClassInstantiationError(className) { 936 function throwAbstractClassInstantiationError(className) {
874 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin g)); 937 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin g));
875 } 938 }
876 class TypeErrorDecoder extends dart.Object { 939 class TypeErrorDecoder extends dart.Object {
877 TypeErrorDecoder(_arguments, _argumentsExpr, _expr, _method, _receiver, _pat tern) { 940 TypeErrorDecoder($_arguments, $_argumentsExpr, $_expr, $_method, $_receiver, $_pattern) {
878 this._arguments = _arguments; 941 this[_arguments] = $_arguments;
879 this._argumentsExpr = _argumentsExpr; 942 this[_argumentsExpr] = $_argumentsExpr;
880 this._expr = _expr; 943 this[_expr] = $_expr;
881 this._method = _method; 944 this[_method] = $_method;
882 this._receiver = _receiver; 945 this[_receiver] = $_receiver;
883 this._pattern = _pattern; 946 this[_pattern] = $_pattern;
884 } 947 }
885 matchTypeError(message) { 948 matchTypeError(message) {
886 let match = new RegExp(this._pattern).exec(message); 949 let match = new RegExp(this[_pattern]).exec(message);
887 if (match === null) 950 if (match === null)
888 return null; 951 return null;
889 let result = Object.create(null); 952 let result = Object.create(null);
890 if (this._arguments !== -1) { 953 if (this[_arguments] !== -1) {
891 result.arguments = match[this._arguments + 1]; 954 result.arguments = match[this[_arguments] + 1];
892 } 955 }
893 if (this._argumentsExpr !== -1) { 956 if (this[_argumentsExpr] !== -1) {
894 result.argumentsExpr = match[this._argumentsExpr + 1]; 957 result.argumentsExpr = match[this[_argumentsExpr] + 1];
895 } 958 }
896 if (this._expr !== -1) { 959 if (this[_expr] !== -1) {
897 result.expr = match[this._expr + 1]; 960 result.expr = match[this[_expr] + 1];
898 } 961 }
899 if (this._method !== -1) { 962 if (this[_method] !== -1) {
900 result.method = match[this._method + 1]; 963 result.method = match[this[_method] + 1];
901 } 964 }
902 if (this._receiver !== -1) { 965 if (this[_receiver] !== -1) {
903 result.receiver = match[this._receiver + 1]; 966 result.receiver = match[this[_receiver] + 1];
904 } 967 }
905 return result; 968 return result;
906 } 969 }
907 static buildJavaScriptObject() { 970 static buildJavaScriptObject() {
908 return { 971 return {
909 toString: function() { 972 toString: function() {
910 return "$receiver$"; 973 return "$receiver$";
911 } 974 }
912 }; 975 };
913 } 976 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 return dart.as(extractPattern(provokePropertyErrorOnNull()), TypeErrorDeco der); 1092 return dart.as(extractPattern(provokePropertyErrorOnNull()), TypeErrorDeco der);
1030 }, 1093 },
1031 get undefinedPropertyPattern() { 1094 get undefinedPropertyPattern() {
1032 return dart.as(extractPattern(provokePropertyErrorOn(void 0)), TypeErrorDe coder); 1095 return dart.as(extractPattern(provokePropertyErrorOn(void 0)), TypeErrorDe coder);
1033 }, 1096 },
1034 get undefinedLiteralPropertyPattern() { 1097 get undefinedLiteralPropertyPattern() {
1035 return dart.as(extractPattern(provokePropertyErrorOnUndefined()), TypeErro rDecoder); 1098 return dart.as(extractPattern(provokePropertyErrorOnUndefined()), TypeErro rDecoder);
1036 } 1099 }
1037 }); 1100 });
1038 class NullError extends core.Error { 1101 class NullError extends core.Error {
1039 NullError(_message, match) { 1102 NullError($_message, match) {
1040 this._message = _message; 1103 this[_message] = $_message;
1041 this._method = dart.as(match === null ? null : match.method, core.String); 1104 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
1042 super.Error(); 1105 super.Error();
1043 } 1106 }
1044 toString() { 1107 toString() {
1045 if (this._method === null) 1108 if (this[_method] === null)
1046 return `NullError: ${this._message}`; 1109 return `NullError: ${this[_message]}`;
1047 return `NullError: Cannot call "${this._method}" on null`; 1110 return `NullError: Cannot call "${this[_method]}" on null`;
1048 } 1111 }
1049 } 1112 }
1050 class JsNoSuchMethodError extends core.Error { 1113 class JsNoSuchMethodError extends core.Error {
1051 JsNoSuchMethodError(_message, match) { 1114 JsNoSuchMethodError($_message, match) {
1052 this._message = _message; 1115 this[_message] = $_message;
1053 this._method = dart.as(match === null ? null : match.method, core.String); 1116 this[_method] = dart.as(match === null ? null : match.method, core.String) ;
1054 this._receiver = dart.as(match === null ? null : match.receiver, core.Stri ng); 1117 this[_receiver] = dart.as(match === null ? null : match.receiver, core.Str ing);
1055 super.Error(); 1118 super.Error();
1056 } 1119 }
1057 toString() { 1120 toString() {
1058 if (this._method === null) 1121 if (this[_method] === null)
1059 return `NoSuchMethodError: ${this._message}`; 1122 return `NoSuchMethodError: ${this[_message]}`;
1060 if (this._receiver === null) { 1123 if (this[_receiver] === null) {
1061 return `NoSuchMethodError: Cannot call "${this._method}" (${this._messag e})`; 1124 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa ge]})`;
1062 } 1125 }
1063 return `NoSuchMethodError: Cannot call "${this._method}" on "${this._recei ver}" ` + `(${this._message})`; 1126 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece iver]}" ` + `(${this[_message]})`;
1064 } 1127 }
1065 } 1128 }
1066 class UnknownJsTypeError extends core.Error { 1129 class UnknownJsTypeError extends core.Error {
1067 UnknownJsTypeError(_message) { 1130 UnknownJsTypeError($_message) {
1068 this._message = _message; 1131 this[_message] = $_message;
1069 super.Error(); 1132 super.Error();
1070 } 1133 }
1071 toString() { 1134 toString() {
1072 return this._message.isEmpty ? 'Error' : `Error: ${this._message}`; 1135 return this[_message].isEmpty ? 'Error' : `Error: ${this[_message]}`;
1073 } 1136 }
1074 } 1137 }
1075 // Function unwrapException: (dynamic) → dynamic 1138 // Function unwrapException: (dynamic) → dynamic
1076 function unwrapException(ex) { 1139 function unwrapException(ex) {
1077 // Function saveStackTrace: (dynamic) → dynamic 1140 // Function saveStackTrace: (dynamic) → dynamic
1078 function saveStackTrace(error) { 1141 function saveStackTrace(error) {
1079 if (dart.is(error, core.Error)) { 1142 if (dart.is(error, core.Error)) {
1080 let thrownStackTrace = error.$thrownJsError; 1143 let thrownStackTrace = error.$thrownJsError;
1081 if (thrownStackTrace === null) { 1144 if (thrownStackTrace === null) {
1082 error.$thrownJsError = ex; 1145 error.$thrownJsError = ex;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 return new core.StackOverflowError(); 1204 return new core.StackOverflowError();
1142 } 1205 }
1143 } 1206 }
1144 return ex; 1207 return ex;
1145 } 1208 }
1146 // Function getTraceFromException: (dynamic) → StackTrace 1209 // Function getTraceFromException: (dynamic) → StackTrace
1147 function getTraceFromException(exception) { 1210 function getTraceFromException(exception) {
1148 return new _StackTrace(exception); 1211 return new _StackTrace(exception);
1149 } 1212 }
1150 class _StackTrace extends dart.Object { 1213 class _StackTrace extends dart.Object {
1151 _StackTrace(_exception) { 1214 _StackTrace($_exception) {
1152 this._exception = _exception; 1215 this[_exception] = $_exception;
1153 this._trace = null; 1216 this[_trace] = null;
1154 } 1217 }
1155 toString() { 1218 toString() {
1156 if (this._trace !== null) 1219 if (this[_trace] !== null)
1157 return this._trace; 1220 return this[_trace];
1158 let trace = null; 1221 let trace = null;
1159 if (typeof this._exception === "object") { 1222 if (typeof this[_exception] === "object") {
1160 trace = dart.as(this._exception.stack, core.String); 1223 trace = dart.as(this[_exception].stack, core.String);
1161 } 1224 }
1162 return this._trace = trace === null ? '' : trace; 1225 return this[_trace] = trace === null ? '' : trace;
1163 } 1226 }
1164 } 1227 }
1165 // Function objectHashCode: (dynamic) → int 1228 // Function objectHashCode: (dynamic) → int
1166 function objectHashCode(object) { 1229 function objectHashCode(object) {
1167 if (dart.notNull(object === null) || dart.notNull(typeof object != 'object') ) { 1230 if (dart.notNull(object === null) || dart.notNull(typeof object != 'object') ) {
1168 return dart.as(dart.dload(object, 'hashCode'), core.int); 1231 return dart.as(dart.dload(object, 'hashCode'), core.int);
1169 } else { 1232 } else {
1170 return Primitives.objectHashCode(object); 1233 return Primitives.objectHashCode(object);
1171 } 1234 }
1172 } 1235 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 Closure.OPTIONAL_PARAMETER_INDEX = 4; 1491 Closure.OPTIONAL_PARAMETER_INDEX = 4;
1429 Closure.DEFAULT_ARGUMENTS_INDEX = 5; 1492 Closure.DEFAULT_ARGUMENTS_INDEX = 5;
1430 Closure.functionCounter = 0; 1493 Closure.functionCounter = 0;
1431 // Function closureFromTearOff: (dynamic, dynamic, dynamic, dynamic, dynamic, dynamic) → dynamic 1494 // Function closureFromTearOff: (dynamic, dynamic, dynamic, dynamic, dynamic, dynamic) → dynamic
1432 function closureFromTearOff(receiver, functions, reflectionInfo, isStatic, jsA rguments, name) { 1495 function closureFromTearOff(receiver, functions, reflectionInfo, isStatic, jsA rguments, name) {
1433 return Closure.fromTearOff(receiver, _interceptors.JSArray.markFixedList(dar t.as(functions, core.List)), _interceptors.JSArray.markFixedList(dart.as(reflect ionInfo, core.List)), !!isStatic, jsArguments, name); 1496 return Closure.fromTearOff(receiver, _interceptors.JSArray.markFixedList(dar t.as(functions, core.List)), _interceptors.JSArray.markFixedList(dart.as(reflect ionInfo, core.List)), !!isStatic, jsArguments, name);
1434 } 1497 }
1435 class TearOffClosure extends Closure { 1498 class TearOffClosure extends Closure {
1436 } 1499 }
1437 class BoundClosure extends TearOffClosure { 1500 class BoundClosure extends TearOffClosure {
1438 BoundClosure(_self, _target, _receiver, _name) { 1501 BoundClosure($_self, $_target, $_receiver, $_name) {
1439 this._self = _self; 1502 this[_self] = $_self;
1440 this._target = _target; 1503 this[_target] = $_target;
1441 this._receiver = _receiver; 1504 this[_receiver] = $_receiver;
1442 this._name = _name; 1505 this[_name] = $_name;
1443 super.TearOffClosure(); 1506 super.TearOffClosure();
1444 } 1507 }
1445 ['=='](other) { 1508 ['=='](other) {
1446 if (core.identical(this, other)) 1509 if (core.identical(this, other))
1447 return true; 1510 return true;
1448 if (!dart.is(other, BoundClosure)) 1511 if (!dart.is(other, BoundClosure))
1449 return false; 1512 return false;
1450 return this._self === dart.dload(other, '_self') && this._target === dart. dload(other, '_target') && this._receiver === dart.dload(other, '_receiver'); 1513 return this[_self] === dart.dload(other, '_self') && this[_target] === dar t.dload(other, '_target') && this[_receiver] === dart.dload(other, '_receiver');
1451 } 1514 }
1452 get hashCode() { 1515 get hashCode() {
1453 let receiverHashCode = null; 1516 let receiverHashCode = null;
1454 if (this._receiver === null) { 1517 if (this[_receiver] === null) {
1455 receiverHashCode = Primitives.objectHashCode(this._self); 1518 receiverHashCode = Primitives.objectHashCode(this[_self]);
1456 } else if (!dart.equals(typeof this._receiver, 'object')) { 1519 } else if (!dart.equals(typeof this[_receiver], 'object')) {
1457 receiverHashCode = dart.as(dart.dload(this._receiver, 'hashCode'), core. int); 1520 receiverHashCode = dart.as(dart.dload(this[_receiver], 'hashCode'), core .int);
1458 } else { 1521 } else {
1459 receiverHashCode = Primitives.objectHashCode(this._receiver); 1522 receiverHashCode = Primitives.objectHashCode(this[_receiver]);
1460 } 1523 }
1461 return receiverHashCode ^ Primitives.objectHashCode(this._target); 1524 return receiverHashCode ^ Primitives.objectHashCode(this[_target]);
1462 } 1525 }
1463 static selfOf(closure) { 1526 static selfOf(closure) {
1464 return closure._self; 1527 return closure[_self];
1465 } 1528 }
1466 static targetOf(closure) { 1529 static targetOf(closure) {
1467 return closure._target; 1530 return closure[_target];
1468 } 1531 }
1469 static receiverOf(closure) { 1532 static receiverOf(closure) {
1470 return closure._receiver; 1533 return closure[_receiver];
1471 } 1534 }
1472 static nameOf(closure) { 1535 static nameOf(closure) {
1473 return closure._name; 1536 return closure[_name];
1474 } 1537 }
1475 static selfFieldName() { 1538 static selfFieldName() {
1476 if (selfFieldNameCache === null) { 1539 if (selfFieldNameCache === null) {
1477 selfFieldNameCache = computeFieldNamed('self'); 1540 selfFieldNameCache = computeFieldNamed('self');
1478 } 1541 }
1479 return selfFieldNameCache; 1542 return selfFieldNameCache;
1480 } 1543 }
1481 static receiverFieldName() { 1544 static receiverFieldName() {
1482 if (receiverFieldNameCache === null) { 1545 if (receiverFieldNameCache === null) {
1483 receiverFieldNameCache = computeFieldNamed('receiver'); 1546 receiverFieldNameCache = computeFieldNamed('receiver');
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 RuntimeFunctionType(returnType, parameterTypes, optionalParameterTypes, name dParameters) { 1930 RuntimeFunctionType(returnType, parameterTypes, optionalParameterTypes, name dParameters) {
1868 this.returnType = returnType; 1931 this.returnType = returnType;
1869 this.parameterTypes = parameterTypes; 1932 this.parameterTypes = parameterTypes;
1870 this.optionalParameterTypes = optionalParameterTypes; 1933 this.optionalParameterTypes = optionalParameterTypes;
1871 this.namedParameters = namedParameters; 1934 this.namedParameters = namedParameters;
1872 super.RuntimeType(); 1935 super.RuntimeType();
1873 } 1936 }
1874 get isVoid() { 1937 get isVoid() {
1875 return dart.is(this.returnType, VoidRuntimeType); 1938 return dart.is(this.returnType, VoidRuntimeType);
1876 } 1939 }
1877 _isTest(expression) { 1940 [_isTest](expression) {
1878 let functionTypeObject = this._extractFunctionTypeObjectFrom(expression); 1941 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression);
1879 return functionTypeObject === null ? false : isFunctionSubtype(functionTyp eObject, this.toRti()); 1942 return functionTypeObject === null ? false : isFunctionSubtype(functionTyp eObject, this.toRti());
1880 } 1943 }
1881 _asCheck(expression) { 1944 [_asCheck](expression) {
1882 return this._check(expression, true); 1945 return this[_check](expression, true);
1883 } 1946 }
1884 _assertCheck(expression) { 1947 [_assertCheck](expression) {
1885 if (inAssert) 1948 if (inAssert)
1886 return null; 1949 return null;
1887 inAssert = true; 1950 inAssert = true;
1888 try { 1951 try {
1889 return this._check(expression, false); 1952 return this[_check](expression, false);
1890 } finally { 1953 } finally {
1891 inAssert = false; 1954 inAssert = false;
1892 } 1955 }
1893 } 1956 }
1894 _check(expression, isCast) { 1957 [_check](expression, isCast) {
1895 if (expression === null) 1958 if (expression === null)
1896 return null; 1959 return null;
1897 if (this._isTest(expression)) 1960 if (this[_isTest](expression))
1898 return expression; 1961 return expression;
1899 let self = new FunctionTypeInfoDecoderRing(this.toRti()).toString(); 1962 let self = new FunctionTypeInfoDecoderRing(this.toRti()).toString();
1900 if (isCast) { 1963 if (isCast) {
1901 let functionTypeObject = this._extractFunctionTypeObjectFrom(expression) ; 1964 let functionTypeObject = this[_extractFunctionTypeObjectFrom](expression );
1902 let pretty = null; 1965 let pretty = null;
1903 if (functionTypeObject !== null) { 1966 if (functionTypeObject !== null) {
1904 pretty = new FunctionTypeInfoDecoderRing(functionTypeObject).toString( ); 1967 pretty = new FunctionTypeInfoDecoderRing(functionTypeObject).toString( );
1905 } else { 1968 } else {
1906 pretty = Primitives.objectTypeName(expression); 1969 pretty = Primitives.objectTypeName(expression);
1907 } 1970 }
1908 throw new CastErrorImplementation(pretty, self); 1971 throw new CastErrorImplementation(pretty, self);
1909 } else { 1972 } else {
1910 throw new TypeErrorImplementation(expression, self); 1973 throw new TypeErrorImplementation(expression, self);
1911 } 1974 }
1912 } 1975 }
1913 _extractFunctionTypeObjectFrom(o) { 1976 [_extractFunctionTypeObjectFrom](o) {
1914 let interceptor = _interceptors.getInterceptor(o); 1977 let interceptor = _interceptors.getInterceptor(o);
1915 return _foreign_helper.JS_SIGNATURE_NAME() in interceptor ? interceptor[_f oreign_helper.JS_SIGNATURE_NAME()]() : null; 1978 return _foreign_helper.JS_SIGNATURE_NAME() in interceptor ? interceptor[_f oreign_helper.JS_SIGNATURE_NAME()]() : null;
1916 } 1979 }
1917 toRti() { 1980 toRti() {
1918 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"}; 1981 let result = {[_foreign_helper.JS_FUNCTION_TYPE_TAG()]: "dynafunc"};
1919 if (this.isVoid) { 1982 if (this.isVoid) {
1920 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true; 1983 result[_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()] = true;
1921 } else { 1984 } else {
1922 if (!dart.is(this.returnType, DynamicRuntimeType)) { 1985 if (!dart.is(this.returnType, DynamicRuntimeType)) {
1923 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu rnType.toRti(); 1986 result[_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_TAG()] = this.retu rnType.toRti();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 for (let argument of this.arguments) { 2176 for (let argument of this.arguments) {
2114 result.push(argument.toRti()); 2177 result.push(argument.toRti());
2115 } 2178 }
2116 return this.rti = result; 2179 return this.rti = result;
2117 } 2180 }
2118 toString() { 2181 toString() {
2119 return `${this.name}<${this.arguments.join(", ")}>`; 2182 return `${this.name}<${this.arguments.join(", ")}>`;
2120 } 2183 }
2121 } 2184 }
2122 class FunctionTypeInfoDecoderRing extends dart.Object { 2185 class FunctionTypeInfoDecoderRing extends dart.Object {
2123 FunctionTypeInfoDecoderRing(_typeData) { 2186 FunctionTypeInfoDecoderRing($_typeData) {
2124 this._typeData = _typeData; 2187 this[_typeData] = $_typeData;
2125 this._cachedToString = null; 2188 this[_cachedToString] = null;
2126 } 2189 }
2127 get _hasReturnType() { 2190 get [_hasReturnType]() {
2128 return "ret" in this._typeData; 2191 return "ret" in this[_typeData];
2129 } 2192 }
2130 get _returnType() { 2193 get [_returnType]() {
2131 return this._typeData.ret; 2194 return this[_typeData].ret;
2132 } 2195 }
2133 get _isVoid() { 2196 get [_isVoid]() {
2134 return !!this._typeData["void"]; 2197 return !!this[_typeData]["void"];
2135 } 2198 }
2136 get _hasArguments() { 2199 get [_hasArguments]() {
2137 return "args" in this._typeData; 2200 return "args" in this[_typeData];
2138 } 2201 }
2139 get _arguments() { 2202 get [_arguments]() {
2140 return dart.as(this._typeData.args, core.List); 2203 return dart.as(this[_typeData].args, core.List);
2141 } 2204 }
2142 get _hasOptionalArguments() { 2205 get [_hasOptionalArguments]() {
2143 return "opt" in this._typeData; 2206 return "opt" in this[_typeData];
2144 } 2207 }
2145 get _optionalArguments() { 2208 get [_optionalArguments]() {
2146 return dart.as(this._typeData.opt, core.List); 2209 return dart.as(this[_typeData].opt, core.List);
2147 } 2210 }
2148 get _hasNamedArguments() { 2211 get [_hasNamedArguments]() {
2149 return "named" in this._typeData; 2212 return "named" in this[_typeData];
2150 } 2213 }
2151 get _namedArguments() { 2214 get [_namedArguments]() {
2152 return this._typeData.named; 2215 return this[_typeData].named;
2153 } 2216 }
2154 toRuntimeType() { 2217 toRuntimeType() {
2155 return new DynamicRuntimeType(); 2218 return new DynamicRuntimeType();
2156 } 2219 }
2157 _convert(type) { 2220 [_convert](type) {
2158 let result = runtimeTypeToString(type); 2221 let result = runtimeTypeToString(type);
2159 if (result !== null) 2222 if (result !== null)
2160 return result; 2223 return result;
2161 if ("func" in type) { 2224 if ("func" in type) {
2162 return new FunctionTypeInfoDecoderRing(type).toString(); 2225 return new FunctionTypeInfoDecoderRing(type).toString();
2163 } else { 2226 } else {
2164 throw 'bad type'; 2227 throw 'bad type';
2165 } 2228 }
2166 } 2229 }
2167 toString() { 2230 toString() {
2168 if (this._cachedToString !== null) 2231 if (this[_cachedToString] !== null)
2169 return this._cachedToString; 2232 return this[_cachedToString];
2170 let s = "("; 2233 let s = "(";
2171 let sep = ''; 2234 let sep = '';
2172 if (this._hasArguments) { 2235 if (this[_hasArguments]) {
2173 for (let argument of this._arguments) { 2236 for (let argument of this[_arguments]) {
2174 s = sep; 2237 s = sep;
2175 s = this._convert(argument); 2238 s = this[_convert](argument);
2176 sep = ', '; 2239 sep = ', ';
2177 } 2240 }
2178 } 2241 }
2179 if (this._hasOptionalArguments) { 2242 if (this[_hasOptionalArguments]) {
2180 s = `${sep}[`; 2243 s = `${sep}[`;
2181 sep = ''; 2244 sep = '';
2182 for (let argument of this._optionalArguments) { 2245 for (let argument of this[_optionalArguments]) {
2183 s = sep; 2246 s = sep;
2184 s = this._convert(argument); 2247 s = this[_convert](argument);
2185 sep = ', '; 2248 sep = ', ';
2186 } 2249 }
2187 s = ']'; 2250 s = ']';
2188 } 2251 }
2189 if (this._hasNamedArguments) { 2252 if (this[_hasNamedArguments]) {
2190 s = `${sep}{`; 2253 s = `${sep}{`;
2191 sep = ''; 2254 sep = '';
2192 for (let name of _js_names.extractKeys(this._namedArguments)) { 2255 for (let name of _js_names.extractKeys(this[_namedArguments])) {
2193 s = sep; 2256 s = sep;
2194 s = `${name}: `; 2257 s = `${name}: `;
2195 s = this._convert(this._namedArguments[name]); 2258 s = this[_convert](this[_namedArguments][name]);
2196 sep = ', '; 2259 sep = ', ';
2197 } 2260 }
2198 s = '}'; 2261 s = '}';
2199 } 2262 }
2200 s = ') -> '; 2263 s = ') -> ';
2201 if (this._isVoid) { 2264 if (this[_isVoid]) {
2202 s = 'void'; 2265 s = 'void';
2203 } else if (this._hasReturnType) { 2266 } else if (this[_hasReturnType]) {
2204 s = this._convert(this._returnType); 2267 s = this[_convert](this[_returnType]);
2205 } else { 2268 } else {
2206 s = 'dynamic'; 2269 s = 'dynamic';
2207 } 2270 }
2208 return this._cachedToString = `${s}`; 2271 return this[_cachedToString] = `${s}`;
2209 } 2272 }
2210 } 2273 }
2211 class UnimplementedNoSuchMethodError extends core.Error { 2274 class UnimplementedNoSuchMethodError extends core.Error {
2212 UnimplementedNoSuchMethodError(_message) { 2275 UnimplementedNoSuchMethodError($_message) {
2213 this._message = _message; 2276 this[_message] = $_message;
2214 super.Error(); 2277 super.Error();
2215 } 2278 }
2216 toString() { 2279 toString() {
2217 return `Unsupported operation: ${this._message}`; 2280 return `Unsupported operation: ${this[_message]}`;
2218 } 2281 }
2219 } 2282 }
2220 // Function random64: () → int 2283 // Function random64: () → int
2221 function random64() { 2284 function random64() {
2222 let int32a = Math.random() * 0x100000000 >>> 0; 2285 let int32a = Math.random() * 0x100000000 >>> 0;
2223 let int32b = Math.random() * 0x100000000 >>> 0; 2286 let int32b = Math.random() * 0x100000000 >>> 0;
2224 return int32a + int32b * 4294967296; 2287 return int32a + int32b * 4294967296;
2225 } 2288 }
2226 // Function jsonEncodeNative: (String) → String 2289 // Function jsonEncodeNative: (String) → String
2227 function jsonEncodeNative(string) { 2290 function jsonEncodeNative(string) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 completer.complete(null); 2397 completer.complete(null);
2335 }, 1), false); 2398 }, 1), false);
2336 script.addEventListener("error", convertDartClosureToJS((event) => { 2399 script.addEventListener("error", convertDartClosureToJS((event) => {
2337 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`)); 2400 completer.completeError(new async.DeferredLoadException(`Loading ${uri} failed.`));
2338 }, 1), false); 2401 }, 1), false);
2339 document.body.appendChild(script); 2402 document.body.appendChild(script);
2340 return completer.future; 2403 return completer.future;
2341 })); 2404 }));
2342 } 2405 }
2343 class MainError extends core.Error { 2406 class MainError extends core.Error {
2344 MainError(_message) { 2407 MainError($_message) {
2345 this._message = _message; 2408 this[_message] = $_message;
2346 super.Error(); 2409 super.Error();
2347 } 2410 }
2348 toString() { 2411 toString() {
2349 return `NoSuchMethodError: ${this._message}`; 2412 return `NoSuchMethodError: ${this[_message]}`;
2350 } 2413 }
2351 } 2414 }
2352 // Function missingMain: () → void 2415 // Function missingMain: () → void
2353 function missingMain() { 2416 function missingMain() {
2354 throw new MainError("No top-level function named 'main'."); 2417 throw new MainError("No top-level function named 'main'.");
2355 } 2418 }
2356 // Function badMain: () → void 2419 // Function badMain: () → void
2357 function badMain() { 2420 function badMain() {
2358 throw new MainError("'main' is not a function."); 2421 throw new MainError("'main' is not a function.");
2359 } 2422 }
(...skipping 29 matching lines...) Expand all
2389 } 2452 }
2390 get isEmpty() { 2453 get isEmpty() {
2391 return this.length === 0; 2454 return this.length === 0;
2392 } 2455 }
2393 get isNotEmpty() { 2456 get isNotEmpty() {
2394 return !dart.notNull(this.isEmpty); 2457 return !dart.notNull(this.isEmpty);
2395 } 2458 }
2396 toString() { 2459 toString() {
2397 return collection.Maps.mapToString(this); 2460 return collection.Maps.mapToString(this);
2398 } 2461 }
2399 _throwUnmodifiable() { 2462 [_throwUnmodifiable]() {
2400 throw new core.UnsupportedError("Cannot modify unmodifiable Map"); 2463 throw new core.UnsupportedError("Cannot modify unmodifiable Map");
2401 } 2464 }
2402 set(key, val) { 2465 set(key, val) {
2403 return this._throwUnmodifiable(); 2466 return this[_throwUnmodifiable]();
2404 } 2467 }
2405 putIfAbsent(key, ifAbsent) { 2468 putIfAbsent(key, ifAbsent) {
2406 return dart.as(this._throwUnmodifiable(), V); 2469 return dart.as(this[_throwUnmodifiable](), V);
2407 } 2470 }
2408 remove(key) { 2471 remove(key) {
2409 return dart.as(this._throwUnmodifiable(), V); 2472 return dart.as(this[_throwUnmodifiable](), V);
2410 } 2473 }
2411 clear() { 2474 clear() {
2412 return this._throwUnmodifiable(); 2475 return this[_throwUnmodifiable]();
2413 } 2476 }
2414 addAll(other) { 2477 addAll(other) {
2415 return this._throwUnmodifiable(); 2478 return this[_throwUnmodifiable]();
2416 } 2479 }
2417 } 2480 }
2418 dart.defineNamedConstructor(ConstantMap, '_'); 2481 dart.defineNamedConstructor(ConstantMap, '_');
2419 return ConstantMap; 2482 return ConstantMap;
2420 }); 2483 });
2421 let ConstantMap = ConstantMap$(dynamic, dynamic); 2484 let ConstantMap = ConstantMap$(dynamic, dynamic);
2422 let ConstantStringMap$ = dart.generic(function(K, V) { 2485 let ConstantStringMap$ = dart.generic(function(K, V) {
2423 class ConstantStringMap extends ConstantMap$(K, V) { 2486 class ConstantStringMap extends ConstantMap$(K, V) {
2424 ConstantStringMap$_(length, _jsObject, _keys) { 2487 ConstantStringMap$_(length, $_jsObject, $_keys) {
2425 this.length = length; 2488 this.length = length;
2426 this._jsObject = _jsObject; 2489 this[_jsObject] = $_jsObject;
2427 this._keys = _keys; 2490 this[_keys] = $_keys;
2428 super.ConstantMap$_(); 2491 super.ConstantMap$_();
2429 } 2492 }
2430 containsValue(needle) { 2493 containsValue(needle) {
2431 return this.values.any((value) => dart.equals(value, needle)); 2494 return this.values.any((value) => dart.equals(value, needle));
2432 } 2495 }
2433 containsKey(key) { 2496 containsKey(key) {
2434 if (!(typeof key == string)) 2497 if (!(typeof key == string))
2435 return false; 2498 return false;
2436 if (dart.equals('__proto__', key)) 2499 if (dart.equals('__proto__', key))
2437 return false; 2500 return false;
2438 return jsHasOwnProperty(this._jsObject, dart.as(key, core.String)); 2501 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
2439 } 2502 }
2440 get(key) { 2503 get(key) {
2441 if (!dart.notNull(this.containsKey(key))) 2504 if (!dart.notNull(this.containsKey(key)))
2442 return dart.as(null, V); 2505 return dart.as(null, V);
2443 return dart.as(this._fetch(key), V); 2506 return dart.as(this[_fetch](key), V);
2444 } 2507 }
2445 _fetch(key) { 2508 [_fetch](key) {
2446 return jsPropertyAccess(this._jsObject, dart.as(key, core.String)); 2509 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String));
2447 } 2510 }
2448 forEach(f) { 2511 forEach(f) {
2449 let keys = this._keys; 2512 let keys = this[_keys];
2450 for (let i = 0; i['<'](dart.dload(keys, 'length')); i++) { 2513 for (let i = 0; i['<'](dart.dload(keys, 'length')); i++) {
2451 let key = dart.dindex(keys, i); 2514 let key = dart.dindex(keys, i);
2452 f(dart.as(key, K), dart.as(this._fetch(key), V)); 2515 f(dart.as(key, K), dart.as(this[_fetch](key), V));
2453 } 2516 }
2454 } 2517 }
2455 get keys() { 2518 get keys() {
2456 return new _ConstantMapKeyIterable(this); 2519 return new _ConstantMapKeyIterable(this);
2457 } 2520 }
2458 get values() { 2521 get values() {
2459 return new _internal.MappedIterable(this._keys, dart.as(((key) => this._ fetch(key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); 2522 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[ _fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V")));
2460 } 2523 }
2461 } 2524 }
2462 dart.defineNamedConstructor(ConstantStringMap, '_'); 2525 dart.defineNamedConstructor(ConstantStringMap, '_');
2463 return ConstantStringMap; 2526 return ConstantStringMap;
2464 }); 2527 });
2465 let ConstantStringMap = ConstantStringMap$(dynamic, dynamic); 2528 let ConstantStringMap = ConstantStringMap$(dynamic, dynamic);
2466 let ConstantProtoMap$ = dart.generic(function(K, V) { 2529 let ConstantProtoMap$ = dart.generic(function(K, V) {
2467 class ConstantProtoMap extends ConstantStringMap$(K, V) { 2530 class ConstantProtoMap extends ConstantStringMap$(K, V) {
2468 ConstantProtoMap$_(length, jsObject, keys, _protoValue) { 2531 ConstantProtoMap$_(length, jsObject, keys, $_protoValue) {
2469 this._protoValue = _protoValue; 2532 this[_protoValue] = $_protoValue;
2470 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k eys, core.List$(K))); 2533 super.ConstantStringMap$_(dart.as(length, core.int), jsObject, dart.as(k eys, core.List$(K)));
2471 } 2534 }
2472 containsKey(key) { 2535 containsKey(key) {
2473 if (!(typeof key == string)) 2536 if (!(typeof key == string))
2474 return false; 2537 return false;
2475 if (dart.equals('__proto__', key)) 2538 if (dart.equals('__proto__', key))
2476 return true; 2539 return true;
2477 return jsHasOwnProperty(this._jsObject, dart.as(key, core.String)); 2540 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
2478 } 2541 }
2479 _fetch(key) { 2542 [_fetch](key) {
2480 return dart.equals('__proto__', key) ? this._protoValue : jsPropertyAcce ss(this._jsObject, dart.as(key, core.String)); 2543 return dart.equals('__proto__', key) ? this[_protoValue] : jsPropertyAcc ess(this[_jsObject], dart.as(key, core.String));
2481 } 2544 }
2482 } 2545 }
2483 dart.defineNamedConstructor(ConstantProtoMap, '_'); 2546 dart.defineNamedConstructor(ConstantProtoMap, '_');
2484 return ConstantProtoMap; 2547 return ConstantProtoMap;
2485 }); 2548 });
2486 let ConstantProtoMap = ConstantProtoMap$(dynamic, dynamic); 2549 let ConstantProtoMap = ConstantProtoMap$(dynamic, dynamic);
2487 let _ConstantMapKeyIterable$ = dart.generic(function(K) { 2550 let _ConstantMapKeyIterable$ = dart.generic(function(K) {
2488 class _ConstantMapKeyIterable extends collection.IterableBase$(K) { 2551 class _ConstantMapKeyIterable extends collection.IterableBase$(K) {
2489 _ConstantMapKeyIterable(_map) { 2552 _ConstantMapKeyIterable($_map) {
2490 this._map = _map; 2553 this[_map] = $_map;
2491 super.IterableBase(); 2554 super.IterableBase();
2492 } 2555 }
2493 get iterator() { 2556 get iterator() {
2494 return this._map._keys.iterator; 2557 return this[_map][_keys].iterator;
2495 } 2558 }
2496 get length() { 2559 get length() {
2497 return this._map._keys.length; 2560 return this[_map][_keys].length;
2498 } 2561 }
2499 } 2562 }
2500 return _ConstantMapKeyIterable; 2563 return _ConstantMapKeyIterable;
2501 }); 2564 });
2502 let _ConstantMapKeyIterable = _ConstantMapKeyIterable$(dynamic); 2565 let _ConstantMapKeyIterable = _ConstantMapKeyIterable$(dynamic);
2503 let GeneralConstantMap$ = dart.generic(function(K, V) { 2566 let GeneralConstantMap$ = dart.generic(function(K, V) {
2504 class GeneralConstantMap extends ConstantMap$(K, V) { 2567 class GeneralConstantMap extends ConstantMap$(K, V) {
2505 GeneralConstantMap(_jsData) { 2568 GeneralConstantMap($_jsData) {
2506 this._jsData = _jsData; 2569 this[_jsData] = $_jsData;
2507 super.ConstantMap$_(); 2570 super.ConstantMap$_();
2508 } 2571 }
2509 _getMap() { 2572 [_getMap]() {
2510 if (!this.$map) { 2573 if (!this.$map) {
2511 let backingMap = new collection.LinkedHashMap(); 2574 let backingMap = new collection.LinkedHashMap();
2512 this.$map = fillLiteralMap(this._jsData, backingMap); 2575 this.$map = fillLiteralMap(this[_jsData], backingMap);
2513 } 2576 }
2514 return this.$map; 2577 return this.$map;
2515 } 2578 }
2516 containsValue(needle) { 2579 containsValue(needle) {
2517 return this._getMap().containsValue(needle); 2580 return this[_getMap]().containsValue(needle);
2518 } 2581 }
2519 containsKey(key) { 2582 containsKey(key) {
2520 return this._getMap().containsKey(key); 2583 return this[_getMap]().containsKey(key);
2521 } 2584 }
2522 get(key) { 2585 get(key) {
2523 return this._getMap().get(key); 2586 return this[_getMap]().get(key);
2524 } 2587 }
2525 forEach(f) { 2588 forEach(f) {
2526 this._getMap().forEach(f); 2589 this[_getMap]().forEach(f);
2527 } 2590 }
2528 get keys() { 2591 get keys() {
2529 return this._getMap().keys; 2592 return this[_getMap]().keys;
2530 } 2593 }
2531 get values() { 2594 get values() {
2532 return this._getMap().values; 2595 return this[_getMap]().values;
2533 } 2596 }
2534 get length() { 2597 get length() {
2535 return this._getMap().length; 2598 return this[_getMap]().length;
2536 } 2599 }
2537 } 2600 }
2538 return GeneralConstantMap; 2601 return GeneralConstantMap;
2539 }); 2602 });
2540 let GeneralConstantMap = GeneralConstantMap$(dynamic, dynamic); 2603 let GeneralConstantMap = GeneralConstantMap$(dynamic, dynamic);
2541 // Function contains: (String, String) → bool 2604 // Function contains: (String, String) → bool
2542 function contains(userAgent, name) { 2605 function contains(userAgent, name) {
2543 return userAgent.indexOf(name) !== -1; 2606 return userAgent.indexOf(name) !== -1;
2544 } 2607 }
2545 // Function arrayLength: (List<dynamic>) → int 2608 // Function arrayLength: (List<dynamic>) → int
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 let _constructorNameFallback = new _foreign_helper.JS_CONST('\nfunction getTag Fallback(o) {\n var constructor = o.constructor;\n if (typeof constructor == " function") {\n var name = constructor.name;\n // If the name is a non-empt y string, we use that as the type name of this\n // object. There are variou s cases where that does not work, so we have to\n // detect them and fall thr ough to the toString() based implementation.\n\n if (typeof name == "string" &&\n\n // Sometimes the string is empty. This test also catches minified \n // shadow dom polyfil wrapper for Window on Firefox where the faked\n // constructor name does not \'stick\'. The shortest real DOM object\n // names have three characters (e.g. URL, CSS).\n name.length > 2 & &\n\n // On Firefox we often get "Object" as the constructor name, even f or\n // more specialized DOM objects.\n name !== "Object" &&\n\n // This can happen in Opera.\n name !== "Function.prototype") {\n return name;\n }\n }\n var s = Object.prototype.toString.call(o);\n re turn s.substring(8, s.length - 1);\n}'); 2855 let _constructorNameFallback = new _foreign_helper.JS_CONST('\nfunction getTag Fallback(o) {\n var constructor = o.constructor;\n if (typeof constructor == " function") {\n var name = constructor.name;\n // If the name is a non-empt y string, we use that as the type name of this\n // object. There are variou s cases where that does not work, so we have to\n // detect them and fall thr ough to the toString() based implementation.\n\n if (typeof name == "string" &&\n\n // Sometimes the string is empty. This test also catches minified \n // shadow dom polyfil wrapper for Window on Firefox where the faked\n // constructor name does not \'stick\'. The shortest real DOM object\n // names have three characters (e.g. URL, CSS).\n name.length > 2 & &\n\n // On Firefox we often get "Object" as the constructor name, even f or\n // more specialized DOM objects.\n name !== "Object" &&\n\n // This can happen in Opera.\n name !== "Function.prototype") {\n return name;\n }\n }\n var s = Object.prototype.toString.call(o);\n re turn s.substring(8, s.length - 1);\n}');
2793 let _fallbackConstructorHooksTransformerGenerator = new _foreign_helper.JS_CON ST('\nfunction(getTagFallback) {\n return function(hooks) {\n // If we are n ot in a browser, assume we are in d8.\n // TODO(sra): Recognize jsshell.\n if (typeof navigator != "object") return hooks;\n\n var ua = navigator.userA gent;\n // TODO(antonm): remove a reference to DumpRenderTree.\n if (ua.in dexOf("DumpRenderTree") >= 0) return hooks;\n if (ua.indexOf("Chrome") >= 0) {\n // Confirm constructor name is usable for dispatch.\n function con firm(p) {\n return typeof window == "object" && window[p] && window[p].na me == p;\n }\n if (confirm("Window") && confirm("HTMLElement")) return hooks;\n }\n\n hooks.getTag = getTagFallback;\n };\n}'); 2856 let _fallbackConstructorHooksTransformerGenerator = new _foreign_helper.JS_CON ST('\nfunction(getTagFallback) {\n return function(hooks) {\n // If we are n ot in a browser, assume we are in d8.\n // TODO(sra): Recognize jsshell.\n if (typeof navigator != "object") return hooks;\n\n var ua = navigator.userA gent;\n // TODO(antonm): remove a reference to DumpRenderTree.\n if (ua.in dexOf("DumpRenderTree") >= 0) return hooks;\n if (ua.indexOf("Chrome") >= 0) {\n // Confirm constructor name is usable for dispatch.\n function con firm(p) {\n return typeof window == "object" && window[p] && window[p].na me == p;\n }\n if (confirm("Window") && confirm("HTMLElement")) return hooks;\n }\n\n hooks.getTag = getTagFallback;\n };\n}');
2794 let _ieHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {\n var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if (userAgent.indexOf("Trident/") == -1) return hooks;\n\n var getTag = hooks.getT ag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTransfer" : "Clipboard",\n "HTMLDDElement": "HTMLElement",\n "HTMLDTElement": "HTMLE lement",\n "HTMLPhraseElement": "HTMLElement",\n "Position": "Geoposition" \n };\n\n function getTagIE(o) {\n var tag = getTag(o);\n var newTag = q uickMap[tag];\n if (newTag) return newTag;\n // Patches for types which re port themselves as Objects.\n if (tag == "Object") {\n if (window.DataVi ew && (o instanceof window.DataView)) return "DataView";\n }\n return tag; \n }\n\n function prototypeForTagIE(tag) {\n var constructor = window[tag]; \n if (constructor == null) return null;\n return constructor.prototype;\n }\n\n hooks.getTag = getTagIE;\n hooks.prototypeForTag = prototypeForTagIE;\ n}'); 2857 let _ieHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {\n var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if (userAgent.indexOf("Trident/") == -1) return hooks;\n\n var getTag = hooks.getT ag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTransfer" : "Clipboard",\n "HTMLDDElement": "HTMLElement",\n "HTMLDTElement": "HTMLE lement",\n "HTMLPhraseElement": "HTMLElement",\n "Position": "Geoposition" \n };\n\n function getTagIE(o) {\n var tag = getTag(o);\n var newTag = q uickMap[tag];\n if (newTag) return newTag;\n // Patches for types which re port themselves as Objects.\n if (tag == "Object") {\n if (window.DataVi ew && (o instanceof window.DataView)) return "DataView";\n }\n return tag; \n }\n\n function prototypeForTagIE(tag) {\n var constructor = window[tag]; \n if (constructor == null) return null;\n return constructor.prototype;\n }\n\n hooks.getTag = getTagIE;\n hooks.prototypeForTag = prototypeForTagIE;\ n}');
2795 let _fixDocumentHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(ho oks) {\n var getTag = hooks.getTag;\n var prototypeForTag = hooks.prototypeFor Tag;\n function getTagFixed(o) {\n var tag = getTag(o);\n if (tag == "Doc ument") {\n // Some browsers and the polymer polyfill call both HTML and XM L documents\n // "Document", so we check for the xmlVersion property, which is the empty\n // string on HTML documents. Since both dart:html classes D ocument and\n // HtmlDocument share the same type, we must patch the instan ces and not\n // the prototype.\n if (!!o.xmlVersion) return "!Documen t";\n return "!HTMLDocument";\n }\n return tag;\n }\n\n function pr ototypeForTagFixed(tag) {\n if (tag == "Document") return null; // Do not pr e-patch Document.\n return prototypeForTag(tag);\n }\n\n hooks.getTag = get TagFixed;\n hooks.prototypeForTag = prototypeForTagFixed;\n}'); 2858 let _fixDocumentHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(ho oks) {\n var getTag = hooks.getTag;\n var prototypeForTag = hooks.prototypeFor Tag;\n function getTagFixed(o) {\n var tag = getTag(o);\n if (tag == "Doc ument") {\n // Some browsers and the polymer polyfill call both HTML and XM L documents\n // "Document", so we check for the xmlVersion property, which is the empty\n // string on HTML documents. Since both dart:html classes D ocument and\n // HtmlDocument share the same type, we must patch the instan ces and not\n // the prototype.\n if (!!o.xmlVersion) return "!Documen t";\n return "!HTMLDocument";\n }\n return tag;\n }\n\n function pr ototypeForTagFixed(tag) {\n if (tag == "Document") return null; // Do not pr e-patch Document.\n return prototypeForTag(tag);\n }\n\n hooks.getTag = get TagFixed;\n hooks.prototypeForTag = prototypeForTagFixed;\n}');
2796 let _firefoxHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {\n var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if (userAgent.indexOf("Firefox") == -1) return hooks;\n\n var getTag = hooks. getTag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTrans fer": "Clipboard",\n "GeoGeolocation": "Geolocation",\n "Location": "!Loca tion", // Fixes issue 18151\n "WorkerMessageEvent": "MessageEve nt",\n "XMLDocument": "!Document"};\n\n function getTagFirefox(o) {\n var tag = getTag(o);\n return quickMap[tag] || tag;\n }\n\n hooks.getTag = get TagFirefox;\n}'); 2859 let _firefoxHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) {\n var userAgent = typeof navigator == "object" ? navigator.userAgent : "";\n if (userAgent.indexOf("Firefox") == -1) return hooks;\n\n var getTag = hooks. getTag;\n\n var quickMap = {\n "BeforeUnloadEvent": "Event",\n "DataTrans fer": "Clipboard",\n "GeoGeolocation": "Geolocation",\n "Location": "!Loca tion", // Fixes issue 18151\n "WorkerMessageEvent": "MessageEve nt",\n "XMLDocument": "!Document"};\n\n function getTagFirefox(o) {\n var tag = getTag(o);\n return quickMap[tag] || tag;\n }\n\n hooks.getTag = get TagFirefox;\n}');
2797 let _operaHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) { return hooks; }\n'); 2860 let _operaHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) { return hooks; }\n');
2798 let _safariHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) { return hooks; }\n'); 2861 let _safariHooksTransformer = new _foreign_helper.JS_CONST('\nfunction(hooks) { return hooks; }\n');
2799 let _dartExperimentalFixupGetTagHooksTransformer = new _foreign_helper.JS_CONS T('\nfunction(hooks) {\n if (typeof dartExperimentalFixupGetTag != "function") return hooks;\n hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag);\n}'); 2862 let _dartExperimentalFixupGetTagHooksTransformer = new _foreign_helper.JS_CONS T('\nfunction(hooks) {\n if (typeof dartExperimentalFixupGetTag != "function") return hooks;\n hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag);\n}');
2800 // Function regExpGetNative: (JSSyntaxRegExp) → dynamic 2863 // Function regExpGetNative: (JSSyntaxRegExp) → dynamic
2801 function regExpGetNative(regexp) { 2864 function regExpGetNative(regexp) {
2802 return regexp._nativeRegExp; 2865 return regexp[_nativeRegExp];
2803 } 2866 }
2804 // Function regExpGetGlobalNative: (JSSyntaxRegExp) → dynamic 2867 // Function regExpGetGlobalNative: (JSSyntaxRegExp) → dynamic
2805 function regExpGetGlobalNative(regexp) { 2868 function regExpGetGlobalNative(regexp) {
2806 let nativeRegexp = regexp._nativeGlobalVersion; 2869 let nativeRegexp = regexp[_nativeGlobalVersion];
2807 nativeRegexp.lastIndex = 0; 2870 nativeRegexp.lastIndex = 0;
2808 return nativeRegexp; 2871 return nativeRegexp;
2809 } 2872 }
2810 // Function regExpCaptureCount: (JSSyntaxRegExp) → int 2873 // Function regExpCaptureCount: (JSSyntaxRegExp) → int
2811 function regExpCaptureCount(regexp) { 2874 function regExpCaptureCount(regexp) {
2812 let nativeAnchoredRegExp = regexp._nativeAnchoredVersion; 2875 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion];
2813 let match = nativeAnchoredRegExp.exec(''); 2876 let match = nativeAnchoredRegExp.exec('');
2814 return dart.as(dart.dbinary(dart.dload(match, 'length'), '-', 2), core.int); 2877 return dart.as(dart.dbinary(dart.dload(match, 'length'), '-', 2), core.int);
2815 } 2878 }
2816 class JSSyntaxRegExp extends dart.Object { 2879 class JSSyntaxRegExp extends dart.Object {
2817 toString() { 2880 toString() {
2818 return `RegExp/${this.pattern}/`; 2881 return `RegExp/${this.pattern}/`;
2819 } 2882 }
2820 JSSyntaxRegExp(source, opt$) { 2883 JSSyntaxRegExp(source, opt$) {
2821 let multiLine = opt$.multiLine === void 0 ? false : opt$.multiLine; 2884 let multiLine = opt$.multiLine === void 0 ? false : opt$.multiLine;
2822 let caseSensitive = opt$.caseSensitive === void 0 ? true : opt$.caseSensit ive; 2885 let caseSensitive = opt$.caseSensitive === void 0 ? true : opt$.caseSensit ive;
2823 this.pattern = source; 2886 this.pattern = source;
2824 this._nativeRegExp = makeNative(source, multiLine, caseSensitive, false); 2887 this[_nativeRegExp] = makeNative(source, multiLine, caseSensitive, false);
2825 this._nativeGlobalRegExp = null; 2888 this[_nativeGlobalRegExp] = null;
2826 this._nativeAnchoredRegExp = null; 2889 this[_nativeAnchoredRegExp] = null;
2827 } 2890 }
2828 get _nativeGlobalVersion() { 2891 get [_nativeGlobalVersion]() {
2829 if (this._nativeGlobalRegExp !== null) 2892 if (this[_nativeGlobalRegExp] !== null)
2830 return this._nativeGlobalRegExp; 2893 return this[_nativeGlobalRegExp];
2831 return this._nativeGlobalRegExp = makeNative(this.pattern, this._isMultiLi ne, this._isCaseSensitive, true); 2894 return this[_nativeGlobalRegExp] = makeNative(this.pattern, this[_isMultiL ine], this[_isCaseSensitive], true);
2832 } 2895 }
2833 get _nativeAnchoredVersion() { 2896 get [_nativeAnchoredVersion]() {
2834 if (this._nativeAnchoredRegExp !== null) 2897 if (this[_nativeAnchoredRegExp] !== null)
2835 return this._nativeAnchoredRegExp; 2898 return this[_nativeAnchoredRegExp];
2836 return this._nativeAnchoredRegExp = makeNative(`${this.pattern}|()`, this. _isMultiLine, this._isCaseSensitive, true); 2899 return this[_nativeAnchoredRegExp] = makeNative(`${this.pattern}|()`, this [_isMultiLine], this[_isCaseSensitive], true);
2837 } 2900 }
2838 get _isMultiLine() { 2901 get [_isMultiLine]() {
2839 return this._nativeRegExp.multiline; 2902 return this[_nativeRegExp].multiline;
2840 } 2903 }
2841 get _isCaseSensitive() { 2904 get [_isCaseSensitive]() {
2842 return !this._nativeRegExp.ignoreCase; 2905 return !this[_nativeRegExp].ignoreCase;
2843 } 2906 }
2844 static makeNative(source, multiLine, caseSensitive, global) { 2907 static makeNative(source, multiLine, caseSensitive, global) {
2845 checkString(source); 2908 checkString(source);
2846 let m = multiLine ? 'm' : ''; 2909 let m = multiLine ? 'm' : '';
2847 let i = caseSensitive ? '' : 'i'; 2910 let i = caseSensitive ? '' : 'i';
2848 let g = global ? 'g' : ''; 2911 let g = global ? 'g' : '';
2849 let regexp = function() { 2912 let regexp = function() {
2850 try { 2913 try {
2851 return new RegExp(source, m + i + g); 2914 return new RegExp(source, m + i + g);
2852 } catch (e) { 2915 } catch (e) {
2853 return e; 2916 return e;
2854 } 2917 }
2855 2918
2856 }(); 2919 }();
2857 if (regexp instanceof RegExp) 2920 if (regexp instanceof RegExp)
2858 return regexp; 2921 return regexp;
2859 let errorMessage = String(regexp); 2922 let errorMessage = String(regexp);
2860 throw new core.FormatException(`Illegal RegExp pattern: ${source}, ${error Message}`); 2923 throw new core.FormatException(`Illegal RegExp pattern: ${source}, ${error Message}`);
2861 } 2924 }
2862 firstMatch(string) { 2925 firstMatch(string) {
2863 let m = dart.as(this._nativeRegExp.exec(checkString(string)), core.List$(c ore.String)); 2926 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$( core.String));
2864 if (m === null) 2927 if (m === null)
2865 return null; 2928 return null;
2866 return new _MatchImplementation(this, m); 2929 return new _MatchImplementation(this, m);
2867 } 2930 }
2868 hasMatch(string) { 2931 hasMatch(string) {
2869 return this._nativeRegExp.test(checkString(string)); 2932 return this[_nativeRegExp].test(checkString(string));
2870 } 2933 }
2871 stringMatch(string) { 2934 stringMatch(string) {
2872 let match = this.firstMatch(string); 2935 let match = this.firstMatch(string);
2873 if (match !== null) 2936 if (match !== null)
2874 return match.group(0); 2937 return match.group(0);
2875 return null; 2938 return null;
2876 } 2939 }
2877 allMatches(string, start) { 2940 allMatches(string, start) {
2878 if (start === void 0) 2941 if (start === void 0)
2879 start = 0; 2942 start = 0;
2880 checkString(string); 2943 checkString(string);
2881 checkInt(start); 2944 checkInt(start);
2882 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { 2945 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) {
2883 throw new core.RangeError.range(start, 0, string.length); 2946 throw new core.RangeError.range(start, 0, string.length);
2884 } 2947 }
2885 return new _AllMatchesIterable(this, string, start); 2948 return new _AllMatchesIterable(this, string, start);
2886 } 2949 }
2887 _execGlobal(string, start) { 2950 [_execGlobal](string, start) {
2888 let regexp = this._nativeGlobalVersion; 2951 let regexp = this[_nativeGlobalVersion];
2889 regexp.lastIndex = start; 2952 regexp.lastIndex = start;
2890 let match = dart.as(regexp.exec(string), core.List); 2953 let match = dart.as(regexp.exec(string), core.List);
2891 if (match === null) 2954 if (match === null)
2892 return null; 2955 return null;
2893 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g))); 2956 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
2894 } 2957 }
2895 _execAnchored(string, start) { 2958 [_execAnchored](string, start) {
2896 let regexp = this._nativeAnchoredVersion; 2959 let regexp = this[_nativeAnchoredVersion];
2897 regexp.lastIndex = start; 2960 regexp.lastIndex = start;
2898 let match = dart.as(regexp.exec(string), core.List); 2961 let match = dart.as(regexp.exec(string), core.List);
2899 if (match === null) 2962 if (match === null)
2900 return null; 2963 return null;
2901 if (match.get(match.length - 1) !== null) 2964 if (match.get(match.length - 1) !== null)
2902 return null; 2965 return null;
2903 match.length = 1; 2966 match.length = 1;
2904 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g))); 2967 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
2905 } 2968 }
2906 matchAsPrefix(string, start) { 2969 matchAsPrefix(string, start) {
2907 if (start === void 0) 2970 if (start === void 0)
2908 start = 0; 2971 start = 0;
2909 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { 2972 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) {
2910 throw new core.RangeError.range(start, 0, string.length); 2973 throw new core.RangeError.range(start, 0, string.length);
2911 } 2974 }
2912 return this._execAnchored(string, start); 2975 return this[_execAnchored](string, start);
2913 } 2976 }
2914 get isMultiLine() { 2977 get isMultiLine() {
2915 return this._isMultiLine; 2978 return this[_isMultiLine];
2916 } 2979 }
2917 get isCaseSensitive() { 2980 get isCaseSensitive() {
2918 return this._isCaseSensitive; 2981 return this[_isCaseSensitive];
2919 } 2982 }
2920 } 2983 }
2921 class _MatchImplementation extends dart.Object { 2984 class _MatchImplementation extends dart.Object {
2922 _MatchImplementation(pattern, _match) { 2985 _MatchImplementation(pattern, $_match) {
2923 this.pattern = pattern; 2986 this.pattern = pattern;
2924 this._match = _match; 2987 this[_match] = $_match;
2925 dart.assert(typeof this._match.input == string); 2988 dart.assert(typeof this[_match].input == string);
2926 dart.assert(typeof this._match.index == number); 2989 dart.assert(typeof this[_match].index == number);
2927 } 2990 }
2928 get input() { 2991 get input() {
2929 return this._match.input; 2992 return this[_match].input;
2930 } 2993 }
2931 get start() { 2994 get start() {
2932 return this._match.index; 2995 return this[_match].index;
2933 } 2996 }
2934 get end() { 2997 get end() {
2935 return this.start + this._match.get(0).length; 2998 return this.start + this[_match].get(0).length;
2936 } 2999 }
2937 group(index) { 3000 group(index) {
2938 return this._match.get(index); 3001 return this[_match].get(index);
2939 } 3002 }
2940 get(index) { 3003 get(index) {
2941 return this.group(index); 3004 return this.group(index);
2942 } 3005 }
2943 get groupCount() { 3006 get groupCount() {
2944 return this._match.length - 1; 3007 return this[_match].length - 1;
2945 } 3008 }
2946 groups(groups) { 3009 groups(groups) {
2947 let out = dart.as(new List.from([]), core.List$(core.String)); 3010 let out = dart.as(new List.from([]), core.List$(core.String));
2948 for (let i of groups) { 3011 for (let i of groups) {
2949 out.add(this.group(i)); 3012 out.add(this.group(i));
2950 } 3013 }
2951 return out; 3014 return out;
2952 } 3015 }
2953 } 3016 }
2954 class _AllMatchesIterable extends collection.IterableBase$(core.Match) { 3017 class _AllMatchesIterable extends collection.IterableBase$(core.Match) {
2955 _AllMatchesIterable(_re, _string, _start) { 3018 _AllMatchesIterable($_re, $_string, $_start) {
2956 this._re = _re; 3019 this[_re] = $_re;
2957 this._string = _string; 3020 this[_string] = $_string;
2958 this._start = _start; 3021 this[_start] = $_start;
2959 super.IterableBase(); 3022 super.IterableBase();
2960 } 3023 }
2961 get iterator() { 3024 get iterator() {
2962 return new _AllMatchesIterator(this._re, this._string, this._start); 3025 return new _AllMatchesIterator(this[_re], this[_string], this[_start]);
2963 } 3026 }
2964 } 3027 }
2965 class _AllMatchesIterator extends dart.Object { 3028 class _AllMatchesIterator extends dart.Object {
2966 _AllMatchesIterator(_regExp, _string, _nextIndex) { 3029 _AllMatchesIterator($_regExp, $_string, $_nextIndex) {
2967 this._regExp = _regExp; 3030 this[_regExp] = $_regExp;
2968 this._string = _string; 3031 this[_string] = $_string;
2969 this._nextIndex = _nextIndex; 3032 this[_nextIndex] = $_nextIndex;
2970 this._current = null; 3033 this[_current] = null;
2971 } 3034 }
2972 get current() { 3035 get current() {
2973 return this._current; 3036 return this[_current];
2974 } 3037 }
2975 moveNext() { 3038 moveNext() {
2976 if (this._string === null) 3039 if (this[_string] === null)
2977 return false; 3040 return false;
2978 if (this._nextIndex <= this._string.length) { 3041 if (this[_nextIndex] <= this[_string].length) {
2979 let match = this._regExp._execGlobal(this._string, this._nextIndex); 3042 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]);
2980 if (match !== null) { 3043 if (match !== null) {
2981 this._current = match; 3044 this[_current] = match;
2982 let nextIndex = match.end; 3045 let nextIndex = match.end;
2983 if (match.start === nextIndex) { 3046 if (match.start === nextIndex) {
2984 nextIndex++; 3047 nextIndex++;
2985 } 3048 }
2986 this._nextIndex = nextIndex; 3049 this[_nextIndex] = nextIndex;
2987 return true; 3050 return true;
2988 } 3051 }
2989 } 3052 }
2990 this._current = null; 3053 this[_current] = null;
2991 this._string = null; 3054 this[_string] = null;
2992 return false; 3055 return false;
2993 } 3056 }
2994 } 3057 }
2995 // Function firstMatchAfter: (JSSyntaxRegExp, String, int) → Match 3058 // Function firstMatchAfter: (JSSyntaxRegExp, String, int) → Match
2996 function firstMatchAfter(regExp, string, start) { 3059 function firstMatchAfter(regExp, string, start) {
2997 return regExp._execGlobal(string, start); 3060 return regExp._execGlobal(string, start);
2998 } 3061 }
2999 class StringMatch extends dart.Object { 3062 class StringMatch extends dart.Object {
3000 StringMatch(start, input, pattern) { 3063 StringMatch(start, input, pattern) {
3001 this.start = start; 3064 this.start = start;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3197 } 3260 }
3198 // Function stringJoinUnchecked: (dynamic, dynamic) → dynamic 3261 // Function stringJoinUnchecked: (dynamic, dynamic) → dynamic
3199 function stringJoinUnchecked(array, separator) { 3262 function stringJoinUnchecked(array, separator) {
3200 return array.join(separator); 3263 return array.join(separator);
3201 } 3264 }
3202 // Function createRuntimeType: (String) → Type 3265 // Function createRuntimeType: (String) → Type
3203 function createRuntimeType(name) { 3266 function createRuntimeType(name) {
3204 return new TypeImpl(name); 3267 return new TypeImpl(name);
3205 } 3268 }
3206 class TypeImpl extends dart.Object { 3269 class TypeImpl extends dart.Object {
3207 TypeImpl(_typeName) { 3270 TypeImpl($_typeName) {
3208 this._typeName = _typeName; 3271 this[_typeName] = $_typeName;
3209 this._unmangledName = null; 3272 this[_unmangledName] = null;
3210 } 3273 }
3211 toString() { 3274 toString() {
3212 if (this._unmangledName !== null) 3275 if (this[_unmangledName] !== null)
3213 return this._unmangledName; 3276 return this[_unmangledName];
3214 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi s._typeName); 3277 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi s[_typeName]);
3215 return this._unmangledName = unmangledName; 3278 return this[_unmangledName] = unmangledName;
3216 } 3279 }
3217 get hashCode() { 3280 get hashCode() {
3218 return this._typeName.hashCode; 3281 return this[_typeName].hashCode;
3219 } 3282 }
3220 ['=='](other) { 3283 ['=='](other) {
3221 return dart.notNull(dart.is(other, TypeImpl)) && dart.notNull(dart.equals( this._typeName, dart.dload(other, '_typeName'))); 3284 return dart.notNull(dart.is(other, TypeImpl)) && dart.notNull(dart.equals( this[_typeName], dart.dload(other, '_typeName')));
3222 } 3285 }
3223 } 3286 }
3224 class TypeVariable extends dart.Object { 3287 class TypeVariable extends dart.Object {
3225 TypeVariable(owner, name, bound) { 3288 TypeVariable(owner, name, bound) {
3226 this.owner = owner; 3289 this.owner = owner;
3227 this.name = name; 3290 this.name = name;
3228 this.bound = bound; 3291 this.bound = bound;
3229 } 3292 }
3230 } 3293 }
3231 // Function getMangledTypeName: (TypeImpl) → dynamic 3294 // Function getMangledTypeName: (TypeImpl) → dynamic
3232 function getMangledTypeName(type) { 3295 function getMangledTypeName(type) {
3233 return type._typeName; 3296 return type[_typeName];
3234 } 3297 }
3235 // Function setRuntimeTypeInfo: (Object, dynamic) → Object 3298 // Function setRuntimeTypeInfo: (Object, dynamic) → Object
3236 function setRuntimeTypeInfo(target, typeInfo) { 3299 function setRuntimeTypeInfo(target, typeInfo) {
3237 dart.assert(dart.notNull(typeInfo === null) || dart.notNull(isJsArray(typeIn fo))); 3300 dart.assert(dart.notNull(typeInfo === null) || dart.notNull(isJsArray(typeIn fo)));
3238 if (target !== null) 3301 if (target !== null)
3239 target.$builtinTypeInfo = typeInfo; 3302 target.$builtinTypeInfo = typeInfo;
3240 return target; 3303 return target;
3241 } 3304 }
3242 // Function getRuntimeTypeInfo: (Object) → dynamic 3305 // Function getRuntimeTypeInfo: (Object) → dynamic
3243 function getRuntimeTypeInfo(target) { 3306 function getRuntimeTypeInfo(target) {
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
3885 exports.getIndex = getIndex; 3948 exports.getIndex = getIndex;
3886 exports.getLength = getLength; 3949 exports.getLength = getLength;
3887 exports.isJsArray = isJsArray; 3950 exports.isJsArray = isJsArray;
3888 exports.hasField = hasField; 3951 exports.hasField = hasField;
3889 exports.hasNoField = hasNoField; 3952 exports.hasNoField = hasNoField;
3890 exports.isJsFunction = isJsFunction; 3953 exports.isJsFunction = isJsFunction;
3891 exports.isJsObject = isJsObject; 3954 exports.isJsObject = isJsObject;
3892 exports.isIdentical = isIdentical; 3955 exports.isIdentical = isIdentical;
3893 exports.isNotIdentical = isNotIdentical; 3956 exports.isNotIdentical = isNotIdentical;
3894 })(_js_helper || (_js_helper = {})); 3957 })(_js_helper || (_js_helper = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698