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

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

Issue 963343002: implement private members, fixes #74 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var _interceptors; 1 var _interceptors;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 let _handleIEtoString = Symbol('_handleIEtoString');
5 let _isInt32 = Symbol('_isInt32');
6 let _tdivFast = Symbol('_tdivFast');
7 let _tdivSlow = Symbol('_tdivSlow');
8 let _shlPositive = Symbol('_shlPositive');
9 let _shrReceiverPositive = Symbol('_shrReceiverPositive');
10 let _shrOtherPositive = Symbol('_shrOtherPositive');
11 let _shrBothPositive = Symbol('_shrBothPositive');
12 let _bitCount = Symbol('_bitCount');
13 let _shru = Symbol('_shru');
14 let _shrs = Symbol('_shrs');
15 let _ors = Symbol('_ors');
16 let _spread = Symbol('_spread');
17 let _defaultSplit = Symbol('_defaultSplit');
18 let _isWhitespace = Symbol('_isWhitespace');
19 let _skipLeadingWhitespace = Symbol('_skipLeadingWhitespace');
20 let _skipTrailingWhitespace = Symbol('_skipTrailingWhitespace');
21 let _string = Symbol('_string');
4 // Function _symbolToString: (Symbol) → String 22 // Function _symbolToString: (Symbol) → String
5 function _symbolToString(symbol) { 23 function _symbolToString(symbol) {
6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); 24 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol));
7 } 25 }
8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic 26 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic
9 function _symbolMapToStringMap(map) { 27 function _symbolMapToStringMap(map) {
10 if (map === null) 28 if (map === null)
11 return null; 29 return null;
12 let result = new core.Map(); 30 let result = new core.Map();
13 map.forEach((key, value) => { 31 map.forEach((key, value) => {
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 _js_helper.checkInt(radix); 727 _js_helper.checkInt(radix);
710 if (dart.notNull(radix < 2) || dart.notNull(radix > 36)) 728 if (dart.notNull(radix < 2) || dart.notNull(radix > 36))
711 throw new core.RangeError(radix); 729 throw new core.RangeError(radix);
712 let result = this.toString(radix); 730 let result = this.toString(radix);
713 let rightParenCode = 41; 731 let rightParenCode = 41;
714 if (result.codeUnitAt(result.length - 1) !== rightParenCode) { 732 if (result.codeUnitAt(result.length - 1) !== rightParenCode) {
715 return result; 733 return result;
716 } 734 }
717 return _handleIEtoString(result); 735 return _handleIEtoString(result);
718 } 736 }
719 static _handleIEtoString(result) { 737 static [_handleIEtoString](result) {
720 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); 738 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result);
721 if (match === null) { 739 if (match === null) {
722 throw new core.UnsupportedError(`Unexpected toString result: ${result}`) ; 740 throw new core.UnsupportedError(`Unexpected toString result: ${result}`) ;
723 } 741 }
724 let result = dart.dindex(match, 1); 742 let result = dart.dindex(match, 1);
725 let exponent = +dart.dindex(match, 3); 743 let exponent = +dart.dindex(match, 3);
726 if (dart.dindex(match, 2) !== null) { 744 if (dart.dindex(match, 2) !== null) {
727 result = result + dart.dindex(match, 2); 745 result = result + dart.dindex(match, 2);
728 exponent = dart.dindex(match, 2).length; 746 exponent = dart.dindex(match, 2).length;
729 } 747 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (result === 0) 787 if (result === 0)
770 return 0; 788 return 0;
771 if (dart.notNull(result) > 0) 789 if (dart.notNull(result) > 0)
772 return result; 790 return result;
773 if (dart.notNull(other) < 0) { 791 if (dart.notNull(other) < 0) {
774 return dart.notNull(result) - dart.notNull(other); 792 return dart.notNull(result) - dart.notNull(other);
775 } else { 793 } else {
776 return dart.notNull(result) + dart.notNull(other); 794 return dart.notNull(result) + dart.notNull(other);
777 } 795 }
778 } 796 }
779 _isInt32(value) { 797 [_isInt32](value) {
780 return (value | 0) === value; 798 return (value | 0) === value;
781 } 799 }
782 ['~/'](other) { 800 ['~/'](other) {
783 if (false) 801 if (false)
784 this._tdivFast(other); 802 this[_tdivFast](other);
785 if (dart.notNull(dart.notNull(dart.notNull(this._isInt32(this)) && dart.no tNull(this._isInt32(other))) && dart.notNull(0 !== other)) && dart.notNull(-1 != = other)) { 803 if (dart.notNull(dart.notNull(dart.notNull(this[_isInt32](this)) && dart.n otNull(this[_isInt32](other))) && dart.notNull(0 !== other)) && dart.notNull(-1 !== other)) {
786 return this / other | 0; 804 return this / other | 0;
787 } else { 805 } else {
788 return this._tdivSlow(other); 806 return this[_tdivSlow](other);
789 } 807 }
790 } 808 }
791 _tdivFast(other) { 809 [_tdivFast](other) {
792 return this._isInt32(this) ? this / other | 0 : (this / other).toInt(); 810 return this[_isInt32](this) ? this / other | 0 : (this / other).toInt();
793 } 811 }
794 _tdivSlow(other) { 812 [_tdivSlow](other) {
795 if (!dart.is(other, core.num)) 813 if (!dart.is(other, core.num))
796 throw new core.ArgumentError(other); 814 throw new core.ArgumentError(other);
797 return (this / other).toInt(); 815 return (this / other).toInt();
798 } 816 }
799 ['<<'](other) { 817 ['<<'](other) {
800 if (!dart.is(other, core.num)) 818 if (!dart.is(other, core.num))
801 throw new core.ArgumentError(other); 819 throw new core.ArgumentError(other);
802 if (dart.notNull(other) < 0) 820 if (dart.notNull(other) < 0)
803 throw new core.ArgumentError(other); 821 throw new core.ArgumentError(other);
804 return this._shlPositive(other); 822 return this[_shlPositive](other);
805 } 823 }
806 _shlPositive(other) { 824 [_shlPositive](other) {
807 return dart.as(other > 31 ? 0 : this << other >>> 0, core.num); 825 return dart.as(other > 31 ? 0 : this << other >>> 0, core.num);
808 } 826 }
809 ['>>'](other) { 827 ['>>'](other) {
810 if (false) 828 if (false)
811 this._shrReceiverPositive(other); 829 this[_shrReceiverPositive](other);
812 if (!dart.is(other, core.num)) 830 if (!dart.is(other, core.num))
813 throw new core.ArgumentError(other); 831 throw new core.ArgumentError(other);
814 if (dart.notNull(other) < 0) 832 if (dart.notNull(other) < 0)
815 throw new core.ArgumentError(other); 833 throw new core.ArgumentError(other);
816 return this._shrOtherPositive(other); 834 return this[_shrOtherPositive](other);
817 } 835 }
818 _shrOtherPositive(other) { 836 [_shrOtherPositive](other) {
819 return dart.as(dart.notNull(this) > 0 ? this._shrBothPositive(other) : thi s >> (dart.notNull(other) > 31 ? 31 : other) >>> 0, core.num); 837 return dart.as(dart.notNull(this) > 0 ? this[_shrBothPositive](other) : th is >> (dart.notNull(other) > 31 ? 31 : other) >>> 0, core.num);
820 } 838 }
821 _shrReceiverPositive(other) { 839 [_shrReceiverPositive](other) {
822 if (dart.notNull(other) < 0) 840 if (dart.notNull(other) < 0)
823 throw new core.ArgumentError(other); 841 throw new core.ArgumentError(other);
824 return this._shrBothPositive(other); 842 return this[_shrBothPositive](other);
825 } 843 }
826 _shrBothPositive(other) { 844 [_shrBothPositive](other) {
827 return dart.as(other > 31 ? 0 : this >>> other, core.num); 845 return dart.as(other > 31 ? 0 : this >>> other, core.num);
828 } 846 }
829 ['&'](other) { 847 ['&'](other) {
830 if (!dart.is(other, core.num)) 848 if (!dart.is(other, core.num))
831 throw new core.ArgumentError(other); 849 throw new core.ArgumentError(other);
832 return dart.as((this & other) >>> 0, core.num); 850 return dart.as((this & other) >>> 0, core.num);
833 } 851 }
834 ['|'](other) { 852 ['|'](other) {
835 if (!dart.is(other, core.num)) 853 if (!dart.is(other, core.num))
836 throw new core.ArgumentError(other); 854 throw new core.ArgumentError(other);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 return dart.notNull(dart.notNull(this['&'](signMask - 1)) - dart.notNull(t his['&'](signMask))); 903 return dart.notNull(dart.notNull(this['&'](signMask - 1)) - dart.notNull(t his['&'](signMask)));
886 } 904 }
887 get bitLength() { 905 get bitLength() {
888 let nonneg = dart.notNull(this['<'](0) ? dart.notNull(dart.throw_("Unimple mented PrefixExpression: -this")) - 1 : this); 906 let nonneg = dart.notNull(this['<'](0) ? dart.notNull(dart.throw_("Unimple mented PrefixExpression: -this")) - 1 : this);
889 if (nonneg >= 4294967296) { 907 if (nonneg >= 4294967296) {
890 nonneg = (nonneg / 4294967296).truncate(); 908 nonneg = (nonneg / 4294967296).truncate();
891 return _bitCount(_spread(nonneg)) + 32; 909 return _bitCount(_spread(nonneg)) + 32;
892 } 910 }
893 return _bitCount(_spread(nonneg)); 911 return _bitCount(_spread(nonneg));
894 } 912 }
895 static _bitCount(i) { 913 static [_bitCount](i) {
896 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&', 1431655765)), core.int); 914 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&', 1431655765)), core.int);
897 i = dart.notNull((i & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 85899 3459))); 915 i = dart.notNull((i & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 85899 3459)));
898 i = 252645135 & dart.notNull(i['+'](_shru(i, 4))); 916 i = 252645135 & dart.notNull(i['+'](_shru(i, 4)));
899 i = dart.as(_shru(i, 8), core.int); 917 i = dart.as(_shru(i, 8), core.int);
900 i = dart.as(_shru(i, 16), core.int); 918 i = dart.as(_shru(i, 16), core.int);
901 return i & 63; 919 return i & 63;
902 } 920 }
903 static _shru(value, shift) { 921 static [_shru](value, shift) {
904 return value >>> shift; 922 return value >>> shift;
905 } 923 }
906 static _shrs(value, shift) { 924 static [_shrs](value, shift) {
907 return value >> shift; 925 return value >> shift;
908 } 926 }
909 static _ors(a, b) { 927 static [_ors](a, b) {
910 return a | b; 928 return a | b;
911 } 929 }
912 static _spread(i) { 930 static [_spread](i) {
913 i = dart.as(_ors(i, dart.as(_shrs(i, 1), core.int)), core.int); 931 i = dart.as(_ors(i, dart.as(_shrs(i, 1), core.int)), core.int);
914 i = dart.as(_ors(i, dart.as(_shrs(i, 2), core.int)), core.int); 932 i = dart.as(_ors(i, dart.as(_shrs(i, 2), core.int)), core.int);
915 i = dart.as(_ors(i, dart.as(_shrs(i, 4), core.int)), core.int); 933 i = dart.as(_ors(i, dart.as(_shrs(i, 4), core.int)), core.int);
916 i = dart.as(_ors(i, dart.as(_shrs(i, 8), core.int)), core.int); 934 i = dart.as(_ors(i, dart.as(_shrs(i, 8), core.int)), core.int);
917 i = dart.as(_shru(dart.as(_ors(i, dart.as(_shrs(i, 16), core.int)), core.i nt), 0), core.int); 935 i = dart.as(_shru(dart.as(_ors(i, dart.as(_shrs(i, 16), core.int)), core.i nt), 0), core.int);
918 return i; 936 return i;
919 } 937 }
920 get runtimeType() { 938 get runtimeType() {
921 return core.int; 939 return core.int;
922 } 940 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star tIndex), core.String); 1029 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star tIndex), core.String);
1012 } 1030 }
1013 split(pattern) { 1031 split(pattern) {
1014 _js_helper.checkNull(pattern); 1032 _js_helper.checkNull(pattern);
1015 if (typeof pattern == string) { 1033 if (typeof pattern == string) {
1016 return dart.as(this.split(pattern), core.List$(core.String)); 1034 return dart.as(this.split(pattern), core.List$(core.String));
1017 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && da rt.notNull(_js_helper.regExpCaptureCount(pattern) === 0)) { 1035 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && da rt.notNull(_js_helper.regExpCaptureCount(pattern) === 0)) {
1018 let re = _js_helper.regExpGetNative(pattern); 1036 let re = _js_helper.regExpGetNative(pattern);
1019 return dart.as(this.split(re), core.List$(core.String)); 1037 return dart.as(this.split(re), core.List$(core.String));
1020 } else { 1038 } else {
1021 return this._defaultSplit(pattern); 1039 return this[_defaultSplit](pattern);
1022 } 1040 }
1023 } 1041 }
1024 _defaultSplit(pattern) { 1042 [_defaultSplit](pattern) {
1025 let result = new List.from([]); 1043 let result = new List.from([]);
1026 let start = 0; 1044 let start = 0;
1027 let length = 1; 1045 let length = 1;
1028 for (let match of pattern.allMatches(this)) { 1046 for (let match of pattern.allMatches(this)) {
1029 let matchStart = dart.as(dart.dload(match, 'start'), core.int); 1047 let matchStart = dart.as(dart.dload(match, 'start'), core.int);
1030 let matchEnd = dart.as(dart.dload(match, 'end'), core.int); 1048 let matchEnd = dart.as(dart.dload(match, 'end'), core.int);
1031 length = matchEnd - matchStart; 1049 length = matchEnd - matchStart;
1032 if (dart.notNull(length === 0) && dart.notNull(start === matchStart)) { 1050 if (dart.notNull(length === 0) && dart.notNull(start === matchStart)) {
1033 continue; 1051 continue;
1034 } 1052 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 if (endIndex > this.length) 1090 if (endIndex > this.length)
1073 throw new core.RangeError.value(endIndex); 1091 throw new core.RangeError.value(endIndex);
1074 return this.substring(startIndex, endIndex); 1092 return this.substring(startIndex, endIndex);
1075 } 1093 }
1076 toLowerCase() { 1094 toLowerCase() {
1077 return this.toLowerCase(); 1095 return this.toLowerCase();
1078 } 1096 }
1079 toUpperCase() { 1097 toUpperCase() {
1080 return this.toUpperCase(); 1098 return this.toUpperCase();
1081 } 1099 }
1082 static _isWhitespace(codeUnit) { 1100 static [_isWhitespace](codeUnit) {
1083 if (codeUnit < 256) { 1101 if (codeUnit < 256) {
1084 switch (codeUnit) { 1102 switch (codeUnit) {
1085 case 9: 1103 case 9:
1086 case 10: 1104 case 10:
1087 case 11: 1105 case 11:
1088 case 12: 1106 case 12:
1089 case 13: 1107 case 13:
1090 case 32: 1108 case 32:
1091 case 133: 1109 case 133:
1092 case 160: 1110 case 160:
(...skipping 20 matching lines...) Expand all
1113 case 8233: 1131 case 8233:
1114 case 8239: 1132 case 8239:
1115 case 8287: 1133 case 8287:
1116 case 12288: 1134 case 12288:
1117 case 65279: 1135 case 65279:
1118 return true; 1136 return true;
1119 default: 1137 default:
1120 return false; 1138 return false;
1121 } 1139 }
1122 } 1140 }
1123 static _skipLeadingWhitespace(string, index) { 1141 static [_skipLeadingWhitespace](string, index) {
1124 let SPACE = 32; 1142 let SPACE = 32;
1125 let CARRIAGE_RETURN = 13; 1143 let CARRIAGE_RETURN = 13;
1126 while (index < string.length) { 1144 while (index < string.length) {
1127 let codeUnit = string.codeUnitAt(index); 1145 let codeUnit = string.codeUnitAt(index);
1128 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit))) ) { 1146 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit))) ) {
1129 break; 1147 break;
1130 } 1148 }
1131 index++; 1149 index++;
1132 } 1150 }
1133 return index; 1151 return index;
1134 } 1152 }
1135 static _skipTrailingWhitespace(string, index) { 1153 static [_skipTrailingWhitespace](string, index) {
1136 let SPACE = 32; 1154 let SPACE = 32;
1137 let CARRIAGE_RETURN = 13; 1155 let CARRIAGE_RETURN = 13;
1138 while (index > 0) { 1156 while (index > 0) {
1139 let codeUnit = string.codeUnitAt(index - 1); 1157 let codeUnit = string.codeUnitAt(index - 1);
1140 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit))) ) { 1158 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit))) ) {
1141 break; 1159 break;
1142 } 1160 }
1143 index--; 1161 index--;
1144 } 1162 }
1145 return index; 1163 return index;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 } 1359 }
1342 get(index) { 1360 get(index) {
1343 if (!(typeof index == number)) 1361 if (!(typeof index == number))
1344 throw new core.ArgumentError(index); 1362 throw new core.ArgumentError(index);
1345 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) 1363 if (dart.notNull(index >= this.length) || dart.notNull(index < 0))
1346 throw new core.RangeError.value(index); 1364 throw new core.RangeError.value(index);
1347 return this[index]; 1365 return this[index];
1348 } 1366 }
1349 } 1367 }
1350 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { 1368 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) {
1351 _CodeUnits(_string) { 1369 _CodeUnits($_string) {
1352 this._string = _string; 1370 this[_string] = $_string;
1353 super.UnmodifiableListBase(); 1371 super.UnmodifiableListBase();
1354 } 1372 }
1355 get length() { 1373 get length() {
1356 return this._string.length; 1374 return this[_string].length;
1357 } 1375 }
1358 get(i) { 1376 get(i) {
1359 return this._string.codeUnitAt(i); 1377 return this[_string].codeUnitAt(i);
1360 } 1378 }
1361 } 1379 }
1362 // Exports: 1380 // Exports:
1363 exports.getInterceptor = getInterceptor; 1381 exports.getInterceptor = getInterceptor;
1364 exports.getDispatchProperty = getDispatchProperty; 1382 exports.getDispatchProperty = getDispatchProperty;
1365 exports.setDispatchProperty = setDispatchProperty; 1383 exports.setDispatchProperty = setDispatchProperty;
1366 exports.makeDispatchRecord = makeDispatchRecord; 1384 exports.makeDispatchRecord = makeDispatchRecord;
1367 exports.dispatchRecordInterceptor = dispatchRecordInterceptor; 1385 exports.dispatchRecordInterceptor = dispatchRecordInterceptor;
1368 exports.dispatchRecordProto = dispatchRecordProto; 1386 exports.dispatchRecordProto = dispatchRecordProto;
1369 exports.dispatchRecordExtension = dispatchRecordExtension; 1387 exports.dispatchRecordExtension = dispatchRecordExtension;
(...skipping 22 matching lines...) Expand all
1392 exports.JSExtendableArray = JSExtendableArray; 1410 exports.JSExtendableArray = JSExtendableArray;
1393 exports.JSExtendableArray$ = JSExtendableArray$; 1411 exports.JSExtendableArray$ = JSExtendableArray$;
1394 exports.JSNumber = JSNumber; 1412 exports.JSNumber = JSNumber;
1395 exports.JSInt = JSInt; 1413 exports.JSInt = JSInt;
1396 exports.JSDouble = JSDouble; 1414 exports.JSDouble = JSDouble;
1397 exports.JSPositiveInt = JSPositiveInt; 1415 exports.JSPositiveInt = JSPositiveInt;
1398 exports.JSUInt32 = JSUInt32; 1416 exports.JSUInt32 = JSUInt32;
1399 exports.JSUInt31 = JSUInt31; 1417 exports.JSUInt31 = JSUInt31;
1400 exports.JSString = JSString; 1418 exports.JSString = JSString;
1401 })(_interceptors || (_interceptors = {})); 1419 })(_interceptors || (_interceptors = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698