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

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

Issue 1085723002: fixes for angular hello: String + and disable broken arg parsing (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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 if (source === void 0) 931 if (source === void 0)
932 source = null; 932 source = null;
933 if (offset === void 0) 933 if (offset === void 0)
934 offset = -1; 934 offset = -1;
935 this.message = message; 935 this.message = message;
936 this.source = source; 936 this.source = source;
937 this.offset = offset; 937 this.offset = offset;
938 } 938 }
939 toString() { 939 toString() {
940 let report = "FormatException"; 940 let report = "FormatException";
941 if (dart.notNull(this.message != null) && dart.notNull("" != this.message) ) { 941 if (this.message != null && "" != this.message) {
942 report = `${report}: ${this.message}`; 942 report = `${report}: ${this.message}`;
943 } 943 }
944 let offset = this.offset; 944 let offset = this.offset;
945 if (!(typeof this.source == 'string')) { 945 if (!(typeof this.source == 'string')) {
946 if (offset != -1) { 946 if (offset != -1) {
947 report = String['+'](report, ` (at offset ${offset})`); 947 report = dart.notNull(report) + ` (at offset ${offset})`;
948 } 948 }
949 return report; 949 return report;
950 } 950 }
951 if (offset != -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(th is.source, 'length')))) { 951 if (offset != -1 && (dart.notNull(offset) < 0 || int['>'](offset, dart.dlo ad(this.source, 'length')))) {
952 offset = -1; 952 offset = -1;
953 } 953 }
954 if (offset == -1) { 954 if (offset == -1) {
955 let source = dart.as(this.source, String); 955 let source = dart.as(this.source, String);
956 if (dart.notNull(source.length) > 78) { 956 if (dart.notNull(source.length) > 78) {
957 source = String['+'](source.substring(0, 75), "..."); 957 source = dart.notNull(source.substring(0, 75)) + "...";
958 } 958 }
959 return `${report}\n${source}`; 959 return `${report}\n${source}`;
960 } 960 }
961 let lineNum = 1; 961 let lineNum = 1;
962 let lineStart = 0; 962 let lineStart = 0;
963 let lastWasCR = null; 963 let lastWasCR = null;
964 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i ) + 1) { 964 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i ) + 1) {
965 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int); 965 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int);
966 if (char == 10) { 966 if (char == 10) {
967 if (lineStart != i || !dart.notNull(lastWasCR)) { 967 if (lineStart != i || !dart.notNull(lastWasCR)) {
968 lineNum = dart.notNull(lineNum) + 1; 968 lineNum = dart.notNull(lineNum) + 1;
969 } 969 }
970 lineStart = dart.notNull(i) + 1; 970 lineStart = dart.notNull(i) + 1;
971 lastWasCR = false; 971 lastWasCR = false;
972 } else if (char == 13) { 972 } else if (char == 13) {
973 lineNum = dart.notNull(lineNum) + 1; 973 lineNum = dart.notNull(lineNum) + 1;
974 lineStart = dart.notNull(i) + 1; 974 lineStart = dart.notNull(i) + 1;
975 lastWasCR = true; 975 lastWasCR = true;
976 } 976 }
977 } 977 }
978 if (dart.notNull(lineNum) > 1) { 978 if (dart.notNull(lineNum) > 1) {
979 report = String['+'](report, ` (at line ${lineNum}, character ${dart.not Null(offset) - dart.notNull(lineStart) + 1})\n`); 979 report = dart.notNull(report) + ` (at line ${lineNum}, character ${dart. notNull(offset) - dart.notNull(lineStart) + 1})\n`;
980 } else { 980 } else {
981 report = String['+'](report, ` (at character ${dart.notNull(offset) + 1} )\n`); 981 report = dart.notNull(report) + ` (at character ${dart.notNull(offset) + 1})\n`;
982 } 982 }
983 let lineEnd = dart.as(dart.dload(this.source, 'length'), int); 983 let lineEnd = dart.as(dart.dload(this.source, 'length'), int);
984 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i = dart.n otNull(i) + 1) { 984 for (let i = offset; int['<'](i, dart.dload(this.source, 'length')); i = d art.notNull(i) + 1) {
985 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int); 985 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int);
986 if (char == 10 || char == 13) { 986 if (char == 10 || char == 13) {
987 lineEnd = i; 987 lineEnd = i;
988 break; 988 break;
989 } 989 }
990 } 990 }
991 let length = dart.notNull(lineEnd) - dart.notNull(lineStart); 991 let length = dart.notNull(lineEnd) - dart.notNull(lineStart);
992 let start = lineStart; 992 let start = lineStart;
993 let end = lineEnd; 993 let end = lineEnd;
994 let prefix = ""; 994 let prefix = "";
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 let fragment = opts && 'fragment' in opts ? opts.fragment : null; 1987 let fragment = opts && 'fragment' in opts ? opts.fragment : null;
1988 scheme = Uri[_makeScheme](scheme, Uri[_stringOrNullLength](scheme)); 1988 scheme = Uri[_makeScheme](scheme, Uri[_stringOrNullLength](scheme));
1989 userInfo = Uri[_makeUserInfo](userInfo, 0, Uri[_stringOrNullLength](userIn fo)); 1989 userInfo = Uri[_makeUserInfo](userInfo, 0, Uri[_stringOrNullLength](userIn fo));
1990 host = Uri[_makeHost](host, 0, Uri[_stringOrNullLength](host), false); 1990 host = Uri[_makeHost](host, 0, Uri[_stringOrNullLength](host), false);
1991 if (query == "") 1991 if (query == "")
1992 query = null; 1992 query = null;
1993 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), queryPa rameters); 1993 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), queryPa rameters);
1994 fragment = Uri[_makeFragment](fragment, 0, Uri[_stringOrNullLength](fragme nt)); 1994 fragment = Uri[_makeFragment](fragment, 0, Uri[_stringOrNullLength](fragme nt));
1995 port = Uri[_makePort](port, scheme); 1995 port = Uri[_makePort](port, scheme);
1996 let isFile = scheme == "file"; 1996 let isFile = scheme == "file";
1997 if (dart.notNull(host == null) && (dart.notNull(userInfo.isNotEmpty) || po rt != null || dart.notNull(isFile))) { 1997 if (host == null && (dart.notNull(userInfo.isNotEmpty) || port != null || dart.notNull(isFile))) {
1998 host = ""; 1998 host = "";
1999 } 1999 }
2000 let ensureLeadingSlash = host != null; 2000 let ensureLeadingSlash = host != null;
2001 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegment s, ensureLeadingSlash, isFile); 2001 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegment s, ensureLeadingSlash, isFile);
2002 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment); 2002 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment);
2003 } 2003 }
2004 http(authority, unencodedPath, queryParameters) { 2004 http(authority, unencodedPath, queryParameters) {
2005 if (queryParameters === void 0) 2005 if (queryParameters === void 0)
2006 queryParameters = null; 2006 queryParameters = null;
2007 return Uri[_makeHttpUri]("http", authority, unencodedPath, queryParameters ); 2007 return Uri[_makeHttpUri]("http", authority, unencodedPath, queryParameters );
2008 } 2008 }
2009 https(authority, unencodedPath, queryParameters) { 2009 https(authority, unencodedPath, queryParameters) {
2010 if (queryParameters === void 0) 2010 if (queryParameters === void 0)
2011 queryParameters = null; 2011 queryParameters = null;
2012 return Uri[_makeHttpUri]("https", authority, unencodedPath, queryParameter s); 2012 return Uri[_makeHttpUri]("https", authority, unencodedPath, queryParameter s);
2013 } 2013 }
2014 static [_makeHttpUri](scheme, authority, unencodedPath, queryParameters) { 2014 static [_makeHttpUri](scheme, authority, unencodedPath, queryParameters) {
2015 let userInfo = ""; 2015 let userInfo = "";
2016 let host = null; 2016 let host = null;
2017 let port = null; 2017 let port = null;
2018 if (dart.notNull(authority != null) && dart.notNull(authority.isNotEmpty)) { 2018 if (authority != null && dart.notNull(authority.isNotEmpty)) {
2019 let hostStart = 0; 2019 let hostStart = 0;
2020 let hasUserInfo = false; 2020 let hasUserInfo = false;
2021 for (let i = 0; dart.notNull(i) < dart.notNull(authority.length); i = da rt.notNull(i) + 1) { 2021 for (let i = 0; dart.notNull(i) < dart.notNull(authority.length); i = da rt.notNull(i) + 1) {
2022 if (authority.codeUnitAt(i) == Uri[_AT_SIGN]) { 2022 if (authority.codeUnitAt(i) == Uri[_AT_SIGN]) {
2023 hasUserInfo = true; 2023 hasUserInfo = true;
2024 userInfo = authority.substring(0, i); 2024 userInfo = authority.substring(0, i);
2025 hostStart = dart.notNull(i) + 1; 2025 hostStart = dart.notNull(i) + 1;
2026 break; 2026 break;
2027 } 2027 }
2028 } 2028 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 throw new UnsupportedError("Illegal character in path"); 2090 throw new UnsupportedError("Illegal character in path");
2091 } 2091 }
2092 } 2092 }
2093 }, dart.functionType(dart.void, [String]))); 2093 }, dart.functionType(dart.void, [String])));
2094 } 2094 }
2095 static [_checkWindowsDriveLetter](charCode, argumentError) { 2095 static [_checkWindowsDriveLetter](charCode, argumentError) {
2096 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])) { 2096 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])) {
2097 return; 2097 return;
2098 } 2098 }
2099 if (argumentError) { 2099 if (argumentError) {
2100 throw new ArgumentError(String['+']("Illegal drive letter ", new String. fromCharCode(charCode))); 2100 throw new ArgumentError("Illegal drive letter " + dart.notNull(new Strin g.fromCharCode(charCode)));
2101 } else { 2101 } else {
2102 throw new UnsupportedError(String['+']("Illegal drive letter ", new Stri ng.fromCharCode(charCode))); 2102 throw new UnsupportedError("Illegal drive letter " + dart.notNull(new St ring.fromCharCode(charCode)));
2103 } 2103 }
2104 } 2104 }
2105 static [_makeFileUri](path) { 2105 static [_makeFileUri](path) {
2106 let sep = "/"; 2106 let sep = "/";
2107 if (path.startsWith(sep)) { 2107 if (path.startsWith(sep)) {
2108 return new Uri({scheme: "file", pathSegments: path.split(sep)}); 2108 return new Uri({scheme: "file", pathSegments: path.split(sep)});
2109 } else { 2109 } else {
2110 return new Uri({pathSegments: path.split(sep)}); 2110 return new Uri({pathSegments: path.split(sep)});
2111 } 2111 }
2112 } 2112 }
2113 static [_makeWindowsFileUrl](path) { 2113 static [_makeWindowsFileUrl](path) {
2114 if (path.startsWith("\\\\?\\")) { 2114 if (path.startsWith("\\\\?\\")) {
2115 if (path.startsWith("\\\\?\\UNC\\")) { 2115 if (path.startsWith("\\\\?\\UNC\\")) {
2116 path = `\\${path.substring(7)}`; 2116 path = `\\${path.substring(7)}`;
2117 } else { 2117 } else {
2118 path = path.substring(4); 2118 path = path.substring(4);
2119 if (dart.notNull(path.length) < 3 || path.codeUnitAt(1) != Uri[_COLON] || path.codeUnitAt(2) != Uri[_BACKSLASH]) { 2119 if (dart.notNull(path.length) < 3 || path.codeUnitAt(1) != Uri[_COLON] || path.codeUnitAt(2) != Uri[_BACKSLASH]) {
2120 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute"); 2120 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute");
2121 } 2121 }
2122 } 2122 }
2123 } else { 2123 } else {
2124 path = path.replaceAll("/", "\\"); 2124 path = path.replaceAll("/", "\\");
2125 } 2125 }
2126 let sep = "\\"; 2126 let sep = "\\";
2127 if (dart.notNull(path.length) > 1 && dart.notNull(String.get(path, 1) == " :")) { 2127 if (dart.notNull(path.length) > 1 && String.get(path, 1) == ":") {
2128 Uri[_checkWindowsDriveLetter](path.codeUnitAt(0), true); 2128 Uri[_checkWindowsDriveLetter](path.codeUnitAt(0), true);
2129 if (path.length == 2 || path.codeUnitAt(2) != Uri[_BACKSLASH]) { 2129 if (path.length == 2 || path.codeUnitAt(2) != Uri[_BACKSLASH]) {
2130 throw new ArgumentError("Windows paths with drive letter must be absol ute"); 2130 throw new ArgumentError("Windows paths with drive letter must be absol ute");
2131 } 2131 }
2132 let pathSegments = path.split(sep); 2132 let pathSegments = path.split(sep);
2133 Uri[_checkWindowsPathReservedCharacters](pathSegments, true, 1); 2133 Uri[_checkWindowsPathReservedCharacters](pathSegments, true, 1);
2134 return new Uri({scheme: "file", pathSegments: pathSegments}); 2134 return new Uri({scheme: "file", pathSegments: pathSegments});
2135 } 2135 }
2136 if (dart.notNull(path.length) > 0 && dart.notNull(String.get(path, 0) == s ep)) { 2136 if (dart.notNull(path.length) > 0 && String.get(path, 0) == sep) {
2137 if (dart.notNull(path.length) > 1 && dart.notNull(String.get(path, 1) == sep)) { 2137 if (dart.notNull(path.length) > 1 && String.get(path, 1) == sep) {
2138 let pathStart = path.indexOf("\\", 2); 2138 let pathStart = path.indexOf("\\", 2);
2139 let hostPart = pathStart == -1 ? path.substring(2) : path.substring(2, pathStart); 2139 let hostPart = pathStart == -1 ? path.substring(2) : path.substring(2, pathStart);
2140 let pathPart = pathStart == -1 ? "" : path.substring(dart.notNull(path Start) + 1); 2140 let pathPart = pathStart == -1 ? "" : path.substring(dart.notNull(path Start) + 1);
2141 let pathSegments = pathPart.split(sep); 2141 let pathSegments = pathPart.split(sep);
2142 Uri[_checkWindowsPathReservedCharacters](pathSegments, true); 2142 Uri[_checkWindowsPathReservedCharacters](pathSegments, true);
2143 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents}); 2143 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents});
2144 } else { 2144 } else {
2145 let pathSegments = path.split(sep); 2145 let pathSegments = path.split(sep);
2146 Uri[_checkWindowsPathReservedCharacters](pathSegments, true); 2146 Uri[_checkWindowsPathReservedCharacters](pathSegments, true);
2147 return new Uri({scheme: "file", pathSegments: pathSegments}); 2147 return new Uri({scheme: "file", pathSegments: pathSegments});
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 } 2184 }
2185 } 2185 }
2186 if (host != null) { 2186 if (host != null) {
2187 host = Uri[_makeHost](host, 0, host.length, false); 2187 host = Uri[_makeHost](host, 0, host.length, false);
2188 } else if (this.hasAuthority) { 2188 } else if (this.hasAuthority) {
2189 host = this.host; 2189 host = this.host;
2190 } else if (dart.notNull(userInfo.isNotEmpty) || port != null || dart.notNu ll(isFile)) { 2190 } else if (dart.notNull(userInfo.isNotEmpty) || port != null || dart.notNu ll(isFile)) {
2191 host = ""; 2191 host = "";
2192 } 2192 }
2193 let ensureLeadingSlash = host != null; 2193 let ensureLeadingSlash = host != null;
2194 if (dart.notNull(path != null) || dart.notNull(pathSegments != null)) { 2194 if (path != null || dart.notNull(pathSegments != null)) {
2195 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegme nts, ensureLeadingSlash, isFile); 2195 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegme nts, ensureLeadingSlash, isFile);
2196 } else { 2196 } else {
2197 path = this.path; 2197 path = this.path;
2198 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n otNull(path.isEmpty)) && !dart.notNull(path.startsWith('/'))) { 2198 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n otNull(path.isEmpty)) && !dart.notNull(path.startsWith('/'))) {
2199 path = `/${path}`; 2199 path = `/${path}`;
2200 } 2200 }
2201 } 2201 }
2202 if (dart.notNull(query != null) || dart.notNull(queryParameters != null)) { 2202 if (query != null || dart.notNull(queryParameters != null)) {
2203 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), query Parameters); 2203 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), query Parameters);
2204 } else if (this.hasQuery) { 2204 } else if (this.hasQuery) {
2205 query = this.query; 2205 query = this.query;
2206 } 2206 }
2207 if (fragment != null) { 2207 if (fragment != null) {
2208 fragment = Uri[_makeFragment](fragment, 0, fragment.length); 2208 fragment = Uri[_makeFragment](fragment, 0, fragment.length);
2209 } else if (this.hasFragment) { 2209 } else if (this.hasFragment) {
2210 fragment = this.fragment; 2210 fragment = this.fragment;
2211 } 2211 }
2212 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment); 2212 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 } 2256 }
2257 static [_normalizeRegName](host, start, end) { 2257 static [_normalizeRegName](host, start, end) {
2258 let buffer = null; 2258 let buffer = null;
2259 let sectionStart = start; 2259 let sectionStart = start;
2260 let index = start; 2260 let index = start;
2261 let isNormalized = true; 2261 let isNormalized = true;
2262 while (dart.notNull(index) < dart.notNull(end)) { 2262 while (dart.notNull(index) < dart.notNull(end)) {
2263 let char = host.codeUnitAt(index); 2263 let char = host.codeUnitAt(index);
2264 if (char == Uri[_PERCENT]) { 2264 if (char == Uri[_PERCENT]) {
2265 let replacement = Uri[_normalizeEscape](host, index, true); 2265 let replacement = Uri[_normalizeEscape](host, index, true);
2266 if (dart.notNull(replacement == null) && dart.notNull(isNormalized)) { 2266 if (replacement == null && dart.notNull(isNormalized)) {
2267 index = dart.notNull(index) + 3; 2267 index = dart.notNull(index) + 3;
2268 continue; 2268 continue;
2269 } 2269 }
2270 if (buffer == null) 2270 if (buffer == null)
2271 buffer = new StringBuffer(); 2271 buffer = new StringBuffer();
2272 let slice = host.substring(sectionStart, index); 2272 let slice = host.substring(sectionStart, index);
2273 if (!dart.notNull(isNormalized)) 2273 if (!dart.notNull(isNormalized))
2274 slice = slice.toLowerCase(); 2274 slice = slice.toLowerCase();
2275 buffer.write(slice); 2275 buffer.write(slice);
2276 let sourceLength = 3; 2276 let sourceLength = 3;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 if (!dart.notNull(allLowercase)) 2348 if (!dart.notNull(allLowercase))
2349 scheme = scheme.toLowerCase(); 2349 scheme = scheme.toLowerCase();
2350 return scheme; 2350 return scheme;
2351 } 2351 }
2352 static [_makeUserInfo](userInfo, start, end) { 2352 static [_makeUserInfo](userInfo, start, end) {
2353 if (userInfo == null) 2353 if (userInfo == null)
2354 return ""; 2354 return "";
2355 return Uri[_normalize](userInfo, start, end, dart.as(Uri[_userinfoTable], List$(int))); 2355 return Uri[_normalize](userInfo, start, end, dart.as(Uri[_userinfoTable], List$(int)));
2356 } 2356 }
2357 static [_makePath](path, start, end, pathSegments, ensureLeadingSlash, isFil e) { 2357 static [_makePath](path, start, end, pathSegments, ensureLeadingSlash, isFil e) {
2358 if (dart.notNull(path == null) && dart.notNull(pathSegments == null)) 2358 if (path == null && dart.notNull(pathSegments == null))
2359 return isFile ? "/" : ""; 2359 return isFile ? "/" : "";
2360 if (dart.notNull(path != null) && dart.notNull(pathSegments != null)) { 2360 if (path != null && dart.notNull(pathSegments != null)) {
2361 throw new ArgumentError('Both path and pathSegments specified'); 2361 throw new ArgumentError('Both path and pathSegments specified');
2362 } 2362 }
2363 let result = null; 2363 let result = null;
2364 if (path != null) { 2364 if (path != null) {
2365 result = Uri[_normalize](path, start, end, dart.as(Uri[_pathCharOrSlashT able], List$(int))); 2365 result = Uri[_normalize](path, start, end, dart.as(Uri[_pathCharOrSlashT able], List$(int)));
2366 } else { 2366 } else {
2367 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]("/"); 2367 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]("/");
2368 } 2368 }
2369 if (dart.dload(result, 'isEmpty')) { 2369 if (dart.dload(result, 'isEmpty')) {
2370 if (isFile) 2370 if (isFile)
2371 return "/"; 2371 return "/";
2372 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri[_SLASH]))) { 2372 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri[_SLASH]))) {
2373 return `/${result}`; 2373 return `/${result}`;
2374 } 2374 }
2375 return dart.as(result, String); 2375 return dart.as(result, String);
2376 } 2376 }
2377 static [_makeQuery](query, start, end, queryParameters) { 2377 static [_makeQuery](query, start, end, queryParameters) {
2378 if (dart.notNull(query == null) && dart.notNull(queryParameters == null)) 2378 if (query == null && dart.notNull(queryParameters == null))
2379 return null; 2379 return null;
2380 if (dart.notNull(query != null) && dart.notNull(queryParameters != null)) { 2380 if (query != null && dart.notNull(queryParameters != null)) {
2381 throw new ArgumentError('Both query and queryParameters specified'); 2381 throw new ArgumentError('Both query and queryParameters specified');
2382 } 2382 }
2383 if (query != null) 2383 if (query != null)
2384 return Uri[_normalize](query, start, end, dart.as(Uri[_queryCharTable], List$(int))); 2384 return Uri[_normalize](query, start, end, dart.as(Uri[_queryCharTable], List$(int)));
2385 let result = new StringBuffer(); 2385 let result = new StringBuffer();
2386 let first = true; 2386 let first = true;
2387 queryParameters.forEach(dart.as((key, value) => { 2387 queryParameters.forEach(dart.as((key, value) => {
2388 if (!dart.notNull(first)) { 2388 if (!dart.notNull(first)) {
2389 result.write("&"); 2389 result.write("&");
2390 } 2390 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 } 2530 }
2531 return buffer.toString(); 2531 return buffer.toString();
2532 } 2532 }
2533 static [_isSchemeCharacter](ch) { 2533 static [_isSchemeCharacter](ch) {
2534 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)); 2534 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));
2535 } 2535 }
2536 static [_isGeneralDelimiter](ch) { 2536 static [_isGeneralDelimiter](ch) {
2537 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)); 2537 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));
2538 } 2538 }
2539 get isAbsolute() { 2539 get isAbsolute() {
2540 return dart.notNull(this.scheme != "") && dart.notNull(this.fragment == "" ); 2540 return this.scheme != "" && this.fragment == "";
2541 } 2541 }
2542 [_merge](base, reference) { 2542 [_merge](base, reference) {
2543 if (base.isEmpty) 2543 if (base.isEmpty)
2544 return `/${reference}`; 2544 return `/${reference}`;
2545 let backCount = 0; 2545 let backCount = 0;
2546 let refStart = 0; 2546 let refStart = 0;
2547 while (reference.startsWith("../", refStart)) { 2547 while (reference.startsWith("../", refStart)) {
2548 refStart = dart.notNull(refStart) + 3; 2548 refStart = dart.notNull(refStart) + 3;
2549 backCount = dart.notNull(backCount) + 1; 2549 backCount = dart.notNull(backCount) + 1;
2550 } 2550 }
2551 let baseEnd = base.lastIndexOf('/'); 2551 let baseEnd = base.lastIndexOf('/');
2552 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { 2552 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) {
2553 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1); 2553 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1);
2554 if (dart.notNull(newEnd) < 0) { 2554 if (dart.notNull(newEnd) < 0) {
2555 break; 2555 break;
2556 } 2556 }
2557 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); 2557 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
2558 if ((delta == 2 || delta == 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) == Uri[_DOT] && (delta == 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) == Uri[_DOT])) { 2558 if ((delta == 2 || delta == 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) == Uri[_DOT] && (delta == 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) == Uri[_DOT])) {
2559 break; 2559 break;
2560 } 2560 }
2561 baseEnd = newEnd; 2561 baseEnd = newEnd;
2562 backCount = dart.notNull(backCount) - 1; 2562 backCount = dart.notNull(backCount) - 1;
2563 } 2563 }
2564 return String['+'](base.substring(0, dart.notNull(baseEnd) + 1), reference .substring(dart.notNull(refStart) - 3 * dart.notNull(backCount))); 2564 return dart.notNull(base.substring(0, dart.notNull(baseEnd) + 1)) + dart.n otNull(reference.substring(dart.notNull(refStart) - 3 * dart.notNull(backCount)) );
2565 } 2565 }
2566 [_hasDotSegments](path) { 2566 [_hasDotSegments](path) {
2567 if (dart.notNull(path.length) > 0 && path.codeUnitAt(0) == Uri[_DOT]) 2567 if (dart.notNull(path.length) > 0 && path.codeUnitAt(0) == Uri[_DOT])
2568 return true; 2568 return true;
2569 let index = path.indexOf("/."); 2569 let index = path.indexOf("/.");
2570 return index != -1; 2570 return index != -1;
2571 } 2571 }
2572 [_removeDotSegments](path) { 2572 [_removeDotSegments](path) {
2573 if (!dart.notNull(this[_hasDotSegments](path))) 2573 if (!dart.notNull(this[_hasDotSegments](path)))
2574 return path; 2574 return path;
2575 let output = dart.as(new List.from([]), List$(String)); 2575 let output = dart.as(new List.from([]), List$(String));
2576 let appendSlash = false; 2576 let appendSlash = false;
2577 for (let segment of path.split("/")) { 2577 for (let segment of path.split("/")) {
2578 appendSlash = false; 2578 appendSlash = false;
2579 if (segment == "..") { 2579 if (segment == "..") {
2580 if (!dart.notNull(output[exports.$isEmpty]) && (output[exports.$length ] != 1 || dart.notNull(output[exports.$get](0) != ""))) 2580 if (!dart.notNull(output[exports.$isEmpty]) && (output[exports.$length ] != 1 || output[exports.$get](0) != ""))
2581 output[exports.$removeLast](); 2581 output[exports.$removeLast]();
2582 appendSlash = true; 2582 appendSlash = true;
2583 } else if ("." == segment) { 2583 } else if ("." == segment) {
2584 appendSlash = true; 2584 appendSlash = true;
2585 } else { 2585 } else {
2586 output[exports.$add](segment); 2586 output[exports.$add](segment);
2587 } 2587 }
2588 } 2588 }
2589 if (appendSlash) 2589 if (appendSlash)
2590 output[exports.$add](""); 2590 output[exports.$add]("");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 get hasPort() { 2651 get hasPort() {
2652 return this[_port] != null; 2652 return this[_port] != null;
2653 } 2653 }
2654 get hasQuery() { 2654 get hasQuery() {
2655 return this[_query] != null; 2655 return this[_query] != null;
2656 } 2656 }
2657 get hasFragment() { 2657 get hasFragment() {
2658 return this[_fragment] != null; 2658 return this[_fragment] != null;
2659 } 2659 }
2660 get origin() { 2660 get origin() {
2661 if (dart.notNull(this.scheme == "") || dart.notNull(this[_host] == null) | | dart.notNull(this[_host] == "")) { 2661 if (this.scheme == "" || this[_host] == null || this[_host] == "") {
2662 throw new StateError(`Cannot use origin without a scheme: ${this}`); 2662 throw new StateError(`Cannot use origin without a scheme: ${this}`);
2663 } 2663 }
2664 if (dart.notNull(this.scheme != "http") && dart.notNull(this.scheme != "ht tps")) { 2664 if (this.scheme != "http" && this.scheme != "https") {
2665 throw new StateError(`Origin is only applicable schemes http and https: ${this}`); 2665 throw new StateError(`Origin is only applicable schemes http and https: ${this}`);
2666 } 2666 }
2667 if (this[_port] == null) 2667 if (this[_port] == null)
2668 return `${this.scheme}://${this[_host]}`; 2668 return `${this.scheme}://${this[_host]}`;
2669 return `${this.scheme}://${this[_host]}:${this[_port]}`; 2669 return `${this.scheme}://${this[_host]}:${this[_port]}`;
2670 } 2670 }
2671 toFilePath(opts) { 2671 toFilePath(opts) {
2672 let windows = opts && 'windows' in opts ? opts.windows : null; 2672 let windows = opts && 'windows' in opts ? opts.windows : null;
2673 if (dart.notNull(this.scheme != "") && dart.notNull(this.scheme != "file") ) { 2673 if (this.scheme != "" && this.scheme != "file") {
2674 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch eme} URI`); 2674 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch eme} URI`);
2675 } 2675 }
2676 if (this.query != "") { 2676 if (this.query != "") {
2677 throw new UnsupportedError("Cannot extract a file path from a URI with a query component"); 2677 throw new UnsupportedError("Cannot extract a file path from a URI with a query component");
2678 } 2678 }
2679 if (this.fragment != "") { 2679 if (this.fragment != "") {
2680 throw new UnsupportedError("Cannot extract a file path from a URI with a fragment component"); 2680 throw new UnsupportedError("Cannot extract a file path from a URI with a fragment component");
2681 } 2681 }
2682 if (windows == null) 2682 if (windows == null)
2683 windows = Uri[_isWindows]; 2683 windows = Uri[_isWindows];
(...skipping 27 matching lines...) Expand all
2711 result.write("\\"); 2711 result.write("\\");
2712 result.write(this.host); 2712 result.write(this.host);
2713 result.write("\\"); 2713 result.write("\\");
2714 } 2714 }
2715 result.writeAll(segments, "\\"); 2715 result.writeAll(segments, "\\");
2716 if (dart.notNull(hasDriveLetter) && segments[exports.$length] == 1) 2716 if (dart.notNull(hasDriveLetter) && segments[exports.$length] == 1)
2717 result.write("\\"); 2717 result.write("\\");
2718 return result.toString(); 2718 return result.toString();
2719 } 2719 }
2720 get [_isPathAbsolute]() { 2720 get [_isPathAbsolute]() {
2721 if (dart.notNull(this.path == null) || dart.notNull(this.path.isEmpty)) 2721 if (this.path == null || dart.notNull(this.path.isEmpty))
2722 return false; 2722 return false;
2723 return this.path.startsWith('/'); 2723 return this.path.startsWith('/');
2724 } 2724 }
2725 [_writeAuthority](ss) { 2725 [_writeAuthority](ss) {
2726 if (this[_userInfo].isNotEmpty) { 2726 if (this[_userInfo].isNotEmpty) {
2727 ss.write(this[_userInfo]); 2727 ss.write(this[_userInfo]);
2728 ss.write("@"); 2728 ss.write("@");
2729 } 2729 }
2730 if (this[_host] != null) 2730 if (this[_host] != null)
2731 ss.write(this[_host]); 2731 ss.write(this[_host]);
2732 if (this[_port] != null) { 2732 if (this[_port] != null) {
2733 ss.write(":"); 2733 ss.write(":");
2734 ss.write(this[_port]); 2734 ss.write(this[_port]);
2735 } 2735 }
2736 } 2736 }
2737 toString() { 2737 toString() {
2738 let sb = new StringBuffer(); 2738 let sb = new StringBuffer();
2739 Uri[_addIfNonEmpty](sb, this.scheme, this.scheme, ':'); 2739 Uri[_addIfNonEmpty](sb, this.scheme, this.scheme, ':');
2740 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path.startsWith(" //")) || dart.notNull(this.scheme == "file")) { 2740 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path.startsWith(" //")) || this.scheme == "file") {
2741 sb.write("//"); 2741 sb.write("//");
2742 this[_writeAuthority](sb); 2742 this[_writeAuthority](sb);
2743 } 2743 }
2744 sb.write(this.path); 2744 sb.write(this.path);
2745 if (this[_query] != null) { 2745 if (this[_query] != null) {
2746 sb.write("?"); 2746 sb.write("?");
2747 sb.write(this[_query]); 2747 sb.write(this[_query]);
2748 } 2748 }
2749 if (this[_fragment] != null) { 2749 if (this[_fragment] != null) {
2750 sb.write("#"); 2750 sb.write("#");
2751 sb.write(this[_fragment]); 2751 sb.write(this[_fragment]);
2752 } 2752 }
2753 return sb.toString(); 2753 return sb.toString();
2754 } 2754 }
2755 ['=='](other) { 2755 ['=='](other) {
2756 if (!dart.is(other, Uri)) 2756 if (!dart.is(other, Uri))
2757 return false; 2757 return false;
2758 let uri = dart.as(other, Uri); 2758 let uri = dart.as(other, Uri);
2759 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); 2759 return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.po rt && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == ur i.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
2760 } 2760 }
2761 get hashCode() { 2761 get hashCode() {
2762 // Function combine: (dynamic, dynamic) → int 2762 // Function combine: (dynamic, dynamic) → int
2763 function combine(part, current) { 2763 function combine(part, current) {
2764 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', part.hashCode), '&', 1073741823), int); 2764 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', part.hashCode), '&', 1073741823), int);
2765 } 2765 }
2766 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) ))))); 2766 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) )))));
2767 } 2767 }
2768 static [_addIfNonEmpty](sb, test, first, second) { 2768 static [_addIfNonEmpty](sb, test, first, second) {
2769 if ("" != test) { 2769 if ("" != test) {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 exports.Symbol = Symbol; 3145 exports.Symbol = Symbol;
3146 exports.Type = Type; 3146 exports.Type = Type;
3147 exports.$forEach = $forEach; 3147 exports.$forEach = $forEach;
3148 exports.$map = $map; 3148 exports.$map = $map;
3149 exports.$toList = $toList; 3149 exports.$toList = $toList;
3150 exports.$isEmpty = $isEmpty; 3150 exports.$isEmpty = $isEmpty;
3151 exports.$removeLast = $removeLast; 3151 exports.$removeLast = $removeLast;
3152 exports.$fold = $fold; 3152 exports.$fold = $fold;
3153 exports.Uri = Uri; 3153 exports.Uri = Uri;
3154 })(core || (core = {})); 3154 })(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