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

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

Issue 1147143007: fixes #206, add checking for unary ops (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _js_helper = dart.defineLibrary(_js_helper, {}); 1 var _js_helper = dart.defineLibrary(_js_helper, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 var collection = dart.import(collection); 3 var collection = dart.import(collection);
4 var _interceptors = dart.lazyImport(_interceptors); 4 var _interceptors = dart.lazyImport(_interceptors);
5 var _foreign_helper = dart.import(_foreign_helper); 5 var _foreign_helper = dart.import(_foreign_helper);
6 (function(exports, core, collection, _interceptors, _foreign_helper) { 6 (function(exports, core, collection, _interceptors, _foreign_helper) {
7 'use strict'; 7 'use strict';
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return this[_nativeAnchoredRegExp] = JSSyntaxRegExp.makeNative(`${this.pat tern}|()`, this[_isMultiLine], this[_isCaseSensitive], true); 104 return this[_nativeAnchoredRegExp] = JSSyntaxRegExp.makeNative(`${this.pat tern}|()`, this[_isMultiLine], this[_isCaseSensitive], true);
105 } 105 }
106 get [_isMultiLine]() { 106 get [_isMultiLine]() {
107 return this[_nativeRegExp].multiline; 107 return this[_nativeRegExp].multiline;
108 } 108 }
109 get [_isCaseSensitive]() { 109 get [_isCaseSensitive]() {
110 return !this[_nativeRegExp].ignoreCase; 110 return !this[_nativeRegExp].ignoreCase;
111 } 111 }
112 static makeNative(source, multiLine, caseSensitive, global) { 112 static makeNative(source, multiLine, caseSensitive, global) {
113 checkString(source); 113 checkString(source);
114 let m = multiLine ? 'm' : ''; 114 let m = dart.notNull(multiLine) ? 'm' : '';
115 let i = caseSensitive ? '' : 'i'; 115 let i = dart.notNull(caseSensitive) ? '' : 'i';
116 let g = global ? 'g' : ''; 116 let g = dart.notNull(global) ? 'g' : '';
117 let regexp = function() { 117 let regexp = function() {
118 try { 118 try {
119 return new RegExp(source, m + i + g); 119 return new RegExp(source, m + i + g);
120 } catch (e) { 120 } catch (e) {
121 return e; 121 return e;
122 } 122 }
123 123
124 }(); 124 }();
125 if (regexp instanceof RegExp) 125 if (regexp instanceof RegExp)
126 return regexp; 126 return regexp;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 494 }
495 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI ndex))); 495 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI ndex)));
496 return dart.toString(buffer); 496 return dart.toString(buffer);
497 } 497 }
498 dart.fn(stringReplaceAllStringFuncUnchecked); 498 dart.fn(stringReplaceAllStringFuncUnchecked);
499 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { 499 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) {
500 if (startIndex === void 0) 500 if (startIndex === void 0)
501 startIndex = 0; 501 startIndex = 0;
502 if (typeof from == 'string') { 502 if (typeof from == 'string') {
503 let index = dart.dsend(receiver, 'indexOf', from, startIndex); 503 let index = dart.dsend(receiver, 'indexOf', from, startIndex);
504 if (dart.dsend(index, '<', 0)) 504 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool)))
505 return receiver; 505 return receiver;
506 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`; 506 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`;
507 } else if (dart.is(from, JSSyntaxRegExp)) { 507 } else if (dart.is(from, JSSyntaxRegExp)) {
508 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as (from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd ex); 508 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as (from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd ex);
509 } else { 509 } else {
510 checkNull(from); 510 checkNull(from);
511 throw "String.replace(Pattern) UNIMPLEMENTED"; 511 throw "String.replace(Pattern) UNIMPLEMENTED";
512 } 512 }
513 } 513 }
514 dart.fn(stringReplaceFirstUnchecked, core.Object, [core.Object, core.Object, c ore.Object], [core.int]); 514 dart.fn(stringReplaceFirstUnchecked, core.Object, [core.Object, core.Object, c ore.Object], [core.int]);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 579 }
580 return handleError(source); 580 return handleError(source);
581 } 581 }
582 } else { 582 } else {
583 if (!(typeof radix == 'number')) 583 if (!(typeof radix == 'number'))
584 throw new core.ArgumentError("Radix is not an integer"); 584 throw new core.ArgumentError("Radix is not an integer");
585 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) { 585 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) {
586 throw new core.RangeError(`Radix ${radix} not in range 2..36`); 586 throw new core.RangeError(`Radix ${radix} not in range 2..36`);
587 } 587 }
588 if (match != null) { 588 if (match != null) {
589 if (radix == 10 && dart.notNull(dart.dindex(match, decimalIndex) != nu ll)) { 589 if (radix == 10 && dart.dindex(match, decimalIndex) != null) {
590 return parseInt(source, 10); 590 return parseInt(source, 10);
591 } 591 }
592 if (dart.notNull(radix) < 10 || dart.notNull(dart.dindex(match, decima lIndex) == null)) { 592 if (dart.notNull(radix) < 10 || dart.dindex(match, decimalIndex) == nu ll) {
593 let maxCharCode = null; 593 let maxCharCode = null;
594 if (dart.notNull(radix) <= 10) { 594 if (dart.notNull(radix) <= 10) {
595 maxCharCode = 48 + dart.notNull(radix) - 1; 595 maxCharCode = 48 + dart.notNull(radix) - 1;
596 } else { 596 } else {
597 maxCharCode = 97 + dart.notNull(radix) - 10 - 1; 597 maxCharCode = 97 + dart.notNull(radix) - 10 - 1;
598 } 598 }
599 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin g); 599 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin g);
600 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); i = dart.notNull(i) + 1) { 600 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); i = dart.notNull(i) + 1) {
601 let characterCode = dart.notNull(digitsPart[dartx.codeUnitAt](0)) | 32; 601 let characterCode = dart.notNull(digitsPart[dartx.codeUnitAt](0)) | 32;
602 if (dart.notNull(digitsPart[dartx.codeUnitAt](i)) > dart.notNull(m axCharCode)) { 602 if (dart.notNull(digitsPart[dartx.codeUnitAt](i)) > dart.notNull(m axCharCode)) {
603 return handleError(source); 603 return handleError(source);
604 } 604 }
605 } 605 }
606 } 606 }
607 } 607 }
608 } 608 }
609 if (match == null) 609 if (match == null)
610 return handleError(source); 610 return handleError(source);
611 return parseInt(source, radix); 611 return parseInt(source, radix);
612 } 612 }
613 static parseDouble(source, handleError) { 613 static parseDouble(source, handleError) {
614 checkString(source); 614 checkString(source);
615 if (handleError == null) 615 if (handleError == null)
616 handleError = dart.fn(s => dart.as(Primitives._throwFormatException(dart .as(s, core.String)), core.double), core.double, [core.Object]); 616 handleError = dart.fn(s => dart.as(Primitives._throwFormatException(dart .as(s, core.String)), core.double), core.double, [core.Object]);
617 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) { 617 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) {
618 return handleError(source); 618 return handleError(source);
619 } 619 }
620 let result = parseFloat(source); 620 let result = parseFloat(source);
621 if (result[dartx.isNaN]) { 621 if (dart.notNull(result[dartx.isNaN])) {
622 let trimmed = source[dartx.trim](); 622 let trimmed = source[dartx.trim]();
623 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') { 623 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') {
624 return result; 624 return result;
625 } 625 }
626 return handleError(source); 626 return handleError(source);
627 } 627 }
628 return result; 628 return result;
629 } 629 }
630 static objectTypeName(object) { 630 static objectTypeName(object) {
631 return dart.toString(getRuntimeType(object)); 631 return dart.toString(getRuntimeType(object));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 680 }
681 result = result + String.fromCharCode.apply(null, subarray); 681 result = result + String.fromCharCode.apply(null, subarray);
682 } 682 }
683 return result; 683 return result;
684 } 684 }
685 static stringFromCodePoints(codePoints) { 685 static stringFromCodePoints(codePoints) {
686 let a = dart.list([], core.int); 686 let a = dart.list([], core.int);
687 for (let i of dart.as(codePoints, core.Iterable)) { 687 for (let i of dart.as(codePoints, core.Iterable)) {
688 if (!(typeof i == 'number')) 688 if (!(typeof i == 'number'))
689 throw new core.ArgumentError(i); 689 throw new core.ArgumentError(i);
690 if (dart.dsend(i, '<=', 65535)) { 690 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) {
691 a[dartx.add](dart.as(i, core.int)); 691 a[dartx.add](dart.as(i, core.int));
692 } else if (dart.dsend(i, '<=', 1114111)) { 692 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool) )) {
693 a[dartx.add]((55296)[dartx['+']](dart.as(dart.dsend(dart.dsend(dart.ds end(i, '-', 65536), '>>', 10), '&', 1023), core.num))); 693 a[dartx.add]((55296)[dartx['+']](dart.as(dart.dsend(dart.dsend(dart.ds end(i, '-', 65536), '>>', 10), '&', 1023), core.num)));
694 a[dartx.add]((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), cor e.num))); 694 a[dartx.add]((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), cor e.num)));
695 } else { 695 } else {
696 throw new core.ArgumentError(i); 696 throw new core.ArgumentError(i);
697 } 697 }
698 } 698 }
699 return Primitives._fromCharCodeApply(a); 699 return Primitives._fromCharCodeApply(a);
700 } 700 }
701 static stringFromCharCodes(charCodes) { 701 static stringFromCharCodes(charCodes) {
702 for (let i of dart.as(charCodes, core.Iterable)) { 702 for (let i of dart.as(charCodes, core.Iterable)) {
703 if (!(typeof i == 'number')) 703 if (!(typeof i == 'number'))
704 throw new core.ArgumentError(i); 704 throw new core.ArgumentError(i);
705 if (dart.dsend(i, '<', 0)) 705 if (dart.notNull(dart.as(dart.dsend(i, '<', 0), core.bool)))
706 throw new core.ArgumentError(i); 706 throw new core.ArgumentError(i);
707 if (dart.dsend(i, '>', 65535)) 707 if (dart.notNull(dart.as(dart.dsend(i, '>', 65535), core.bool)))
708 return Primitives.stringFromCodePoints(charCodes); 708 return Primitives.stringFromCodePoints(charCodes);
709 } 709 }
710 return Primitives._fromCharCodeApply(dart.as(charCodes, core.List$(core.in t))); 710 return Primitives._fromCharCodeApply(dart.as(charCodes, core.List$(core.in t)));
711 } 711 }
712 static stringFromCharCode(charCode) { 712 static stringFromCharCode(charCode) {
713 if (0 <= dart.notNull(dart.as(charCode, core.num))) { 713 if (0 <= dart.notNull(dart.as(charCode, core.num))) {
714 if (dart.dsend(charCode, '<=', 65535)) { 714 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 65535), core.bool))) {
715 return String.fromCharCode(charCode); 715 return String.fromCharCode(charCode);
716 } 716 }
717 if (dart.dsend(charCode, '<=', 1114111)) { 717 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 1114111), core.bool) )) {
718 let bits = dart.dsend(charCode, '-', 65536); 718 let bits = dart.dsend(charCode, '-', 65536);
719 let low = (56320)[dartx['|']](dart.as(dart.dsend(bits, '&', 1023), cor e.int)); 719 let low = (56320)[dartx['|']](dart.as(dart.dsend(bits, '&', 1023), cor e.int));
720 let high = (55296)[dartx['|']](dart.as(dart.dsend(bits, '>>', 10), cor e.int)); 720 let high = (55296)[dartx['|']](dart.as(dart.dsend(bits, '>>', 10), cor e.int));
721 return String.fromCharCode(high, low); 721 return String.fromCharCode(high, low);
722 } 722 }
723 } 723 }
724 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111); 724 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111);
725 } 725 }
726 static stringConcatUnchecked(string1, string2) { 726 static stringConcatUnchecked(string1, string2) {
727 return _foreign_helper.JS_STRING_CONCAT(string1, string2); 727 return _foreign_helper.JS_STRING_CONCAT(string1, string2);
(...skipping 22 matching lines...) Expand all
750 checkInt(years); 750 checkInt(years);
751 checkInt(month); 751 checkInt(month);
752 checkInt(day); 752 checkInt(day);
753 checkInt(hours); 753 checkInt(hours);
754 checkInt(minutes); 754 checkInt(minutes);
755 checkInt(seconds); 755 checkInt(seconds);
756 checkInt(milliseconds); 756 checkInt(milliseconds);
757 checkBool(isUtc); 757 checkBool(isUtc);
758 let jsMonth = dart.dsend(month, '-', 1); 758 let jsMonth = dart.dsend(month, '-', 1);
759 let value = null; 759 let value = null;
760 if (isUtc) { 760 if (dart.notNull(dart.as(isUtc, core.bool))) {
761 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds); 761 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds);
762 } else { 762 } else {
763 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf(); 763 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf();
764 } 764 }
765 if (dart.notNull(dart.as(dart.dload(value, 'isNaN'), core.bool)) || dart.n otNull(dart.as(dart.dsend(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH )), core.bool)) || dart.notNull(dart.as(dart.dsend(value, '>', MAX_MILLISECONDS_ SINCE_EPOCH), core.bool))) { 765 if (dart.notNull(dart.as(dart.dload(value, 'isNaN'), core.bool)) || dart.n otNull(dart.as(dart.dsend(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH )), core.bool)) || dart.notNull(dart.as(dart.dsend(value, '>', MAX_MILLISECONDS_ SINCE_EPOCH), core.bool))) {
766 return null; 766 return null;
767 } 767 }
768 if (dart.notNull(dart.as(dart.dsend(years, '<=', 0), core.bool)) || dart.n otNull(dart.as(dart.dsend(years, '<', 100), core.bool))) 768 if (dart.notNull(dart.as(dart.dsend(years, '<=', 0), core.bool)) || dart.n otNull(dart.as(dart.dsend(years, '<', 100), core.bool)))
769 return Primitives.patchUpY2K(value, years, isUtc); 769 return Primitives.patchUpY2K(value, years, isUtc);
770 return value; 770 return value;
771 } 771 }
772 static patchUpY2K(value, years, isUtc) { 772 static patchUpY2K(value, years, isUtc) {
773 let date = new Date(value); 773 let date = new Date(value);
774 if (isUtc) { 774 if (dart.notNull(dart.as(isUtc, core.bool))) {
775 date.setUTCFullYear(years); 775 date.setUTCFullYear(years);
776 } else { 776 } else {
777 date.setFullYear(years); 777 date.setFullYear(years);
778 } 778 }
779 return date.valueOf(); 779 return date.valueOf();
780 } 780 }
781 static lazyAsJsDate(receiver) { 781 static lazyAsJsDate(receiver) {
782 if (receiver.date === void 0) { 782 if (receiver.date === void 0) {
783 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch')) ; 783 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch')) ;
784 } 784 }
785 return receiver.date; 785 return receiver.date;
786 } 786 }
787 static getYear(receiver) { 787 static getYear(receiver) {
788 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCFullYear() + 0 : Primitives.lazyAsJsDate(receiver).getFullYear() + 0; 788 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCFullYear() + 0 : Primitives.lazyAsJsDate( receiver).getFullYear() + 0;
789 } 789 }
790 static getMonth(receiver) { 790 static getMonth(receiver) {
791 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCMonth() + 1 : Primitives.lazyAsJsDate(receiver).getMonth() + 1; 791 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMonth() + 1 : Primitives.lazyAsJsDate(rec eiver).getMonth() + 1;
792 } 792 }
793 static getDay(receiver) { 793 static getDay(receiver) {
794 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCDate() + 0 : Primitives.lazyAsJsDate(receiver).getDate() + 0; 794 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCDate() + 0 : Primitives.lazyAsJsDate(rece iver).getDate() + 0;
795 } 795 }
796 static getHours(receiver) { 796 static getHours(receiver) {
797 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCHours() + 0 : Primitives.lazyAsJsDate(receiver).getHours() + 0; 797 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCHours() + 0 : Primitives.lazyAsJsDate(rec eiver).getHours() + 0;
798 } 798 }
799 static getMinutes(receiver) { 799 static getMinutes(receiver) {
800 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCMinutes() + 0 : Primitives.lazyAsJsDate(receiver).getMinutes() + 0; 800 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMinutes() + 0 : Primitives.lazyAsJsDate(r eceiver).getMinutes() + 0;
801 } 801 }
802 static getSeconds(receiver) { 802 static getSeconds(receiver) {
803 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCSeconds() + 0 : Primitives.lazyAsJsDate(receiver).getSeconds() + 0; 803 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCSeconds() + 0 : Primitives.lazyAsJsDate(r eceiver).getSeconds() + 0;
804 } 804 }
805 static getMilliseconds(receiver) { 805 static getMilliseconds(receiver) {
806 return dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(receiver).g etUTCMilliseconds() + 0 : Primitives.lazyAsJsDate(receiver).getMilliseconds() + 0; 806 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P rimitives.lazyAsJsDate(receiver).getUTCMilliseconds() + 0 : Primitives.lazyAsJsD ate(receiver).getMilliseconds() + 0;
807 } 807 }
808 static getWeekday(receiver) { 808 static getWeekday(receiver) {
809 let weekday = dart.dload(receiver, 'isUtc') ? Primitives.lazyAsJsDate(rece iver).getUTCDay() + 0 : Primitives.lazyAsJsDate(receiver).getDay() + 0; 809 let weekday = dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.boo l)) ? Primitives.lazyAsJsDate(receiver).getUTCDay() + 0 : Primitives.lazyAsJsDat e(receiver).getDay() + 0;
810 return (dart.notNull(weekday) + 6) % 7 + 1; 810 return (dart.notNull(weekday) + 6) % 7 + 1;
811 } 811 }
812 static valueFromDateString(str) { 812 static valueFromDateString(str) {
813 if (!(typeof str == 'string')) 813 if (!(typeof str == 'string'))
814 throw new core.ArgumentError(str); 814 throw new core.ArgumentError(str);
815 let value = Date.parse(str); 815 let value = Date.parse(str);
816 if (value[dartx.isNaN]) 816 if (dart.notNull(value[dartx.isNaN]))
817 throw new core.ArgumentError(str); 817 throw new core.ArgumentError(str);
818 return value; 818 return value;
819 } 819 }
820 static getProperty(object, key) { 820 static getProperty(object, key) {
821 if (dart.notNull(object == null) || typeof object == 'boolean' || dart.is( object, core.num) || typeof object == 'string') { 821 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') {
822 throw new core.ArgumentError(object); 822 throw new core.ArgumentError(object);
823 } 823 }
824 return object[key]; 824 return object[key];
825 } 825 }
826 static setProperty(object, key, value) { 826 static setProperty(object, key, value) {
827 if (dart.notNull(object == null) || typeof object == 'boolean' || dart.is( object, core.num) || typeof object == 'string') { 827 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') {
828 throw new core.ArgumentError(object); 828 throw new core.ArgumentError(object);
829 } 829 }
830 object[key] = value; 830 object[key] = value;
831 } 831 }
832 static identicalImplementation(a, b) { 832 static identicalImplementation(a, b) {
833 return a == null ? b == null : a === b; 833 return a == null ? b == null : a === b;
834 } 834 }
835 static extractStackTrace(error) { 835 static extractStackTrace(error) {
836 return getTraceFromException(error.$thrownJsError); 836 return getTraceFromException(error.$thrownJsError);
837 } 837 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 JsNoSuchMethodError[dart.implements] = () => [core.NoSuchMethodError]; 964 JsNoSuchMethodError[dart.implements] = () => [core.NoSuchMethodError];
965 dart.setSignature(JsNoSuchMethodError, { 965 dart.setSignature(JsNoSuchMethodError, {
966 constructors: () => ({JsNoSuchMethodError: [JsNoSuchMethodError, [core.Strin g, core.Object]]}) 966 constructors: () => ({JsNoSuchMethodError: [JsNoSuchMethodError, [core.Strin g, core.Object]]})
967 }); 967 });
968 class UnknownJsTypeError extends core.Error { 968 class UnknownJsTypeError extends core.Error {
969 UnknownJsTypeError(message) { 969 UnknownJsTypeError(message) {
970 this[_message] = message; 970 this[_message] = message;
971 super.Error(); 971 super.Error();
972 } 972 }
973 toString() { 973 toString() {
974 return this[_message][dartx.isEmpty] ? 'Error' : `Error: ${this[_message]} `; 974 return dart.notNull(this[_message][dartx.isEmpty]) ? 'Error' : `Error: ${t his[_message]}`;
975 } 975 }
976 } 976 }
977 dart.setSignature(UnknownJsTypeError, { 977 dart.setSignature(UnknownJsTypeError, {
978 constructors: () => ({UnknownJsTypeError: [UnknownJsTypeError, [core.String] ]}) 978 constructors: () => ({UnknownJsTypeError: [UnknownJsTypeError, [core.String] ]})
979 }); 979 });
980 function getTraceFromException(exception) { 980 function getTraceFromException(exception) {
981 return new _StackTrace(exception); 981 return new _StackTrace(exception);
982 } 982 }
983 dart.fn(getTraceFromException, core.StackTrace, [core.Object]); 983 dart.fn(getTraceFromException, core.StackTrace, [core.Object]);
984 let _exception = Symbol('_exception'); 984 let _exception = Symbol('_exception');
(...skipping 11 matching lines...) Expand all
996 trace = dart.as(this[_exception].stack, core.String); 996 trace = dart.as(this[_exception].stack, core.String);
997 } 997 }
998 return this[_trace] = trace == null ? '' : trace; 998 return this[_trace] = trace == null ? '' : trace;
999 } 999 }
1000 } 1000 }
1001 _StackTrace[dart.implements] = () => [core.StackTrace]; 1001 _StackTrace[dart.implements] = () => [core.StackTrace];
1002 dart.setSignature(_StackTrace, { 1002 dart.setSignature(_StackTrace, {
1003 constructors: () => ({_StackTrace: [_StackTrace, [core.Object]]}) 1003 constructors: () => ({_StackTrace: [_StackTrace, [core.Object]]})
1004 }); 1004 });
1005 function objectHashCode(object) { 1005 function objectHashCode(object) {
1006 if (dart.notNull(object == null) || typeof object != 'object') { 1006 if (object == null || typeof object != 'object') {
1007 return dart.hashCode(object); 1007 return dart.hashCode(object);
1008 } else { 1008 } else {
1009 return Primitives.objectHashCode(object); 1009 return Primitives.objectHashCode(object);
1010 } 1010 }
1011 } 1011 }
1012 dart.fn(objectHashCode, core.int, [core.Object]); 1012 dart.fn(objectHashCode, core.int, [core.Object]);
1013 function fillLiteralMap(keyValuePairs, result) { 1013 function fillLiteralMap(keyValuePairs, result) {
1014 let index = 0; 1014 let index = 0;
1015 let length = getLength(keyValuePairs); 1015 let length = getLength(keyValuePairs);
1016 while (dart.notNull(index) < dart.notNull(length)) { 1016 while (dart.notNull(index) < dart.notNull(length)) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 exports.Creates = Creates; 1195 exports.Creates = Creates;
1196 exports.Returns = Returns; 1196 exports.Returns = Returns;
1197 exports.JSName = JSName; 1197 exports.JSName = JSName;
1198 exports.TypeErrorImplementation = TypeErrorImplementation; 1198 exports.TypeErrorImplementation = TypeErrorImplementation;
1199 exports.CastErrorImplementation = CastErrorImplementation; 1199 exports.CastErrorImplementation = CastErrorImplementation;
1200 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; 1200 exports.FallThroughErrorImplementation = FallThroughErrorImplementation;
1201 exports.RuntimeError = RuntimeError; 1201 exports.RuntimeError = RuntimeError;
1202 exports.random64 = random64; 1202 exports.random64 = random64;
1203 exports.jsonEncodeNative = jsonEncodeNative; 1203 exports.jsonEncodeNative = jsonEncodeNative;
1204 })(_js_helper, core, collection, _interceptors, _foreign_helper); 1204 })(_js_helper, core, collection, _interceptors, _foreign_helper);
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698