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

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

Issue 1233553005: Fixes #254 - Better stacktrace support (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: format fix Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_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
1 dart_library.library('dart/_js_helper', null, /* Imports */[ 1 dart_library.library('dart/_js_helper', null, /* Imports */[
2 "dart_runtime/dart", 2 "dart_runtime/dart",
3 'dart/core', 3 'dart/core',
4 'dart/collection', 4 'dart/collection',
5 'dart/_interceptors', 5 'dart/_interceptors',
6 'dart/_foreign_helper' 6 'dart/_foreign_helper'
7 ], /* Lazy imports */[ 7 ], /* Lazy imports */[
8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) { 8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) {
9 'use strict'; 9 'use strict';
10 let dartx = dart.dartx; 10 let dartx = dart.dartx;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 try { 121 try {
122 return new RegExp(source, m + i + g); 122 return new RegExp(source, m + i + g);
123 } catch (e) { 123 } catch (e) {
124 return e; 124 return e;
125 } 125 }
126 126
127 })(); 127 })();
128 if (regexp instanceof RegExp) 128 if (regexp instanceof RegExp)
129 return regexp; 129 return regexp;
130 let errorMessage = String(regexp); 130 let errorMessage = String(regexp);
131 throw new core.FormatException(`Illegal RegExp pattern: ${source}, ${error Message}`); 131 dart.throw(new core.FormatException(`Illegal RegExp pattern: ${source}, ${ errorMessage}`));
132 } 132 }
133 firstMatch(string) { 133 firstMatch(string) {
134 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$( core.String)); 134 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$( core.String));
135 if (m == null) 135 if (m == null)
136 return null; 136 return null;
137 return new _MatchImplementation(this, m); 137 return new _MatchImplementation(this, m);
138 } 138 }
139 hasMatch(string) { 139 hasMatch(string) {
140 return this[_nativeRegExp].test(checkString(string)); 140 return this[_nativeRegExp].test(checkString(string));
141 } 141 }
142 stringMatch(string) { 142 stringMatch(string) {
143 let match = this.firstMatch(string); 143 let match = this.firstMatch(string);
144 if (match != null) 144 if (match != null)
145 return match.group(0); 145 return match.group(0);
146 return null; 146 return null;
147 } 147 }
148 allMatches(string, start) { 148 allMatches(string, start) {
149 if (start === void 0) 149 if (start === void 0)
150 start = 0; 150 start = 0;
151 checkString(string); 151 checkString(string);
152 checkInt(start); 152 checkInt(start);
153 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) { 153 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) {
154 throw new core.RangeError.range(start, 0, string[dartx.length]); 154 dart.throw(new core.RangeError.range(start, 0, string[dartx.length]));
155 } 155 }
156 return new _AllMatchesIterable(this, string, start); 156 return new _AllMatchesIterable(this, string, start);
157 } 157 }
158 [_execGlobal](string, start) { 158 [_execGlobal](string, start) {
159 let regexp = this[_nativeGlobalVersion]; 159 let regexp = this[_nativeGlobalVersion];
160 regexp.lastIndex = start; 160 regexp.lastIndex = start;
161 let match = dart.as(regexp.exec(string), core.List); 161 let match = dart.as(regexp.exec(string), core.List);
162 if (match == null) 162 if (match == null)
163 return null; 163 return null;
164 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g))); 164 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
165 } 165 }
166 [_execAnchored](string, start) { 166 [_execAnchored](string, start) {
167 let regexp = this[_nativeAnchoredVersion]; 167 let regexp = this[_nativeAnchoredVersion];
168 regexp.lastIndex = start; 168 regexp.lastIndex = start;
169 let match = dart.as(regexp.exec(string), core.List); 169 let match = dart.as(regexp.exec(string), core.List);
170 if (match == null) 170 if (match == null)
171 return null; 171 return null;
172 if (match[dartx.get](dart.notNull(match[dartx.length]) - 1) != null) 172 if (match[dartx.get](dart.notNull(match[dartx.length]) - 1) != null)
173 return null; 173 return null;
174 match[dartx.length] = dart.notNull(match[dartx.length]) - 1; 174 match[dartx.length] = dart.notNull(match[dartx.length]) - 1;
175 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g))); 175 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin g)));
176 } 176 }
177 matchAsPrefix(string, start) { 177 matchAsPrefix(string, start) {
178 if (start === void 0) 178 if (start === void 0)
179 start = 0; 179 start = 0;
180 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) { 180 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) {
181 throw new core.RangeError.range(start, 0, string[dartx.length]); 181 dart.throw(new core.RangeError.range(start, 0, string[dartx.length]));
182 } 182 }
183 return this[_execAnchored](string, start); 183 return this[_execAnchored](string, start);
184 } 184 }
185 get isMultiLine() { 185 get isMultiLine() {
186 return this[_isMultiLine]; 186 return this[_isMultiLine];
187 } 187 }
188 get isCaseSensitive() { 188 get isCaseSensitive() {
189 return this[_isCaseSensitive]; 189 return this[_isCaseSensitive];
190 } 190 }
191 } 191 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return dart.notNull(this.start) + dart.notNull(this.pattern[dartx.length]) ; 318 return dart.notNull(this.start) + dart.notNull(this.pattern[dartx.length]) ;
319 } 319 }
320 get(g) { 320 get(g) {
321 return this.group(g); 321 return this.group(g);
322 } 322 }
323 get groupCount() { 323 get groupCount() {
324 return 0; 324 return 0;
325 } 325 }
326 group(group_) { 326 group(group_) {
327 if (group_ != 0) { 327 if (group_ != 0) {
328 throw new core.RangeError.value(group_); 328 dart.throw(new core.RangeError.value(group_));
329 } 329 }
330 return this.pattern; 330 return this.pattern;
331 } 331 }
332 groups(groups_) { 332 groups(groups_) {
333 let result = core.List$(core.String).new(); 333 let result = core.List$(core.String).new();
334 for (let g of groups_) { 334 for (let g of groups_) {
335 result[dartx.add](this.group(g)); 335 result[dartx.add](this.group(g));
336 } 336 }
337 return result; 337 return result;
338 } 338 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); 414 let quoter = new RegExp(ESCAPE_REGEXP, 'g');
415 let quoted = from.replace(quoter, "\\$&"); 415 let quoted = from.replace(quoter, "\\$&");
416 let replacer = new RegExp(quoted, 'g'); 416 let replacer = new RegExp(quoted, 'g');
417 return stringReplaceJS(receiver, replacer, to); 417 return stringReplaceJS(receiver, replacer, to);
418 } 418 }
419 } else if (dart.is(from, JSSyntaxRegExp)) { 419 } else if (dart.is(from, JSSyntaxRegExp)) {
420 let re = regExpGetGlobalNative(dart.as(from, JSSyntaxRegExp)); 420 let re = regExpGetGlobalNative(dart.as(from, JSSyntaxRegExp));
421 return stringReplaceJS(receiver, re, to); 421 return stringReplaceJS(receiver, re, to);
422 } else { 422 } else {
423 checkNull(from); 423 checkNull(from);
424 throw "String.replaceAll(Pattern) UNIMPLEMENTED"; 424 dart.throw("String.replaceAll(Pattern) UNIMPLEMENTED");
425 } 425 }
426 } 426 }
427 dart.fn(stringReplaceAllUnchecked); 427 dart.fn(stringReplaceAllUnchecked);
428 function _matchString(match) { 428 function _matchString(match) {
429 return match.get(0); 429 return match.get(0);
430 } 430 }
431 dart.fn(_matchString, core.String, [core.Match]); 431 dart.fn(_matchString, core.String, [core.Match]);
432 function _stringIdentity(string) { 432 function _stringIdentity(string) {
433 return string; 433 return string;
434 } 434 }
435 dart.fn(_stringIdentity, core.String, [core.String]); 435 dart.fn(_stringIdentity, core.String, [core.String]);
436 function stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch) { 436 function stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch) {
437 if (!dart.is(pattern, core.Pattern)) { 437 if (!dart.is(pattern, core.Pattern)) {
438 throw new core.ArgumentError(`${pattern} is not a Pattern`); 438 dart.throw(new core.ArgumentError(`${pattern} is not a Pattern`));
439 } 439 }
440 if (onMatch == null) 440 if (onMatch == null)
441 onMatch = _matchString; 441 onMatch = _matchString;
442 if (onNonMatch == null) 442 if (onNonMatch == null)
443 onNonMatch = _stringIdentity; 443 onNonMatch = _stringIdentity;
444 if (typeof pattern == 'string') { 444 if (typeof pattern == 'string') {
445 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN onMatch); 445 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN onMatch);
446 } 446 }
447 let buffer = new core.StringBuffer(); 447 let buffer = new core.StringBuffer();
448 let startIndex = 0; 448 let startIndex = 0;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 startIndex = 0; 505 startIndex = 0;
506 if (typeof from == 'string') { 506 if (typeof from == 'string') {
507 let index = dart.dsend(receiver, 'indexOf', from, startIndex); 507 let index = dart.dsend(receiver, 'indexOf', from, startIndex);
508 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool))) 508 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool)))
509 return receiver; 509 return receiver;
510 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`; 510 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`;
511 } else if (dart.is(from, JSSyntaxRegExp)) { 511 } else if (dart.is(from, JSSyntaxRegExp)) {
512 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as (from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd ex); 512 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as (from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd ex);
513 } else { 513 } else {
514 checkNull(from); 514 checkNull(from);
515 throw "String.replace(Pattern) UNIMPLEMENTED"; 515 dart.throw("String.replace(Pattern) UNIMPLEMENTED");
516 } 516 }
517 } 517 }
518 dart.fn(stringReplaceFirstUnchecked, dart.dynamic, [dart.dynamic, dart.dynamic , dart.dynamic], [core.int]); 518 dart.fn(stringReplaceFirstUnchecked, dart.dynamic, [dart.dynamic, dart.dynamic , dart.dynamic], [core.int]);
519 function stringJoinUnchecked(array, separator) { 519 function stringJoinUnchecked(array, separator) {
520 return array.join(separator); 520 return array.join(separator);
521 } 521 }
522 dart.fn(stringJoinUnchecked); 522 dart.fn(stringJoinUnchecked);
523 function getRuntimeType(object) { 523 function getRuntimeType(object) {
524 return dart.as(dart.realRuntimeType(object), core.Type); 524 return dart.as(dart.realRuntimeType(object), core.Type);
525 } 525 }
(...skipping 28 matching lines...) Expand all
554 } 554 }
555 static objectHashCode(object) { 555 static objectHashCode(object) {
556 let hash = dart.as(object.$identityHash, core.int); 556 let hash = dart.as(object.$identityHash, core.int);
557 if (hash == null) { 557 if (hash == null) {
558 hash = Math.random() * 0x3fffffff | 0; 558 hash = Math.random() * 0x3fffffff | 0;
559 object.$identityHash = hash; 559 object.$identityHash = hash;
560 } 560 }
561 return hash; 561 return hash;
562 } 562 }
563 static _throwFormatException(string) { 563 static _throwFormatException(string) {
564 throw new core.FormatException(string); 564 dart.throw(new core.FormatException(string));
565 } 565 }
566 static parseInt(source, radix, handleError) { 566 static parseInt(source, radix, handleError) {
567 if (handleError == null) 567 if (handleError == null)
568 handleError = dart.fn(s => dart.as(Primitives._throwFormatException(dart .as(s, core.String)), core.int), core.int, [dart.dynamic]); 568 handleError = dart.fn(s => dart.as(Primitives._throwFormatException(dart .as(s, core.String)), core.int), core.int, [dart.dynamic]);
569 checkString(source); 569 checkString(source);
570 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ; 570 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
571 let digitsIndex = 1; 571 let digitsIndex = 1;
572 let hexIndex = 2; 572 let hexIndex = 2;
573 let decimalIndex = 3; 573 let decimalIndex = 3;
574 let nonDecimalHexIndex = 4; 574 let nonDecimalHexIndex = 4;
575 if (radix == null) { 575 if (radix == null) {
576 radix = 10; 576 radix = 10;
577 if (match != null) { 577 if (match != null) {
578 if (dart.dindex(match, hexIndex) != null) { 578 if (dart.dindex(match, hexIndex) != null) {
579 return parseInt(source, 16); 579 return parseInt(source, 16);
580 } 580 }
581 if (dart.dindex(match, decimalIndex) != null) { 581 if (dart.dindex(match, decimalIndex) != null) {
582 return parseInt(source, 10); 582 return parseInt(source, 10);
583 } 583 }
584 return handleError(source); 584 return handleError(source);
585 } 585 }
586 } else { 586 } else {
587 if (!(typeof radix == 'number')) 587 if (!(typeof radix == 'number'))
588 throw new core.ArgumentError("Radix is not an integer"); 588 dart.throw(new core.ArgumentError("Radix is not an integer"));
589 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) { 589 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) {
590 throw new core.RangeError(`Radix ${radix} not in range 2..36`); 590 dart.throw(new core.RangeError(`Radix ${radix} not in range 2..36`));
591 } 591 }
592 if (match != null) { 592 if (match != null) {
593 if (radix == 10 && dart.dindex(match, decimalIndex) != null) { 593 if (radix == 10 && dart.dindex(match, decimalIndex) != null) {
594 return parseInt(source, 10); 594 return parseInt(source, 10);
595 } 595 }
596 if (dart.notNull(radix) < 10 || dart.dindex(match, decimalIndex) == nu ll) { 596 if (dart.notNull(radix) < 10 || dart.dindex(match, decimalIndex) == nu ll) {
597 let maxCharCode = null; 597 let maxCharCode = null;
598 if (dart.notNull(radix) <= 10) { 598 if (dart.notNull(radix) <= 10) {
599 maxCharCode = 48 + dart.notNull(radix) - 1; 599 maxCharCode = 48 + dart.notNull(radix) - 1;
600 } else { 600 } else {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); 683 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) < dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end);
684 } 684 }
685 result = result + String.fromCharCode.apply(null, subarray); 685 result = result + String.fromCharCode.apply(null, subarray);
686 } 686 }
687 return result; 687 return result;
688 } 688 }
689 static stringFromCodePoints(codePoints) { 689 static stringFromCodePoints(codePoints) {
690 let a = dart.list([], core.int); 690 let a = dart.list([], core.int);
691 for (let i of dart.as(codePoints, core.Iterable)) { 691 for (let i of dart.as(codePoints, core.Iterable)) {
692 if (!(typeof i == 'number')) 692 if (!(typeof i == 'number'))
693 throw new core.ArgumentError(i); 693 dart.throw(new core.ArgumentError(i));
694 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) { 694 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) {
695 a[dartx.add](dart.as(i, core.int)); 695 a[dartx.add](dart.as(i, core.int));
696 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool) )) { 696 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool) )) {
697 a[dartx.add]((55296)[dartx['+']](dart.as(dart.dsend(dart.dsend(dart.ds end(i, '-', 65536), '>>', 10), '&', 1023), core.num))); 697 a[dartx.add]((55296)[dartx['+']](dart.as(dart.dsend(dart.dsend(dart.ds end(i, '-', 65536), '>>', 10), '&', 1023), core.num)));
698 a[dartx.add]((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), cor e.num))); 698 a[dartx.add]((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), cor e.num)));
699 } else { 699 } else {
700 throw new core.ArgumentError(i); 700 dart.throw(new core.ArgumentError(i));
701 } 701 }
702 } 702 }
703 return Primitives._fromCharCodeApply(a); 703 return Primitives._fromCharCodeApply(a);
704 } 704 }
705 static stringFromCharCodes(charCodes) { 705 static stringFromCharCodes(charCodes) {
706 for (let i of dart.as(charCodes, core.Iterable)) { 706 for (let i of dart.as(charCodes, core.Iterable)) {
707 if (!(typeof i == 'number')) 707 if (!(typeof i == 'number'))
708 throw new core.ArgumentError(i); 708 dart.throw(new core.ArgumentError(i));
709 if (dart.notNull(dart.as(dart.dsend(i, '<', 0), core.bool))) 709 if (dart.notNull(dart.as(dart.dsend(i, '<', 0), core.bool)))
710 throw new core.ArgumentError(i); 710 dart.throw(new core.ArgumentError(i));
711 if (dart.notNull(dart.as(dart.dsend(i, '>', 65535), core.bool))) 711 if (dart.notNull(dart.as(dart.dsend(i, '>', 65535), core.bool)))
712 return Primitives.stringFromCodePoints(charCodes); 712 return Primitives.stringFromCodePoints(charCodes);
713 } 713 }
714 return Primitives._fromCharCodeApply(dart.as(charCodes, core.List$(core.in t))); 714 return Primitives._fromCharCodeApply(dart.as(charCodes, core.List$(core.in t)));
715 } 715 }
716 static stringFromCharCode(charCode) { 716 static stringFromCharCode(charCode) {
717 if (0 <= dart.notNull(dart.as(charCode, core.num))) { 717 if (0 <= dart.notNull(dart.as(charCode, core.num))) {
718 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 65535), core.bool))) { 718 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 65535), core.bool))) {
719 return String.fromCharCode(charCode); 719 return String.fromCharCode(charCode);
720 } 720 }
721 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 1114111), core.bool) )) { 721 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 1114111), core.bool) )) {
722 let bits = dart.dsend(charCode, '-', 65536); 722 let bits = dart.dsend(charCode, '-', 65536);
723 let low = (56320)[dartx['|']](dart.as(dart.dsend(bits, '&', 1023), cor e.int)); 723 let low = (56320)[dartx['|']](dart.as(dart.dsend(bits, '&', 1023), cor e.int));
724 let high = (55296)[dartx['|']](dart.as(dart.dsend(bits, '>>', 10), cor e.int)); 724 let high = (55296)[dartx['|']](dart.as(dart.dsend(bits, '>>', 10), cor e.int));
725 return String.fromCharCode(high, low); 725 return String.fromCharCode(high, low);
726 } 726 }
727 } 727 }
728 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111); 728 dart.throw(new core.RangeError.range(dart.as(charCode, core.num), 0, 11141 11));
729 } 729 }
730 static stringConcatUnchecked(string1, string2) { 730 static stringConcatUnchecked(string1, string2) {
731 return _foreign_helper.JS_STRING_CONCAT(string1, string2); 731 return _foreign_helper.JS_STRING_CONCAT(string1, string2);
732 } 732 }
733 static flattenString(str) { 733 static flattenString(str) {
734 return str.charCodeAt(0) == 0 ? str : str; 734 return str.charCodeAt(0) == 0 ? str : str;
735 } 735 }
736 static getTimeZoneName(receiver) { 736 static getTimeZoneName(receiver) {
737 let d = Primitives.lazyAsJsDate(receiver); 737 let d = Primitives.lazyAsJsDate(receiver);
738 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List); 738 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 } 808 }
809 static getMilliseconds(receiver) { 809 static getMilliseconds(receiver) {
810 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMilliseconds() + 0 : Primitives.lazyAsJsD ate(receiver).getMilliseconds() + 0; 810 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMilliseconds() + 0 : Primitives.lazyAsJsD ate(receiver).getMilliseconds() + 0;
811 } 811 }
812 static getWeekday(receiver) { 812 static getWeekday(receiver) {
813 let weekday = dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.boo l)) ? Primitives.lazyAsJsDate(receiver).getUTCDay() + 0 : Primitives.lazyAsJsDat e(receiver).getDay() + 0; 813 let weekday = dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.boo l)) ? Primitives.lazyAsJsDate(receiver).getUTCDay() + 0 : Primitives.lazyAsJsDat e(receiver).getDay() + 0;
814 return (dart.notNull(weekday) + 6) % 7 + 1; 814 return (dart.notNull(weekday) + 6) % 7 + 1;
815 } 815 }
816 static valueFromDateString(str) { 816 static valueFromDateString(str) {
817 if (!(typeof str == 'string')) 817 if (!(typeof str == 'string'))
818 throw new core.ArgumentError(str); 818 dart.throw(new core.ArgumentError(str));
819 let value = Date.parse(str); 819 let value = Date.parse(str);
820 if (dart.notNull(value[dartx.isNaN])) 820 if (dart.notNull(value[dartx.isNaN]))
821 throw new core.ArgumentError(str); 821 dart.throw(new core.ArgumentError(str));
822 return value; 822 return value;
823 } 823 }
824 static getProperty(object, key) { 824 static getProperty(object, key) {
825 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') { 825 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') {
826 throw new core.ArgumentError(object); 826 dart.throw(new core.ArgumentError(object));
827 } 827 }
828 return object[key]; 828 return object[key];
829 } 829 }
830 static setProperty(object, key, value) { 830 static setProperty(object, key, value) {
831 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') { 831 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') {
832 throw new core.ArgumentError(object); 832 dart.throw(new core.ArgumentError(object));
833 } 833 }
834 object[key] = value; 834 object[key] = value;
835 } 835 }
836 static identicalImplementation(a, b) { 836 static identicalImplementation(a, b) {
837 return a == null ? b == null : a === b; 837 return a == null ? b == null : a === b;
838 } 838 }
839 static extractStackTrace(error) { 839 static extractStackTrace(error) {
840 return getTraceFromException(error.$thrownJsError); 840 return getTraceFromException(error.$thrownJsError);
841 } 841 }
842 } 842 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 Primitives.mirrorInvokeCacheName = '$cachedInvocation'; 883 Primitives.mirrorInvokeCacheName = '$cachedInvocation';
884 Primitives.DOLLAR_CHAR_VALUE = 36; 884 Primitives.DOLLAR_CHAR_VALUE = 36;
885 Primitives.timerFrequency = null; 885 Primitives.timerFrequency = null;
886 Primitives.timerTicks = null; 886 Primitives.timerTicks = null;
887 function stringLastIndexOfUnchecked(receiver, element, start) { 887 function stringLastIndexOfUnchecked(receiver, element, start) {
888 return receiver.lastIndexOf(element, start); 888 return receiver.lastIndexOf(element, start);
889 } 889 }
890 dart.fn(stringLastIndexOfUnchecked); 890 dart.fn(stringLastIndexOfUnchecked);
891 function checkNull(object) { 891 function checkNull(object) {
892 if (object == null) 892 if (object == null)
893 throw new core.ArgumentError(null); 893 dart.throw(new core.ArgumentError(null));
894 return object; 894 return object;
895 } 895 }
896 dart.fn(checkNull); 896 dart.fn(checkNull);
897 function checkNum(value) { 897 function checkNum(value) {
898 if (!dart.is(value, core.num)) { 898 if (!dart.is(value, core.num)) {
899 throw new core.ArgumentError(value); 899 dart.throw(new core.ArgumentError(value));
900 } 900 }
901 return value; 901 return value;
902 } 902 }
903 dart.fn(checkNum); 903 dart.fn(checkNum);
904 function checkInt(value) { 904 function checkInt(value) {
905 if (!(typeof value == 'number')) { 905 if (!(typeof value == 'number')) {
906 throw new core.ArgumentError(value); 906 dart.throw(new core.ArgumentError(value));
907 } 907 }
908 return value; 908 return value;
909 } 909 }
910 dart.fn(checkInt); 910 dart.fn(checkInt);
911 function checkBool(value) { 911 function checkBool(value) {
912 if (!(typeof value == 'boolean')) { 912 if (!(typeof value == 'boolean')) {
913 throw new core.ArgumentError(value); 913 dart.throw(new core.ArgumentError(value));
914 } 914 }
915 return value; 915 return value;
916 } 916 }
917 dart.fn(checkBool); 917 dart.fn(checkBool);
918 function checkString(value) { 918 function checkString(value) {
919 if (!(typeof value == 'string')) { 919 if (!(typeof value == 'string')) {
920 throw new core.ArgumentError(value); 920 dart.throw(new core.ArgumentError(value));
921 } 921 }
922 return value; 922 return value;
923 } 923 }
924 dart.fn(checkString); 924 dart.fn(checkString);
925 function throwRuntimeError(message) { 925 function throwRuntimeError(message) {
926 throw new RuntimeError(message); 926 dart.throw(new RuntimeError(message));
927 } 927 }
928 dart.fn(throwRuntimeError); 928 dart.fn(throwRuntimeError);
929 function throwAbstractClassInstantiationError(className) { 929 function throwAbstractClassInstantiationError(className) {
930 throw new core.AbstractClassInstantiationError(dart.as(className, core.Strin g)); 930 dart.throw(new core.AbstractClassInstantiationError(dart.as(className, core. String)));
931 } 931 }
932 dart.fn(throwAbstractClassInstantiationError); 932 dart.fn(throwAbstractClassInstantiationError);
933 let _message = Symbol('_message'); 933 let _message = Symbol('_message');
934 let _method = Symbol('_method'); 934 let _method = Symbol('_method');
935 class NullError extends core.Error { 935 class NullError extends core.Error {
936 NullError(message, match) { 936 NullError(message, match) {
937 this[_message] = message; 937 this[_message] = message;
938 this[_method] = match == null ? null : dart.as(match.method, core.String); 938 this[_method] = match == null ? null : dart.as(match.method, core.String);
939 super.Error(); 939 super.Error();
940 } 940 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 exports.Returns = Returns; 1190 exports.Returns = Returns;
1191 exports.JSName = JSName; 1191 exports.JSName = JSName;
1192 exports.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior; 1192 exports.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior;
1193 exports.TypeErrorImplementation = TypeErrorImplementation; 1193 exports.TypeErrorImplementation = TypeErrorImplementation;
1194 exports.CastErrorImplementation = CastErrorImplementation; 1194 exports.CastErrorImplementation = CastErrorImplementation;
1195 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; 1195 exports.FallThroughErrorImplementation = FallThroughErrorImplementation;
1196 exports.RuntimeError = RuntimeError; 1196 exports.RuntimeError = RuntimeError;
1197 exports.random64 = random64; 1197 exports.random64 = random64;
1198 exports.jsonEncodeNative = jsonEncodeNative; 1198 exports.jsonEncodeNative = jsonEncodeNative;
1199 }); 1199 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_js_mirrors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698