OLD | NEW |
1 var core = dart.defineLibrary(core, {}); | 1 var core = dart.defineLibrary(core, {}); |
2 var _js_helper = dart.lazyImport(_js_helper); | 2 var _js_helper = dart.lazyImport(_js_helper); |
3 var _internal = dart.lazyImport(_internal); | 3 var _internal = dart.lazyImport(_internal); |
4 var collection = dart.lazyImport(collection); | 4 var collection = dart.lazyImport(collection); |
5 var _interceptors = dart.lazyImport(_interceptors); | 5 var _interceptors = dart.lazyImport(_interceptors); |
6 var convert = dart.lazyImport(convert); | 6 var convert = dart.lazyImport(convert); |
7 (function(exports, _js_helper, _internal, collection, _interceptors, convert) { | 7 (function(exports, _js_helper, _internal, collection, _interceptors, convert) { |
8 'use strict'; | 8 'use strict'; |
9 class Object { | 9 class Object { |
10 constructor() { | 10 constructor() { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 let hourDifference = int.parse(match.get(10)); | 167 let hourDifference = int.parse(match.get(10)); |
168 let minuteDifference = parseIntOrZero(match.get(11)); | 168 let minuteDifference = parseIntOrZero(match.get(11)); |
169 minuteDifference = dart.notNull(minuteDifference) + 60 * dart.notNul
l(hourDifference); | 169 minuteDifference = dart.notNull(minuteDifference) + 60 * dart.notNul
l(hourDifference); |
170 minute = dart.notNull(minute) - dart.notNull(sign) * dart.notNull(mi
nuteDifference); | 170 minute = dart.notNull(minute) - dart.notNull(sign) * dart.notNull(mi
nuteDifference); |
171 } | 171 } |
172 } | 172 } |
173 let millisecondsSinceEpoch = DateTime._brokenDownDateToMillisecondsSince
Epoch(years, month, day, hour, minute, second, millisecond, isUtc); | 173 let millisecondsSinceEpoch = DateTime._brokenDownDateToMillisecondsSince
Epoch(years, month, day, hour, minute, second, millisecond, isUtc); |
174 if (millisecondsSinceEpoch == null) { | 174 if (millisecondsSinceEpoch == null) { |
175 throw new FormatException("Time out of range", formattedString); | 175 throw new FormatException("Time out of range", formattedString); |
176 } | 176 } |
177 if (addOneMillisecond) { | 177 if (dart.notNull(addOneMillisecond)) { |
178 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1; | 178 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1; |
179 } | 179 } |
180 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, {
isUtc: isUtc}); | 180 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, {
isUtc: isUtc}); |
181 } else { | 181 } else { |
182 throw new FormatException("Invalid date format", formattedString); | 182 throw new FormatException("Invalid date format", formattedString); |
183 } | 183 } |
184 } | 184 } |
185 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { | 185 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { |
186 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; | 186 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; |
187 this.millisecondsSinceEpoch = millisecondsSinceEpoch; | 187 this.millisecondsSinceEpoch = millisecondsSinceEpoch; |
(...skipping 18 matching lines...) Expand all Loading... |
206 isAtSameMomentAs(other) { | 206 isAtSameMomentAs(other) { |
207 return this.millisecondsSinceEpoch == other.millisecondsSinceEpoch; | 207 return this.millisecondsSinceEpoch == other.millisecondsSinceEpoch; |
208 } | 208 } |
209 compareTo(other) { | 209 compareTo(other) { |
210 return this.millisecondsSinceEpoch[dartx.compareTo](other.millisecondsSinc
eEpoch); | 210 return this.millisecondsSinceEpoch[dartx.compareTo](other.millisecondsSinc
eEpoch); |
211 } | 211 } |
212 get hashCode() { | 212 get hashCode() { |
213 return this.millisecondsSinceEpoch; | 213 return this.millisecondsSinceEpoch; |
214 } | 214 } |
215 toLocal() { | 215 toLocal() { |
216 if (this.isUtc) { | 216 if (dart.notNull(this.isUtc)) { |
217 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo
ch, {isUtc: false}); | 217 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo
ch, {isUtc: false}); |
218 } | 218 } |
219 return this; | 219 return this; |
220 } | 220 } |
221 toUtc() { | 221 toUtc() { |
222 if (this.isUtc) | 222 if (dart.notNull(this.isUtc)) |
223 return this; | 223 return this; |
224 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch
, {isUtc: true}); | 224 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch
, {isUtc: true}); |
225 } | 225 } |
226 static _fourDigits(n) { | 226 static _fourDigits(n) { |
227 let absN = n[dartx.abs](); | 227 let absN = n[dartx.abs](); |
228 let sign = dart.notNull(n) < 0 ? "-" : ""; | 228 let sign = dart.notNull(n) < 0 ? "-" : ""; |
229 if (dart.notNull(absN) >= 1000) | 229 if (dart.notNull(absN) >= 1000) |
230 return `${n}`; | 230 return `${n}`; |
231 if (dart.notNull(absN) >= 100) | 231 if (dart.notNull(absN) >= 100) |
232 return `${sign}0${absN}`; | 232 return `${sign}0${absN}`; |
(...skipping 22 matching lines...) Expand all Loading... |
255 return `0${n}`; | 255 return `0${n}`; |
256 } | 256 } |
257 toString() { | 257 toString() { |
258 let y = DateTime._fourDigits(this.year); | 258 let y = DateTime._fourDigits(this.year); |
259 let m = DateTime._twoDigits(this.month); | 259 let m = DateTime._twoDigits(this.month); |
260 let d = DateTime._twoDigits(this.day); | 260 let d = DateTime._twoDigits(this.day); |
261 let h = DateTime._twoDigits(this.hour); | 261 let h = DateTime._twoDigits(this.hour); |
262 let min = DateTime._twoDigits(this.minute); | 262 let min = DateTime._twoDigits(this.minute); |
263 let sec = DateTime._twoDigits(this.second); | 263 let sec = DateTime._twoDigits(this.second); |
264 let ms = DateTime._threeDigits(this.millisecond); | 264 let ms = DateTime._threeDigits(this.millisecond); |
265 if (this.isUtc) { | 265 if (dart.notNull(this.isUtc)) { |
266 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}Z`; | 266 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}Z`; |
267 } else { | 267 } else { |
268 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}`; | 268 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}`; |
269 } | 269 } |
270 } | 270 } |
271 toIso8601String() { | 271 toIso8601String() { |
272 let y = dart.notNull(this.year) >= -9999 && dart.notNull(this.year) <= 999
9 ? DateTime._fourDigits(this.year) : DateTime._sixDigits(this.year); | 272 let y = dart.notNull(this.year) >= -9999 && dart.notNull(this.year) <= 999
9 ? DateTime._fourDigits(this.year) : DateTime._sixDigits(this.year); |
273 let m = DateTime._twoDigits(this.month); | 273 let m = DateTime._twoDigits(this.month); |
274 let d = DateTime._twoDigits(this.day); | 274 let d = DateTime._twoDigits(this.day); |
275 let h = DateTime._twoDigits(this.hour); | 275 let h = DateTime._twoDigits(this.hour); |
276 let min = DateTime._twoDigits(this.minute); | 276 let min = DateTime._twoDigits(this.minute); |
277 let sec = DateTime._twoDigits(this.second); | 277 let sec = DateTime._twoDigits(this.second); |
278 let ms = DateTime._threeDigits(this.millisecond); | 278 let ms = DateTime._threeDigits(this.millisecond); |
279 if (this.isUtc) { | 279 if (dart.notNull(this.isUtc)) { |
280 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}Z`; | 280 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}Z`; |
281 } else { | 281 } else { |
282 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}`; | 282 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}`; |
283 } | 283 } |
284 } | 284 } |
285 add(duration) { | 285 add(duration) { |
286 let ms = this.millisecondsSinceEpoch; | 286 let ms = this.millisecondsSinceEpoch; |
287 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) + dart.not
Null(duration.inMilliseconds), {isUtc: this.isUtc}); | 287 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) + dart.not
Null(duration.inMilliseconds), {isUtc: this.isUtc}); |
288 } | 288 } |
289 subtract(duration) { | 289 subtract(duration) { |
(...skipping 10 matching lines...) Expand all Loading... |
300 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi
tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon
d, isUtc)), int); | 300 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi
tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon
d, isUtc)), int); |
301 } | 301 } |
302 _now() { | 302 _now() { |
303 this.isUtc = false; | 303 this.isUtc = false; |
304 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); | 304 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); |
305 } | 305 } |
306 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut
e, second, millisecond, isUtc) { | 306 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut
e, second, millisecond, isUtc) { |
307 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month,
day, hour, minute, second, millisecond, isUtc), int); | 307 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month,
day, hour, minute, second, millisecond, isUtc), int); |
308 } | 308 } |
309 get timeZoneName() { | 309 get timeZoneName() { |
310 if (this.isUtc) | 310 if (dart.notNull(this.isUtc)) |
311 return "UTC"; | 311 return "UTC"; |
312 return _js_helper.Primitives.getTimeZoneName(this); | 312 return _js_helper.Primitives.getTimeZoneName(this); |
313 } | 313 } |
314 get timeZoneOffset() { | 314 get timeZoneOffset() { |
315 if (this.isUtc) | 315 if (dart.notNull(this.isUtc)) |
316 return new Duration(); | 316 return new Duration(); |
317 return new Duration({minutes: _js_helper.Primitives.getTimeZoneOffsetInMin
utes(this)}); | 317 return new Duration({minutes: _js_helper.Primitives.getTimeZoneOffsetInMin
utes(this)}); |
318 } | 318 } |
319 get year() { | 319 get year() { |
320 return dart.as(_js_helper.Primitives.getYear(this), int); | 320 return dart.as(_js_helper.Primitives.getYear(this), int); |
321 } | 321 } |
322 get month() { | 322 get month() { |
323 return dart.as(_js_helper.Primitives.getMonth(this), int); | 323 return dart.as(_js_helper.Primitives.getMonth(this), int); |
324 } | 324 } |
325 get day() { | 325 get day() { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 Duration.MILLISECONDS_PER_HOUR = dart.notNull(Duration.MILLISECONDS_PER_MINUTE
) * dart.notNull(Duration.MINUTES_PER_HOUR); | 595 Duration.MILLISECONDS_PER_HOUR = dart.notNull(Duration.MILLISECONDS_PER_MINUTE
) * dart.notNull(Duration.MINUTES_PER_HOUR); |
596 Duration.MILLISECONDS_PER_DAY = dart.notNull(Duration.MILLISECONDS_PER_HOUR) *
dart.notNull(Duration.HOURS_PER_DAY); | 596 Duration.MILLISECONDS_PER_DAY = dart.notNull(Duration.MILLISECONDS_PER_HOUR) *
dart.notNull(Duration.HOURS_PER_DAY); |
597 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n
otNull(Duration.MINUTES_PER_HOUR); | 597 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n
otNull(Duration.MINUTES_PER_HOUR); |
598 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN
ull(Duration.HOURS_PER_DAY); | 598 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN
ull(Duration.HOURS_PER_DAY); |
599 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN
ull(Duration.HOURS_PER_DAY); | 599 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN
ull(Duration.HOURS_PER_DAY); |
600 Duration.ZERO = dart.const(new Duration({seconds: 0})); | 600 Duration.ZERO = dart.const(new Duration({seconds: 0})); |
601 class Error extends Object { | 601 class Error extends Object { |
602 Error() { | 602 Error() { |
603 } | 603 } |
604 static safeToString(object) { | 604 static safeToString(object) { |
605 if (dart.is(object, num) || typeof object == 'boolean' || dart.notNull(nul
l == object)) { | 605 if (dart.is(object, num) || typeof object == 'boolean' || null == object)
{ |
606 return dart.toString(object); | 606 return dart.toString(object); |
607 } | 607 } |
608 if (typeof object == 'string') { | 608 if (typeof object == 'string') { |
609 return Error._stringToSafeString(object); | 609 return Error._stringToSafeString(object); |
610 } | 610 } |
611 return Error._objectToString(object); | 611 return Error._objectToString(object); |
612 } | 612 } |
613 static _stringToSafeString(string) { | 613 static _stringToSafeString(string) { |
614 return _js_helper.jsonEncodeNative(string); | 614 return _js_helper.jsonEncodeNative(string); |
615 } | 615 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 get start() { | 829 get start() { |
830 return 0; | 830 return 0; |
831 } | 831 } |
832 get end() { | 832 get end() { |
833 return dart.notNull(this.length) - 1; | 833 return dart.notNull(this.length) - 1; |
834 } | 834 } |
835 toString() { | 835 toString() { |
836 dart.assert(this[_hasValue]); | 836 dart.assert(this[_hasValue]); |
837 let target = Error.safeToString(this.indexable); | 837 let target = Error.safeToString(this.indexable); |
838 let explanation = `index should be less than ${this.length}`; | 838 let explanation = `index should be less than ${this.length}`; |
839 if (dart.dsend(this.invalidValue, '<', 0)) { | 839 if (dart.notNull(dart.as(dart.dsend(this.invalidValue, '<', 0), bool))) { |
840 explanation = "index must not be negative"; | 840 explanation = "index must not be negative"; |
841 } | 841 } |
842 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e
xplanation}`; | 842 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e
xplanation}`; |
843 } | 843 } |
844 } | 844 } |
845 IndexError[dart.implements] = () => [RangeError]; | 845 IndexError[dart.implements] = () => [RangeError]; |
846 dart.setSignature(IndexError, { | 846 dart.setSignature(IndexError, { |
847 constructors: () => ({IndexError: [IndexError, [int, Object], [String, Strin
g, int]]}) | 847 constructors: () => ({IndexError: [IndexError, [int, Object], [String, Strin
g, int]]}) |
848 }); | 848 }); |
849 class FallThroughError extends Error { | 849 class FallThroughError extends Error { |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 } else { | 1406 } else { |
1407 if (!(typeof length == 'number') || dart.notNull(length) < 0) { | 1407 if (!(typeof length == 'number') || dart.notNull(length) < 0) { |
1408 throw new ArgumentError(`Length must be a non-negative integer: ${le
ngth}`); | 1408 throw new ArgumentError(`Length must be a non-negative integer: ${le
ngth}`); |
1409 } | 1409 } |
1410 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length),
List$())); | 1410 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length),
List$())); |
1411 } | 1411 } |
1412 return _interceptors.JSArray$(E).typed(list); | 1412 return _interceptors.JSArray$(E).typed(list); |
1413 } | 1413 } |
1414 static filled(length, fill) { | 1414 static filled(length, fill) { |
1415 let result = List$(E).new(length); | 1415 let result = List$(E).new(length); |
1416 if (length != 0 && dart.notNull(fill != null)) { | 1416 if (length != 0 && fill != null) { |
1417 for (let i = 0; dart.notNull(i) < dart.notNull(result.length); i = dar
t.notNull(i) + 1) { | 1417 for (let i = 0; dart.notNull(i) < dart.notNull(result.length); i = dar
t.notNull(i) + 1) { |
1418 result[dartx.set](i, fill); | 1418 result[dartx.set](i, fill); |
1419 } | 1419 } |
1420 } | 1420 } |
1421 return result; | 1421 return result; |
1422 } | 1422 } |
1423 static from(elements, opts) { | 1423 static from(elements, opts) { |
1424 let growable = opts && 'growable' in opts ? opts.growable : true; | 1424 let growable = opts && 'growable' in opts ? opts.growable : true; |
1425 let list = List$(E).new(); | 1425 let list = List$(E).new(); |
1426 for (let e of elements) { | 1426 for (let e of elements) { |
1427 list[dartx.add](dart.as(e, E)); | 1427 list[dartx.add](dart.as(e, E)); |
1428 } | 1428 } |
1429 if (growable) | 1429 if (dart.notNull(growable)) |
1430 return list; | 1430 return list; |
1431 return dart.as(_internal.makeListFixedLength(list), List$(E)); | 1431 return dart.as(_internal.makeListFixedLength(list), List$(E)); |
1432 } | 1432 } |
1433 static generate(length, generator, opts) { | 1433 static generate(length, generator, opts) { |
1434 let growable = opts && 'growable' in opts ? opts.growable : true; | 1434 let growable = opts && 'growable' in opts ? opts.growable : true; |
1435 let result = null; | 1435 let result = null; |
1436 if (growable) { | 1436 if (dart.notNull(growable)) { |
1437 result = dart.list([], E); | 1437 result = dart.list([], E); |
1438 result.length = length; | 1438 result.length = length; |
1439 } else { | 1439 } else { |
1440 result = List$(E).new(length); | 1440 result = List$(E).new(length); |
1441 } | 1441 } |
1442 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { | 1442 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { |
1443 result[dartx.set](i, generator(i)); | 1443 result[dartx.set](i, generator(i)); |
1444 } | 1444 } |
1445 return result; | 1445 return result; |
1446 } | 1446 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 class Stopwatch extends Object { | 1557 class Stopwatch extends Object { |
1558 get frequency() { | 1558 get frequency() { |
1559 return Stopwatch._frequency; | 1559 return Stopwatch._frequency; |
1560 } | 1560 } |
1561 Stopwatch() { | 1561 Stopwatch() { |
1562 this[_start] = null; | 1562 this[_start] = null; |
1563 this[_stop] = null; | 1563 this[_stop] = null; |
1564 Stopwatch._initTicker(); | 1564 Stopwatch._initTicker(); |
1565 } | 1565 } |
1566 start() { | 1566 start() { |
1567 if (this.isRunning) | 1567 if (dart.notNull(this.isRunning)) |
1568 return; | 1568 return; |
1569 if (this[_start] == null) { | 1569 if (this[_start] == null) { |
1570 this[_start] = Stopwatch._now(); | 1570 this[_start] = Stopwatch._now(); |
1571 } else { | 1571 } else { |
1572 this[_start] = dart.notNull(Stopwatch._now()) - (dart.notNull(this[_stop
]) - dart.notNull(this[_start])); | 1572 this[_start] = dart.notNull(Stopwatch._now()) - (dart.notNull(this[_stop
]) - dart.notNull(this[_start])); |
1573 this[_stop] = null; | 1573 this[_stop] = null; |
1574 } | 1574 } |
1575 } | 1575 } |
1576 stop() { | 1576 stop() { |
1577 if (!dart.notNull(this.isRunning)) | 1577 if (!dart.notNull(this.isRunning)) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 throw new RangeError.range(end, start, charCodes.length); | 1664 throw new RangeError.range(end, start, charCodes.length); |
1665 } | 1665 } |
1666 let it = charCodes[dartx.iterator]; | 1666 let it = charCodes[dartx.iterator]; |
1667 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i)
+ 1) { | 1667 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i)
+ 1) { |
1668 if (!dart.notNull(it.moveNext())) { | 1668 if (!dart.notNull(it.moveNext())) { |
1669 throw new RangeError.range(start, 0, i); | 1669 throw new RangeError.range(start, 0, i); |
1670 } | 1670 } |
1671 } | 1671 } |
1672 let list = []; | 1672 let list = []; |
1673 if (end == null) { | 1673 if (end == null) { |
1674 while (it.moveNext()) | 1674 while (dart.notNull(it.moveNext())) |
1675 list[dartx.add](it.current); | 1675 list[dartx.add](it.current); |
1676 } else { | 1676 } else { |
1677 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1677 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
1678 if (!dart.notNull(it.moveNext())) { | 1678 if (!dart.notNull(it.moveNext())) { |
1679 throw new RangeError.range(end, start, i); | 1679 throw new RangeError.range(end, start, i); |
1680 } | 1680 } |
1681 list[dartx.add](it.current); | 1681 list[dartx.add](it.current); |
1682 } | 1682 } |
1683 } | 1683 } |
1684 return _js_helper.Primitives.stringFromCharCodes(list); | 1684 return _js_helper.Primitives.stringFromCharCodes(list); |
(...skipping 20 matching lines...) Expand all Loading... |
1705 return new RuneIterator(this.string); | 1705 return new RuneIterator(this.string); |
1706 } | 1706 } |
1707 get last() { | 1707 get last() { |
1708 if (this.string.length == 0) { | 1708 if (this.string.length == 0) { |
1709 throw new StateError('No elements.'); | 1709 throw new StateError('No elements.'); |
1710 } | 1710 } |
1711 let length = this.string.length; | 1711 let length = this.string.length; |
1712 let code = this.string[dartx.codeUnitAt](dart.notNull(length) - 1); | 1712 let code = this.string[dartx.codeUnitAt](dart.notNull(length) - 1); |
1713 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string.
length) > 1) { | 1713 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string.
length) > 1) { |
1714 let previousCode = this.string[dartx.codeUnitAt](dart.notNull(length
) - 2); | 1714 let previousCode = this.string[dartx.codeUnitAt](dart.notNull(length
) - 2); |
1715 if (_isLeadSurrogate(previousCode)) { | 1715 if (dart.notNull(_isLeadSurrogate(previousCode))) { |
1716 return _combineSurrogatePair(previousCode, code); | 1716 return _combineSurrogatePair(previousCode, code); |
1717 } | 1717 } |
1718 } | 1718 } |
1719 return code; | 1719 return code; |
1720 } | 1720 } |
1721 } | 1721 } |
1722 dart.setSignature(Runes, { | 1722 dart.setSignature(Runes, { |
1723 constructors: () => ({Runes: [exports.Runes, [String]]}) | 1723 constructors: () => ({Runes: [exports.Runes, [String]]}) |
1724 }); | 1724 }); |
1725 return Runes; | 1725 return Runes; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 moveNext() { | 1793 moveNext() { |
1794 this[_position] = this[_nextPosition]; | 1794 this[_position] = this[_nextPosition]; |
1795 if (this[_position] == this.string.length) { | 1795 if (this[_position] == this.string.length) { |
1796 this[_currentCodePoint] = null; | 1796 this[_currentCodePoint] = null; |
1797 return false; | 1797 return false; |
1798 } | 1798 } |
1799 let codeUnit = this.string[dartx.codeUnitAt](this[_position]); | 1799 let codeUnit = this.string[dartx.codeUnitAt](this[_position]); |
1800 let nextPosition = dart.notNull(this[_position]) + 1; | 1800 let nextPosition = dart.notNull(this[_position]) + 1; |
1801 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition)
< dart.notNull(this.string.length)) { | 1801 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition)
< dart.notNull(this.string.length)) { |
1802 let nextCodeUnit = this.string[dartx.codeUnitAt](nextPosition); | 1802 let nextCodeUnit = this.string[dartx.codeUnitAt](nextPosition); |
1803 if (_isTrailSurrogate(nextCodeUnit)) { | 1803 if (dart.notNull(_isTrailSurrogate(nextCodeUnit))) { |
1804 this[_nextPosition] = dart.notNull(nextPosition) + 1; | 1804 this[_nextPosition] = dart.notNull(nextPosition) + 1; |
1805 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit
); | 1805 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit
); |
1806 return true; | 1806 return true; |
1807 } | 1807 } |
1808 } | 1808 } |
1809 this[_nextPosition] = nextPosition; | 1809 this[_nextPosition] = nextPosition; |
1810 this[_currentCodePoint] = codeUnit; | 1810 this[_currentCodePoint] = codeUnit; |
1811 return true; | 1811 return true; |
1812 } | 1812 } |
1813 movePrevious() { | 1813 movePrevious() { |
1814 this[_nextPosition] = this[_position]; | 1814 this[_nextPosition] = this[_position]; |
1815 if (this[_position] == 0) { | 1815 if (this[_position] == 0) { |
1816 this[_currentCodePoint] = null; | 1816 this[_currentCodePoint] = null; |
1817 return false; | 1817 return false; |
1818 } | 1818 } |
1819 let position = dart.notNull(this[_position]) - 1; | 1819 let position = dart.notNull(this[_position]) - 1; |
1820 let codeUnit = this.string[dartx.codeUnitAt](position); | 1820 let codeUnit = this.string[dartx.codeUnitAt](position); |
1821 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position) >
0) { | 1821 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position) >
0) { |
1822 let prevCodeUnit = this.string[dartx.codeUnitAt](dart.notNull(position)
- 1); | 1822 let prevCodeUnit = this.string[dartx.codeUnitAt](dart.notNull(position)
- 1); |
1823 if (_isLeadSurrogate(prevCodeUnit)) { | 1823 if (dart.notNull(_isLeadSurrogate(prevCodeUnit))) { |
1824 this[_position] = dart.notNull(position) - 1; | 1824 this[_position] = dart.notNull(position) - 1; |
1825 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit
); | 1825 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit
); |
1826 return true; | 1826 return true; |
1827 } | 1827 } |
1828 } | 1828 } |
1829 this[_position] = position; | 1829 this[_position] = position; |
1830 this[_currentCodePoint] = codeUnit; | 1830 this[_currentCodePoint] = codeUnit; |
1831 return true; | 1831 return true; |
1832 } | 1832 } |
1833 } | 1833 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 } | 1867 } |
1868 writeCharCode(charCode) { | 1868 writeCharCode(charCode) { |
1869 this[_writeString](String.fromCharCode(charCode)); | 1869 this[_writeString](String.fromCharCode(charCode)); |
1870 } | 1870 } |
1871 writeAll(objects, separator) { | 1871 writeAll(objects, separator) { |
1872 if (separator === void 0) | 1872 if (separator === void 0) |
1873 separator = ""; | 1873 separator = ""; |
1874 let iterator = objects[dartx.iterator]; | 1874 let iterator = objects[dartx.iterator]; |
1875 if (!dart.notNull(iterator.moveNext())) | 1875 if (!dart.notNull(iterator.moveNext())) |
1876 return; | 1876 return; |
1877 if (separator[dartx.isEmpty]) { | 1877 if (dart.notNull(separator[dartx.isEmpty])) { |
1878 do { | 1878 do { |
1879 this.write(iterator.current); | 1879 this.write(iterator.current); |
1880 } while (iterator.moveNext()); | 1880 } while (dart.notNull(iterator.moveNext())); |
1881 } else { | 1881 } else { |
1882 this.write(iterator.current); | 1882 this.write(iterator.current); |
1883 while (iterator.moveNext()) { | 1883 while (dart.notNull(iterator.moveNext())) { |
1884 this.write(separator); | 1884 this.write(separator); |
1885 this.write(iterator.current); | 1885 this.write(iterator.current); |
1886 } | 1886 } |
1887 } | 1887 } |
1888 } | 1888 } |
1889 writeln(obj) { | 1889 writeln(obj) { |
1890 if (obj === void 0) | 1890 if (obj === void 0) |
1891 obj = ""; | 1891 obj = ""; |
1892 this.write(obj); | 1892 this.write(obj); |
1893 this.write("\n"); | 1893 this.write("\n"); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 let sb = new StringBuffer(); | 1946 let sb = new StringBuffer(); |
1947 this[_writeAuthority](sb); | 1947 this[_writeAuthority](sb); |
1948 return dart.toString(sb); | 1948 return dart.toString(sb); |
1949 } | 1949 } |
1950 get userInfo() { | 1950 get userInfo() { |
1951 return this[_userInfo]; | 1951 return this[_userInfo]; |
1952 } | 1952 } |
1953 get host() { | 1953 get host() { |
1954 if (this[_host] == null) | 1954 if (this[_host] == null) |
1955 return ""; | 1955 return ""; |
1956 if (this[_host][dartx.startsWith]('[')) { | 1956 if (dart.notNull(this[_host][dartx.startsWith]('['))) { |
1957 return this[_host][dartx.substring](1, dart.notNull(this[_host].length)
- 1); | 1957 return this[_host][dartx.substring](1, dart.notNull(this[_host].length)
- 1); |
1958 } | 1958 } |
1959 return this[_host]; | 1959 return this[_host]; |
1960 } | 1960 } |
1961 get port() { | 1961 get port() { |
1962 if (this[_port] == null) | 1962 if (this[_port] == null) |
1963 return Uri._defaultPort(this.scheme); | 1963 return Uri._defaultPort(this.scheme); |
1964 return this[_port]; | 1964 return this[_port]; |
1965 } | 1965 } |
1966 static _defaultPort(scheme) { | 1966 static _defaultPort(scheme) { |
1967 if (scheme == "http") | 1967 if (scheme == "http") |
1968 return 80; | 1968 return 80; |
1969 if (scheme == "https") | 1969 if (scheme == "https") |
1970 return 443; | 1970 return 443; |
1971 return 0; | 1971 return 0; |
1972 } | 1972 } |
1973 get path() { | 1973 get path() { |
1974 return this[_path]; | 1974 return this[_path]; |
1975 } | 1975 } |
1976 get query() { | 1976 get query() { |
1977 return this[_query] == null ? "" : this[_query]; | 1977 return this[_query] == null ? "" : this[_query]; |
1978 } | 1978 } |
1979 get fragment() { | 1979 get fragment() { |
1980 return this[_fragment] == null ? "" : this[_fragment]; | 1980 return this[_fragment] == null ? "" : this[_fragment]; |
1981 } | 1981 } |
1982 static parse(uri) { | 1982 static parse(uri) { |
1983 let isRegName = ch => { | 1983 let isRegName = ch => { |
1984 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dsend(Ur
i._regNameTable[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) &
15)), 0)); | 1984 return dart.notNull(ch) < 128 && !dart.equals(dart.dsend(Uri._regNameTab
le[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0); |
1985 }; | 1985 }; |
1986 dart.fn(isRegName, bool, [int]); | 1986 dart.fn(isRegName, bool, [int]); |
1987 let EOI = -1; | 1987 let EOI = -1; |
1988 let scheme = ""; | 1988 let scheme = ""; |
1989 let userinfo = ""; | 1989 let userinfo = ""; |
1990 let host = null; | 1990 let host = null; |
1991 let port = null; | 1991 let port = null; |
1992 let path = null; | 1992 let path = null; |
1993 let query = null; | 1993 let query = null; |
1994 let fragment = null; | 1994 let fragment = null; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2220 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); | 2220 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); |
2221 hostEnd = dart.notNull(hostEnd) + 1; | 2221 hostEnd = dart.notNull(hostEnd) + 1; |
2222 if (hostEnd != authority.length && authority[dartx.codeUnitAt](hostEnd
) != Uri._COLON) { | 2222 if (hostEnd != authority.length && authority[dartx.codeUnitAt](hostEnd
) != Uri._COLON) { |
2223 throw new FormatException("Invalid end of authority", authority, hos
tEnd); | 2223 throw new FormatException("Invalid end of authority", authority, hos
tEnd); |
2224 } | 2224 } |
2225 } | 2225 } |
2226 let hasPort = false; | 2226 let hasPort = false; |
2227 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd =
dart.notNull(hostEnd) + 1) { | 2227 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd =
dart.notNull(hostEnd) + 1) { |
2228 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) { | 2228 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) { |
2229 let portString = authority[dartx.substring](dart.notNull(hostEnd) +
1); | 2229 let portString = authority[dartx.substring](dart.notNull(hostEnd) +
1); |
2230 if (portString[dartx.isNotEmpty]) | 2230 if (dart.notNull(portString[dartx.isNotEmpty])) |
2231 port = int.parse(portString); | 2231 port = int.parse(portString); |
2232 break; | 2232 break; |
2233 } | 2233 } |
2234 } | 2234 } |
2235 host = authority[dartx.substring](hostStart, hostEnd); | 2235 host = authority[dartx.substring](hostStart, hostEnd); |
2236 } | 2236 } |
2237 return Uri.new({scheme: scheme, userInfo: userInfo, host: dart.as(host, St
ring), port: dart.as(port, int), pathSegments: unencodedPath[dartx.split]("/"),
queryParameters: queryParameters}); | 2237 return Uri.new({scheme: scheme, userInfo: userInfo, host: dart.as(host, St
ring), port: dart.as(port, int), pathSegments: unencodedPath[dartx.split]("/"),
queryParameters: queryParameters}); |
2238 } | 2238 } |
2239 static file(path, opts) { | 2239 static file(path, opts) { |
2240 let windows = opts && 'windows' in opts ? opts.windows : null; | 2240 let windows = opts && 'windows' in opts ? opts.windows : null; |
2241 windows = windows == null ? Uri._isWindows : windows; | 2241 windows = windows == null ? Uri._isWindows : windows; |
2242 return windows ? dart.as(Uri._makeWindowsFileUrl(path), Uri) : dart.as(Uri
._makeFileUri(path), Uri); | 2242 return dart.notNull(windows) ? dart.as(Uri._makeWindowsFileUrl(path), Uri)
: dart.as(Uri._makeFileUri(path), Uri); |
2243 } | 2243 } |
2244 static get base() { | 2244 static get base() { |
2245 let uri = _js_helper.Primitives.currentUri(); | 2245 let uri = _js_helper.Primitives.currentUri(); |
2246 if (uri != null) | 2246 if (uri != null) |
2247 return Uri.parse(uri); | 2247 return Uri.parse(uri); |
2248 throw new UnsupportedError("'Uri.base' is not supported"); | 2248 throw new UnsupportedError("'Uri.base' is not supported"); |
2249 } | 2249 } |
2250 static get _isWindows() { | 2250 static get _isWindows() { |
2251 return false; | 2251 return false; |
2252 } | 2252 } |
2253 static _checkNonWindowsPathReservedCharacters(segments, argumentError) { | 2253 static _checkNonWindowsPathReservedCharacters(segments, argumentError) { |
2254 segments[dartx.forEach](dart.fn(segment => { | 2254 segments[dartx.forEach](dart.fn(segment => { |
2255 if (dart.dsend(segment, 'contains', "/")) { | 2255 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', "/"), bool))) { |
2256 if (argumentError) { | 2256 if (dart.notNull(argumentError)) { |
2257 throw new ArgumentError(`Illegal path character ${segment}`); | 2257 throw new ArgumentError(`Illegal path character ${segment}`); |
2258 } else { | 2258 } else { |
2259 throw new UnsupportedError(`Illegal path character ${segment}`); | 2259 throw new UnsupportedError(`Illegal path character ${segment}`); |
2260 } | 2260 } |
2261 } | 2261 } |
2262 })); | 2262 })); |
2263 } | 2263 } |
2264 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg
ment) { | 2264 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg
ment) { |
2265 if (firstSegment === void 0) | 2265 if (firstSegment === void 0) |
2266 firstSegment = 0; | 2266 firstSegment = 0; |
2267 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => { | 2267 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => { |
2268 if (dart.dsend(segment, 'contains', RegExp.new('["*/:<>?\\\\|]'))) { | 2268 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', RegExp.new('["*
/:<>?\\\\|]')), bool))) { |
2269 if (argumentError) { | 2269 if (dart.notNull(argumentError)) { |
2270 throw new ArgumentError("Illegal character in path"); | 2270 throw new ArgumentError("Illegal character in path"); |
2271 } else { | 2271 } else { |
2272 throw new UnsupportedError("Illegal character in path"); | 2272 throw new UnsupportedError("Illegal character in path"); |
2273 } | 2273 } |
2274 } | 2274 } |
2275 })); | 2275 })); |
2276 } | 2276 } |
2277 static _checkWindowsDriveLetter(charCode, argumentError) { | 2277 static _checkWindowsDriveLetter(charCode, argumentError) { |
2278 if (dart.notNull(Uri._UPPER_CASE_A) <= dart.notNull(charCode) && dart.notN
ull(charCode) <= dart.notNull(Uri._UPPER_CASE_Z) || dart.notNull(Uri._LOWER_CASE
_A) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri._LOW
ER_CASE_Z)) { | 2278 if (dart.notNull(Uri._UPPER_CASE_A) <= dart.notNull(charCode) && dart.notN
ull(charCode) <= dart.notNull(Uri._UPPER_CASE_Z) || dart.notNull(Uri._LOWER_CASE
_A) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri._LOW
ER_CASE_Z)) { |
2279 return; | 2279 return; |
2280 } | 2280 } |
2281 if (argumentError) { | 2281 if (dart.notNull(argumentError)) { |
2282 throw new ArgumentError("Illegal drive letter " + dart.notNull(String.fr
omCharCode(charCode))); | 2282 throw new ArgumentError("Illegal drive letter " + dart.notNull(String.fr
omCharCode(charCode))); |
2283 } else { | 2283 } else { |
2284 throw new UnsupportedError("Illegal drive letter " + dart.notNull(String
.fromCharCode(charCode))); | 2284 throw new UnsupportedError("Illegal drive letter " + dart.notNull(String
.fromCharCode(charCode))); |
2285 } | 2285 } |
2286 } | 2286 } |
2287 static _makeFileUri(path) { | 2287 static _makeFileUri(path) { |
2288 let sep = "/"; | 2288 let sep = "/"; |
2289 if (path[dartx.startsWith](sep)) { | 2289 if (dart.notNull(path[dartx.startsWith](sep))) { |
2290 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)}); | 2290 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)}); |
2291 } else { | 2291 } else { |
2292 return Uri.new({pathSegments: path[dartx.split](sep)}); | 2292 return Uri.new({pathSegments: path[dartx.split](sep)}); |
2293 } | 2293 } |
2294 } | 2294 } |
2295 static _makeWindowsFileUrl(path) { | 2295 static _makeWindowsFileUrl(path) { |
2296 if (path[dartx.startsWith]("\\\\?\\")) { | 2296 if (dart.notNull(path[dartx.startsWith]("\\\\?\\"))) { |
2297 if (path[dartx.startsWith]("\\\\?\\UNC\\")) { | 2297 if (dart.notNull(path[dartx.startsWith]("\\\\?\\UNC\\"))) { |
2298 path = `\\${path[dartx.substring](7)}`; | 2298 path = `\\${path[dartx.substring](7)}`; |
2299 } else { | 2299 } else { |
2300 path = path[dartx.substring](4); | 2300 path = path[dartx.substring](4); |
2301 if (dart.notNull(path.length) < 3 || path[dartx.codeUnitAt](1) != Uri.
_COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { | 2301 if (dart.notNull(path.length) < 3 || path[dartx.codeUnitAt](1) != Uri.
_COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { |
2302 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a
bsolute"); | 2302 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a
bsolute"); |
2303 } | 2303 } |
2304 } | 2304 } |
2305 } else { | 2305 } else { |
2306 path = path[dartx.replaceAll]("/", "\\"); | 2306 path = path[dartx.replaceAll]("/", "\\"); |
2307 } | 2307 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 let isFile = scheme == "file"; | 2354 let isFile = scheme == "file"; |
2355 if (userInfo != null) { | 2355 if (userInfo != null) { |
2356 userInfo = Uri._makeUserInfo(userInfo, 0, userInfo.length); | 2356 userInfo = Uri._makeUserInfo(userInfo, 0, userInfo.length); |
2357 } else { | 2357 } else { |
2358 userInfo = this.userInfo; | 2358 userInfo = this.userInfo; |
2359 } | 2359 } |
2360 if (port != null) { | 2360 if (port != null) { |
2361 port = Uri._makePort(port, scheme); | 2361 port = Uri._makePort(port, scheme); |
2362 } else { | 2362 } else { |
2363 port = this[_port]; | 2363 port = this[_port]; |
2364 if (schemeChanged) { | 2364 if (dart.notNull(schemeChanged)) { |
2365 port = Uri._makePort(port, scheme); | 2365 port = Uri._makePort(port, scheme); |
2366 } | 2366 } |
2367 } | 2367 } |
2368 if (host != null) { | 2368 if (host != null) { |
2369 host = Uri._makeHost(host, 0, host.length, false); | 2369 host = Uri._makeHost(host, 0, host.length, false); |
2370 } else if (this.hasAuthority) { | 2370 } else if (dart.notNull(this.hasAuthority)) { |
2371 host = this.host; | 2371 host = this.host; |
2372 } else if (dart.notNull(userInfo[dartx.isNotEmpty]) || port != null || dar
t.notNull(isFile)) { | 2372 } else if (dart.notNull(userInfo[dartx.isNotEmpty]) || port != null || dar
t.notNull(isFile)) { |
2373 host = ""; | 2373 host = ""; |
2374 } | 2374 } |
2375 let ensureLeadingSlash = host != null; | 2375 let ensureLeadingSlash = host != null; |
2376 if (path != null || dart.notNull(pathSegments != null)) { | 2376 if (path != null || pathSegments != null) { |
2377 path = Uri._makePath(path, 0, Uri._stringOrNullLength(path), pathSegment
s, ensureLeadingSlash, isFile); | 2377 path = Uri._makePath(path, 0, Uri._stringOrNullLength(path), pathSegment
s, ensureLeadingSlash, isFile); |
2378 } else { | 2378 } else { |
2379 path = this.path; | 2379 path = this.path; |
2380 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n
otNull(path[dartx.isEmpty])) && !dart.notNull(path[dartx.startsWith]('/'))) { | 2380 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n
otNull(path[dartx.isEmpty])) && !dart.notNull(path[dartx.startsWith]('/'))) { |
2381 path = `/${path}`; | 2381 path = `/${path}`; |
2382 } | 2382 } |
2383 } | 2383 } |
2384 if (query != null || dart.notNull(queryParameters != null)) { | 2384 if (query != null || queryParameters != null) { |
2385 query = Uri._makeQuery(query, 0, Uri._stringOrNullLength(query), queryPa
rameters); | 2385 query = Uri._makeQuery(query, 0, Uri._stringOrNullLength(query), queryPa
rameters); |
2386 } else if (this.hasQuery) { | 2386 } else if (dart.notNull(this.hasQuery)) { |
2387 query = this.query; | 2387 query = this.query; |
2388 } | 2388 } |
2389 if (fragment != null) { | 2389 if (fragment != null) { |
2390 fragment = Uri._makeFragment(fragment, 0, fragment.length); | 2390 fragment = Uri._makeFragment(fragment, 0, fragment.length); |
2391 } else if (this.hasFragment) { | 2391 } else if (dart.notNull(this.hasFragment)) { |
2392 fragment = this.fragment; | 2392 fragment = this.fragment; |
2393 } | 2393 } |
2394 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme
nt); | 2394 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme
nt); |
2395 } | 2395 } |
2396 get pathSegments() { | 2396 get pathSegments() { |
2397 if (this[_pathSegments] == null) { | 2397 if (this[_pathSegments] == null) { |
2398 let pathToSplit = !dart.notNull(this.path[dartx.isEmpty]) && this.path[d
artx.codeUnitAt](0) == Uri._SLASH ? this.path[dartx.substring](1) : this.path; | 2398 let pathToSplit = !dart.notNull(this.path[dartx.isEmpty]) && this.path[d
artx.codeUnitAt](0) == Uri._SLASH ? this.path[dartx.substring](1) : this.path; |
2399 this[_pathSegments] = new (collection.UnmodifiableListView$(String))(pat
hToSplit == "" ? dart.const(dart.list([], String)) : List$(String).from(pathToSp
lit[dartx.split]("/")[dartx.map](Uri.decodeComponent), {growable: false})); | 2399 this[_pathSegments] = new (collection.UnmodifiableListView$(String))(pat
hToSplit == "" ? dart.const(dart.list([], String)) : List$(String).from(pathToSp
lit[dartx.split]("/")[dartx.map](Uri.decodeComponent), {growable: false})); |
2400 } | 2400 } |
2401 return this[_pathSegments]; | 2401 return this[_pathSegments]; |
(...skipping 25 matching lines...) Expand all Loading... |
2427 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 2427 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
2428 if (host[dartx.codeUnitAt](i) == Uri._COLON) { | 2428 if (host[dartx.codeUnitAt](i) == Uri._COLON) { |
2429 Uri.parseIPv6Address(host, start, end); | 2429 Uri.parseIPv6Address(host, start, end); |
2430 return `[${host}]`; | 2430 return `[${host}]`; |
2431 } | 2431 } |
2432 } | 2432 } |
2433 } | 2433 } |
2434 return Uri._normalizeRegName(host, start, end); | 2434 return Uri._normalizeRegName(host, start, end); |
2435 } | 2435 } |
2436 static _isRegNameChar(char) { | 2436 static _isRegNameChar(char) { |
2437 return dart.notNull(char) < 127 && dart.notNull(!dart.equals(dart.dsend(Ur
i._regNameTable[dartx.get](dart.notNull(char) >> 4), '&', 1 << (dart.notNull(cha
r) & 15)), 0)); | 2437 return dart.notNull(char) < 127 && !dart.equals(dart.dsend(Uri._regNameTab
le[dartx.get](dart.notNull(char) >> 4), '&', 1 << (dart.notNull(char) & 15)), 0)
; |
2438 } | 2438 } |
2439 static _normalizeRegName(host, start, end) { | 2439 static _normalizeRegName(host, start, end) { |
2440 let buffer = null; | 2440 let buffer = null; |
2441 let sectionStart = start; | 2441 let sectionStart = start; |
2442 let index = start; | 2442 let index = start; |
2443 let isNormalized = true; | 2443 let isNormalized = true; |
2444 while (dart.notNull(index) < dart.notNull(end)) { | 2444 while (dart.notNull(index) < dart.notNull(end)) { |
2445 let char = host[dartx.codeUnitAt](index); | 2445 let char = host[dartx.codeUnitAt](index); |
2446 if (char == Uri._PERCENT) { | 2446 if (char == Uri._PERCENT) { |
2447 let replacement = Uri._normalizeEscape(host, index, true); | 2447 let replacement = Uri._normalizeEscape(host, index, true); |
(...skipping 11 matching lines...) Expand all Loading... |
2459 if (replacement == null) { | 2459 if (replacement == null) { |
2460 replacement = host[dartx.substring](index, dart.notNull(index) + 3); | 2460 replacement = host[dartx.substring](index, dart.notNull(index) + 3); |
2461 } else if (replacement == "%") { | 2461 } else if (replacement == "%") { |
2462 replacement = "%25"; | 2462 replacement = "%25"; |
2463 sourceLength = 1; | 2463 sourceLength = 1; |
2464 } | 2464 } |
2465 buffer.write(replacement); | 2465 buffer.write(replacement); |
2466 index = dart.notNull(index) + dart.notNull(sourceLength); | 2466 index = dart.notNull(index) + dart.notNull(sourceLength); |
2467 sectionStart = index; | 2467 sectionStart = index; |
2468 isNormalized = true; | 2468 isNormalized = true; |
2469 } else if (Uri._isRegNameChar(char)) { | 2469 } else if (dart.notNull(Uri._isRegNameChar(char))) { |
2470 if (dart.notNull(isNormalized) && dart.notNull(Uri._UPPER_CASE_A) <= d
art.notNull(char) && dart.notNull(Uri._UPPER_CASE_Z) >= dart.notNull(char)) { | 2470 if (dart.notNull(isNormalized) && dart.notNull(Uri._UPPER_CASE_A) <= d
art.notNull(char) && dart.notNull(Uri._UPPER_CASE_Z) >= dart.notNull(char)) { |
2471 if (buffer == null) | 2471 if (buffer == null) |
2472 buffer = new StringBuffer(); | 2472 buffer = new StringBuffer(); |
2473 if (dart.notNull(sectionStart) < dart.notNull(index)) { | 2473 if (dart.notNull(sectionStart) < dart.notNull(index)) { |
2474 buffer.write(host[dartx.substring](sectionStart, index)); | 2474 buffer.write(host[dartx.substring](sectionStart, index)); |
2475 sectionStart = index; | 2475 sectionStart = index; |
2476 } | 2476 } |
2477 isNormalized = false; | 2477 isNormalized = false; |
2478 } | 2478 } |
2479 index = dart.notNull(index) + 1; | 2479 index = dart.notNull(index) + 1; |
2480 } else if (Uri._isGeneralDelimiter(char)) { | 2480 } else if (dart.notNull(Uri._isGeneralDelimiter(char))) { |
2481 Uri._fail(host, index, "Invalid character"); | 2481 Uri._fail(host, index, "Invalid character"); |
2482 } else { | 2482 } else { |
2483 let sourceLength = 1; | 2483 let sourceLength = 1; |
2484 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 <
dart.notNull(end)) { | 2484 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 <
dart.notNull(end)) { |
2485 let tail = host[dartx.codeUnitAt](dart.notNull(index) + 1); | 2485 let tail = host[dartx.codeUnitAt](dart.notNull(index) + 1); |
2486 if ((dart.notNull(tail) & 64512) == 56320) { | 2486 if ((dart.notNull(tail) & 64512) == 56320) { |
2487 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta
il) & 1023; | 2487 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta
il) & 1023; |
2488 sourceLength = 2; | 2488 sourceLength = 2; |
2489 } | 2489 } |
2490 } | 2490 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2530 if (!dart.notNull(allLowercase)) | 2530 if (!dart.notNull(allLowercase)) |
2531 scheme = scheme[dartx.toLowerCase](); | 2531 scheme = scheme[dartx.toLowerCase](); |
2532 return scheme; | 2532 return scheme; |
2533 } | 2533 } |
2534 static _makeUserInfo(userInfo, start, end) { | 2534 static _makeUserInfo(userInfo, start, end) { |
2535 if (userInfo == null) | 2535 if (userInfo == null) |
2536 return ""; | 2536 return ""; |
2537 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li
st$(int))); | 2537 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li
st$(int))); |
2538 } | 2538 } |
2539 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile)
{ | 2539 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile)
{ |
2540 if (path == null && dart.notNull(pathSegments == null)) | 2540 if (path == null && pathSegments == null) |
2541 return isFile ? "/" : ""; | 2541 return dart.notNull(isFile) ? "/" : ""; |
2542 if (path != null && dart.notNull(pathSegments != null)) { | 2542 if (path != null && pathSegments != null) { |
2543 throw new ArgumentError('Both path and pathSegments specified'); | 2543 throw new ArgumentError('Both path and pathSegments specified'); |
2544 } | 2544 } |
2545 let result = null; | 2545 let result = null; |
2546 if (path != null) { | 2546 if (path != null) { |
2547 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa
ble, List$(int))); | 2547 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa
ble, List$(int))); |
2548 } else { | 2548 } else { |
2549 result = pathSegments[dartx.map](dart.fn(s => Uri._uriEncode(dart.as(Uri
._pathCharTable, List$(int)), dart.as(s, String)), String, [Object]))[dartx.join
]("/"); | 2549 result = pathSegments[dartx.map](dart.fn(s => Uri._uriEncode(dart.as(Uri
._pathCharTable, List$(int)), dart.as(s, String)), String, [Object]))[dartx.join
]("/"); |
2550 } | 2550 } |
2551 if (dart.dload(result, 'isEmpty')) { | 2551 if (dart.notNull(dart.as(dart.dload(result, 'isEmpty'), bool))) { |
2552 if (isFile) | 2552 if (dart.notNull(isFile)) |
2553 return "/"; | 2553 return "/"; |
2554 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d
art.notNull(!dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH))) { | 2554 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && !
dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH)) { |
2555 return `/${result}`; | 2555 return `/${result}`; |
2556 } | 2556 } |
2557 return dart.as(result, String); | 2557 return dart.as(result, String); |
2558 } | 2558 } |
2559 static _makeQuery(query, start, end, queryParameters) { | 2559 static _makeQuery(query, start, end, queryParameters) { |
2560 if (query == null && dart.notNull(queryParameters == null)) | 2560 if (query == null && queryParameters == null) |
2561 return null; | 2561 return null; |
2562 if (query != null && dart.notNull(queryParameters != null)) { | 2562 if (query != null && queryParameters != null) { |
2563 throw new ArgumentError('Both query and queryParameters specified'); | 2563 throw new ArgumentError('Both query and queryParameters specified'); |
2564 } | 2564 } |
2565 if (query != null) | 2565 if (query != null) |
2566 return Uri._normalize(query, start, end, dart.as(Uri._queryCharTable, Li
st$(int))); | 2566 return Uri._normalize(query, start, end, dart.as(Uri._queryCharTable, Li
st$(int))); |
2567 let result = new StringBuffer(); | 2567 let result = new StringBuffer(); |
2568 let first = true; | 2568 let first = true; |
2569 queryParameters.forEach(dart.fn((key, value) => { | 2569 queryParameters.forEach(dart.fn((key, value) => { |
2570 if (!dart.notNull(first)) { | 2570 if (!dart.notNull(first)) { |
2571 result.write("&"); | 2571 result.write("&"); |
2572 } | 2572 } |
2573 first = false; | 2573 first = false; |
2574 result.write(Uri.encodeQueryComponent(dart.as(key, String))); | 2574 result.write(Uri.encodeQueryComponent(dart.as(key, String))); |
2575 if (dart.notNull(value != null) && dart.notNull(dart.dsend(dart.dload(va
lue, 'isEmpty'), '!'))) { | 2575 if (value != null && !dart.notNull(dart.as(dart.dload(value, 'isEmpty'),
bool))) { |
2576 result.write("="); | 2576 result.write("="); |
2577 result.write(Uri.encodeQueryComponent(dart.as(value, String))); | 2577 result.write(Uri.encodeQueryComponent(dart.as(value, String))); |
2578 } | 2578 } |
2579 })); | 2579 })); |
2580 return dart.toString(result); | 2580 return dart.toString(result); |
2581 } | 2581 } |
2582 static _makeFragment(fragment, start, end) { | 2582 static _makeFragment(fragment, start, end) { |
2583 if (fragment == null) | 2583 if (fragment == null) |
2584 return null; | 2584 return null; |
2585 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L
ist$(int))); | 2585 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L
ist$(int))); |
(...skipping 18 matching lines...) Expand all Loading... |
2604 dart.assert(source[dartx.codeUnitAt](index) == Uri._PERCENT); | 2604 dart.assert(source[dartx.codeUnitAt](index) == Uri._PERCENT); |
2605 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) { | 2605 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) { |
2606 return "%"; | 2606 return "%"; |
2607 } | 2607 } |
2608 let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1); | 2608 let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1); |
2609 let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2); | 2609 let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2); |
2610 if (!dart.notNull(Uri._isHexDigit(firstDigit)) || !dart.notNull(Uri._isHex
Digit(secondDigit))) { | 2610 if (!dart.notNull(Uri._isHexDigit(firstDigit)) || !dart.notNull(Uri._isHex
Digit(secondDigit))) { |
2611 return "%"; | 2611 return "%"; |
2612 } | 2612 } |
2613 let value = dart.notNull(Uri._hexValue(firstDigit)) * 16 + dart.notNull(Ur
i._hexValue(secondDigit)); | 2613 let value = dart.notNull(Uri._hexValue(firstDigit)) * 16 + dart.notNull(Ur
i._hexValue(secondDigit)); |
2614 if (Uri._isUnreservedChar(value)) { | 2614 if (dart.notNull(Uri._isUnreservedChar(value))) { |
2615 if (dart.notNull(lowerCase) && dart.notNull(Uri._UPPER_CASE_A) <= dart.n
otNull(value) && dart.notNull(Uri._UPPER_CASE_Z) >= dart.notNull(value)) { | 2615 if (dart.notNull(lowerCase) && dart.notNull(Uri._UPPER_CASE_A) <= dart.n
otNull(value) && dart.notNull(Uri._UPPER_CASE_Z) >= dart.notNull(value)) { |
2616 value = dart.notNull(value) | 32; | 2616 value = dart.notNull(value) | 32; |
2617 } | 2617 } |
2618 return String.fromCharCode(value); | 2618 return String.fromCharCode(value); |
2619 } | 2619 } |
2620 if (dart.notNull(firstDigit) >= dart.notNull(Uri._LOWER_CASE_A) || dart.no
tNull(secondDigit) >= dart.notNull(Uri._LOWER_CASE_A)) { | 2620 if (dart.notNull(firstDigit) >= dart.notNull(Uri._LOWER_CASE_A) || dart.no
tNull(secondDigit) >= dart.notNull(Uri._LOWER_CASE_A)) { |
2621 return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toU
pperCase](); | 2621 return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toU
pperCase](); |
2622 } | 2622 } |
2623 return null; | 2623 return null; |
2624 } | 2624 } |
2625 static _isUnreservedChar(ch) { | 2625 static _isUnreservedChar(ch) { |
2626 return dart.notNull(ch) < 127 && dart.notNull(!dart.equals(dart.dsend(Uri.
_unreservedTable[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch)
& 15)), 0)); | 2626 return dart.notNull(ch) < 127 && !dart.equals(dart.dsend(Uri._unreservedTa
ble[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0); |
2627 } | 2627 } |
2628 static _escapeChar(char) { | 2628 static _escapeChar(char) { |
2629 dart.assert(dart.dsend(char, '<=', 1114111)); | 2629 dart.assert(dart.dsend(char, '<=', 1114111)); |
2630 let hexDigits = "0123456789ABCDEF"; | 2630 let hexDigits = "0123456789ABCDEF"; |
2631 let codeUnits = null; | 2631 let codeUnits = null; |
2632 if (dart.dsend(char, '<', 128)) { | 2632 if (dart.notNull(dart.as(dart.dsend(char, '<', 128), bool))) { |
2633 codeUnits = List.new(3); | 2633 codeUnits = List.new(3); |
2634 codeUnits[dartx.set](0, Uri._PERCENT); | 2634 codeUnits[dartx.set](0, Uri._PERCENT); |
2635 codeUnits[dartx.set](1, hexDigits[dartx.codeUnitAt](dart.as(dart.dsend(c
har, '>>', 4), int))); | 2635 codeUnits[dartx.set](1, hexDigits[dartx.codeUnitAt](dart.as(dart.dsend(c
har, '>>', 4), int))); |
2636 codeUnits[dartx.set](2, hexDigits[dartx.codeUnitAt](dart.as(dart.dsend(c
har, '&', 15), int))); | 2636 codeUnits[dartx.set](2, hexDigits[dartx.codeUnitAt](dart.as(dart.dsend(c
har, '&', 15), int))); |
2637 } else { | 2637 } else { |
2638 let flag = 192; | 2638 let flag = 192; |
2639 let encodedBytes = 2; | 2639 let encodedBytes = 2; |
2640 if (dart.dsend(char, '>', 2047)) { | 2640 if (dart.notNull(dart.as(dart.dsend(char, '>', 2047), bool))) { |
2641 flag = 224; | 2641 flag = 224; |
2642 encodedBytes = 3; | 2642 encodedBytes = 3; |
2643 if (dart.dsend(char, '>', 65535)) { | 2643 if (dart.notNull(dart.as(dart.dsend(char, '>', 65535), bool))) { |
2644 encodedBytes = 4; | 2644 encodedBytes = 4; |
2645 flag = 240; | 2645 flag = 240; |
2646 } | 2646 } |
2647 } | 2647 } |
2648 codeUnits = List.new(3 * dart.notNull(encodedBytes)); | 2648 codeUnits = List.new(3 * dart.notNull(encodedBytes)); |
2649 let index = 0; | 2649 let index = 0; |
2650 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) { | 2650 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) { |
2651 let byte = dart.as(dart.dsend(dart.dsend(dart.dsend(char, '>>', 6 * da
rt.notNull(encodedBytes)), '&', 63), '|', flag), int); | 2651 let byte = dart.as(dart.dsend(dart.dsend(dart.dsend(char, '>>', 6 * da
rt.notNull(encodedBytes)), '&', 63), '|', flag), int); |
2652 codeUnits[dartx.set](index, Uri._PERCENT); | 2652 codeUnits[dartx.set](index, Uri._PERCENT); |
2653 codeUnits[dartx.set](dart.notNull(index) + 1, hexDigits[dartx.codeUnit
At](dart.notNull(byte) >> 4)); | 2653 codeUnits[dartx.set](dart.notNull(index) + 1, hexDigits[dartx.codeUnit
At](dart.notNull(byte) >> 4)); |
(...skipping 20 matching lines...) Expand all Loading... |
2674 if (replacement == null) { | 2674 if (replacement == null) { |
2675 index = dart.notNull(index) + 3; | 2675 index = dart.notNull(index) + 3; |
2676 continue; | 2676 continue; |
2677 } | 2677 } |
2678 if ("%" == replacement) { | 2678 if ("%" == replacement) { |
2679 replacement = "%25"; | 2679 replacement = "%25"; |
2680 sourceLength = 1; | 2680 sourceLength = 1; |
2681 } else { | 2681 } else { |
2682 sourceLength = 3; | 2682 sourceLength = 3; |
2683 } | 2683 } |
2684 } else if (Uri._isGeneralDelimiter(char)) { | 2684 } else if (dart.notNull(Uri._isGeneralDelimiter(char))) { |
2685 Uri._fail(component, index, "Invalid character"); | 2685 Uri._fail(component, index, "Invalid character"); |
2686 } else { | 2686 } else { |
2687 sourceLength = 1; | 2687 sourceLength = 1; |
2688 if ((dart.notNull(char) & 64512) == 55296) { | 2688 if ((dart.notNull(char) & 64512) == 55296) { |
2689 if (dart.notNull(index) + 1 < dart.notNull(end)) { | 2689 if (dart.notNull(index) + 1 < dart.notNull(end)) { |
2690 let tail = component[dartx.codeUnitAt](dart.notNull(index) + 1); | 2690 let tail = component[dartx.codeUnitAt](dart.notNull(index) + 1); |
2691 if ((dart.notNull(tail) & 64512) == 56320) { | 2691 if ((dart.notNull(tail) & 64512) == 56320) { |
2692 sourceLength = 2; | 2692 sourceLength = 2; |
2693 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul
l(tail) & 1023; | 2693 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul
l(tail) & 1023; |
2694 } | 2694 } |
(...skipping 11 matching lines...) Expand all Loading... |
2706 } | 2706 } |
2707 if (buffer == null) { | 2707 if (buffer == null) { |
2708 return component[dartx.substring](start, end); | 2708 return component[dartx.substring](start, end); |
2709 } | 2709 } |
2710 if (dart.notNull(sectionStart) < dart.notNull(end)) { | 2710 if (dart.notNull(sectionStart) < dart.notNull(end)) { |
2711 buffer.write(component[dartx.substring](sectionStart, end)); | 2711 buffer.write(component[dartx.substring](sectionStart, end)); |
2712 } | 2712 } |
2713 return dart.toString(buffer); | 2713 return dart.toString(buffer); |
2714 } | 2714 } |
2715 static _isSchemeCharacter(ch) { | 2715 static _isSchemeCharacter(ch) { |
2716 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dsend(Uri.
_schemeTable[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15
)), 0)); | 2716 return dart.notNull(ch) < 128 && !dart.equals(dart.dsend(Uri._schemeTable[
dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0); |
2717 } | 2717 } |
2718 static _isGeneralDelimiter(ch) { | 2718 static _isGeneralDelimiter(ch) { |
2719 return dart.notNull(ch) <= dart.notNull(Uri._RIGHT_BRACKET) && dart.notNul
l(!dart.equals(dart.dsend(Uri._genDelimitersTable[dartx.get](dart.notNull(ch) >>
4), '&', 1 << (dart.notNull(ch) & 15)), 0)); | 2719 return dart.notNull(ch) <= dart.notNull(Uri._RIGHT_BRACKET) && !dart.equal
s(dart.dsend(Uri._genDelimitersTable[dartx.get](dart.notNull(ch) >> 4), '&', 1 <
< (dart.notNull(ch) & 15)), 0); |
2720 } | 2720 } |
2721 get isAbsolute() { | 2721 get isAbsolute() { |
2722 return this.scheme != "" && this.fragment == ""; | 2722 return this.scheme != "" && this.fragment == ""; |
2723 } | 2723 } |
2724 [_merge](base, reference) { | 2724 [_merge](base, reference) { |
2725 if (base[dartx.isEmpty]) | 2725 if (dart.notNull(base[dartx.isEmpty])) |
2726 return `/${reference}`; | 2726 return `/${reference}`; |
2727 let backCount = 0; | 2727 let backCount = 0; |
2728 let refStart = 0; | 2728 let refStart = 0; |
2729 while (reference[dartx.startsWith]("../", refStart)) { | 2729 while (dart.notNull(reference[dartx.startsWith]("../", refStart))) { |
2730 refStart = dart.notNull(refStart) + 3; | 2730 refStart = dart.notNull(refStart) + 3; |
2731 backCount = dart.notNull(backCount) + 1; | 2731 backCount = dart.notNull(backCount) + 1; |
2732 } | 2732 } |
2733 let baseEnd = base[dartx.lastIndexOf]('/'); | 2733 let baseEnd = base[dartx.lastIndexOf]('/'); |
2734 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { | 2734 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { |
2735 let newEnd = base[dartx.lastIndexOf]('/', dart.notNull(baseEnd) - 1); | 2735 let newEnd = base[dartx.lastIndexOf]('/', dart.notNull(baseEnd) - 1); |
2736 if (dart.notNull(newEnd) < 0) { | 2736 if (dart.notNull(newEnd) < 0) { |
2737 break; | 2737 break; |
2738 } | 2738 } |
2739 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); | 2739 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); |
(...skipping 21 matching lines...) Expand all Loading... |
2761 if (segment == "..") { | 2761 if (segment == "..") { |
2762 if (!dart.notNull(output[dartx.isEmpty]) && (output.length != 1 || out
put[dartx.get](0) != "")) | 2762 if (!dart.notNull(output[dartx.isEmpty]) && (output.length != 1 || out
put[dartx.get](0) != "")) |
2763 output[dartx.removeLast](); | 2763 output[dartx.removeLast](); |
2764 appendSlash = true; | 2764 appendSlash = true; |
2765 } else if ("." == segment) { | 2765 } else if ("." == segment) { |
2766 appendSlash = true; | 2766 appendSlash = true; |
2767 } else { | 2767 } else { |
2768 output[dartx.add](segment); | 2768 output[dartx.add](segment); |
2769 } | 2769 } |
2770 } | 2770 } |
2771 if (appendSlash) | 2771 if (dart.notNull(appendSlash)) |
2772 output[dartx.add](""); | 2772 output[dartx.add](""); |
2773 return output[dartx.join]("/"); | 2773 return output[dartx.join]("/"); |
2774 } | 2774 } |
2775 resolve(reference) { | 2775 resolve(reference) { |
2776 return this.resolveUri(Uri.parse(reference)); | 2776 return this.resolveUri(Uri.parse(reference)); |
2777 } | 2777 } |
2778 resolveUri(reference) { | 2778 resolveUri(reference) { |
2779 let targetScheme = null; | 2779 let targetScheme = null; |
2780 let targetUserInfo = ""; | 2780 let targetUserInfo = ""; |
2781 let targetHost = null; | 2781 let targetHost = null; |
2782 let targetPort = null; | 2782 let targetPort = null; |
2783 let targetPath = null; | 2783 let targetPath = null; |
2784 let targetQuery = null; | 2784 let targetQuery = null; |
2785 if (reference.scheme[dartx.isNotEmpty]) { | 2785 if (dart.notNull(reference.scheme[dartx.isNotEmpty])) { |
2786 targetScheme = reference.scheme; | 2786 targetScheme = reference.scheme; |
2787 if (reference.hasAuthority) { | 2787 if (dart.notNull(reference.hasAuthority)) { |
2788 targetUserInfo = reference.userInfo; | 2788 targetUserInfo = reference.userInfo; |
2789 targetHost = reference.host; | 2789 targetHost = reference.host; |
2790 targetPort = reference.hasPort ? reference.port : null; | 2790 targetPort = dart.notNull(reference.hasPort) ? reference.port : null; |
2791 } | 2791 } |
2792 targetPath = this[_removeDotSegments](reference.path); | 2792 targetPath = this[_removeDotSegments](reference.path); |
2793 if (reference.hasQuery) { | 2793 if (dart.notNull(reference.hasQuery)) { |
2794 targetQuery = reference.query; | 2794 targetQuery = reference.query; |
2795 } | 2795 } |
2796 } else { | 2796 } else { |
2797 targetScheme = this.scheme; | 2797 targetScheme = this.scheme; |
2798 if (reference.hasAuthority) { | 2798 if (dart.notNull(reference.hasAuthority)) { |
2799 targetUserInfo = reference.userInfo; | 2799 targetUserInfo = reference.userInfo; |
2800 targetHost = reference.host; | 2800 targetHost = reference.host; |
2801 targetPort = Uri._makePort(reference.hasPort ? reference.port : null,
targetScheme); | 2801 targetPort = Uri._makePort(dart.notNull(reference.hasPort) ? reference
.port : null, targetScheme); |
2802 targetPath = this[_removeDotSegments](reference.path); | 2802 targetPath = this[_removeDotSegments](reference.path); |
2803 if (reference.hasQuery) | 2803 if (dart.notNull(reference.hasQuery)) |
2804 targetQuery = reference.query; | 2804 targetQuery = reference.query; |
2805 } else { | 2805 } else { |
2806 if (reference.path == "") { | 2806 if (reference.path == "") { |
2807 targetPath = this[_path]; | 2807 targetPath = this[_path]; |
2808 if (reference.hasQuery) { | 2808 if (dart.notNull(reference.hasQuery)) { |
2809 targetQuery = reference.query; | 2809 targetQuery = reference.query; |
2810 } else { | 2810 } else { |
2811 targetQuery = this[_query]; | 2811 targetQuery = this[_query]; |
2812 } | 2812 } |
2813 } else { | 2813 } else { |
2814 if (reference.path[dartx.startsWith]("/")) { | 2814 if (dart.notNull(reference.path[dartx.startsWith]("/"))) { |
2815 targetPath = this[_removeDotSegments](reference.path); | 2815 targetPath = this[_removeDotSegments](reference.path); |
2816 } else { | 2816 } else { |
2817 targetPath = this[_removeDotSegments](this[_merge](this[_path], re
ference.path)); | 2817 targetPath = this[_removeDotSegments](this[_merge](this[_path], re
ference.path)); |
2818 } | 2818 } |
2819 if (reference.hasQuery) | 2819 if (dart.notNull(reference.hasQuery)) |
2820 targetQuery = reference.query; | 2820 targetQuery = reference.query; |
2821 } | 2821 } |
2822 targetUserInfo = this[_userInfo]; | 2822 targetUserInfo = this[_userInfo]; |
2823 targetHost = this[_host]; | 2823 targetHost = this[_host]; |
2824 targetPort = this[_port]; | 2824 targetPort = this[_port]; |
2825 } | 2825 } |
2826 } | 2826 } |
2827 let fragment = reference.hasFragment ? reference.fragment : null; | 2827 let fragment = dart.notNull(reference.hasFragment) ? reference.fragment :
null; |
2828 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP
ort, targetPath, targetQuery, fragment); | 2828 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP
ort, targetPath, targetQuery, fragment); |
2829 } | 2829 } |
2830 get hasAuthority() { | 2830 get hasAuthority() { |
2831 return this[_host] != null; | 2831 return this[_host] != null; |
2832 } | 2832 } |
2833 get hasPort() { | 2833 get hasPort() { |
2834 return this[_port] != null; | 2834 return this[_port] != null; |
2835 } | 2835 } |
2836 get hasQuery() { | 2836 get hasQuery() { |
2837 return this[_query] != null; | 2837 return this[_query] != null; |
(...skipping 18 matching lines...) Expand all Loading... |
2856 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch
eme} URI`); | 2856 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch
eme} URI`); |
2857 } | 2857 } |
2858 if (this.query != "") { | 2858 if (this.query != "") { |
2859 throw new UnsupportedError("Cannot extract a file path from a URI with a
query component"); | 2859 throw new UnsupportedError("Cannot extract a file path from a URI with a
query component"); |
2860 } | 2860 } |
2861 if (this.fragment != "") { | 2861 if (this.fragment != "") { |
2862 throw new UnsupportedError("Cannot extract a file path from a URI with a
fragment component"); | 2862 throw new UnsupportedError("Cannot extract a file path from a URI with a
fragment component"); |
2863 } | 2863 } |
2864 if (windows == null) | 2864 if (windows == null) |
2865 windows = Uri._isWindows; | 2865 windows = Uri._isWindows; |
2866 return windows ? this[_toWindowsFilePath]() : this[_toFilePath](); | 2866 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa
th](); |
2867 } | 2867 } |
2868 [_toFilePath]() { | 2868 [_toFilePath]() { |
2869 if (this.host != "") { | 2869 if (this.host != "") { |
2870 throw new UnsupportedError("Cannot extract a non-Windows file path from
a file URI " + "with an authority"); | 2870 throw new UnsupportedError("Cannot extract a non-Windows file path from
a file URI " + "with an authority"); |
2871 } | 2871 } |
2872 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false); | 2872 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false); |
2873 let result = new StringBuffer(); | 2873 let result = new StringBuffer(); |
2874 if (this[_isPathAbsolute]) | 2874 if (dart.notNull(this[_isPathAbsolute])) |
2875 result.write("/"); | 2875 result.write("/"); |
2876 result.writeAll(this.pathSegments, "/"); | 2876 result.writeAll(this.pathSegments, "/"); |
2877 return dart.toString(result); | 2877 return dart.toString(result); |
2878 } | 2878 } |
2879 [_toWindowsFilePath]() { | 2879 [_toWindowsFilePath]() { |
2880 let hasDriveLetter = false; | 2880 let hasDriveLetter = false; |
2881 let segments = this.pathSegments; | 2881 let segments = this.pathSegments; |
2882 if (dart.notNull(segments.length) > 0 && segments[dartx.get](0).length ==
2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) { | 2882 if (dart.notNull(segments.length) > 0 && segments[dartx.get](0).length ==
2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) { |
2883 Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0)
, false); | 2883 Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0)
, false); |
2884 Uri._checkWindowsPathReservedCharacters(segments, false, 1); | 2884 Uri._checkWindowsPathReservedCharacters(segments, false, 1); |
(...skipping 13 matching lines...) Expand all Loading... |
2898 if (dart.notNull(hasDriveLetter) && segments.length == 1) | 2898 if (dart.notNull(hasDriveLetter) && segments.length == 1) |
2899 result.write("\\"); | 2899 result.write("\\"); |
2900 return dart.toString(result); | 2900 return dart.toString(result); |
2901 } | 2901 } |
2902 get [_isPathAbsolute]() { | 2902 get [_isPathAbsolute]() { |
2903 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) | 2903 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) |
2904 return false; | 2904 return false; |
2905 return this.path[dartx.startsWith]('/'); | 2905 return this.path[dartx.startsWith]('/'); |
2906 } | 2906 } |
2907 [_writeAuthority](ss) { | 2907 [_writeAuthority](ss) { |
2908 if (this[_userInfo][dartx.isNotEmpty]) { | 2908 if (dart.notNull(this[_userInfo][dartx.isNotEmpty])) { |
2909 ss.write(this[_userInfo]); | 2909 ss.write(this[_userInfo]); |
2910 ss.write("@"); | 2910 ss.write("@"); |
2911 } | 2911 } |
2912 if (this[_host] != null) | 2912 if (this[_host] != null) |
2913 ss.write(this[_host]); | 2913 ss.write(this[_host]); |
2914 if (this[_port] != null) { | 2914 if (this[_port] != null) { |
2915 ss.write(":"); | 2915 ss.write(":"); |
2916 ss.write(this[_port]); | 2916 ss.write(this[_port]); |
2917 } | 2917 } |
2918 } | 2918 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | 3038 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { |
3039 if (host[dartx.codeUnitAt](i) == Uri._COLON) { | 3039 if (host[dartx.codeUnitAt](i) == Uri._COLON) { |
3040 if (i == start) { | 3040 if (i == start) { |
3041 i = dart.notNull(i) + 1; | 3041 i = dart.notNull(i) + 1; |
3042 if (host[dartx.codeUnitAt](i) != Uri._COLON) { | 3042 if (host[dartx.codeUnitAt](i) != Uri._COLON) { |
3043 error('invalid start colon.', i); | 3043 error('invalid start colon.', i); |
3044 } | 3044 } |
3045 partStart = i; | 3045 partStart = i; |
3046 } | 3046 } |
3047 if (i == partStart) { | 3047 if (i == partStart) { |
3048 if (wildcardSeen) { | 3048 if (dart.notNull(wildcardSeen)) { |
3049 error('only one wildcard `::` is allowed', i); | 3049 error('only one wildcard `::` is allowed', i); |
3050 } | 3050 } |
3051 wildcardSeen = true; | 3051 wildcardSeen = true; |
3052 parts[dartx.add](-1); | 3052 parts[dartx.add](-1); |
3053 } else { | 3053 } else { |
3054 parts[dartx.add](parseHex(partStart, i)); | 3054 parts[dartx.add](parseHex(partStart, i)); |
3055 } | 3055 } |
3056 partStart = dart.notNull(i) + 1; | 3056 partStart = dart.notNull(i) + 1; |
3057 } | 3057 } |
3058 } | 3058 } |
(...skipping 12 matching lines...) Expand all Loading... |
3071 let last = Uri.parseIPv4Address(host[dartx.substring](partStart, end
)); | 3071 let last = Uri.parseIPv4Address(host[dartx.substring](partStart, end
)); |
3072 parts[dartx.add](dart.notNull(last[dartx.get](0)) << 8 | dart.notNul
l(last[dartx.get](1))); | 3072 parts[dartx.add](dart.notNull(last[dartx.get](0)) << 8 | dart.notNul
l(last[dartx.get](1))); |
3073 parts[dartx.add](dart.notNull(last[dartx.get](2)) << 8 | dart.notNul
l(last[dartx.get](3))); | 3073 parts[dartx.add](dart.notNull(last[dartx.get](2)) << 8 | dart.notNul
l(last[dartx.get](3))); |
3074 } catch (e) { | 3074 } catch (e) { |
3075 error('invalid end of IPv6 address.', partStart); | 3075 error('invalid end of IPv6 address.', partStart); |
3076 } | 3076 } |
3077 | 3077 |
3078 } | 3078 } |
3079 | 3079 |
3080 } | 3080 } |
3081 if (wildcardSeen) { | 3081 if (dart.notNull(wildcardSeen)) { |
3082 if (dart.notNull(parts.length) > 7) { | 3082 if (dart.notNull(parts.length) > 7) { |
3083 error('an address with a wildcard must have less than 7 parts'); | 3083 error('an address with a wildcard must have less than 7 parts'); |
3084 } | 3084 } |
3085 } else if (parts.length != 8) { | 3085 } else if (parts.length != 8) { |
3086 error('an address without a wildcard must contain exactly 8 parts'); | 3086 error('an address without a wildcard must contain exactly 8 parts'); |
3087 } | 3087 } |
3088 let bytes = List$(int).new(16); | 3088 let bytes = List$(int).new(16); |
3089 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts.length); i
= dart.notNull(i) + 1) { | 3089 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts.length); i
= dart.notNull(i) + 1) { |
3090 let value = parts[dartx.get](i); | 3090 let value = parts[dartx.get](i); |
3091 if (value == -1) { | 3091 if (value == -1) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 } | 3146 } |
3147 static _uriDecode(text, opts) { | 3147 static _uriDecode(text, opts) { |
3148 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false
; | 3148 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false
; |
3149 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; | 3149 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; |
3150 let simple = true; | 3150 let simple = true; |
3151 for (let i = 0; dart.notNull(i) < dart.notNull(text.length) && dart.notNul
l(simple); i = dart.notNull(i) + 1) { | 3151 for (let i = 0; dart.notNull(i) < dart.notNull(text.length) && dart.notNul
l(simple); i = dart.notNull(i) + 1) { |
3152 let codeUnit = text[dartx.codeUnitAt](i); | 3152 let codeUnit = text[dartx.codeUnitAt](i); |
3153 simple = codeUnit != Uri._PERCENT && codeUnit != Uri._PLUS; | 3153 simple = codeUnit != Uri._PERCENT && codeUnit != Uri._PLUS; |
3154 } | 3154 } |
3155 let bytes = null; | 3155 let bytes = null; |
3156 if (simple) { | 3156 if (dart.notNull(simple)) { |
3157 if (dart.notNull(dart.equals(encoding, convert.UTF8)) || dart.notNull(da
rt.equals(encoding, convert.LATIN1))) { | 3157 if (dart.equals(encoding, convert.UTF8) || dart.equals(encoding, convert
.LATIN1)) { |
3158 return text; | 3158 return text; |
3159 } else { | 3159 } else { |
3160 bytes = text[dartx.codeUnits]; | 3160 bytes = text[dartx.codeUnits]; |
3161 } | 3161 } |
3162 } else { | 3162 } else { |
3163 bytes = List$(int).new(); | 3163 bytes = List$(int).new(); |
3164 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.no
tNull(i) + 1) { | 3164 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.no
tNull(i) + 1) { |
3165 let codeUnit = text[dartx.codeUnitAt](i); | 3165 let codeUnit = text[dartx.codeUnitAt](i); |
3166 if (dart.notNull(codeUnit) > 127) { | 3166 if (dart.notNull(codeUnit) > 127) { |
3167 throw new ArgumentError("Illegal percent encoding in URI"); | 3167 throw new ArgumentError("Illegal percent encoding in URI"); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3356 exports.StackTrace = StackTrace; | 3356 exports.StackTrace = StackTrace; |
3357 exports.Stopwatch = Stopwatch; | 3357 exports.Stopwatch = Stopwatch; |
3358 exports.String = String; | 3358 exports.String = String; |
3359 exports.RuneIterator = RuneIterator; | 3359 exports.RuneIterator = RuneIterator; |
3360 exports.StringBuffer = StringBuffer; | 3360 exports.StringBuffer = StringBuffer; |
3361 exports.StringSink = StringSink; | 3361 exports.StringSink = StringSink; |
3362 exports.Symbol = Symbol; | 3362 exports.Symbol = Symbol; |
3363 exports.Type = Type; | 3363 exports.Type = Type; |
3364 exports.Uri = Uri; | 3364 exports.Uri = Uri; |
3365 })(core, _js_helper, _internal, collection, _interceptors, convert); | 3365 })(core, _js_helper, _internal, collection, _interceptors, convert); |
OLD | NEW |