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

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

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
OLDNEW
1 var core; 1 var core;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class Object { 4 class Object {
5 constructor() { 5 constructor() {
6 let name = this.constructor.name; 6 let name = this.constructor.name;
7 let init = this[name]; 7 let init = this[name];
8 let result = void 0; 8 let result = void 0;
9 if (init) 9 if (init)
10 result = init.apply(this, arguments); 10 result = init.apply(this, arguments);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 addOneMillisecond = true; 170 addOneMillisecond = true;
171 millisecond = 999; 171 millisecond = 999;
172 } 172 }
173 let isUtc = false; 173 let isUtc = false;
174 if (match.get(8) != null) { 174 if (match.get(8) != null) {
175 isUtc = true; 175 isUtc = true;
176 if (match.get(9) != null) { 176 if (match.get(9) != null) {
177 let sign = match.get(9) == '-' ? -1 : 1; 177 let sign = match.get(9) == '-' ? -1 : 1;
178 let hourDifference = int.parse(match.get(10)); 178 let hourDifference = int.parse(match.get(10));
179 let minuteDifference = parseIntOrZero(match.get(11)); 179 let minuteDifference = parseIntOrZero(match.get(11));
180 minuteDifference = 60 * dart.notNull(hourDifference); 180 minuteDifference = dart.notNull(minuteDifference) + 60 * dart.notNul l(hourDifference);
181 minute = dart.notNull(sign) * dart.notNull(minuteDifference); 181 minute = dart.notNull(minute) - dart.notNull(sign) * dart.notNull(mi nuteDifference);
182 } 182 }
183 } 183 }
184 let millisecondsSinceEpoch = DateTime[_brokenDownDateToMillisecondsSince Epoch](years, month, day, hour, minute, second, millisecond, isUtc); 184 let millisecondsSinceEpoch = DateTime[_brokenDownDateToMillisecondsSince Epoch](years, month, day, hour, minute, second, millisecond, isUtc);
185 if (millisecondsSinceEpoch == null) { 185 if (millisecondsSinceEpoch == null) {
186 throw new FormatException("Time out of range", formattedString); 186 throw new FormatException("Time out of range", formattedString);
187 } 187 }
188 if (addOneMillisecond) 188 if (addOneMillisecond) {
189 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1; 189 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1;
190 }
190 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc}); 191 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc});
191 } else { 192 } else {
192 throw new FormatException("Invalid date format", formattedString); 193 throw new FormatException("Invalid date format", formattedString);
193 } 194 }
194 } 195 }
195 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { 196 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) {
196 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; 197 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false;
197 this.millisecondsSinceEpoch = millisecondsSinceEpoch; 198 this.millisecondsSinceEpoch = millisecondsSinceEpoch;
198 this.isUtc = isUtc; 199 this.isUtc = isUtc;
199 if (dart.notNull(millisecondsSinceEpoch.abs()) > dart.notNull(DateTime[_MA X_MILLISECONDS_SINCE_EPOCH])) { 200 if (dart.notNull(millisecondsSinceEpoch.abs()) > dart.notNull(DateTime[_MA X_MILLISECONDS_SINCE_EPOCH])) {
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 this.offset = offset; 935 this.offset = offset;
935 } 936 }
936 toString() { 937 toString() {
937 let report = "FormatException"; 938 let report = "FormatException";
938 if (dart.notNull(this.message != null) && dart.notNull("" != this.message) ) { 939 if (dart.notNull(this.message != null) && dart.notNull("" != this.message) ) {
939 report = `${report}: ${this.message}`; 940 report = `${report}: ${this.message}`;
940 } 941 }
941 let offset = this.offset; 942 let offset = this.offset;
942 if (!(typeof this.source == 'string')) { 943 if (!(typeof this.source == 'string')) {
943 if (offset != -1) { 944 if (offset != -1) {
944 report = ` (at offset ${offset})`; 945 report = String['+'](report, ` (at offset ${offset})`);
945 } 946 }
946 return report; 947 return report;
947 } 948 }
948 if (offset != -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(th is.source, 'length')))) { 949 if (offset != -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(th is.source, 'length')))) {
949 offset = -1; 950 offset = -1;
950 } 951 }
951 if (offset == -1) { 952 if (offset == -1) {
952 let source = dart.as(this.source, String); 953 let source = dart.as(this.source, String);
953 if (dart.notNull(source.length) > 78) { 954 if (dart.notNull(source.length) > 78) {
954 source = String['+'](source.substring(0, 75), "..."); 955 source = String['+'](source.substring(0, 75), "...");
(...skipping 11 matching lines...) Expand all
966 } 967 }
967 lineStart = dart.notNull(i) + 1; 968 lineStart = dart.notNull(i) + 1;
968 lastWasCR = false; 969 lastWasCR = false;
969 } else if (char == 13) { 970 } else if (char == 13) {
970 lineNum = dart.notNull(lineNum) + 1; 971 lineNum = dart.notNull(lineNum) + 1;
971 lineStart = dart.notNull(i) + 1; 972 lineStart = dart.notNull(i) + 1;
972 lastWasCR = true; 973 lastWasCR = true;
973 } 974 }
974 } 975 }
975 if (dart.notNull(lineNum) > 1) { 976 if (dart.notNull(lineNum) > 1) {
976 report = ` (at line ${lineNum}, character ${dart.notNull(offset) - dart. notNull(lineStart) + 1})\n`; 977 report = String['+'](report, ` (at line ${lineNum}, character ${dart.not Null(offset) - dart.notNull(lineStart) + 1})\n`);
977 } else { 978 } else {
978 report = ` (at character ${dart.notNull(offset) + 1})\n`; 979 report = String['+'](report, ` (at character ${dart.notNull(offset) + 1} )\n`);
979 } 980 }
980 let lineEnd = dart.as(dart.dload(this.source, 'length'), int); 981 let lineEnd = dart.as(dart.dload(this.source, 'length'), int);
981 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i = dart.n otNull(i) + 1) { 982 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i = dart.n otNull(i) + 1) {
982 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 983 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
983 if (char == 10 || char == 13) { 984 if (char == 10 || char == 13) {
984 lineEnd = i; 985 lineEnd = i;
985 break; 986 break;
986 } 987 }
987 } 988 }
988 let length = dart.notNull(lineEnd) - dart.notNull(lineStart); 989 let length = dart.notNull(lineEnd) - dart.notNull(lineStart);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 let values = _js_helper.Primitives.getProperty(object, Expando[_EXPANDO_ PROPERTY_NAME]); 1041 let values = _js_helper.Primitives.getProperty(object, Expando[_EXPANDO_ PROPERTY_NAME]);
1041 if (values == null) { 1042 if (values == null) {
1042 values = new Object(); 1043 values = new Object();
1043 _js_helper.Primitives.setProperty(object, Expando[_EXPANDO_PROPERTY_NA ME], values); 1044 _js_helper.Primitives.setProperty(object, Expando[_EXPANDO_PROPERTY_NA ME], values);
1044 } 1045 }
1045 _js_helper.Primitives.setProperty(values, this[_getKey](), value); 1046 _js_helper.Primitives.setProperty(values, this[_getKey](), value);
1046 } 1047 }
1047 [_getKey]() { 1048 [_getKey]() {
1048 let key = dart.as(_js_helper.Primitives.getProperty(this, Expando[_KEY_P ROPERTY_NAME]), String); 1049 let key = dart.as(_js_helper.Primitives.getProperty(this, Expando[_KEY_P ROPERTY_NAME]), String);
1049 if (key == null) { 1050 if (key == null) {
1050 key = `expando$key$${((x) => Expando[_keyCount] = dart.notNull(x) + 1, x)(Expando[_keyCount])}`; 1051 key = `expando$key$${((x) => (x = Expando[_keyCount], Expando[_keyCoun t] = dart.notNull(x) + 1, x))()}`;
1051 _js_helper.Primitives.setProperty(this, Expando[_KEY_PROPERTY_NAME], k ey); 1052 _js_helper.Primitives.setProperty(this, Expando[_KEY_PROPERTY_NAME], k ey);
1052 } 1053 }
1053 return key; 1054 return key;
1054 } 1055 }
1055 } 1056 }
1056 Expando._KEY_PROPERTY_NAME = 'expando$key'; 1057 Expando._KEY_PROPERTY_NAME = 'expando$key';
1057 Expando._EXPANDO_PROPERTY_NAME = 'expando$values'; 1058 Expando._EXPANDO_PROPERTY_NAME = 'expando$values';
1058 Expando._keyCount = 0; 1059 Expando._keyCount = 0;
1059 return Expando; 1060 return Expando;
1060 }); 1061 });
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 return dart.as(result, List$(E)); 1237 return dart.as(result, List$(E));
1237 } 1238 }
1238 from(elements, opts) { 1239 from(elements, opts) {
1239 let growable = opts && 'growable' in opts ? opts.growable : true; 1240 let growable = opts && 'growable' in opts ? opts.growable : true;
1240 return null; 1241 return null;
1241 } 1242 }
1242 generate(length, generator, opts) { 1243 generate(length, generator, opts) {
1243 let growable = opts && 'growable' in opts ? opts.growable : true; 1244 let growable = opts && 'growable' in opts ? opts.growable : true;
1244 let result = null; 1245 let result = null;
1245 if (growable) { 1246 if (growable) {
1246 result = ((_$) => { 1247 result = new List$(E).from([]);
1247 _$[exports.$length] = length; 1248 result[exports.$length] = length;
1248 return _$;
1249 })(new List$(E).from([]));
1250 } else { 1249 } else {
1251 result = new (List$(E))(length); 1250 result = new (List$(E))(length);
1252 } 1251 }
1253 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 1252 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
1254 result[exports.$set](i, generator(i)); 1253 result[exports.$set](i, generator(i));
1255 } 1254 }
1256 return result; 1255 return result;
1257 } 1256 }
1258 } 1257 }
1259 List[dart.implements] = () => [Iterable$(E), _internal.EfficientLength]; 1258 List[dart.implements] = () => [Iterable$(E), _internal.EfficientLength];
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 static [_normalizeRegName](host, start, end) { 2243 static [_normalizeRegName](host, start, end) {
2245 let buffer = null; 2244 let buffer = null;
2246 let sectionStart = start; 2245 let sectionStart = start;
2247 let index = start; 2246 let index = start;
2248 let isNormalized = true; 2247 let isNormalized = true;
2249 while (dart.notNull(index) < dart.notNull(end)) { 2248 while (dart.notNull(index) < dart.notNull(end)) {
2250 let char = host.codeUnitAt(index); 2249 let char = host.codeUnitAt(index);
2251 if (char == Uri[_PERCENT]) { 2250 if (char == Uri[_PERCENT]) {
2252 let replacement = Uri[_normalizeEscape](host, index, true); 2251 let replacement = Uri[_normalizeEscape](host, index, true);
2253 if (dart.notNull(replacement == null) && dart.notNull(isNormalized)) { 2252 if (dart.notNull(replacement == null) && dart.notNull(isNormalized)) {
2254 index = 3; 2253 index = dart.notNull(index) + 3;
2255 continue; 2254 continue;
2256 } 2255 }
2257 if (buffer == null) 2256 if (buffer == null)
2258 buffer = new StringBuffer(); 2257 buffer = new StringBuffer();
2259 let slice = host.substring(sectionStart, index); 2258 let slice = host.substring(sectionStart, index);
2260 if (!dart.notNull(isNormalized)) 2259 if (!dart.notNull(isNormalized))
2261 slice = slice.toLowerCase(); 2260 slice = slice.toLowerCase();
2262 buffer.write(slice); 2261 buffer.write(slice);
2263 let sourceLength = 3; 2262 let sourceLength = 3;
2264 if (replacement == null) { 2263 if (replacement == null) {
2265 replacement = host.substring(index, dart.notNull(index) + 3); 2264 replacement = host.substring(index, dart.notNull(index) + 3);
2266 } else if (replacement == "%") { 2265 } else if (replacement == "%") {
2267 replacement = "%25"; 2266 replacement = "%25";
2268 sourceLength = 1; 2267 sourceLength = 1;
2269 } 2268 }
2270 buffer.write(replacement); 2269 buffer.write(replacement);
2271 index = sourceLength; 2270 index = dart.notNull(index) + dart.notNull(sourceLength);
2272 sectionStart = index; 2271 sectionStart = index;
2273 isNormalized = true; 2272 isNormalized = true;
2274 } else if (Uri[_isRegNameChar](char)) { 2273 } else if (Uri[_isRegNameChar](char)) {
2275 if (dart.notNull(isNormalized) && dart.notNull(Uri[_UPPER_CASE_A]) <= dart.notNull(char) && dart.notNull(Uri[_UPPER_CASE_Z]) >= dart.notNull(char)) { 2274 if (dart.notNull(isNormalized) && dart.notNull(Uri[_UPPER_CASE_A]) <= dart.notNull(char) && dart.notNull(Uri[_UPPER_CASE_Z]) >= dart.notNull(char)) {
2276 if (buffer == null) 2275 if (buffer == null)
2277 buffer = new StringBuffer(); 2276 buffer = new StringBuffer();
2278 if (dart.notNull(sectionStart) < dart.notNull(index)) { 2277 if (dart.notNull(sectionStart) < dart.notNull(index)) {
2279 buffer.write(host.substring(sectionStart, index)); 2278 buffer.write(host.substring(sectionStart, index));
2280 sectionStart = index; 2279 sectionStart = index;
2281 } 2280 }
(...skipping 11 matching lines...) Expand all
2293 sourceLength = 2; 2292 sourceLength = 2;
2294 } 2293 }
2295 } 2294 }
2296 if (buffer == null) 2295 if (buffer == null)
2297 buffer = new StringBuffer(); 2296 buffer = new StringBuffer();
2298 let slice = host.substring(sectionStart, index); 2297 let slice = host.substring(sectionStart, index);
2299 if (!dart.notNull(isNormalized)) 2298 if (!dart.notNull(isNormalized))
2300 slice = slice.toLowerCase(); 2299 slice = slice.toLowerCase();
2301 buffer.write(slice); 2300 buffer.write(slice);
2302 buffer.write(Uri[_escapeChar](char)); 2301 buffer.write(Uri[_escapeChar](char));
2303 index = sourceLength; 2302 index = dart.notNull(index) + dart.notNull(sourceLength);
2304 sectionStart = index; 2303 sectionStart = index;
2305 } 2304 }
2306 } 2305 }
2307 if (buffer == null) 2306 if (buffer == null)
2308 return host.substring(start, end); 2307 return host.substring(start, end);
2309 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2308 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2310 let slice = host.substring(sectionStart, end); 2309 let slice = host.substring(sectionStart, end);
2311 if (!dart.notNull(isNormalized)) 2310 if (!dart.notNull(isNormalized))
2312 slice = slice.toLowerCase(); 2311 slice = slice.toLowerCase();
2313 buffer.write(slice); 2312 buffer.write(slice);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 if (fragment == null) 2387 if (fragment == null)
2389 return null; 2388 return null;
2390 return Uri[_normalize](fragment, start, end, dart.as(Uri[_queryCharTable], List$(int))); 2389 return Uri[_normalize](fragment, start, end, dart.as(Uri[_queryCharTable], List$(int)));
2391 } 2390 }
2392 static [_stringOrNullLength](s) { 2391 static [_stringOrNullLength](s) {
2393 return s == null ? 0 : s.length; 2392 return s == null ? 0 : s.length;
2394 } 2393 }
2395 static [_isHexDigit](char) { 2394 static [_isHexDigit](char) {
2396 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char)) 2395 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char))
2397 return dart.notNull(Uri[_ZERO]) <= dart.notNull(char); 2396 return dart.notNull(Uri[_ZERO]) <= dart.notNull(char);
2398 char = 32; 2397 char = dart.notNull(char) | 32;
2399 return dart.notNull(Uri[_LOWER_CASE_A]) <= dart.notNull(char) && dart.notN ull(Uri[_LOWER_CASE_F]) >= dart.notNull(char); 2398 return dart.notNull(Uri[_LOWER_CASE_A]) <= dart.notNull(char) && dart.notN ull(Uri[_LOWER_CASE_F]) >= dart.notNull(char);
2400 } 2399 }
2401 static [_hexValue](char) { 2400 static [_hexValue](char) {
2402 dart.assert(Uri[_isHexDigit](char)); 2401 dart.assert(Uri[_isHexDigit](char));
2403 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char)) 2402 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char))
2404 return dart.notNull(char) - dart.notNull(Uri[_ZERO]); 2403 return dart.notNull(char) - dart.notNull(Uri[_ZERO]);
2405 char = 32; 2404 char = dart.notNull(char) | 32;
2406 return dart.notNull(char) - (dart.notNull(Uri[_LOWER_CASE_A]) - 10); 2405 return dart.notNull(char) - (dart.notNull(Uri[_LOWER_CASE_A]) - 10);
2407 } 2406 }
2408 static [_normalizeEscape](source, index, lowerCase) { 2407 static [_normalizeEscape](source, index, lowerCase) {
2409 dart.assert(source.codeUnitAt(index) == Uri[_PERCENT]); 2408 dart.assert(source.codeUnitAt(index) == Uri[_PERCENT]);
2410 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) { 2409 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) {
2411 return "%"; 2410 return "%";
2412 } 2411 }
2413 let firstDigit = source.codeUnitAt(dart.notNull(index) + 1); 2412 let firstDigit = source.codeUnitAt(dart.notNull(index) + 1);
2414 let secondDigit = source.codeUnitAt(dart.notNull(index) + 2); 2413 let secondDigit = source.codeUnitAt(dart.notNull(index) + 2);
2415 if (!dart.notNull(Uri[_isHexDigit](firstDigit)) || !dart.notNull(Uri[_isHe xDigit](secondDigit))) { 2414 if (!dart.notNull(Uri[_isHexDigit](firstDigit)) || !dart.notNull(Uri[_isHe xDigit](secondDigit))) {
2416 return "%"; 2415 return "%";
2417 } 2416 }
2418 let value = dart.notNull(Uri[_hexValue](firstDigit)) * 16 + dart.notNull(U ri[_hexValue](secondDigit)); 2417 let value = dart.notNull(Uri[_hexValue](firstDigit)) * 16 + dart.notNull(U ri[_hexValue](secondDigit));
2419 if (Uri[_isUnreservedChar](value)) { 2418 if (Uri[_isUnreservedChar](value)) {
2420 if (dart.notNull(lowerCase) && dart.notNull(Uri[_UPPER_CASE_A]) <= dart. notNull(value) && dart.notNull(Uri[_UPPER_CASE_Z]) >= dart.notNull(value)) { 2419 if (dart.notNull(lowerCase) && dart.notNull(Uri[_UPPER_CASE_A]) <= dart. notNull(value) && dart.notNull(Uri[_UPPER_CASE_Z]) >= dart.notNull(value)) {
2421 value = 32; 2420 value = dart.notNull(value) | 32;
2422 } 2421 }
2423 return new String.fromCharCode(value); 2422 return new String.fromCharCode(value);
2424 } 2423 }
2425 if (dart.notNull(firstDigit) >= dart.notNull(Uri[_LOWER_CASE_A]) || dart.n otNull(secondDigit) >= dart.notNull(Uri[_LOWER_CASE_A])) { 2424 if (dart.notNull(firstDigit) >= dart.notNull(Uri[_LOWER_CASE_A]) || dart.n otNull(secondDigit) >= dart.notNull(Uri[_LOWER_CASE_A])) {
2426 return source.substring(index, dart.notNull(index) + 3).toUpperCase(); 2425 return source.substring(index, dart.notNull(index) + 3).toUpperCase();
2427 } 2426 }
2428 return null; 2427 return null;
2429 } 2428 }
2430 static [_isUnreservedChar](ch) { 2429 static [_isUnreservedChar](ch) {
2431 return dart.notNull(ch) < 127 && dart.notNull(!dart.equals(dart.dbinary(Ur i[_unreservedTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNul l(ch) & 15)), 0)); 2430 return dart.notNull(ch) < 127 && dart.notNull(!dart.equals(dart.dbinary(Ur i[_unreservedTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNul l(ch) & 15)), 0));
(...skipping 18 matching lines...) Expand all
2450 flag = 240; 2449 flag = 240;
2451 } 2450 }
2452 } 2451 }
2453 codeUnits = new List(3 * dart.notNull(encodedBytes)); 2452 codeUnits = new List(3 * dart.notNull(encodedBytes));
2454 let index = 0; 2453 let index = 0;
2455 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) { 2454 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) {
2456 let byte = dart.as(dart.dbinary(dart.dbinary(dart.dbinary(char, '>>', 6 * dart.notNull(encodedBytes)), '&', 63), '|', flag), int); 2455 let byte = dart.as(dart.dbinary(dart.dbinary(dart.dbinary(char, '>>', 6 * dart.notNull(encodedBytes)), '&', 63), '|', flag), int);
2457 codeUnits[exports.$set](index, Uri[_PERCENT]); 2456 codeUnits[exports.$set](index, Uri[_PERCENT]);
2458 codeUnits[exports.$set](dart.notNull(index) + 1, hexDigits.codeUnitAt( dart.notNull(byte) >> 4)); 2457 codeUnits[exports.$set](dart.notNull(index) + 1, hexDigits.codeUnitAt( dart.notNull(byte) >> 4));
2459 codeUnits[exports.$set](dart.notNull(index) + 2, hexDigits.codeUnitAt( dart.notNull(byte) & 15)); 2458 codeUnits[exports.$set](dart.notNull(index) + 2, hexDigits.codeUnitAt( dart.notNull(byte) & 15));
2460 index = 3; 2459 index = dart.notNull(index) + 3;
2461 flag = 128; 2460 flag = 128;
2462 } 2461 }
2463 } 2462 }
2464 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int))); 2463 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int)));
2465 } 2464 }
2466 static [_normalize](component, start, end, charTable) { 2465 static [_normalize](component, start, end, charTable) {
2467 let buffer = null; 2466 let buffer = null;
2468 let sectionStart = start; 2467 let sectionStart = start;
2469 let index = start; 2468 let index = start;
2470 while (dart.notNull(index) < dart.notNull(end)) { 2469 while (dart.notNull(index) < dart.notNull(end)) {
2471 let char = component.codeUnitAt(index); 2470 let char = component.codeUnitAt(index);
2472 if (dart.notNull(char) < 127 && (dart.notNull(charTable[exports.$get](da rt.notNull(char) >> 4)) & 1 << (dart.notNull(char) & 15)) != 0) { 2471 if (dart.notNull(char) < 127 && (dart.notNull(charTable[exports.$get](da rt.notNull(char) >> 4)) & 1 << (dart.notNull(char) & 15)) != 0) {
2473 index = dart.notNull(index) + 1; 2472 index = dart.notNull(index) + 1;
2474 } else { 2473 } else {
2475 let replacement = null; 2474 let replacement = null;
2476 let sourceLength = null; 2475 let sourceLength = null;
2477 if (char == Uri[_PERCENT]) { 2476 if (char == Uri[_PERCENT]) {
2478 replacement = Uri[_normalizeEscape](component, index, false); 2477 replacement = Uri[_normalizeEscape](component, index, false);
2479 if (replacement == null) { 2478 if (replacement == null) {
2480 index = 3; 2479 index = dart.notNull(index) + 3;
2481 continue; 2480 continue;
2482 } 2481 }
2483 if ("%" == replacement) { 2482 if ("%" == replacement) {
2484 replacement = "%25"; 2483 replacement = "%25";
2485 sourceLength = 1; 2484 sourceLength = 1;
2486 } else { 2485 } else {
2487 sourceLength = 3; 2486 sourceLength = 3;
2488 } 2487 }
2489 } else if (Uri[_isGeneralDelimiter](char)) { 2488 } else if (Uri[_isGeneralDelimiter](char)) {
2490 Uri[_fail](component, index, "Invalid character"); 2489 Uri[_fail](component, index, "Invalid character");
2491 } else { 2490 } else {
2492 sourceLength = 1; 2491 sourceLength = 1;
2493 if ((dart.notNull(char) & 64512) == 55296) { 2492 if ((dart.notNull(char) & 64512) == 55296) {
2494 if (dart.notNull(index) + 1 < dart.notNull(end)) { 2493 if (dart.notNull(index) + 1 < dart.notNull(end)) {
2495 let tail = component.codeUnitAt(dart.notNull(index) + 1); 2494 let tail = component.codeUnitAt(dart.notNull(index) + 1);
2496 if ((dart.notNull(tail) & 64512) == 56320) { 2495 if ((dart.notNull(tail) & 64512) == 56320) {
2497 sourceLength = 2; 2496 sourceLength = 2;
2498 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023; 2497 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023;
2499 } 2498 }
2500 } 2499 }
2501 } 2500 }
2502 replacement = Uri[_escapeChar](char); 2501 replacement = Uri[_escapeChar](char);
2503 } 2502 }
2504 if (buffer == null) 2503 if (buffer == null)
2505 buffer = new StringBuffer(); 2504 buffer = new StringBuffer();
2506 buffer.write(component.substring(sectionStart, index)); 2505 buffer.write(component.substring(sectionStart, index));
2507 buffer.write(replacement); 2506 buffer.write(replacement);
2508 index = sourceLength; 2507 index = dart.notNull(index) + dart.notNull(sourceLength);
2509 sectionStart = index; 2508 sectionStart = index;
2510 } 2509 }
2511 } 2510 }
2512 if (buffer == null) { 2511 if (buffer == null) {
2513 return component.substring(start, end); 2512 return component.substring(start, end);
2514 } 2513 }
2515 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2514 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2516 buffer.write(component.substring(sectionStart, end)); 2515 buffer.write(component.substring(sectionStart, end));
2517 } 2516 }
2518 return buffer.toString(); 2517 return buffer.toString();
2519 } 2518 }
2520 static [_isSchemeCharacter](ch) { 2519 static [_isSchemeCharacter](ch) {
2521 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary(Ur i[_schemeTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch ) & 15)), 0)); 2520 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary(Ur i[_schemeTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch ) & 15)), 0));
2522 } 2521 }
2523 static [_isGeneralDelimiter](ch) { 2522 static [_isGeneralDelimiter](ch) {
2524 return dart.notNull(ch) <= dart.notNull(Uri[_RIGHT_BRACKET]) && dart.notNu ll(!dart.equals(dart.dbinary(Uri[_genDelimitersTable][exports.$get](dart.notNull (ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0)); 2523 return dart.notNull(ch) <= dart.notNull(Uri[_RIGHT_BRACKET]) && dart.notNu ll(!dart.equals(dart.dbinary(Uri[_genDelimitersTable][exports.$get](dart.notNull (ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
2525 } 2524 }
2526 get isAbsolute() { 2525 get isAbsolute() {
2527 return dart.notNull(this.scheme != "") && dart.notNull(this.fragment == "" ); 2526 return dart.notNull(this.scheme != "") && dart.notNull(this.fragment == "" );
2528 } 2527 }
2529 [_merge](base, reference) { 2528 [_merge](base, reference) {
2530 if (base.isEmpty) 2529 if (base.isEmpty)
2531 return `/${reference}`; 2530 return `/${reference}`;
2532 let backCount = 0; 2531 let backCount = 0;
2533 let refStart = 0; 2532 let refStart = 0;
2534 while (reference.startsWith("../", refStart)) { 2533 while (reference.startsWith("../", refStart)) {
2535 refStart = 3; 2534 refStart = dart.notNull(refStart) + 3;
2536 backCount = dart.notNull(backCount) + 1; 2535 backCount = dart.notNull(backCount) + 1;
2537 } 2536 }
2538 let baseEnd = base.lastIndexOf('/'); 2537 let baseEnd = base.lastIndexOf('/');
2539 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { 2538 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) {
2540 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1); 2539 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1);
2541 if (dart.notNull(newEnd) < 0) { 2540 if (dart.notNull(newEnd) < 0) {
2542 break; 2541 break;
2543 } 2542 }
2544 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); 2543 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
2545 if ((delta == 2 || delta == 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) == Uri[_DOT] && (delta == 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) == Uri[_DOT])) { 2544 if ((delta == 2 || delta == 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) == Uri[_DOT] && (delta == 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) == Uri[_DOT])) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 error('an address without a wildcard must contain exactly 8 parts'); 2890 error('an address without a wildcard must contain exactly 8 parts');
2892 } 2891 }
2893 let bytes = new (List$(int))(16); 2892 let bytes = new (List$(int))(16);
2894 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts[exports.$l ength]); i = dart.notNull(i) + 1) { 2893 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts[exports.$l ength]); i = dart.notNull(i) + 1) {
2895 let value = parts[exports.$get](i); 2894 let value = parts[exports.$get](i);
2896 if (value == -1) { 2895 if (value == -1) {
2897 let wildCardLength = 9 - dart.notNull(parts[exports.$length]); 2896 let wildCardLength = 9 - dart.notNull(parts[exports.$length]);
2898 for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); j = da rt.notNull(j) + 1) { 2897 for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); j = da rt.notNull(j) + 1) {
2899 bytes[exports.$set](index, 0); 2898 bytes[exports.$set](index, 0);
2900 bytes[exports.$set](dart.notNull(index) + 1, 0); 2899 bytes[exports.$set](dart.notNull(index) + 1, 0);
2901 index = 2; 2900 index = dart.notNull(index) + 2;
2902 } 2901 }
2903 } else { 2902 } else {
2904 bytes[exports.$set](index, dart.notNull(value) >> 8); 2903 bytes[exports.$set](index, dart.notNull(value) >> 8);
2905 bytes[exports.$set](dart.notNull(index) + 1, dart.notNull(value) & 255 ); 2904 bytes[exports.$set](dart.notNull(index) + 1, dart.notNull(value) & 255 );
2906 index = 2; 2905 index = dart.notNull(index) + 2;
2907 } 2906 }
2908 } 2907 }
2909 return dart.as(bytes, List$(int)); 2908 return dart.as(bytes, List$(int));
2910 } 2909 }
2911 static [_uriEncode](canonicalTable, text, opts) { 2910 static [_uriEncode](canonicalTable, text, opts) {
2912 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2911 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2913 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false ; 2912 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false ;
2914 // Function byteToHex: (dynamic, dynamic) → dynamic 2913 // Function byteToHex: (dynamic, dynamic) → dynamic
2915 function byteToHex(byte, buffer) { 2914 function byteToHex(byte, buffer) {
2916 let hex = '0123456789ABCDEF'; 2915 let hex = '0123456789ABCDEF';
(...skipping 15 matching lines...) Expand all
2932 } 2931 }
2933 return result.toString(); 2932 return result.toString();
2934 } 2933 }
2935 static [_hexCharPairToByte](s, pos) { 2934 static [_hexCharPairToByte](s, pos) {
2936 let byte = 0; 2935 let byte = 0;
2937 for (let i = 0; dart.notNull(i) < 2; i = dart.notNull(i) + 1) { 2936 for (let i = 0; dart.notNull(i) < 2; i = dart.notNull(i) + 1) {
2938 let charCode = s.codeUnitAt(dart.notNull(pos) + dart.notNull(i)); 2937 let charCode = s.codeUnitAt(dart.notNull(pos) + dart.notNull(i));
2939 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) { 2938 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) {
2940 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 48; 2939 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 48;
2941 } else { 2940 } else {
2942 charCode = 32; 2941 charCode = dart.notNull(charCode) | 32;
2943 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) { 2942 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) {
2944 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 87; 2943 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 87;
2945 } else { 2944 } else {
2946 throw new ArgumentError("Invalid URL encoding"); 2945 throw new ArgumentError("Invalid URL encoding");
2947 } 2946 }
2948 } 2947 }
2949 } 2948 }
2950 return byte; 2949 return byte;
2951 } 2950 }
2952 static [_uriDecode](text, opts) { 2951 static [_uriDecode](text, opts) {
(...skipping 16 matching lines...) Expand all
2969 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.no tNull(i) + 1) { 2968 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.no tNull(i) + 1) {
2970 let codeUnit = text.codeUnitAt(i); 2969 let codeUnit = text.codeUnitAt(i);
2971 if (dart.notNull(codeUnit) > 127) { 2970 if (dart.notNull(codeUnit) > 127) {
2972 throw new ArgumentError("Illegal percent encoding in URI"); 2971 throw new ArgumentError("Illegal percent encoding in URI");
2973 } 2972 }
2974 if (codeUnit == Uri[_PERCENT]) { 2973 if (codeUnit == Uri[_PERCENT]) {
2975 if (dart.notNull(i) + 3 > dart.notNull(text.length)) { 2974 if (dart.notNull(i) + 3 > dart.notNull(text.length)) {
2976 throw new ArgumentError('Truncated URI'); 2975 throw new ArgumentError('Truncated URI');
2977 } 2976 }
2978 bytes[exports.$add](Uri[_hexCharPairToByte](text, dart.notNull(i) + 1)); 2977 bytes[exports.$add](Uri[_hexCharPairToByte](text, dart.notNull(i) + 1));
2979 i = 2; 2978 i = dart.notNull(i) + 2;
2980 } else if (dart.notNull(plusToSpace) && codeUnit == Uri[_PLUS]) { 2979 } else if (dart.notNull(plusToSpace) && codeUnit == Uri[_PLUS]) {
2981 bytes[exports.$add](Uri[_SPACE]); 2980 bytes[exports.$add](Uri[_SPACE]);
2982 } else { 2981 } else {
2983 bytes[exports.$add](codeUnit); 2982 bytes[exports.$add](codeUnit);
2984 } 2983 }
2985 } 2984 }
2986 } 2985 }
2987 return encoding.decode(bytes); 2986 return encoding.decode(bytes);
2988 } 2987 }
2989 static [_isAlphabeticCharacter](codeUnit) { 2988 static [_isAlphabeticCharacter](codeUnit) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 exports.Stopwatch = Stopwatch; 3121 exports.Stopwatch = Stopwatch;
3123 exports.String = String; 3122 exports.String = String;
3124 exports.$last = $last; 3123 exports.$last = $last;
3125 exports.RuneIterator = RuneIterator; 3124 exports.RuneIterator = RuneIterator;
3126 exports.StringBuffer = StringBuffer; 3125 exports.StringBuffer = StringBuffer;
3127 exports.StringSink = StringSink; 3126 exports.StringSink = StringSink;
3128 exports.Symbol = Symbol; 3127 exports.Symbol = Symbol;
3129 exports.Type = Type; 3128 exports.Type = Type;
3130 exports.Uri = Uri; 3129 exports.Uri = Uri;
3131 })(core || (core = {})); 3130 })(core || (core = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698