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

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

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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/_js_embedded_names.js ('k') | lib/runtime/dart/_js_mirrors.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 dart_library.library('dart/_js_helper', null, /* Imports */[
2 'dart/_runtime',
3 'dart/core',
4 'dart/collection',
5 'dart/_interceptors',
6 'dart/_foreign_helper'
7 ], /* Lazy imports */[
8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) {
9 'use strict';
10 let dartx = dart.dartx;
11 class NoThrows extends core.Object {
12 NoThrows() {
13 }
14 }
15 dart.setSignature(NoThrows, {
16 constructors: () => ({NoThrows: [NoThrows, []]})
17 });
18 class NoInline extends core.Object {
19 NoInline() {
20 }
21 }
22 dart.setSignature(NoInline, {
23 constructors: () => ({NoInline: [NoInline, []]})
24 });
25 class Native extends core.Object {
26 Native(name) {
27 this.name = name;
28 }
29 }
30 dart.setSignature(Native, {
31 constructors: () => ({Native: [Native, [core.String]]})
32 });
33 class JsPeerInterface extends core.Object {
34 JsPeerInterface(opts) {
35 let name = opts && 'name' in opts ? opts.name : null;
36 this.name = name;
37 }
38 }
39 dart.setSignature(JsPeerInterface, {
40 constructors: () => ({JsPeerInterface: [JsPeerInterface, [], {name: core.Str ing}]})
41 });
42 class SupportJsExtensionMethods extends core.Object {
43 SupportJsExtensionMethods() {
44 }
45 }
46 dart.setSignature(SupportJsExtensionMethods, {
47 constructors: () => ({SupportJsExtensionMethods: [SupportJsExtensionMethods, []]})
48 });
49 function defineProperty(obj, property, value) {
50 Object.defineProperty(obj, property, {value: value, enumerable: false, writa ble: true, configurable: true});
51 }
52 dart.fn(defineProperty, dart.void, [dart.dynamic, core.String, dart.dynamic]);
53 const _nativeRegExp = Symbol('_nativeRegExp');
54 function regExpGetNative(regexp) {
55 return regexp[_nativeRegExp];
56 }
57 dart.fn(regExpGetNative, () => dart.definiteFunctionType(dart.dynamic, [JSSynt axRegExp]));
58 const _nativeGlobalVersion = Symbol('_nativeGlobalVersion');
59 function regExpGetGlobalNative(regexp) {
60 let nativeRegexp = regexp[_nativeGlobalVersion];
61 nativeRegexp.lastIndex = 0;
62 return nativeRegexp;
63 }
64 dart.fn(regExpGetGlobalNative, () => dart.definiteFunctionType(dart.dynamic, [ JSSyntaxRegExp]));
65 const _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion');
66 function regExpCaptureCount(regexp) {
67 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion];
68 let match = nativeAnchoredRegExp.exec('');
69 return dart.as(dart.dsend(dart.dload(match, 'length'), '-', 2), core.int);
70 }
71 dart.fn(regExpCaptureCount, () => dart.definiteFunctionType(core.int, [JSSynta xRegExp]));
72 const _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp');
73 const _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp');
74 const _isMultiLine = Symbol('_isMultiLine');
75 const _isCaseSensitive = Symbol('_isCaseSensitive');
76 const _execGlobal = Symbol('_execGlobal');
77 const _execAnchored = Symbol('_execAnchored');
78 class JSSyntaxRegExp extends core.Object {
79 toString() {
80 return `RegExp/${this.pattern}/`;
81 }
82 JSSyntaxRegExp(source, opts) {
83 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
84 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true;
85 this.pattern = source;
86 this[_nativeRegExp] = JSSyntaxRegExp.makeNative(source, multiLine, caseSen sitive, false);
87 this[_nativeGlobalRegExp] = null;
88 this[_nativeAnchoredRegExp] = null;
89 }
90 get [_nativeGlobalVersion]() {
91 if (this[_nativeGlobalRegExp] != null) return this[_nativeGlobalRegExp];
92 return this[_nativeGlobalRegExp] = JSSyntaxRegExp.makeNative(this.pattern, this[_isMultiLine], this[_isCaseSensitive], true);
93 }
94 get [_nativeAnchoredVersion]() {
95 if (this[_nativeAnchoredRegExp] != null) return this[_nativeAnchoredRegExp ];
96 return this[_nativeAnchoredRegExp] = JSSyntaxRegExp.makeNative(`${this.pat tern}|()`, this[_isMultiLine], this[_isCaseSensitive], true);
97 }
98 get [_isMultiLine]() {
99 return this[_nativeRegExp].multiline;
100 }
101 get [_isCaseSensitive]() {
102 return !this[_nativeRegExp].ignoreCase;
103 }
104 static makeNative(source, multiLine, caseSensitive, global) {
105 checkString(source);
106 let m = dart.notNull(multiLine) ? 'm' : '';
107 let i = dart.notNull(caseSensitive) ? '' : 'i';
108 let g = dart.notNull(global) ? 'g' : '';
109 let regexp = (function() {
110 try {
111 return new RegExp(source, m + i + g);
112 } catch (e) {
113 return e;
114 }
115
116 })();
117 if (regexp instanceof RegExp) return regexp;
118 let errorMessage = String(regexp);
119 dart.throw(new core.FormatException(`Illegal RegExp pattern: ${source}, ${ errorMessage}`));
120 }
121 firstMatch(string) {
122 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$( core.String));
123 if (m == null) return null;
124 return new _MatchImplementation(this, m);
125 }
126 hasMatch(string) {
127 return this[_nativeRegExp].test(checkString(string));
128 }
129 stringMatch(string) {
130 let match = this.firstMatch(string);
131 if (match != null) return match.group(0);
132 return null;
133 }
134 allMatches(string, start) {
135 if (start === void 0) start = 0;
136 checkString(string);
137 checkInt(start);
138 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) {
139 dart.throw(new core.RangeError.range(start, 0, string[dartx.length]));
140 }
141 return new _AllMatchesIterable(this, string, start);
142 }
143 [_execGlobal](string, start) {
144 let regexp = this[_nativeGlobalVersion];
145 regexp.lastIndex = start;
146 let match = dart.as(regexp.exec(string), core.List);
147 if (match == null) return null;
148 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
149 }
150 [_execAnchored](string, start) {
151 let regexp = this[_nativeAnchoredVersion];
152 regexp.lastIndex = start;
153 let match = dart.as(regexp.exec(string), core.List);
154 if (match == null) return null;
155 if (match[dartx.get](dart.notNull(match[dartx.length]) - 1) != null) retur n null;
156 match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
157 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
158 }
159 matchAsPrefix(string, start) {
160 if (start === void 0) start = 0;
161 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) {
162 dart.throw(new core.RangeError.range(start, 0, string[dartx.length]));
163 }
164 return this[_execAnchored](string, start);
165 }
166 get isMultiLine() {
167 return this[_isMultiLine];
168 }
169 get isCaseSensitive() {
170 return this[_isCaseSensitive];
171 }
172 }
173 JSSyntaxRegExp[dart.implements] = () => [core.RegExp];
174 dart.setSignature(JSSyntaxRegExp, {
175 constructors: () => ({JSSyntaxRegExp: [JSSyntaxRegExp, [core.String], {multi Line: core.bool, caseSensitive: core.bool}]}),
176 methods: () => ({
177 firstMatch: [core.Match, [core.String]],
178 hasMatch: [core.bool, [core.String]],
179 stringMatch: [core.String, [core.String]],
180 allMatches: [core.Iterable$(core.Match), [core.String], [core.int]],
181 [_execGlobal]: [core.Match, [core.String, core.int]],
182 [_execAnchored]: [core.Match, [core.String, core.int]],
183 matchAsPrefix: [core.Match, [core.String], [core.int]]
184 }),
185 statics: () => ({makeNative: [dart.dynamic, [core.String, core.bool, core.bo ol, core.bool]]}),
186 names: ['makeNative']
187 });
188 dart.defineExtensionMembers(JSSyntaxRegExp, ['allMatches', 'matchAsPrefix']);
189 const _match = Symbol('_match');
190 class _MatchImplementation extends core.Object {
191 _MatchImplementation(pattern, match) {
192 this.pattern = pattern;
193 this[_match] = match;
194 dart.assert(typeof this[_match].input == 'string');
195 dart.assert(typeof this[_match].index == 'number');
196 }
197 get input() {
198 return this[_match].input;
199 }
200 get start() {
201 return this[_match].index;
202 }
203 get end() {
204 return dart.notNull(this.start) + dart.notNull(this[_match][dartx.get](0)[ dartx.length]);
205 }
206 group(index) {
207 return this[_match][dartx.get](index);
208 }
209 get(index) {
210 return this.group(index);
211 }
212 get groupCount() {
213 return dart.notNull(this[_match][dartx.length]) - 1;
214 }
215 groups(groups) {
216 let out = dart.list([], core.String);
217 for (let i of groups) {
218 out[dartx.add](this.group(i));
219 }
220 return out;
221 }
222 }
223 _MatchImplementation[dart.implements] = () => [core.Match];
224 dart.setSignature(_MatchImplementation, {
225 constructors: () => ({_MatchImplementation: [_MatchImplementation, [core.Pat tern, core.List$(core.String)]]}),
226 methods: () => ({
227 group: [core.String, [core.int]],
228 get: [core.String, [core.int]],
229 groups: [core.List$(core.String), [core.List$(core.int)]]
230 })
231 });
232 const _re = Symbol('_re');
233 const _string = Symbol('_string');
234 const _start = Symbol('_start');
235 class _AllMatchesIterable extends collection.IterableBase$(core.Match) {
236 _AllMatchesIterable(re, string, start) {
237 this[_re] = re;
238 this[_string] = string;
239 this[_start] = start;
240 super.IterableBase();
241 }
242 get iterator() {
243 return new _AllMatchesIterator(this[_re], this[_string], this[_start]);
244 }
245 }
246 dart.setSignature(_AllMatchesIterable, {
247 constructors: () => ({_AllMatchesIterable: [_AllMatchesIterable, [JSSyntaxRe gExp, core.String, core.int]]})
248 });
249 dart.defineExtensionMembers(_AllMatchesIterable, ['iterator']);
250 const _regExp = Symbol('_regExp');
251 const _nextIndex = Symbol('_nextIndex');
252 const _current = Symbol('_current');
253 class _AllMatchesIterator extends core.Object {
254 _AllMatchesIterator(regExp, string, nextIndex) {
255 this[_regExp] = regExp;
256 this[_string] = string;
257 this[_nextIndex] = nextIndex;
258 this[_current] = null;
259 }
260 get current() {
261 return this[_current];
262 }
263 moveNext() {
264 if (this[_string] == null) return false;
265 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string][dartx.len gth])) {
266 let match = this[_regExp][_execGlobal](this[_string], this[_nextIndex]);
267 if (match != null) {
268 this[_current] = match;
269 let nextIndex = match.end;
270 if (match.start == nextIndex) {
271 nextIndex = dart.notNull(nextIndex) + 1;
272 }
273 this[_nextIndex] = nextIndex;
274 return true;
275 }
276 }
277 this[_current] = null;
278 this[_string] = null;
279 return false;
280 }
281 }
282 _AllMatchesIterator[dart.implements] = () => [core.Iterator$(core.Match)];
283 dart.setSignature(_AllMatchesIterator, {
284 constructors: () => ({_AllMatchesIterator: [_AllMatchesIterator, [JSSyntaxRe gExp, core.String, core.int]]}),
285 methods: () => ({moveNext: [core.bool, []]})
286 });
287 function firstMatchAfter(regExp, string, start) {
288 return regExp[_execGlobal](string, start);
289 }
290 dart.fn(firstMatchAfter, core.Match, [JSSyntaxRegExp, core.String, core.int]);
291 class StringMatch extends core.Object {
292 StringMatch(start, input, pattern) {
293 this.start = start;
294 this.input = input;
295 this.pattern = pattern;
296 }
297 get end() {
298 return dart.notNull(this.start) + dart.notNull(this.pattern[dartx.length]) ;
299 }
300 get(g) {
301 return this.group(g);
302 }
303 get groupCount() {
304 return 0;
305 }
306 group(group_) {
307 if (group_ != 0) {
308 dart.throw(new core.RangeError.value(group_));
309 }
310 return this.pattern;
311 }
312 groups(groups_) {
313 let result = core.List$(core.String).new();
314 for (let g of groups_) {
315 result[dartx.add](this.group(g));
316 }
317 return result;
318 }
319 }
320 StringMatch[dart.implements] = () => [core.Match];
321 dart.setSignature(StringMatch, {
322 constructors: () => ({StringMatch: [StringMatch, [core.int, core.String, cor e.String]]}),
323 methods: () => ({
324 get: [core.String, [core.int]],
325 group: [core.String, [core.int]],
326 groups: [core.List$(core.String), [core.List$(core.int)]]
327 })
328 });
329 function allMatchesInStringUnchecked(needle, haystack, startIndex) {
330 let result = core.List$(core.Match).new();
331 let length = haystack[dartx.length];
332 let patternLength = needle[dartx.length];
333 while (true) {
334 let position = haystack[dartx.indexOf](needle, startIndex);
335 if (position == -1) {
336 break;
337 }
338 result[dartx.add](new StringMatch(position, haystack, needle));
339 let endIndex = dart.notNull(position) + dart.notNull(patternLength);
340 if (endIndex == length) {
341 break;
342 } else if (position == endIndex) {
343 startIndex = dart.notNull(startIndex) + 1;
344 } else {
345 startIndex = endIndex;
346 }
347 }
348 return result;
349 }
350 dart.fn(allMatchesInStringUnchecked, core.List$(core.Match), [core.String, cor e.String, core.int]);
351 function stringContainsUnchecked(receiver, other, startIndex) {
352 if (typeof other == 'string') {
353 return !dart.equals(dart.dsend(receiver, 'indexOf', other, startIndex), -1 );
354 } else if (dart.is(other, JSSyntaxRegExp)) {
355 return other.hasMatch(dart.as(dart.dsend(receiver, 'substring', startIndex ), core.String));
356 } else {
357 let substr = dart.dsend(receiver, 'substring', startIndex);
358 return dart.dload(dart.dsend(other, 'allMatches', substr), 'isNotEmpty');
359 }
360 }
361 dart.fn(stringContainsUnchecked);
362 function stringReplaceJS(receiver, replacer, to) {
363 to = to.replace(/\$/g, "$$$$");
364 return receiver.replace(replacer, to);
365 }
366 dart.fn(stringReplaceJS);
367 function stringReplaceFirstRE(receiver, regexp, to, startIndex) {
368 let match = dart.dsend(regexp, _execGlobal, receiver, startIndex);
369 if (match == null) return receiver;
370 let start = dart.dload(match, 'start');
371 let end = dart.dload(match, 'end');
372 return `${dart.dsend(receiver, 'substring', 0, start)}${to}${dart.dsend(rece iver, 'substring', end)}`;
373 }
374 dart.fn(stringReplaceFirstRE);
375 const ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]';
376 function stringReplaceAllUnchecked(receiver, from, to) {
377 checkString(to);
378 if (typeof from == 'string') {
379 if (from == "") {
380 if (dart.equals(receiver, "")) {
381 return to;
382 } else {
383 let result = new core.StringBuffer();
384 let length = dart.as(dart.dload(receiver, 'length'), core.int);
385 result.write(to);
386 for (let i = 0; i < dart.notNull(length); i++) {
387 result.write(dart.dindex(receiver, i));
388 result.write(to);
389 }
390 return result.toString();
391 }
392 } else {
393 let quoter = new RegExp(ESCAPE_REGEXP, 'g');
394 let quoted = from.replace(quoter, "\\$&");
395 let replacer = new RegExp(quoted, 'g');
396 return stringReplaceJS(receiver, replacer, to);
397 }
398 } else if (dart.is(from, JSSyntaxRegExp)) {
399 let re = regExpGetGlobalNative(from);
400 return stringReplaceJS(receiver, re, to);
401 } else {
402 checkNull(from);
403 dart.throw("String.replaceAll(Pattern) UNIMPLEMENTED");
404 }
405 }
406 dart.fn(stringReplaceAllUnchecked);
407 function _matchString(match) {
408 return match.get(0);
409 }
410 dart.fn(_matchString, core.String, [core.Match]);
411 function _stringIdentity(string) {
412 return string;
413 }
414 dart.fn(_stringIdentity, core.String, [core.String]);
415 function stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch) {
416 if (!dart.is(pattern, core.Pattern)) {
417 dart.throw(new core.ArgumentError(`${pattern} is not a Pattern`));
418 }
419 if (onMatch == null) onMatch = _matchString;
420 if (onNonMatch == null) onNonMatch = _stringIdentity;
421 if (typeof pattern == 'string') {
422 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN onMatch);
423 }
424 let buffer = new core.StringBuffer();
425 let startIndex = 0;
426 for (let match of dart.as(dart.dsend(pattern, 'allMatches', receiver), core. Iterable)) {
427 dart.as(match, core.Match);
428 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', star tIndex, match.start)));
429 buffer.write(dart.dcall(onMatch, match));
430 startIndex = match.end;
431 }
432 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI ndex)));
433 return buffer.toString();
434 }
435 dart.fn(stringReplaceAllFuncUnchecked);
436 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) {
437 let buffer = new core.StringBuffer();
438 let length = dart.as(dart.dload(receiver, 'length'), core.int);
439 let i = 0;
440 buffer.write(dart.dcall(onNonMatch, ""));
441 while (i < dart.notNull(length)) {
442 buffer.write(dart.dcall(onMatch, new StringMatch(i, dart.as(receiver, core .String), "")));
443 let code = dart.as(dart.dsend(receiver, 'codeUnitAt', i), core.int);
444 if ((dart.notNull(code) & ~1023) == 55296 && dart.notNull(length) > i + 1) {
445 code = dart.as(dart.dsend(receiver, 'codeUnitAt', i + 1), core.int);
446 if ((dart.notNull(code) & ~1023) == 56320) {
447 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', i, i + 2)));
448 i = i + 2;
449 continue;
450 }
451 }
452 buffer.write(dart.dcall(onNonMatch, dart.dindex(receiver, i)));
453 i++;
454 }
455 buffer.write(dart.dcall(onMatch, new StringMatch(i, dart.as(receiver, core.S tring), "")));
456 buffer.write(dart.dcall(onNonMatch, ""));
457 return buffer.toString();
458 }
459 dart.fn(stringReplaceAllEmptyFuncUnchecked);
460 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon Match) {
461 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int);
462 if (patternLength == 0) {
463 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch);
464 }
465 let length = dart.as(dart.dload(receiver, 'length'), core.int);
466 let buffer = new core.StringBuffer();
467 let startIndex = 0;
468 while (startIndex < dart.notNull(length)) {
469 let position = dart.as(dart.dsend(receiver, 'indexOf', pattern, startIndex ), core.int);
470 if (position == -1) {
471 break;
472 }
473 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', star tIndex, position)));
474 buffer.write(dart.dcall(onMatch, new StringMatch(position, dart.as(receive r, core.String), dart.as(pattern, core.String))));
475 startIndex = dart.notNull(position) + dart.notNull(patternLength);
476 }
477 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI ndex)));
478 return buffer.toString();
479 }
480 dart.fn(stringReplaceAllStringFuncUnchecked);
481 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) {
482 if (startIndex === void 0) startIndex = 0;
483 if (typeof from == 'string') {
484 let index = dart.dsend(receiver, 'indexOf', from, startIndex);
485 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool))) return re ceiver;
486 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse nd(receiver, 'substring', dart.dsend(index, '+', from[dartx.length]))}`;
487 } else if (dart.is(from, JSSyntaxRegExp)) {
488 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(from), to) : stringReplaceFirstRE(receiver, from, to, startIndex);
489 } else {
490 checkNull(from);
491 dart.throw("String.replace(Pattern) UNIMPLEMENTED");
492 }
493 }
494 dart.fn(stringReplaceFirstUnchecked, dart.dynamic, [dart.dynamic, dart.dynamic , dart.dynamic], [core.int]);
495 function stringJoinUnchecked(array, separator) {
496 return array.join(separator);
497 }
498 dart.fn(stringJoinUnchecked);
499 function getRuntimeType(object) {
500 return dart.as(dart.realRuntimeType(object), core.Type);
501 }
502 dart.fn(getRuntimeType, core.Type, [dart.dynamic]);
503 function getIndex(array, index) {
504 dart.assert(isJsArray(array));
505 return array[index];
506 }
507 dart.fn(getIndex, dart.dynamic, [dart.dynamic, core.int]);
508 function getLength(array) {
509 dart.assert(isJsArray(array));
510 return array.length;
511 }
512 dart.fn(getLength, core.int, [dart.dynamic]);
513 function isJsArray(value) {
514 return dart.is(value, _interceptors.JSArray);
515 }
516 dart.fn(isJsArray, core.bool, [dart.dynamic]);
517 class _Patch extends core.Object {
518 _Patch() {
519 }
520 }
521 dart.setSignature(_Patch, {
522 constructors: () => ({_Patch: [_Patch, []]})
523 });
524 const patch = dart.const(new _Patch());
525 class InternalMap extends core.Object {}
526 class Primitives extends core.Object {
527 static initializeStatics(id) {
528 Primitives.mirrorFunctionCacheName = dart.notNull(Primitives.mirrorFunctio nCacheName) + `_${id}`;
529 Primitives.mirrorInvokeCacheName = dart.notNull(Primitives.mirrorInvokeCac heName) + `_${id}`;
530 }
531 static objectHashCode(object) {
532 let hash = dart.as(object.$identityHash, core.int);
533 if (hash == null) {
534 hash = Math.random() * 0x3fffffff | 0;
535 object.$identityHash = hash;
536 }
537 return hash;
538 }
539 static _throwFormatException(string) {
540 dart.throw(new core.FormatException(string));
541 }
542 static parseInt(source, radix, handleError) {
543 if (handleError == null) handleError = dart.fn(s => dart.as(Primitives._th rowFormatException(s), core.int), core.int, [core.String]);
544 checkString(source);
545 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
546 let digitsIndex = 1;
547 let hexIndex = 2;
548 let decimalIndex = 3;
549 let nonDecimalHexIndex = 4;
550 if (radix == null) {
551 radix = 10;
552 if (match != null) {
553 if (dart.dindex(match, hexIndex) != null) {
554 return parseInt(source, 16);
555 }
556 if (dart.dindex(match, decimalIndex) != null) {
557 return parseInt(source, 10);
558 }
559 return handleError(source);
560 }
561 } else {
562 if (!(typeof radix == 'number')) dart.throw(new core.ArgumentError("Radi x is not an integer"));
563 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) {
564 dart.throw(new core.RangeError(`Radix ${radix} not in range 2..36`));
565 }
566 if (match != null) {
567 if (radix == 10 && dart.dindex(match, decimalIndex) != null) {
568 return parseInt(source, 10);
569 }
570 if (dart.notNull(radix) < 10 || dart.dindex(match, decimalIndex) == nu ll) {
571 let maxCharCode = null;
572 if (dart.notNull(radix) <= 10) {
573 maxCharCode = 48 + dart.notNull(radix) - 1;
574 } else {
575 maxCharCode = 97 + dart.notNull(radix) - 10 - 1;
576 }
577 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin g);
578 for (let i = 0; i < dart.notNull(digitsPart[dartx.length]); i++) {
579 let characterCode = dart.notNull(digitsPart[dartx.codeUnitAt](0)) | 32;
580 if (dart.notNull(digitsPart[dartx.codeUnitAt](i)) > dart.notNull(m axCharCode)) {
581 return handleError(source);
582 }
583 }
584 }
585 }
586 }
587 if (match == null) return handleError(source);
588 return parseInt(source, radix);
589 }
590 static parseDouble(source, handleError) {
591 checkString(source);
592 if (handleError == null) handleError = dart.fn(s => dart.as(Primitives._th rowFormatException(s), core.double), core.double, [core.String]);
593 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) {
594 return handleError(source);
595 }
596 let result = parseFloat(source);
597 if (dart.notNull(result[dartx.isNaN])) {
598 let trimmed = source[dartx.trim]();
599 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') {
600 return result;
601 }
602 return handleError(source);
603 }
604 return result;
605 }
606 static objectTypeName(object) {
607 return dart.toString(getRuntimeType(object));
608 }
609 static objectToString(object) {
610 let name = dart.typeName(dart.realRuntimeType(object));
611 return `Instance of '${name}'`;
612 }
613 static dateNow() {
614 return Date.now();
615 }
616 static initTicker() {
617 if (Primitives.timerFrequency != null) return;
618 Primitives.timerFrequency = 1000;
619 Primitives.timerTicks = Primitives.dateNow;
620 if (typeof window == "undefined") return;
621 let jsWindow = window;
622 if (jsWindow == null) return;
623 let performance = jsWindow.performance;
624 if (performance == null) return;
625 if (typeof performance.now != "function") return;
626 Primitives.timerFrequency = 1000000;
627 Primitives.timerTicks = dart.fn(() => (1000 * performance.now())[dartx.flo or](), core.int, []);
628 }
629 static get isD8() {
630 return typeof version == "function" && typeof os == "object" && "system" i n os;
631 }
632 static get isJsshell() {
633 return typeof version == "function" && typeof system == "function";
634 }
635 static currentUri() {
636 if (!!self.location) {
637 return self.location.href;
638 }
639 return null;
640 }
641 static _fromCharCodeApply(array) {
642 let result = "";
643 let kMaxApply = 500;
644 let end = array[dartx.length];
645 for (let i = 0; i < dart.notNull(end); i = i + kMaxApply) {
646 let subarray = null;
647 if (dart.notNull(end) <= kMaxApply) {
648 subarray = array;
649 } else {
650 subarray = array.slice(i, i + kMaxApply < dart.notNull(end) ? i + kMax Apply : end);
651 }
652 result = result + String.fromCharCode.apply(null, subarray);
653 }
654 return result;
655 }
656 static stringFromCodePoints(codePoints) {
657 let a = dart.list([], core.int);
658 for (let i of dart.as(codePoints, core.Iterable)) {
659 if (!(typeof i == 'number')) dart.throw(new core.ArgumentError(i));
660 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) {
661 a[dartx.add](dart.as(i, core.int));
662 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool) )) {
663 a[dartx.add](dart.asInt((55296)[dartx['+']](dart.as(dart.dsend(dart.ds end(dart.dsend(i, '-', 65536), '>>', 10), '&', 1023), core.num))));
664 a[dartx.add](dart.asInt((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), core.num))));
665 } else {
666 dart.throw(new core.ArgumentError(i));
667 }
668 }
669 return Primitives._fromCharCodeApply(a);
670 }
671 static stringFromCharCodes(charCodes) {
672 for (let i of dart.as(charCodes, core.Iterable)) {
673 if (!(typeof i == 'number')) dart.throw(new core.ArgumentError(i));
674 if (dart.notNull(dart.as(dart.dsend(i, '<', 0), core.bool))) dart.throw( new core.ArgumentError(i));
675 if (dart.notNull(dart.as(dart.dsend(i, '>', 65535), core.bool))) return Primitives.stringFromCodePoints(charCodes);
676 }
677 return Primitives._fromCharCodeApply(dart.as(charCodes, core.List$(core.in t)));
678 }
679 static stringFromCharCode(charCode) {
680 if (0 <= dart.notNull(dart.as(charCode, core.num))) {
681 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 65535), core.bool))) {
682 return String.fromCharCode(charCode);
683 }
684 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 1114111), core.bool) )) {
685 let bits = dart.dsend(charCode, '-', 65536);
686 let low = (56320)[dartx['|']](dart.as(dart.dsend(bits, '&', 1023), cor e.int));
687 let high = (55296)[dartx['|']](dart.as(dart.dsend(bits, '>>', 10), cor e.int));
688 return String.fromCharCode(high, low);
689 }
690 }
691 dart.throw(new core.RangeError.range(dart.as(charCode, core.num), 0, 11141 11));
692 }
693 static stringConcatUnchecked(string1, string2) {
694 return _foreign_helper.JS_STRING_CONCAT(string1, string2);
695 }
696 static flattenString(str) {
697 return str.charCodeAt(0) == 0 ? str : str;
698 }
699 static getTimeZoneName(receiver) {
700 let d = Primitives.lazyAsJsDate(receiver);
701 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List);
702 if (match != null) return dart.as(match[dartx.get](1), core.String);
703 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);
704 if (match != null) return dart.as(match[dartx.get](1), core.String);
705 match = dart.as(/(?:GMT|UTC)[+-]\d{4}/.exec(d.toString()), core.List);
706 if (match != null) return dart.as(match[dartx.get](0), core.String);
707 return "";
708 }
709 static getTimeZoneOffsetInMinutes(receiver) {
710 return -Primitives.lazyAsJsDate(receiver).getTimezoneOffset();
711 }
712 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m illiseconds, isUtc) {
713 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
714 checkInt(years);
715 checkInt(month);
716 checkInt(day);
717 checkInt(hours);
718 checkInt(minutes);
719 checkInt(seconds);
720 checkInt(milliseconds);
721 checkBool(isUtc);
722 let jsMonth = dart.dsend(month, '-', 1);
723 let value = null;
724 if (dart.notNull(dart.as(isUtc, core.bool))) {
725 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds);
726 } else {
727 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf();
728 }
729 if (dart.notNull(dart.as(dart.dload(value, 'isNaN'), core.bool)) || dart.n otNull(dart.as(dart.dsend(value, '<', -MAX_MILLISECONDS_SINCE_EPOCH), core.bool) ) || dart.notNull(dart.as(dart.dsend(value, '>', MAX_MILLISECONDS_SINCE_EPOCH), core.bool))) {
730 return null;
731 }
732 if (dart.notNull(dart.as(dart.dsend(years, '<=', 0), core.bool)) || dart.n otNull(dart.as(dart.dsend(years, '<', 100), core.bool))) return Primitives.patch UpY2K(value, years, isUtc);
733 return value;
734 }
735 static patchUpY2K(value, years, isUtc) {
736 let date = new Date(value);
737 if (dart.notNull(dart.as(isUtc, core.bool))) {
738 date.setUTCFullYear(years);
739 } else {
740 date.setFullYear(years);
741 }
742 return date.valueOf();
743 }
744 static lazyAsJsDate(receiver) {
745 if (receiver.date === void 0) {
746 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch')) ;
747 }
748 return receiver.date;
749 }
750 static getYear(receiver) {
751 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCFullYear() + 0 : Primitives.lazyAsJsDate( receiver).getFullYear() + 0;
752 }
753 static getMonth(receiver) {
754 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMonth() + 1 : Primitives.lazyAsJsDate(rec eiver).getMonth() + 1;
755 }
756 static getDay(receiver) {
757 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCDate() + 0 : Primitives.lazyAsJsDate(rece iver).getDate() + 0;
758 }
759 static getHours(receiver) {
760 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCHours() + 0 : Primitives.lazyAsJsDate(rec eiver).getHours() + 0;
761 }
762 static getMinutes(receiver) {
763 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMinutes() + 0 : Primitives.lazyAsJsDate(r eceiver).getMinutes() + 0;
764 }
765 static getSeconds(receiver) {
766 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCSeconds() + 0 : Primitives.lazyAsJsDate(r eceiver).getSeconds() + 0;
767 }
768 static getMilliseconds(receiver) {
769 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMilliseconds() + 0 : Primitives.lazyAsJsD ate(receiver).getMilliseconds() + 0;
770 }
771 static getWeekday(receiver) {
772 let weekday = dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.boo l)) ? Primitives.lazyAsJsDate(receiver).getUTCDay() + 0 : Primitives.lazyAsJsDat e(receiver).getDay() + 0;
773 return (weekday + 6) % 7 + 1;
774 }
775 static valueFromDateString(str) {
776 if (!(typeof str == 'string')) dart.throw(new core.ArgumentError(str));
777 let value = Date.parse(str);
778 if (dart.notNull(value[dartx.isNaN])) dart.throw(new core.ArgumentError(st r));
779 return value;
780 }
781 static getProperty(object, key) {
782 if (object == null || typeof object == 'boolean' || typeof object == 'numb er' || typeof object == 'string') {
783 dart.throw(new core.ArgumentError(object));
784 }
785 return object[key];
786 }
787 static setProperty(object, key, value) {
788 if (object == null || typeof object == 'boolean' || typeof object == 'numb er' || typeof object == 'string') {
789 dart.throw(new core.ArgumentError(object));
790 }
791 object[key] = value;
792 }
793 static identicalImplementation(a, b) {
794 return a == null ? b == null : a === b;
795 }
796 static extractStackTrace(error) {
797 return getTraceFromException(error.$thrownJsError);
798 }
799 }
800 dart.setSignature(Primitives, {
801 statics: () => ({
802 initializeStatics: [dart.void, [core.int]],
803 objectHashCode: [core.int, [dart.dynamic]],
804 _throwFormatException: [dart.dynamic, [core.String]],
805 parseInt: [core.int, [core.String, core.int, dart.functionType(core.int, [ core.String])]],
806 parseDouble: [core.double, [core.String, dart.functionType(core.double, [c ore.String])]],
807 objectTypeName: [core.String, [core.Object]],
808 objectToString: [core.String, [core.Object]],
809 dateNow: [core.int, []],
810 initTicker: [dart.void, []],
811 currentUri: [core.String, []],
812 _fromCharCodeApply: [core.String, [core.List$(core.int)]],
813 stringFromCodePoints: [core.String, [dart.dynamic]],
814 stringFromCharCodes: [core.String, [dart.dynamic]],
815 stringFromCharCode: [core.String, [dart.dynamic]],
816 stringConcatUnchecked: [core.String, [core.String, core.String]],
817 flattenString: [core.String, [core.String]],
818 getTimeZoneName: [core.String, [dart.dynamic]],
819 getTimeZoneOffsetInMinutes: [core.int, [dart.dynamic]],
820 valueFromDecomposedDate: [dart.dynamic, [dart.dynamic, dart.dynamic, dart. dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]],
821 patchUpY2K: [dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic]],
822 lazyAsJsDate: [dart.dynamic, [dart.dynamic]],
823 getYear: [dart.dynamic, [dart.dynamic]],
824 getMonth: [dart.dynamic, [dart.dynamic]],
825 getDay: [dart.dynamic, [dart.dynamic]],
826 getHours: [dart.dynamic, [dart.dynamic]],
827 getMinutes: [dart.dynamic, [dart.dynamic]],
828 getSeconds: [dart.dynamic, [dart.dynamic]],
829 getMilliseconds: [dart.dynamic, [dart.dynamic]],
830 getWeekday: [dart.dynamic, [dart.dynamic]],
831 valueFromDateString: [dart.dynamic, [dart.dynamic]],
832 getProperty: [dart.dynamic, [dart.dynamic, dart.dynamic]],
833 setProperty: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]],
834 identicalImplementation: [core.bool, [dart.dynamic, dart.dynamic]],
835 extractStackTrace: [core.StackTrace, [core.Error]]
836 }),
837 names: ['initializeStatics', 'objectHashCode', '_throwFormatException', 'par seInt', 'parseDouble', 'objectTypeName', 'objectToString', 'dateNow', 'initTicke r', 'currentUri', '_fromCharCodeApply', 'stringFromCodePoints', 'stringFromCharC odes', 'stringFromCharCode', 'stringConcatUnchecked', 'flattenString', 'getTimeZ oneName', 'getTimeZoneOffsetInMinutes', 'valueFromDecomposedDate', 'patchUpY2K', 'lazyAsJsDate', 'getYear', 'getMonth', 'getDay', 'getHours', 'getMinutes', 'get Seconds', 'getMilliseconds', 'getWeekday', 'valueFromDateString', 'getProperty', 'setProperty', 'identicalImplementation', 'extractStackTrace']
838 });
839 Primitives.mirrorFunctionCacheName = '$cachedFunction';
840 Primitives.mirrorInvokeCacheName = '$cachedInvocation';
841 Primitives.DOLLAR_CHAR_VALUE = 36;
842 Primitives.timerFrequency = null;
843 Primitives.timerTicks = null;
844 function stringLastIndexOfUnchecked(receiver, element, start) {
845 return receiver.lastIndexOf(element, start);
846 }
847 dart.fn(stringLastIndexOfUnchecked);
848 function checkNull(object) {
849 if (object == null) dart.throw(new core.ArgumentError(null));
850 return object;
851 }
852 dart.fn(checkNull);
853 function checkNum(value) {
854 if (!(typeof value == 'number')) {
855 dart.throw(new core.ArgumentError(value));
856 }
857 return value;
858 }
859 dart.fn(checkNum);
860 function checkInt(value) {
861 if (!(typeof value == 'number')) {
862 dart.throw(new core.ArgumentError(value));
863 }
864 return value;
865 }
866 dart.fn(checkInt);
867 function checkBool(value) {
868 if (!(typeof value == 'boolean')) {
869 dart.throw(new core.ArgumentError(value));
870 }
871 return value;
872 }
873 dart.fn(checkBool);
874 function checkString(value) {
875 if (!(typeof value == 'string')) {
876 dart.throw(new core.ArgumentError(value));
877 }
878 return value;
879 }
880 dart.fn(checkString);
881 function throwRuntimeError(message) {
882 dart.throw(new RuntimeError(message));
883 }
884 dart.fn(throwRuntimeError);
885 function throwAbstractClassInstantiationError(className) {
886 dart.throw(new core.AbstractClassInstantiationError(dart.as(className, core. String)));
887 }
888 dart.fn(throwAbstractClassInstantiationError);
889 const _message = Symbol('_message');
890 const _method = Symbol('_method');
891 class NullError extends core.Error {
892 NullError(message, match) {
893 this[_message] = message;
894 this[_method] = dart.as(match == null ? null : match.method, core.String);
895 super.Error();
896 }
897 toString() {
898 if (this[_method] == null) return `NullError: ${this[_message]}`;
899 return `NullError: Cannot call "${this[_method]}" on null`;
900 }
901 }
902 NullError[dart.implements] = () => [core.NoSuchMethodError];
903 dart.setSignature(NullError, {
904 constructors: () => ({NullError: [NullError, [core.String, dart.dynamic]]})
905 });
906 const _receiver = Symbol('_receiver');
907 class JsNoSuchMethodError extends core.Error {
908 JsNoSuchMethodError(message, match) {
909 this[_message] = message;
910 this[_method] = dart.as(match == null ? null : match.method, core.String);
911 this[_receiver] = dart.as(match == null ? null : match.receiver, core.Stri ng);
912 super.Error();
913 }
914 toString() {
915 if (this[_method] == null) return `NoSuchMethodError: ${this[_message]}`;
916 if (this[_receiver] == null) {
917 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa ge]})`;
918 }
919 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece iver]}" ` + `(${this[_message]})`;
920 }
921 }
922 JsNoSuchMethodError[dart.implements] = () => [core.NoSuchMethodError];
923 dart.setSignature(JsNoSuchMethodError, {
924 constructors: () => ({JsNoSuchMethodError: [JsNoSuchMethodError, [core.Strin g, dart.dynamic]]})
925 });
926 class UnknownJsTypeError extends core.Error {
927 UnknownJsTypeError(message) {
928 this[_message] = message;
929 super.Error();
930 }
931 toString() {
932 return dart.notNull(this[_message][dartx.isEmpty]) ? 'Error' : `Error: ${t his[_message]}`;
933 }
934 }
935 dart.setSignature(UnknownJsTypeError, {
936 constructors: () => ({UnknownJsTypeError: [UnknownJsTypeError, [core.String] ]})
937 });
938 function getTraceFromException(exception) {
939 return new _StackTrace(exception);
940 }
941 dart.fn(getTraceFromException, core.StackTrace, [dart.dynamic]);
942 const _exception = Symbol('_exception');
943 const _trace = Symbol('_trace');
944 class _StackTrace extends core.Object {
945 _StackTrace(exception) {
946 this[_exception] = exception;
947 this[_trace] = null;
948 }
949 toString() {
950 if (this[_trace] != null) return this[_trace];
951 let trace = null;
952 if (typeof this[_exception] === "object") {
953 trace = dart.as(this[_exception].stack, core.String);
954 }
955 return this[_trace] = trace == null ? '' : trace;
956 }
957 }
958 _StackTrace[dart.implements] = () => [core.StackTrace];
959 dart.setSignature(_StackTrace, {
960 constructors: () => ({_StackTrace: [_StackTrace, [dart.dynamic]]})
961 });
962 function objectHashCode(object) {
963 if (object == null || typeof object != 'object') {
964 return dart.hashCode(object);
965 } else {
966 return Primitives.objectHashCode(object);
967 }
968 }
969 dart.fn(objectHashCode, core.int, [dart.dynamic]);
970 function fillLiteralMap(keyValuePairs, result) {
971 let index = 0;
972 let length = getLength(keyValuePairs);
973 while (index < dart.notNull(length)) {
974 let key = getIndex(keyValuePairs, index++);
975 let value = getIndex(keyValuePairs, index++);
976 result[dartx.set](key, value);
977 }
978 return result;
979 }
980 dart.fn(fillLiteralMap, dart.dynamic, [dart.dynamic, core.Map]);
981 function jsHasOwnProperty(jsObject, property) {
982 return jsObject.hasOwnProperty(property);
983 }
984 dart.fn(jsHasOwnProperty, core.bool, [dart.dynamic, core.String]);
985 function jsPropertyAccess(jsObject, property) {
986 return jsObject[property];
987 }
988 dart.fn(jsPropertyAccess, dart.dynamic, [dart.dynamic, core.String]);
989 function getFallThroughError() {
990 return new FallThroughErrorImplementation();
991 }
992 dart.fn(getFallThroughError);
993 class Creates extends core.Object {
994 Creates(types) {
995 this.types = types;
996 }
997 }
998 dart.setSignature(Creates, {
999 constructors: () => ({Creates: [Creates, [core.String]]})
1000 });
1001 class Returns extends core.Object {
1002 Returns(types) {
1003 this.types = types;
1004 }
1005 }
1006 dart.setSignature(Returns, {
1007 constructors: () => ({Returns: [Returns, [core.String]]})
1008 });
1009 class JSName extends core.Object {
1010 JSName(name) {
1011 this.name = name;
1012 }
1013 }
1014 dart.setSignature(JSName, {
1015 constructors: () => ({JSName: [JSName, [core.String]]})
1016 });
1017 class JavaScriptIndexingBehavior extends _interceptors.JSMutableIndexable {}
1018 class TypeErrorImplementation extends core.Error {
1019 TypeErrorImplementation(value, type) {
1020 this.message = `type '${Primitives.objectTypeName(value)}' is not a subtyp e ` + `of type '${type}'`;
1021 super.Error();
1022 }
1023 fromMessage(message) {
1024 this.message = message;
1025 super.Error();
1026 }
1027 toString() {
1028 return this.message;
1029 }
1030 }
1031 TypeErrorImplementation[dart.implements] = () => [core.TypeError];
1032 dart.defineNamedConstructor(TypeErrorImplementation, 'fromMessage');
1033 dart.setSignature(TypeErrorImplementation, {
1034 constructors: () => ({
1035 TypeErrorImplementation: [TypeErrorImplementation, [core.Object, core.Stri ng]],
1036 fromMessage: [TypeErrorImplementation, [core.String]]
1037 })
1038 });
1039 class CastErrorImplementation extends core.Error {
1040 CastErrorImplementation(actualType, expectedType) {
1041 this.message = `CastError: Casting value of type ${actualType} to` + ` inc ompatible type ${expectedType}`;
1042 super.Error();
1043 }
1044 toString() {
1045 return this.message;
1046 }
1047 }
1048 CastErrorImplementation[dart.implements] = () => [core.CastError];
1049 dart.setSignature(CastErrorImplementation, {
1050 constructors: () => ({CastErrorImplementation: [CastErrorImplementation, [co re.Object, core.Object]]})
1051 });
1052 class FallThroughErrorImplementation extends core.FallThroughError {
1053 FallThroughErrorImplementation() {
1054 super.FallThroughError();
1055 }
1056 toString() {
1057 return "Switch case fall-through.";
1058 }
1059 }
1060 dart.setSignature(FallThroughErrorImplementation, {
1061 constructors: () => ({FallThroughErrorImplementation: [FallThroughErrorImple mentation, []]})
1062 });
1063 class RuntimeError extends core.Error {
1064 RuntimeError(message) {
1065 this.message = message;
1066 super.Error();
1067 }
1068 toString() {
1069 return `RuntimeError: ${this.message}`;
1070 }
1071 }
1072 dart.setSignature(RuntimeError, {
1073 constructors: () => ({RuntimeError: [RuntimeError, [dart.dynamic]]})
1074 });
1075 function random64() {
1076 let int32a = Math.random() * 0x100000000 >>> 0;
1077 let int32b = Math.random() * 0x100000000 >>> 0;
1078 return int32a + int32b * 4294967296;
1079 }
1080 dart.fn(random64, core.int, []);
1081 function jsonEncodeNative(string) {
1082 return JSON.stringify(string);
1083 }
1084 dart.fn(jsonEncodeNative, core.String, [core.String]);
1085 const _jsIterator = Symbol('_jsIterator');
1086 const SyncIterator$ = dart.generic(function(E) {
1087 class SyncIterator extends core.Object {
1088 SyncIterator(jsIterator) {
1089 this[_jsIterator] = jsIterator;
1090 this[_current] = null;
1091 }
1092 get current() {
1093 return this[_current];
1094 }
1095 moveNext() {
1096 let ret = this[_jsIterator].next();
1097 this[_current] = dart.as(ret.value, E);
1098 return !ret.done;
1099 }
1100 }
1101 SyncIterator[dart.implements] = () => [core.Iterator$(E)];
1102 dart.setSignature(SyncIterator, {
1103 constructors: () => ({SyncIterator: [SyncIterator$(E), [dart.dynamic]]}),
1104 methods: () => ({moveNext: [core.bool, []]})
1105 });
1106 return SyncIterator;
1107 });
1108 let SyncIterator = SyncIterator$();
1109 const _generator = Symbol('_generator');
1110 const _args = Symbol('_args');
1111 const SyncIterable$ = dart.generic(function(E) {
1112 class SyncIterable extends collection.IterableBase$(E) {
1113 SyncIterable(generator, args) {
1114 this[_generator] = generator;
1115 this[_args] = args;
1116 super.IterableBase();
1117 }
1118 [_jsIterator]() {
1119 return this[_generator](...this[_args]);
1120 }
1121 get iterator() {
1122 return new (SyncIterator$(E))(this[_jsIterator]());
1123 }
1124 }
1125 dart.setSignature(SyncIterable, {
1126 constructors: () => ({SyncIterable: [SyncIterable$(E), [dart.dynamic, dart .dynamic]]}),
1127 methods: () => ({[_jsIterator]: [dart.dynamic, []]})
1128 });
1129 dart.defineExtensionMembers(SyncIterable, ['iterator']);
1130 return SyncIterable;
1131 });
1132 let SyncIterable = SyncIterable$();
1133 // Exports:
1134 exports.NoThrows = NoThrows;
1135 exports.NoInline = NoInline;
1136 exports.Native = Native;
1137 exports.JsPeerInterface = JsPeerInterface;
1138 exports.SupportJsExtensionMethods = SupportJsExtensionMethods;
1139 exports.defineProperty = defineProperty;
1140 exports.regExpGetNative = regExpGetNative;
1141 exports.regExpGetGlobalNative = regExpGetGlobalNative;
1142 exports.regExpCaptureCount = regExpCaptureCount;
1143 exports.JSSyntaxRegExp = JSSyntaxRegExp;
1144 exports.firstMatchAfter = firstMatchAfter;
1145 exports.StringMatch = StringMatch;
1146 exports.allMatchesInStringUnchecked = allMatchesInStringUnchecked;
1147 exports.stringContainsUnchecked = stringContainsUnchecked;
1148 exports.stringReplaceJS = stringReplaceJS;
1149 exports.stringReplaceFirstRE = stringReplaceFirstRE;
1150 exports.ESCAPE_REGEXP = ESCAPE_REGEXP;
1151 exports.stringReplaceAllUnchecked = stringReplaceAllUnchecked;
1152 exports.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked;
1153 exports.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecke d;
1154 exports.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchec ked;
1155 exports.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked;
1156 exports.stringJoinUnchecked = stringJoinUnchecked;
1157 exports.getRuntimeType = getRuntimeType;
1158 exports.getIndex = getIndex;
1159 exports.getLength = getLength;
1160 exports.isJsArray = isJsArray;
1161 exports.patch = patch;
1162 exports.InternalMap = InternalMap;
1163 exports.Primitives = Primitives;
1164 exports.stringLastIndexOfUnchecked = stringLastIndexOfUnchecked;
1165 exports.checkNull = checkNull;
1166 exports.checkNum = checkNum;
1167 exports.checkInt = checkInt;
1168 exports.checkBool = checkBool;
1169 exports.checkString = checkString;
1170 exports.throwRuntimeError = throwRuntimeError;
1171 exports.throwAbstractClassInstantiationError = throwAbstractClassInstantiation Error;
1172 exports.NullError = NullError;
1173 exports.JsNoSuchMethodError = JsNoSuchMethodError;
1174 exports.UnknownJsTypeError = UnknownJsTypeError;
1175 exports.getTraceFromException = getTraceFromException;
1176 exports.objectHashCode = objectHashCode;
1177 exports.fillLiteralMap = fillLiteralMap;
1178 exports.jsHasOwnProperty = jsHasOwnProperty;
1179 exports.jsPropertyAccess = jsPropertyAccess;
1180 exports.getFallThroughError = getFallThroughError;
1181 exports.Creates = Creates;
1182 exports.Returns = Returns;
1183 exports.JSName = JSName;
1184 exports.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior;
1185 exports.TypeErrorImplementation = TypeErrorImplementation;
1186 exports.CastErrorImplementation = CastErrorImplementation;
1187 exports.FallThroughErrorImplementation = FallThroughErrorImplementation;
1188 exports.RuntimeError = RuntimeError;
1189 exports.random64 = random64;
1190 exports.jsonEncodeNative = jsonEncodeNative;
1191 exports.SyncIterator$ = SyncIterator$;
1192 exports.SyncIterator = SyncIterator;
1193 exports.SyncIterable$ = SyncIterable$;
1194 exports.SyncIterable = SyncIterable;
1195 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_embedded_names.js ('k') | lib/runtime/dart/_js_mirrors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698