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

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

Issue 1074923003: rename dart_runtime.js helpers (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
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart_runtime.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 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 get start() { 742 get start() {
743 return 0; 743 return 0;
744 } 744 }
745 get end() { 745 get end() {
746 return dart.notNull(this.length) - 1; 746 return dart.notNull(this.length) - 1;
747 } 747 }
748 toString() { 748 toString() {
749 dart.assert(this[_hasValue]); 749 dart.assert(this[_hasValue]);
750 let target = Error.safeToString(this.indexable); 750 let target = Error.safeToString(this.indexable);
751 let explanation = `index should be less than ${this.length}`; 751 let explanation = `index should be less than ${this.length}`;
752 if (dart.dbinary(this.invalidValue, '<', 0)) { 752 if (dart.dsend(this.invalidValue, '<', 0)) {
753 explanation = "index must not be negative"; 753 explanation = "index must not be negative";
754 } 754 }
755 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e xplanation}`; 755 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e xplanation}`;
756 } 756 }
757 } 757 }
758 IndexError[dart.implements] = () => [RangeError]; 758 IndexError[dart.implements] = () => [RangeError];
759 class FallThroughError extends Error { 759 class FallThroughError extends Error {
760 FallThroughError() { 760 FallThroughError() {
761 super.Error(); 761 super.Error();
762 } 762 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 let source = dart.as(this.source, String); 953 let source = dart.as(this.source, String);
954 if (dart.notNull(source.length) > 78) { 954 if (dart.notNull(source.length) > 78) {
955 source = String['+'](source.substring(0, 75), "..."); 955 source = String['+'](source.substring(0, 75), "...");
956 } 956 }
957 return `${report}\n${source}`; 957 return `${report}\n${source}`;
958 } 958 }
959 let lineNum = 1; 959 let lineNum = 1;
960 let lineStart = 0; 960 let lineStart = 0;
961 let lastWasCR = null; 961 let lastWasCR = null;
962 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i ) + 1) { 962 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i ) + 1) {
963 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 963 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int);
964 if (char == 10) { 964 if (char == 10) {
965 if (lineStart != i || !dart.notNull(lastWasCR)) { 965 if (lineStart != i || !dart.notNull(lastWasCR)) {
966 lineNum = dart.notNull(lineNum) + 1; 966 lineNum = dart.notNull(lineNum) + 1;
967 } 967 }
968 lineStart = dart.notNull(i) + 1; 968 lineStart = dart.notNull(i) + 1;
969 lastWasCR = false; 969 lastWasCR = false;
970 } else if (char == 13) { 970 } else if (char == 13) {
971 lineNum = dart.notNull(lineNum) + 1; 971 lineNum = dart.notNull(lineNum) + 1;
972 lineStart = dart.notNull(i) + 1; 972 lineStart = dart.notNull(i) + 1;
973 lastWasCR = true; 973 lastWasCR = true;
974 } 974 }
975 } 975 }
976 if (dart.notNull(lineNum) > 1) { 976 if (dart.notNull(lineNum) > 1) {
977 report = String['+'](report, ` (at line ${lineNum}, character ${dart.not Null(offset) - dart.notNull(lineStart) + 1})\n`); 977 report = String['+'](report, ` (at line ${lineNum}, character ${dart.not Null(offset) - dart.notNull(lineStart) + 1})\n`);
978 } else { 978 } else {
979 report = String['+'](report, ` (at character ${dart.notNull(offset) + 1} )\n`); 979 report = String['+'](report, ` (at character ${dart.notNull(offset) + 1} )\n`);
980 } 980 }
981 let lineEnd = dart.as(dart.dload(this.source, 'length'), int); 981 let lineEnd = dart.as(dart.dload(this.source, 'length'), int);
982 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) {
983 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 983 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int);
984 if (char == 10 || char == 13) { 984 if (char == 10 || char == 13) {
985 lineEnd = i; 985 lineEnd = i;
986 break; 986 break;
987 } 987 }
988 } 988 }
989 let length = dart.notNull(lineEnd) - dart.notNull(lineStart); 989 let length = dart.notNull(lineEnd) - dart.notNull(lineStart);
990 let start = lineStart; 990 let start = lineStart;
991 let end = lineEnd; 991 let end = lineEnd;
992 let prefix = ""; 992 let prefix = "";
993 let postfix = ""; 993 let postfix = "";
994 if (dart.notNull(length) > 78) { 994 if (dart.notNull(length) > 78) {
995 let index = dart.notNull(offset) - dart.notNull(lineStart); 995 let index = dart.notNull(offset) - dart.notNull(lineStart);
996 if (dart.notNull(index) < 75) { 996 if (dart.notNull(index) < 75) {
997 end = dart.notNull(start) + 75; 997 end = dart.notNull(start) + 75;
998 postfix = "..."; 998 postfix = "...";
999 } else if (dart.notNull(end) - dart.notNull(offset) < 75) { 999 } else if (dart.notNull(end) - dart.notNull(offset) < 75) {
1000 start = dart.notNull(end) - 75; 1000 start = dart.notNull(end) - 75;
1001 prefix = "..."; 1001 prefix = "...";
1002 } else { 1002 } else {
1003 start = dart.notNull(offset) - 36; 1003 start = dart.notNull(offset) - 36;
1004 end = dart.notNull(offset) + 36; 1004 end = dart.notNull(offset) + 36;
1005 prefix = postfix = "..."; 1005 prefix = postfix = "...";
1006 } 1006 }
1007 } 1007 }
1008 let slice = dart.as(dart.dinvoke(this.source, 'substring', start, end), St ring); 1008 let slice = dart.as(dart.dsend(this.source, 'substring', start, end), Stri ng);
1009 let markOffset = dart.notNull(offset) - dart.notNull(start) + dart.notNull (prefix.length); 1009 let markOffset = dart.notNull(offset) - dart.notNull(start) + dart.notNull (prefix.length);
1010 return `${report}${prefix}${slice}${postfix}\n${String['*'](" ", markOffse t)}^\n`; 1010 return `${report}${prefix}${slice}${postfix}\n${String['*'](" ", markOffse t)}^\n`;
1011 } 1011 }
1012 } 1012 }
1013 FormatException[dart.implements] = () => [Exception]; 1013 FormatException[dart.implements] = () => [Exception];
1014 class IntegerDivisionByZeroException extends Object { 1014 class IntegerDivisionByZeroException extends Object {
1015 IntegerDivisionByZeroException() { 1015 IntegerDivisionByZeroException() {
1016 } 1016 }
1017 toString() { 1017 toString() {
1018 return "IntegerDivisionByZeroException"; 1018 return "IntegerDivisionByZeroException";
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 } 1301 }
1302 } 1302 }
1303 dart.defineNamedConstructor(Null, _uninstantiable); 1303 dart.defineNamedConstructor(Null, _uninstantiable);
1304 class Pattern extends Object {} 1304 class Pattern extends Object {}
1305 // Function print: (Object) → void 1305 // Function print: (Object) → void
1306 function print(object) { 1306 function print(object) {
1307 let line = `${object}`; 1307 let line = `${object}`;
1308 if (_internal.printToZone == null) { 1308 if (_internal.printToZone == null) {
1309 _internal.printToConsole(line); 1309 _internal.printToConsole(line);
1310 } else { 1310 } else {
1311 dart.dinvokef(_internal.printToZone, line); 1311 dart.dcall(_internal.printToZone, line);
1312 } 1312 }
1313 } 1313 }
1314 class Match extends Object {} 1314 class Match extends Object {}
1315 class RegExp extends Object { 1315 class RegExp extends Object {
1316 RegExp(source, opts) { 1316 RegExp(source, opts) {
1317 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false; 1317 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
1318 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true; 1318 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true;
1319 return new _js_helper.JSSyntaxRegExp(source, {multiLine: multiLine, caseSe nsitive: caseSensitive}); 1319 return new _js_helper.JSSyntaxRegExp(source, {multiLine: multiLine, caseSe nsitive: caseSensitive});
1320 } 1320 }
1321 } 1321 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequen cy)).truncate(); 1395 return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequen cy)).truncate();
1396 } 1396 }
1397 get isRunning() { 1397 get isRunning() {
1398 return this[_start] != null && this[_stop] == null; 1398 return this[_start] != null && this[_stop] == null;
1399 } 1399 }
1400 static [_initTicker]() { 1400 static [_initTicker]() {
1401 _js_helper.Primitives.initTicker(); 1401 _js_helper.Primitives.initTicker();
1402 Stopwatch[_frequency] = _js_helper.Primitives.timerFrequency; 1402 Stopwatch[_frequency] = _js_helper.Primitives.timerFrequency;
1403 } 1403 }
1404 static [_now]() { 1404 static [_now]() {
1405 return dart.as(dart.dinvoke(_js_helper.Primitives, 'timerTicks'), int); 1405 return dart.as(dart.dsend(_js_helper.Primitives, 'timerTicks'), int);
1406 } 1406 }
1407 } 1407 }
1408 Stopwatch._frequency = null; 1408 Stopwatch._frequency = null;
1409 let _stringFromIterable = dart.JsSymbol('_stringFromIterable'); 1409 let _stringFromIterable = dart.JsSymbol('_stringFromIterable');
1410 class String extends Object { 1410 class String extends Object {
1411 fromCharCodes(charCodes, start, end) { 1411 fromCharCodes(charCodes, start, end) {
1412 if (start === void 0) 1412 if (start === void 0)
1413 start = 0; 1413 start = 0;
1414 if (end === void 0) 1414 if (end === void 0)
1415 end = null; 1415 end = null;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 } 1783 }
1784 get query() { 1784 get query() {
1785 return this[_query] == null ? "" : this[_query]; 1785 return this[_query] == null ? "" : this[_query];
1786 } 1786 }
1787 get fragment() { 1787 get fragment() {
1788 return this[_fragment] == null ? "" : this[_fragment]; 1788 return this[_fragment] == null ? "" : this[_fragment];
1789 } 1789 }
1790 static parse(uri) { 1790 static parse(uri) {
1791 // Function isRegName: (int) → bool 1791 // Function isRegName: (int) → bool
1792 function isRegName(ch) { 1792 function isRegName(ch) {
1793 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary( Uri[_regNameTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull (ch) & 15)), 0)); 1793 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dsend(Ur i[_regNameTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(c h) & 15)), 0));
1794 } 1794 }
1795 let EOI = -1; 1795 let EOI = -1;
1796 let scheme = ""; 1796 let scheme = "";
1797 let userinfo = ""; 1797 let userinfo = "";
1798 let host = null; 1798 let host = null;
1799 let port = null; 1799 let port = null;
1800 let path = null; 1800 let path = null;
1801 let query = null; 1801 let query = null;
1802 let fragment = null; 1802 let fragment = null;
1803 let index = 0; 1803 let index = 0;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 let uri = _js_helper.Primitives.currentUri(); 2053 let uri = _js_helper.Primitives.currentUri();
2054 if (uri != null) 2054 if (uri != null)
2055 return Uri.parse(uri); 2055 return Uri.parse(uri);
2056 throw new UnsupportedError("'Uri.base' is not supported"); 2056 throw new UnsupportedError("'Uri.base' is not supported");
2057 } 2057 }
2058 static get [_isWindows]() { 2058 static get [_isWindows]() {
2059 return false; 2059 return false;
2060 } 2060 }
2061 static [_checkNonWindowsPathReservedCharacters](segments, argumentError) { 2061 static [_checkNonWindowsPathReservedCharacters](segments, argumentError) {
2062 segments[exports.$forEach](dart.as(segment => { 2062 segments[exports.$forEach](dart.as(segment => {
2063 if (dart.dinvoke(segment, 'contains', "/")) { 2063 if (dart.dsend(segment, 'contains', "/")) {
2064 if (argumentError) { 2064 if (argumentError) {
2065 throw new ArgumentError(`Illegal path character ${segment}`); 2065 throw new ArgumentError(`Illegal path character ${segment}`);
2066 } else { 2066 } else {
2067 throw new UnsupportedError(`Illegal path character ${segment}`); 2067 throw new UnsupportedError(`Illegal path character ${segment}`);
2068 } 2068 }
2069 } 2069 }
2070 }, dart.functionType(dart.void, [String]))); 2070 }, dart.functionType(dart.void, [String])));
2071 } 2071 }
2072 static [_checkWindowsPathReservedCharacters](segments, argumentError, firstS egment) { 2072 static [_checkWindowsPathReservedCharacters](segments, argumentError, firstS egment) {
2073 if (firstSegment === void 0) 2073 if (firstSegment === void 0)
2074 firstSegment = 0; 2074 firstSegment = 0;
2075 segments[exports.$skip](firstSegment)[exports.$forEach](dart.as(segment => { 2075 segments[exports.$skip](firstSegment)[exports.$forEach](dart.as(segment => {
2076 if (dart.dinvoke(segment, 'contains', new RegExp('["*/:<>?\\\\|]'))) { 2076 if (dart.dsend(segment, 'contains', new RegExp('["*/:<>?\\\\|]'))) {
2077 if (argumentError) { 2077 if (argumentError) {
2078 throw new ArgumentError("Illegal character in path"); 2078 throw new ArgumentError("Illegal character in path");
2079 } else { 2079 } else {
2080 throw new UnsupportedError("Illegal character in path"); 2080 throw new UnsupportedError("Illegal character in path");
2081 } 2081 }
2082 } 2082 }
2083 }, dart.functionType(dart.void, [String]))); 2083 }, dart.functionType(dart.void, [String])));
2084 } 2084 }
2085 static [_checkWindowsDriveLetter](charCode, argumentError) { 2085 static [_checkWindowsDriveLetter](charCode, argumentError) {
2086 if (dart.notNull(Uri[_UPPER_CASE_A]) <= dart.notNull(charCode) && dart.not Null(charCode) <= dart.notNull(Uri[_UPPER_CASE_Z]) || dart.notNull(Uri[_LOWER_CA SE_A]) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri[_ LOWER_CASE_Z])) { 2086 if (dart.notNull(Uri[_UPPER_CASE_A]) <= dart.notNull(charCode) && dart.not Null(charCode) <= dart.notNull(Uri[_UPPER_CASE_Z]) || dart.notNull(Uri[_LOWER_CA SE_A]) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri[_ LOWER_CASE_Z])) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 2235 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
2236 if (host.codeUnitAt(i) == Uri[_COLON]) { 2236 if (host.codeUnitAt(i) == Uri[_COLON]) {
2237 Uri.parseIPv6Address(host, start, end); 2237 Uri.parseIPv6Address(host, start, end);
2238 return `[${host}]`; 2238 return `[${host}]`;
2239 } 2239 }
2240 } 2240 }
2241 } 2241 }
2242 return Uri[_normalizeRegName](host, start, end); 2242 return Uri[_normalizeRegName](host, start, end);
2243 } 2243 }
2244 static [_isRegNameChar](char) { 2244 static [_isRegNameChar](char) {
2245 return dart.notNull(char) < 127 && dart.notNull(!dart.equals(dart.dbinary( Uri[_regNameTable][exports.$get](dart.notNull(char) >> 4), '&', 1 << (dart.notNu ll(char) & 15)), 0)); 2245 return dart.notNull(char) < 127 && dart.notNull(!dart.equals(dart.dsend(Ur i[_regNameTable][exports.$get](dart.notNull(char) >> 4), '&', 1 << (dart.notNull (char) & 15)), 0));
2246 } 2246 }
2247 static [_normalizeRegName](host, start, end) { 2247 static [_normalizeRegName](host, start, end) {
2248 let buffer = null; 2248 let buffer = null;
2249 let sectionStart = start; 2249 let sectionStart = start;
2250 let index = start; 2250 let index = start;
2251 let isNormalized = true; 2251 let isNormalized = true;
2252 while (dart.notNull(index) < dart.notNull(end)) { 2252 while (dart.notNull(index) < dart.notNull(end)) {
2253 let char = host.codeUnitAt(index); 2253 let char = host.codeUnitAt(index);
2254 if (char == Uri[_PERCENT]) { 2254 if (char == Uri[_PERCENT]) {
2255 let replacement = Uri[_normalizeEscape](host, index, true); 2255 let replacement = Uri[_normalizeEscape](host, index, true);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 } 2352 }
2353 let result = null; 2353 let result = null;
2354 if (path != null) { 2354 if (path != null) {
2355 result = Uri[_normalize](path, start, end, dart.as(Uri[_pathCharOrSlashT able], List$(int))); 2355 result = Uri[_normalize](path, start, end, dart.as(Uri[_pathCharOrSlashT able], List$(int)));
2356 } else { 2356 } else {
2357 result = pathSegments[exports.$map](dart.as(s => Uri[_uriEncode](dart.as (Uri[_pathCharTable], List$(int)), dart.as(s, String)), dart.functionType(dart.d ynamic, [String])))[exports.$join]("/"); 2357 result = pathSegments[exports.$map](dart.as(s => Uri[_uriEncode](dart.as (Uri[_pathCharTable], List$(int)), dart.as(s, String)), dart.functionType(dart.d ynamic, [String])))[exports.$join]("/");
2358 } 2358 }
2359 if (dart.dload(result, 'isEmpty')) { 2359 if (dart.dload(result, 'isEmpty')) {
2360 if (isFile) 2360 if (isFile)
2361 return "/"; 2361 return "/";
2362 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dinvoke(result, 'codeUnitAt', 0), Uri[_SLASH]))) { 2362 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri[_SLASH]))) {
2363 return `/${result}`; 2363 return `/${result}`;
2364 } 2364 }
2365 return dart.as(result, String); 2365 return dart.as(result, String);
2366 } 2366 }
2367 static [_makeQuery](query, start, end, queryParameters) { 2367 static [_makeQuery](query, start, end, queryParameters) {
2368 if (dart.notNull(query == null) && dart.notNull(queryParameters == null)) 2368 if (dart.notNull(query == null) && dart.notNull(queryParameters == null))
2369 return null; 2369 return null;
2370 if (dart.notNull(query != null) && dart.notNull(queryParameters != null)) { 2370 if (dart.notNull(query != null) && dart.notNull(queryParameters != null)) {
2371 throw new ArgumentError('Both query and queryParameters specified'); 2371 throw new ArgumentError('Both query and queryParameters specified');
2372 } 2372 }
2373 if (query != null) 2373 if (query != null)
2374 return Uri[_normalize](query, start, end, dart.as(Uri[_queryCharTable], List$(int))); 2374 return Uri[_normalize](query, start, end, dart.as(Uri[_queryCharTable], List$(int)));
2375 let result = new StringBuffer(); 2375 let result = new StringBuffer();
2376 let first = true; 2376 let first = true;
2377 queryParameters.forEach(dart.as((key, value) => { 2377 queryParameters.forEach(dart.as((key, value) => {
2378 if (!dart.notNull(first)) { 2378 if (!dart.notNull(first)) {
2379 result.write("&"); 2379 result.write("&");
2380 } 2380 }
2381 first = false; 2381 first = false;
2382 result.write(Uri.encodeQueryComponent(dart.as(key, String))); 2382 result.write(Uri.encodeQueryComponent(dart.as(key, String)));
2383 if (dart.notNull(value != null) && dart.notNull(dart.dunary('!', dart.dl oad(value, 'isEmpty')))) { 2383 if (dart.notNull(value != null) && dart.notNull(dart.dsend(dart.dload(va lue, 'isEmpty'), '!'))) {
2384 result.write("="); 2384 result.write("=");
2385 result.write(Uri.encodeQueryComponent(dart.as(value, String))); 2385 result.write(Uri.encodeQueryComponent(dart.as(value, String)));
2386 } 2386 }
2387 }, dart.functionType(dart.void, [String, String]))); 2387 }, dart.functionType(dart.void, [String, String])));
2388 return result.toString(); 2388 return result.toString();
2389 } 2389 }
2390 static [_makeFragment](fragment, start, end) { 2390 static [_makeFragment](fragment, start, end) {
2391 if (fragment == null) 2391 if (fragment == null)
2392 return null; 2392 return null;
2393 return Uri[_normalize](fragment, start, end, dart.as(Uri[_queryCharTable], List$(int))); 2393 return Uri[_normalize](fragment, start, end, dart.as(Uri[_queryCharTable], List$(int)));
(...skipping 30 matching lines...) Expand all
2424 value = dart.notNull(value) | 32; 2424 value = dart.notNull(value) | 32;
2425 } 2425 }
2426 return new String.fromCharCode(value); 2426 return new String.fromCharCode(value);
2427 } 2427 }
2428 if (dart.notNull(firstDigit) >= dart.notNull(Uri[_LOWER_CASE_A]) || dart.n otNull(secondDigit) >= dart.notNull(Uri[_LOWER_CASE_A])) { 2428 if (dart.notNull(firstDigit) >= dart.notNull(Uri[_LOWER_CASE_A]) || dart.n otNull(secondDigit) >= dart.notNull(Uri[_LOWER_CASE_A])) {
2429 return source.substring(index, dart.notNull(index) + 3).toUpperCase(); 2429 return source.substring(index, dart.notNull(index) + 3).toUpperCase();
2430 } 2430 }
2431 return null; 2431 return null;
2432 } 2432 }
2433 static [_isUnreservedChar](ch) { 2433 static [_isUnreservedChar](ch) {
2434 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)); 2434 return dart.notNull(ch) < 127 && dart.notNull(!dart.equals(dart.dsend(Uri[ _unreservedTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull( ch) & 15)), 0));
2435 } 2435 }
2436 static [_escapeChar](char) { 2436 static [_escapeChar](char) {
2437 dart.assert(dart.dbinary(char, '<=', 1114111)); 2437 dart.assert(dart.dsend(char, '<=', 1114111));
2438 let hexDigits = "0123456789ABCDEF"; 2438 let hexDigits = "0123456789ABCDEF";
2439 let codeUnits = null; 2439 let codeUnits = null;
2440 if (dart.dbinary(char, '<', 128)) { 2440 if (dart.dsend(char, '<', 128)) {
2441 codeUnits = new List(3); 2441 codeUnits = new List(3);
2442 codeUnits[exports.$set](0, Uri[_PERCENT]); 2442 codeUnits[exports.$set](0, Uri[_PERCENT]);
2443 codeUnits[exports.$set](1, hexDigits.codeUnitAt(dart.as(dart.dbinary(cha r, '>>', 4), int))); 2443 codeUnits[exports.$set](1, hexDigits.codeUnitAt(dart.as(dart.dsend(char, '>>', 4), int)));
2444 codeUnits[exports.$set](2, hexDigits.codeUnitAt(dart.as(dart.dbinary(cha r, '&', 15), int))); 2444 codeUnits[exports.$set](2, hexDigits.codeUnitAt(dart.as(dart.dsend(char, '&', 15), int)));
2445 } else { 2445 } else {
2446 let flag = 192; 2446 let flag = 192;
2447 let encodedBytes = 2; 2447 let encodedBytes = 2;
2448 if (dart.dbinary(char, '>', 2047)) { 2448 if (dart.dsend(char, '>', 2047)) {
2449 flag = 224; 2449 flag = 224;
2450 encodedBytes = 3; 2450 encodedBytes = 3;
2451 if (dart.dbinary(char, '>', 65535)) { 2451 if (dart.dsend(char, '>', 65535)) {
2452 encodedBytes = 4; 2452 encodedBytes = 4;
2453 flag = 240; 2453 flag = 240;
2454 } 2454 }
2455 } 2455 }
2456 codeUnits = new List(3 * dart.notNull(encodedBytes)); 2456 codeUnits = new List(3 * dart.notNull(encodedBytes));
2457 let index = 0; 2457 let index = 0;
2458 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) { 2458 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) {
2459 let byte = dart.as(dart.dbinary(dart.dbinary(dart.dbinary(char, '>>', 6 * dart.notNull(encodedBytes)), '&', 63), '|', flag), int); 2459 let byte = dart.as(dart.dsend(dart.dsend(dart.dsend(char, '>>', 6 * da rt.notNull(encodedBytes)), '&', 63), '|', flag), int);
2460 codeUnits[exports.$set](index, Uri[_PERCENT]); 2460 codeUnits[exports.$set](index, Uri[_PERCENT]);
2461 codeUnits[exports.$set](dart.notNull(index) + 1, hexDigits.codeUnitAt( dart.notNull(byte) >> 4)); 2461 codeUnits[exports.$set](dart.notNull(index) + 1, hexDigits.codeUnitAt( dart.notNull(byte) >> 4));
2462 codeUnits[exports.$set](dart.notNull(index) + 2, hexDigits.codeUnitAt( dart.notNull(byte) & 15)); 2462 codeUnits[exports.$set](dart.notNull(index) + 2, hexDigits.codeUnitAt( dart.notNull(byte) & 15));
2463 index = dart.notNull(index) + 3; 2463 index = dart.notNull(index) + 3;
2464 flag = 128; 2464 flag = 128;
2465 } 2465 }
2466 } 2466 }
2467 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int))); 2467 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int)));
2468 } 2468 }
2469 static [_normalize](component, start, end, charTable) { 2469 static [_normalize](component, start, end, charTable) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 } 2514 }
2515 if (buffer == null) { 2515 if (buffer == null) {
2516 return component.substring(start, end); 2516 return component.substring(start, end);
2517 } 2517 }
2518 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2518 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2519 buffer.write(component.substring(sectionStart, end)); 2519 buffer.write(component.substring(sectionStart, end));
2520 } 2520 }
2521 return buffer.toString(); 2521 return buffer.toString();
2522 } 2522 }
2523 static [_isSchemeCharacter](ch) { 2523 static [_isSchemeCharacter](ch) {
2524 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)); 2524 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dsend(Uri[ _schemeTable][exports.$get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
2525 } 2525 }
2526 static [_isGeneralDelimiter](ch) { 2526 static [_isGeneralDelimiter](ch) {
2527 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)); 2527 return dart.notNull(ch) <= dart.notNull(Uri[_RIGHT_BRACKET]) && dart.notNu ll(!dart.equals(dart.dsend(Uri[_genDelimitersTable][exports.$get](dart.notNull(c h) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
2528 } 2528 }
2529 get isAbsolute() { 2529 get isAbsolute() {
2530 return dart.notNull(this.scheme != "") && dart.notNull(this.fragment == "" ); 2530 return dart.notNull(this.scheme != "") && dart.notNull(this.fragment == "" );
2531 } 2531 }
2532 [_merge](base, reference) { 2532 [_merge](base, reference) {
2533 if (base.isEmpty) 2533 if (base.isEmpty)
2534 return `/${reference}`; 2534 return `/${reference}`;
2535 let backCount = 0; 2535 let backCount = 0;
2536 let refStart = 0; 2536 let refStart = 0;
2537 while (reference.startsWith("../", refStart)) { 2537 while (reference.startsWith("../", refStart)) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 } 2744 }
2745 ['=='](other) { 2745 ['=='](other) {
2746 if (!dart.is(other, Uri)) 2746 if (!dart.is(other, Uri))
2747 return false; 2747 return false;
2748 let uri = dart.as(other, Uri); 2748 let uri = dart.as(other, Uri);
2749 return dart.notNull(this.scheme == uri.scheme) && this.hasAuthority == uri .hasAuthority && dart.notNull(this.userInfo == uri.userInfo) && dart.notNull(thi s.host == uri.host) && this.port == uri.port && dart.notNull(this.path == uri.pa th) && this.hasQuery == uri.hasQuery && dart.notNull(this.query == uri.query) && this.hasFragment == uri.hasFragment && dart.notNull(this.fragment == uri.fragme nt); 2749 return dart.notNull(this.scheme == uri.scheme) && this.hasAuthority == uri .hasAuthority && dart.notNull(this.userInfo == uri.userInfo) && dart.notNull(thi s.host == uri.host) && this.port == uri.port && dart.notNull(this.path == uri.pa th) && this.hasQuery == uri.hasQuery && dart.notNull(this.query == uri.query) && this.hasFragment == uri.hasFragment && dart.notNull(this.fragment == uri.fragme nt);
2750 } 2750 }
2751 get hashCode() { 2751 get hashCode() {
2752 // Function combine: (dynamic, dynamic) → int 2752 // Function combine: (dynamic, dynamic) → int
2753 function combine(part, current) { 2753 function combine(part, current) {
2754 return dart.as(dart.dbinary(dart.dbinary(dart.dbinary(current, '*', 31), '+', part.hashCode), '&', 1073741823), int); 2754 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', part.hashCode), '&', 1073741823), int);
2755 } 2755 }
2756 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) ))))); 2756 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) )))));
2757 } 2757 }
2758 static [_addIfNonEmpty](sb, test, first, second) { 2758 static [_addIfNonEmpty](sb, test, first, second) {
2759 if ("" != test) { 2759 if ("" != test) {
2760 sb.write(first); 2760 sb.write(first);
2761 sb.write(second); 2761 sb.write(second);
2762 } 2762 }
2763 } 2763 }
2764 static encodeComponent(component) { 2764 static encodeComponent(component) {
(...skipping 12 matching lines...) Expand all
2777 } 2777 }
2778 static encodeFull(uri) { 2778 static encodeFull(uri) {
2779 return Uri[_uriEncode](dart.as(Uri[_encodeFullTable], List$(int)), uri); 2779 return Uri[_uriEncode](dart.as(Uri[_encodeFullTable], List$(int)), uri);
2780 } 2780 }
2781 static decodeFull(uri) { 2781 static decodeFull(uri) {
2782 return Uri[_uriDecode](uri); 2782 return Uri[_uriDecode](uri);
2783 } 2783 }
2784 static splitQueryString(query, opts) { 2784 static splitQueryString(query, opts) {
2785 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2785 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2786 return dart.as(query.split("&")[exports.$fold](dart.map(), dart.as((map, e lement) => { 2786 return dart.as(query.split("&")[exports.$fold](dart.map(), dart.as((map, e lement) => {
2787 let index = dart.as(dart.dinvoke(element, 'indexOf', "="), int); 2787 let index = dart.as(dart.dsend(element, 'indexOf', "="), int);
2788 if (index == -1) { 2788 if (index == -1) {
2789 if (!dart.equals(element, "")) { 2789 if (!dart.equals(element, "")) {
2790 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(element, String ), {encoding: encoding}), ""); 2790 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(element, String ), {encoding: encoding}), "");
2791 } 2791 }
2792 } else if (index != 0) { 2792 } else if (index != 0) {
2793 let key = dart.dinvoke(element, 'substring', 0, index); 2793 let key = dart.dsend(element, 'substring', 0, index);
2794 let value = dart.dinvoke(element, 'substring', dart.notNull(index) + 1 ); 2794 let value = dart.dsend(element, 'substring', dart.notNull(index) + 1);
2795 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding: encoding})); 2795 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding: encoding}));
2796 } 2796 }
2797 return map; 2797 return map;
2798 }, dart.functionType(dart.dynamic, [dart.dynamic, String]))), Map$(String, String)); 2798 }, dart.functionType(dart.dynamic, [dart.dynamic, String]))), Map$(String, String));
2799 } 2799 }
2800 static parseIPv4Address(host) { 2800 static parseIPv4Address(host) {
2801 // Function error: (String) → void 2801 // Function error: (String) → void
2802 function error(msg) { 2802 function error(msg) {
2803 throw new FormatException(`Illegal IPv4 address, ${msg}`); 2803 throw new FormatException(`Illegal IPv4 address, ${msg}`);
2804 } 2804 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 } 2910 }
2911 } 2911 }
2912 return dart.as(bytes, List$(int)); 2912 return dart.as(bytes, List$(int));
2913 } 2913 }
2914 static [_uriEncode](canonicalTable, text, opts) { 2914 static [_uriEncode](canonicalTable, text, opts) {
2915 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2915 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2916 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false ; 2916 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false ;
2917 // Function byteToHex: (dynamic, dynamic) → dynamic 2917 // Function byteToHex: (dynamic, dynamic) → dynamic
2918 function byteToHex(byte, buffer) { 2918 function byteToHex(byte, buffer) {
2919 let hex = '0123456789ABCDEF'; 2919 let hex = '0123456789ABCDEF';
2920 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '>>', 4), int))); 2920 dart.dsend(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dsend(by te, '>>', 4), int)));
2921 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '&', 15), int))); 2921 dart.dsend(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dsend(by te, '&', 15), int)));
2922 } 2922 }
2923 let result = new StringBuffer(); 2923 let result = new StringBuffer();
2924 let bytes = encoding.encode(text); 2924 let bytes = encoding.encode(text);
2925 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[exports.$length]); i = dart.notNull(i) + 1) { 2925 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[exports.$length]); i = dart.notNull(i) + 1) {
2926 let byte = bytes[exports.$get](i); 2926 let byte = bytes[exports.$get](i);
2927 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[exports.$ge t](dart.notNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) { 2927 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[exports.$ge t](dart.notNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) {
2928 result.writeCharCode(byte); 2928 result.writeCharCode(byte);
2929 } else if (dart.notNull(spaceToPlus) && byte == Uri[_SPACE]) { 2929 } else if (dart.notNull(spaceToPlus) && byte == Uri[_SPACE]) {
2930 result.writeCharCode(Uri[_PLUS]); 2930 result.writeCharCode(Uri[_PLUS]);
2931 } else { 2931 } else {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 exports.Stopwatch = Stopwatch; 3125 exports.Stopwatch = Stopwatch;
3126 exports.String = String; 3126 exports.String = String;
3127 exports.$last = $last; 3127 exports.$last = $last;
3128 exports.RuneIterator = RuneIterator; 3128 exports.RuneIterator = RuneIterator;
3129 exports.StringBuffer = StringBuffer; 3129 exports.StringBuffer = StringBuffer;
3130 exports.StringSink = StringSink; 3130 exports.StringSink = StringSink;
3131 exports.Symbol = Symbol; 3131 exports.Symbol = Symbol;
3132 exports.Type = Type; 3132 exports.Type = Type;
3133 exports.Uri = Uri; 3133 exports.Uri = Uri;
3134 })(core || (core = {})); 3134 })(core || (core = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart_runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698