| OLD | NEW |
| (Empty) |
| 1 dart_library.library('dart/core', null, /* Imports */[ | |
| 2 "dart_runtime/dart" | |
| 3 ], /* Lazy imports */[ | |
| 4 'dart/_js_helper', | |
| 5 'dart/_internal', | |
| 6 'dart/collection', | |
| 7 'dart/_interceptors', | |
| 8 'dart/convert' | |
| 9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con
vert) { | |
| 10 'use strict'; | |
| 11 let dartx = dart.dartx; | |
| 12 class Object { | |
| 13 constructor() { | |
| 14 let name = this.constructor.name; | |
| 15 let result = void 0; | |
| 16 if (name in this) | |
| 17 result = this[name](...arguments); | |
| 18 return result === void 0 ? this : result; | |
| 19 } | |
| 20 ['=='](other) { | |
| 21 return identical(this, other); | |
| 22 } | |
| 23 get hashCode() { | |
| 24 return _js_helper.Primitives.objectHashCode(this); | |
| 25 } | |
| 26 toString() { | |
| 27 return _js_helper.Primitives.objectToString(this); | |
| 28 } | |
| 29 noSuchMethod(invocation) { | |
| 30 dart.throw(new NoSuchMethodError(this, invocation.memberName, invocation.p
ositionalArguments, invocation.namedArguments)); | |
| 31 } | |
| 32 get runtimeType() { | |
| 33 return dart.realRuntimeType(this); | |
| 34 } | |
| 35 } | |
| 36 dart.setSignature(Object, { | |
| 37 constructors: () => ({Object: [Object, []]}), | |
| 38 methods: () => ({ | |
| 39 '==': [bool, [dart.dynamic]], | |
| 40 toString: [String, []], | |
| 41 noSuchMethod: [dart.dynamic, [Invocation]] | |
| 42 }) | |
| 43 }); | |
| 44 class Deprecated extends Object { | |
| 45 Deprecated(expires) { | |
| 46 this.expires = expires; | |
| 47 } | |
| 48 toString() { | |
| 49 return `Deprecated feature. Will be removed ${this.expires}`; | |
| 50 } | |
| 51 } | |
| 52 dart.setSignature(Deprecated, { | |
| 53 constructors: () => ({Deprecated: [Deprecated, [String]]}) | |
| 54 }); | |
| 55 class _Override extends Object { | |
| 56 _Override() { | |
| 57 } | |
| 58 } | |
| 59 dart.setSignature(_Override, { | |
| 60 constructors: () => ({_Override: [_Override, []]}) | |
| 61 }); | |
| 62 let deprecated = dart.const(new Deprecated("next release")); | |
| 63 let override = dart.const(new _Override()); | |
| 64 class _Proxy extends Object { | |
| 65 _Proxy() { | |
| 66 } | |
| 67 } | |
| 68 dart.setSignature(_Proxy, { | |
| 69 constructors: () => ({_Proxy: [_Proxy, []]}) | |
| 70 }); | |
| 71 let proxy = dart.const(new _Proxy()); | |
| 72 dart.defineExtensionNames([ | |
| 73 'toString' | |
| 74 ]); | |
| 75 class bool extends Object { | |
| 76 static fromEnvironment(name, opts) { | |
| 77 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : fa
lse; | |
| 78 dart.throw(new UnsupportedError('bool.fromEnvironment can only be used as
a const constructor')); | |
| 79 } | |
| 80 toString() { | |
| 81 return this ? "true" : "false"; | |
| 82 } | |
| 83 } | |
| 84 dart.setSignature(bool, { | |
| 85 constructors: () => ({fromEnvironment: [bool, [String], {defaultValue: bool}
]}) | |
| 86 }); | |
| 87 let Comparator$ = dart.generic(function(T) { | |
| 88 let Comparator = dart.typedef('Comparator', () => dart.functionType(int, [T,
T])); | |
| 89 return Comparator; | |
| 90 }); | |
| 91 let Comparator = Comparator$(); | |
| 92 let Comparable$ = dart.generic(function(T) { | |
| 93 class Comparable extends Object { | |
| 94 static compare(a, b) { | |
| 95 return a[dartx.compareTo](b); | |
| 96 } | |
| 97 } | |
| 98 dart.setSignature(Comparable, { | |
| 99 statics: () => ({compare: [int, [Comparable$(), Comparable$()]]}), | |
| 100 names: ['compare'] | |
| 101 }); | |
| 102 return Comparable; | |
| 103 }); | |
| 104 let Comparable = Comparable$(); | |
| 105 class DateTime extends Object { | |
| 106 DateTime(year, month, day, hour, minute, second, millisecond) { | |
| 107 if (month === void 0) | |
| 108 month = 1; | |
| 109 if (day === void 0) | |
| 110 day = 1; | |
| 111 if (hour === void 0) | |
| 112 hour = 0; | |
| 113 if (minute === void 0) | |
| 114 minute = 0; | |
| 115 if (second === void 0) | |
| 116 second = 0; | |
| 117 if (millisecond === void 0) | |
| 118 millisecond = 0; | |
| 119 this._internal(year, month, day, hour, minute, second, millisecond, false)
; | |
| 120 } | |
| 121 utc(year, month, day, hour, minute, second, millisecond) { | |
| 122 if (month === void 0) | |
| 123 month = 1; | |
| 124 if (day === void 0) | |
| 125 day = 1; | |
| 126 if (hour === void 0) | |
| 127 hour = 0; | |
| 128 if (minute === void 0) | |
| 129 minute = 0; | |
| 130 if (second === void 0) | |
| 131 second = 0; | |
| 132 if (millisecond === void 0) | |
| 133 millisecond = 0; | |
| 134 this._internal(year, month, day, hour, minute, second, millisecond, true); | |
| 135 } | |
| 136 now() { | |
| 137 this._now(); | |
| 138 } | |
| 139 static parse(formattedString) { | |
| 140 let re = RegExp.new('^([+-]?\\d{4,6})-?(\\d\\d)-?(\\d\\d)' + '(?:[ T](\\d\
\d)(?::?(\\d\\d)(?::?(\\d\\d)(.\\d{1,6})?)?)?' + '( ?[zZ]| ?([-+])(\\d\\d)(?::?(
\\d\\d))?)?)?$'); | |
| 141 let match = re.firstMatch(formattedString); | |
| 142 if (match != null) { | |
| 143 function parseIntOrZero(matched) { | |
| 144 if (matched == null) | |
| 145 return 0; | |
| 146 return int.parse(matched); | |
| 147 } | |
| 148 dart.fn(parseIntOrZero, int, [String]); | |
| 149 function parseDoubleOrZero(matched) { | |
| 150 if (matched == null) | |
| 151 return 0.0; | |
| 152 return double.parse(matched); | |
| 153 } | |
| 154 dart.fn(parseDoubleOrZero, double, [String]); | |
| 155 let years = int.parse(match.get(1)); | |
| 156 let month = int.parse(match.get(2)); | |
| 157 let day = int.parse(match.get(3)); | |
| 158 let hour = parseIntOrZero(match.get(4)); | |
| 159 let minute = parseIntOrZero(match.get(5)); | |
| 160 let second = parseIntOrZero(match.get(6)); | |
| 161 let addOneMillisecond = false; | |
| 162 let millisecond = (dart.notNull(parseDoubleOrZero(match.get(7))) * 1000)
[dartx.round](); | |
| 163 if (millisecond == 1000) { | |
| 164 addOneMillisecond = true; | |
| 165 millisecond = 999; | |
| 166 } | |
| 167 let isUtc = false; | |
| 168 if (match.get(8) != null) { | |
| 169 isUtc = true; | |
| 170 if (match.get(9) != null) { | |
| 171 let sign = match.get(9) == '-' ? -1 : 1; | |
| 172 let hourDifference = int.parse(match.get(10)); | |
| 173 let minuteDifference = parseIntOrZero(match.get(11)); | |
| 174 minuteDifference = dart.notNull(minuteDifference) + 60 * dart.notNul
l(hourDifference); | |
| 175 minute = dart.notNull(minute) - dart.notNull(sign) * dart.notNull(mi
nuteDifference); | |
| 176 } | |
| 177 } | |
| 178 let millisecondsSinceEpoch = DateTime._brokenDownDateToMillisecondsSince
Epoch(years, month, day, hour, minute, second, millisecond, isUtc); | |
| 179 if (millisecondsSinceEpoch == null) { | |
| 180 dart.throw(new FormatException("Time out of range", formattedString)); | |
| 181 } | |
| 182 if (dart.notNull(addOneMillisecond)) { | |
| 183 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1; | |
| 184 } | |
| 185 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, {
isUtc: isUtc}); | |
| 186 } else { | |
| 187 dart.throw(new FormatException("Invalid date format", formattedString)); | |
| 188 } | |
| 189 } | |
| 190 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { | |
| 191 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; | |
| 192 this.millisecondsSinceEpoch = millisecondsSinceEpoch; | |
| 193 this.isUtc = isUtc; | |
| 194 if (dart.notNull(millisecondsSinceEpoch[dartx.abs]()) > dart.notNull(DateT
ime._MAX_MILLISECONDS_SINCE_EPOCH)) { | |
| 195 dart.throw(new ArgumentError(millisecondsSinceEpoch)); | |
| 196 } | |
| 197 if (isUtc == null) | |
| 198 dart.throw(new ArgumentError(isUtc)); | |
| 199 } | |
| 200 ['=='](other) { | |
| 201 if (!dart.is(other, DateTime)) | |
| 202 return false; | |
| 203 return dart.equals(this.millisecondsSinceEpoch, dart.dload(other, 'millise
condsSinceEpoch')) && dart.equals(this.isUtc, dart.dload(other, 'isUtc')); | |
| 204 } | |
| 205 isBefore(other) { | |
| 206 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill
isecondsSinceEpoch); | |
| 207 } | |
| 208 isAfter(other) { | |
| 209 return dart.notNull(this.millisecondsSinceEpoch) > dart.notNull(other.mill
isecondsSinceEpoch); | |
| 210 } | |
| 211 isAtSameMomentAs(other) { | |
| 212 return this.millisecondsSinceEpoch == other.millisecondsSinceEpoch; | |
| 213 } | |
| 214 compareTo(other) { | |
| 215 return this.millisecondsSinceEpoch[dartx.compareTo](other.millisecondsSinc
eEpoch); | |
| 216 } | |
| 217 get hashCode() { | |
| 218 return this.millisecondsSinceEpoch; | |
| 219 } | |
| 220 toLocal() { | |
| 221 if (dart.notNull(this.isUtc)) { | |
| 222 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo
ch, {isUtc: false}); | |
| 223 } | |
| 224 return this; | |
| 225 } | |
| 226 toUtc() { | |
| 227 if (dart.notNull(this.isUtc)) | |
| 228 return this; | |
| 229 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch
, {isUtc: true}); | |
| 230 } | |
| 231 static _fourDigits(n) { | |
| 232 let absN = n[dartx.abs](); | |
| 233 let sign = dart.notNull(n) < 0 ? "-" : ""; | |
| 234 if (dart.notNull(absN) >= 1000) | |
| 235 return `${n}`; | |
| 236 if (dart.notNull(absN) >= 100) | |
| 237 return `${sign}0${absN}`; | |
| 238 if (dart.notNull(absN) >= 10) | |
| 239 return `${sign}00${absN}`; | |
| 240 return `${sign}000${absN}`; | |
| 241 } | |
| 242 static _sixDigits(n) { | |
| 243 dart.assert(dart.notNull(n) < -9999 || dart.notNull(n) > 9999); | |
| 244 let absN = n[dartx.abs](); | |
| 245 let sign = dart.notNull(n) < 0 ? "-" : "+"; | |
| 246 if (dart.notNull(absN) >= 100000) | |
| 247 return `${sign}${absN}`; | |
| 248 return `${sign}0${absN}`; | |
| 249 } | |
| 250 static _threeDigits(n) { | |
| 251 if (dart.notNull(n) >= 100) | |
| 252 return `${n}`; | |
| 253 if (dart.notNull(n) >= 10) | |
| 254 return `0${n}`; | |
| 255 return `00${n}`; | |
| 256 } | |
| 257 static _twoDigits(n) { | |
| 258 if (dart.notNull(n) >= 10) | |
| 259 return `${n}`; | |
| 260 return `0${n}`; | |
| 261 } | |
| 262 toString() { | |
| 263 let y = DateTime._fourDigits(this.year); | |
| 264 let m = DateTime._twoDigits(this.month); | |
| 265 let d = DateTime._twoDigits(this.day); | |
| 266 let h = DateTime._twoDigits(this.hour); | |
| 267 let min = DateTime._twoDigits(this.minute); | |
| 268 let sec = DateTime._twoDigits(this.second); | |
| 269 let ms = DateTime._threeDigits(this.millisecond); | |
| 270 if (dart.notNull(this.isUtc)) { | |
| 271 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}Z`; | |
| 272 } else { | |
| 273 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}`; | |
| 274 } | |
| 275 } | |
| 276 toIso8601String() { | |
| 277 let y = dart.notNull(this.year) >= -9999 && dart.notNull(this.year) <= 999
9 ? DateTime._fourDigits(this.year) : DateTime._sixDigits(this.year); | |
| 278 let m = DateTime._twoDigits(this.month); | |
| 279 let d = DateTime._twoDigits(this.day); | |
| 280 let h = DateTime._twoDigits(this.hour); | |
| 281 let min = DateTime._twoDigits(this.minute); | |
| 282 let sec = DateTime._twoDigits(this.second); | |
| 283 let ms = DateTime._threeDigits(this.millisecond); | |
| 284 if (dart.notNull(this.isUtc)) { | |
| 285 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}Z`; | |
| 286 } else { | |
| 287 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}`; | |
| 288 } | |
| 289 } | |
| 290 add(duration) { | |
| 291 let ms = this.millisecondsSinceEpoch; | |
| 292 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) + dart.not
Null(duration.inMilliseconds), {isUtc: this.isUtc}); | |
| 293 } | |
| 294 subtract(duration) { | |
| 295 let ms = this.millisecondsSinceEpoch; | |
| 296 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not
Null(duration.inMilliseconds), {isUtc: this.isUtc}); | |
| 297 } | |
| 298 difference(other) { | |
| 299 let ms = this.millisecondsSinceEpoch; | |
| 300 let otherMs = other.millisecondsSinceEpoch; | |
| 301 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs
)}); | |
| 302 } | |
| 303 _internal(year, month, day, hour, minute, second, millisecond, isUtc) { | |
| 304 this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw(new ArgumentEr
ror(isUtc)); | |
| 305 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi
tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon
d, isUtc)), int); | |
| 306 } | |
| 307 _now() { | |
| 308 this.isUtc = false; | |
| 309 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); | |
| 310 } | |
| 311 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut
e, second, millisecond, isUtc) { | |
| 312 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month,
day, hour, minute, second, millisecond, isUtc), int); | |
| 313 } | |
| 314 get timeZoneName() { | |
| 315 if (dart.notNull(this.isUtc)) | |
| 316 return "UTC"; | |
| 317 return _js_helper.Primitives.getTimeZoneName(this); | |
| 318 } | |
| 319 get timeZoneOffset() { | |
| 320 if (dart.notNull(this.isUtc)) | |
| 321 return new Duration(); | |
| 322 return new Duration({minutes: _js_helper.Primitives.getTimeZoneOffsetInMin
utes(this)}); | |
| 323 } | |
| 324 get year() { | |
| 325 return dart.as(_js_helper.Primitives.getYear(this), int); | |
| 326 } | |
| 327 get month() { | |
| 328 return dart.as(_js_helper.Primitives.getMonth(this), int); | |
| 329 } | |
| 330 get day() { | |
| 331 return dart.as(_js_helper.Primitives.getDay(this), int); | |
| 332 } | |
| 333 get hour() { | |
| 334 return dart.as(_js_helper.Primitives.getHours(this), int); | |
| 335 } | |
| 336 get minute() { | |
| 337 return dart.as(_js_helper.Primitives.getMinutes(this), int); | |
| 338 } | |
| 339 get second() { | |
| 340 return dart.as(_js_helper.Primitives.getSeconds(this), int); | |
| 341 } | |
| 342 get millisecond() { | |
| 343 return dart.as(_js_helper.Primitives.getMilliseconds(this), int); | |
| 344 } | |
| 345 get weekday() { | |
| 346 return dart.as(_js_helper.Primitives.getWeekday(this), int); | |
| 347 } | |
| 348 } | |
| 349 DateTime[dart.implements] = () => [Comparable]; | |
| 350 dart.defineNamedConstructor(DateTime, 'utc'); | |
| 351 dart.defineNamedConstructor(DateTime, 'now'); | |
| 352 dart.defineNamedConstructor(DateTime, 'fromMillisecondsSinceEpoch'); | |
| 353 dart.defineNamedConstructor(DateTime, '_internal'); | |
| 354 dart.defineNamedConstructor(DateTime, '_now'); | |
| 355 dart.setSignature(DateTime, { | |
| 356 constructors: () => ({ | |
| 357 DateTime: [DateTime, [int], [int, int, int, int, int, int]], | |
| 358 utc: [DateTime, [int], [int, int, int, int, int, int]], | |
| 359 now: [DateTime, []], | |
| 360 fromMillisecondsSinceEpoch: [DateTime, [int], {isUtc: bool}], | |
| 361 _internal: [DateTime, [int, int, int, int, int, int, int, bool]], | |
| 362 _now: [DateTime, []] | |
| 363 }), | |
| 364 methods: () => ({ | |
| 365 isBefore: [bool, [DateTime]], | |
| 366 isAfter: [bool, [DateTime]], | |
| 367 isAtSameMomentAs: [bool, [DateTime]], | |
| 368 compareTo: [int, [DateTime]], | |
| 369 toLocal: [DateTime, []], | |
| 370 toUtc: [DateTime, []], | |
| 371 toIso8601String: [String, []], | |
| 372 add: [DateTime, [Duration]], | |
| 373 subtract: [DateTime, [Duration]], | |
| 374 difference: [Duration, [DateTime]] | |
| 375 }), | |
| 376 statics: () => ({ | |
| 377 parse: [DateTime, [String]], | |
| 378 _fourDigits: [String, [int]], | |
| 379 _sixDigits: [String, [int]], | |
| 380 _threeDigits: [String, [int]], | |
| 381 _twoDigits: [String, [int]], | |
| 382 _brokenDownDateToMillisecondsSinceEpoch: [int, [int, int, int, int, int, i
nt, int, bool]] | |
| 383 }), | |
| 384 names: ['parse', '_fourDigits', '_sixDigits', '_threeDigits', '_twoDigits',
'_brokenDownDateToMillisecondsSinceEpoch'] | |
| 385 }); | |
| 386 dart.defineExtensionMembers(DateTime, ['compareTo']); | |
| 387 DateTime.MONDAY = 1; | |
| 388 DateTime.TUESDAY = 2; | |
| 389 DateTime.WEDNESDAY = 3; | |
| 390 DateTime.THURSDAY = 4; | |
| 391 DateTime.FRIDAY = 5; | |
| 392 DateTime.SATURDAY = 6; | |
| 393 DateTime.SUNDAY = 7; | |
| 394 DateTime.DAYS_PER_WEEK = 7; | |
| 395 DateTime.JANUARY = 1; | |
| 396 DateTime.FEBRUARY = 2; | |
| 397 DateTime.MARCH = 3; | |
| 398 DateTime.APRIL = 4; | |
| 399 DateTime.MAY = 5; | |
| 400 DateTime.JUNE = 6; | |
| 401 DateTime.JULY = 7; | |
| 402 DateTime.AUGUST = 8; | |
| 403 DateTime.SEPTEMBER = 9; | |
| 404 DateTime.OCTOBER = 10; | |
| 405 DateTime.NOVEMBER = 11; | |
| 406 DateTime.DECEMBER = 12; | |
| 407 DateTime.MONTHS_PER_YEAR = 12; | |
| 408 DateTime._MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; | |
| 409 class num extends Object { | |
| 410 static parse(input, onError) { | |
| 411 if (onError === void 0) | |
| 412 onError = null; | |
| 413 let source = input[dartx.trim](); | |
| 414 num._parseError = false; | |
| 415 let result = int.parse(source, {onError: num._onParseErrorInt}); | |
| 416 if (!dart.notNull(num._parseError)) | |
| 417 return result; | |
| 418 num._parseError = false; | |
| 419 result = double.parse(source, num._onParseErrorDouble); | |
| 420 if (!dart.notNull(num._parseError)) | |
| 421 return result; | |
| 422 if (onError == null) | |
| 423 dart.throw(new FormatException(input)); | |
| 424 return onError(input); | |
| 425 } | |
| 426 static _onParseErrorInt(_) { | |
| 427 num._parseError = true; | |
| 428 return 0; | |
| 429 } | |
| 430 static _onParseErrorDouble(_) { | |
| 431 num._parseError = true; | |
| 432 return 0.0; | |
| 433 } | |
| 434 } | |
| 435 num[dart.implements] = () => [Comparable$(num)]; | |
| 436 dart.setSignature(num, { | |
| 437 statics: () => ({ | |
| 438 parse: [num, [String], [dart.functionType(num, [String])]], | |
| 439 _onParseErrorInt: [int, [String]], | |
| 440 _onParseErrorDouble: [double, [String]] | |
| 441 }), | |
| 442 names: ['parse', '_onParseErrorInt', '_onParseErrorDouble'] | |
| 443 }); | |
| 444 class double extends num { | |
| 445 static parse(source, onError) { | |
| 446 if (onError === void 0) | |
| 447 onError = null; | |
| 448 return _js_helper.Primitives.parseDouble(source, onError); | |
| 449 } | |
| 450 } | |
| 451 dart.setSignature(double, { | |
| 452 statics: () => ({parse: [double, [String], [dart.functionType(double, [Strin
g])]]}), | |
| 453 names: ['parse'] | |
| 454 }); | |
| 455 double.NAN = 0.0 / 0.0; | |
| 456 double.INFINITY = 1.0 / 0.0; | |
| 457 double.NEGATIVE_INFINITY = -dart.notNull(double.INFINITY); | |
| 458 double.MIN_POSITIVE = 5e-324; | |
| 459 double.MAX_FINITE = 1.7976931348623157e+308; | |
| 460 let _duration = dart.JsSymbol('_duration'); | |
| 461 class Duration extends Object { | |
| 462 Duration(opts) { | |
| 463 let days = opts && 'days' in opts ? opts.days : 0; | |
| 464 let hours = opts && 'hours' in opts ? opts.hours : 0; | |
| 465 let minutes = opts && 'minutes' in opts ? opts.minutes : 0; | |
| 466 let seconds = opts && 'seconds' in opts ? opts.seconds : 0; | |
| 467 let milliseconds = opts && 'milliseconds' in opts ? opts.milliseconds : 0; | |
| 468 let microseconds = opts && 'microseconds' in opts ? opts.microseconds : 0; | |
| 469 this._microseconds(dart.notNull(days) * dart.notNull(Duration.MICROSECONDS
_PER_DAY) + dart.notNull(hours) * dart.notNull(Duration.MICROSECONDS_PER_HOUR) +
dart.notNull(minutes) * dart.notNull(Duration.MICROSECONDS_PER_MINUTE) + dart.n
otNull(seconds) * dart.notNull(Duration.MICROSECONDS_PER_SECOND) + dart.notNull(
milliseconds) * dart.notNull(Duration.MICROSECONDS_PER_MILLISECOND) + dart.notNu
ll(microseconds)); | |
| 470 } | |
| 471 _microseconds(duration) { | |
| 472 this[_duration] = duration; | |
| 473 } | |
| 474 ['+'](other) { | |
| 475 return new Duration._microseconds(dart.notNull(this[_duration]) + dart.not
Null(other[_duration])); | |
| 476 } | |
| 477 ['-'](other) { | |
| 478 return new Duration._microseconds(dart.notNull(this[_duration]) - dart.not
Null(other[_duration])); | |
| 479 } | |
| 480 ['*'](factor) { | |
| 481 return new Duration._microseconds((dart.notNull(this[_duration]) * dart.no
tNull(factor))[dartx.round]()); | |
| 482 } | |
| 483 ['~/'](quotient) { | |
| 484 if (quotient == 0) | |
| 485 dart.throw(new IntegerDivisionByZeroException()); | |
| 486 return new Duration._microseconds((dart.notNull(this[_duration]) / dart.no
tNull(quotient))[dartx.truncate]()); | |
| 487 } | |
| 488 ['<'](other) { | |
| 489 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]); | |
| 490 } | |
| 491 ['>'](other) { | |
| 492 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]); | |
| 493 } | |
| 494 ['<='](other) { | |
| 495 return dart.notNull(this[_duration]) <= dart.notNull(other[_duration]); | |
| 496 } | |
| 497 ['>='](other) { | |
| 498 return dart.notNull(this[_duration]) >= dart.notNull(other[_duration]); | |
| 499 } | |
| 500 get inDays() { | |
| 501 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS
_PER_DAY))[dartx.truncate](); | |
| 502 } | |
| 503 get inHours() { | |
| 504 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS
_PER_HOUR))[dartx.truncate](); | |
| 505 } | |
| 506 get inMinutes() { | |
| 507 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS
_PER_MINUTE))[dartx.truncate](); | |
| 508 } | |
| 509 get inSeconds() { | |
| 510 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS
_PER_SECOND))[dartx.truncate](); | |
| 511 } | |
| 512 get inMilliseconds() { | |
| 513 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS
_PER_MILLISECOND))[dartx.truncate](); | |
| 514 } | |
| 515 get inMicroseconds() { | |
| 516 return this[_duration]; | |
| 517 } | |
| 518 ['=='](other) { | |
| 519 if (!dart.is(other, Duration)) | |
| 520 return false; | |
| 521 return dart.equals(this[_duration], dart.dload(other, _duration)); | |
| 522 } | |
| 523 get hashCode() { | |
| 524 return dart.hashCode(this[_duration]); | |
| 525 } | |
| 526 compareTo(other) { | |
| 527 return this[_duration][dartx.compareTo](other[_duration]); | |
| 528 } | |
| 529 toString() { | |
| 530 function sixDigits(n) { | |
| 531 if (dart.notNull(n) >= 100000) | |
| 532 return `${n}`; | |
| 533 if (dart.notNull(n) >= 10000) | |
| 534 return `0${n}`; | |
| 535 if (dart.notNull(n) >= 1000) | |
| 536 return `00${n}`; | |
| 537 if (dart.notNull(n) >= 100) | |
| 538 return `000${n}`; | |
| 539 if (dart.notNull(n) >= 10) | |
| 540 return `0000${n}`; | |
| 541 return `00000${n}`; | |
| 542 } | |
| 543 dart.fn(sixDigits, String, [int]); | |
| 544 function twoDigits(n) { | |
| 545 if (dart.notNull(n) >= 10) | |
| 546 return `${n}`; | |
| 547 return `0${n}`; | |
| 548 } | |
| 549 dart.fn(twoDigits, String, [int]); | |
| 550 if (dart.notNull(this.inMicroseconds) < 0) { | |
| 551 return `-${this['unary-']()}`; | |
| 552 } | |
| 553 let twoDigitMinutes = twoDigits(this.inMinutes[dartx.remainder](Duration.M
INUTES_PER_HOUR)); | |
| 554 let twoDigitSeconds = twoDigits(this.inSeconds[dartx.remainder](Duration.S
ECONDS_PER_MINUTE)); | |
| 555 let sixDigitUs = sixDigits(this.inMicroseconds[dartx.remainder](Duration.M
ICROSECONDS_PER_SECOND)); | |
| 556 return `${this.inHours}:${twoDigitMinutes}:${twoDigitSeconds}.${sixDigitUs
}`; | |
| 557 } | |
| 558 get isNegative() { | |
| 559 return dart.notNull(this[_duration]) < 0; | |
| 560 } | |
| 561 abs() { | |
| 562 return new Duration._microseconds(this[_duration][dartx.abs]()); | |
| 563 } | |
| 564 ['unary-']() { | |
| 565 return new Duration._microseconds(-dart.notNull(this[_duration])); | |
| 566 } | |
| 567 } | |
| 568 Duration[dart.implements] = () => [Comparable$(Duration)]; | |
| 569 dart.defineNamedConstructor(Duration, '_microseconds'); | |
| 570 dart.setSignature(Duration, { | |
| 571 constructors: () => ({ | |
| 572 Duration: [Duration, [], {days: int, hours: int, minutes: int, seconds: in
t, milliseconds: int, microseconds: int}], | |
| 573 _microseconds: [Duration, [int]] | |
| 574 }), | |
| 575 methods: () => ({ | |
| 576 '+': [Duration, [Duration]], | |
| 577 '-': [Duration, [Duration]], | |
| 578 '*': [Duration, [num]], | |
| 579 '~/': [Duration, [int]], | |
| 580 '<': [bool, [Duration]], | |
| 581 '>': [bool, [Duration]], | |
| 582 '<=': [bool, [Duration]], | |
| 583 '>=': [bool, [Duration]], | |
| 584 compareTo: [int, [Duration]], | |
| 585 abs: [Duration, []], | |
| 586 'unary-': [Duration, []] | |
| 587 }) | |
| 588 }); | |
| 589 dart.defineExtensionMembers(Duration, ['compareTo']); | |
| 590 Duration.MICROSECONDS_PER_MILLISECOND = 1000; | |
| 591 Duration.MILLISECONDS_PER_SECOND = 1000; | |
| 592 Duration.SECONDS_PER_MINUTE = 60; | |
| 593 Duration.MINUTES_PER_HOUR = 60; | |
| 594 Duration.HOURS_PER_DAY = 24; | |
| 595 Duration.MICROSECONDS_PER_SECOND = dart.notNull(Duration.MICROSECONDS_PER_MILL
ISECOND) * dart.notNull(Duration.MILLISECONDS_PER_SECOND); | |
| 596 Duration.MICROSECONDS_PER_MINUTE = dart.notNull(Duration.MICROSECONDS_PER_SECO
ND) * dart.notNull(Duration.SECONDS_PER_MINUTE); | |
| 597 Duration.MICROSECONDS_PER_HOUR = dart.notNull(Duration.MICROSECONDS_PER_MINUTE
) * dart.notNull(Duration.MINUTES_PER_HOUR); | |
| 598 Duration.MICROSECONDS_PER_DAY = dart.notNull(Duration.MICROSECONDS_PER_HOUR) *
dart.notNull(Duration.HOURS_PER_DAY); | |
| 599 Duration.MILLISECONDS_PER_MINUTE = dart.notNull(Duration.MILLISECONDS_PER_SECO
ND) * dart.notNull(Duration.SECONDS_PER_MINUTE); | |
| 600 Duration.MILLISECONDS_PER_HOUR = dart.notNull(Duration.MILLISECONDS_PER_MINUTE
) * dart.notNull(Duration.MINUTES_PER_HOUR); | |
| 601 Duration.MILLISECONDS_PER_DAY = dart.notNull(Duration.MILLISECONDS_PER_HOUR) *
dart.notNull(Duration.HOURS_PER_DAY); | |
| 602 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n
otNull(Duration.MINUTES_PER_HOUR); | |
| 603 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN
ull(Duration.HOURS_PER_DAY); | |
| 604 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN
ull(Duration.HOURS_PER_DAY); | |
| 605 Duration.ZERO = dart.const(new Duration({seconds: 0})); | |
| 606 class Error extends Object { | |
| 607 Error() { | |
| 608 } | |
| 609 static safeToString(object) { | |
| 610 if (dart.is(object, num) || typeof object == 'boolean' || null == object)
{ | |
| 611 return dart.toString(object); | |
| 612 } | |
| 613 if (typeof object == 'string') { | |
| 614 return Error._stringToSafeString(object); | |
| 615 } | |
| 616 return Error._objectToString(object); | |
| 617 } | |
| 618 static _stringToSafeString(string) { | |
| 619 return _js_helper.jsonEncodeNative(string); | |
| 620 } | |
| 621 static _objectToString(object) { | |
| 622 return _js_helper.Primitives.objectToString(object); | |
| 623 } | |
| 624 get stackTrace() { | |
| 625 return _js_helper.Primitives.extractStackTrace(this); | |
| 626 } | |
| 627 } | |
| 628 dart.setSignature(Error, { | |
| 629 constructors: () => ({Error: [Error, []]}), | |
| 630 statics: () => ({ | |
| 631 safeToString: [String, [Object]], | |
| 632 _stringToSafeString: [String, [String]], | |
| 633 _objectToString: [String, [Object]] | |
| 634 }), | |
| 635 names: ['safeToString', '_stringToSafeString', '_objectToString'] | |
| 636 }); | |
| 637 class AssertionError extends Error { | |
| 638 AssertionError() { | |
| 639 super.Error(); | |
| 640 } | |
| 641 } | |
| 642 class TypeError extends AssertionError {} | |
| 643 class CastError extends Error { | |
| 644 CastError() { | |
| 645 super.Error(); | |
| 646 } | |
| 647 } | |
| 648 class NullThrownError extends Error { | |
| 649 NullThrownError() { | |
| 650 super.Error(); | |
| 651 } | |
| 652 toString() { | |
| 653 return "Throw of null."; | |
| 654 } | |
| 655 } | |
| 656 let _hasValue = dart.JsSymbol('_hasValue'); | |
| 657 class ArgumentError extends Error { | |
| 658 ArgumentError(message) { | |
| 659 if (message === void 0) | |
| 660 message = null; | |
| 661 this.message = message; | |
| 662 this.invalidValue = null; | |
| 663 this[_hasValue] = false; | |
| 664 this.name = null; | |
| 665 super.Error(); | |
| 666 } | |
| 667 value(value, name, message) { | |
| 668 if (name === void 0) | |
| 669 name = null; | |
| 670 if (message === void 0) | |
| 671 message = "Invalid argument"; | |
| 672 this.name = name; | |
| 673 this.message = message; | |
| 674 this.invalidValue = value; | |
| 675 this[_hasValue] = true; | |
| 676 super.Error(); | |
| 677 } | |
| 678 notNull(name) { | |
| 679 if (name === void 0) | |
| 680 name = null; | |
| 681 this.value(null, name, "Must not be null"); | |
| 682 } | |
| 683 toString() { | |
| 684 if (!dart.notNull(this[_hasValue])) { | |
| 685 let result = "Invalid arguments(s)"; | |
| 686 if (this.message != null) { | |
| 687 result = `${result}: ${this.message}`; | |
| 688 } | |
| 689 return result; | |
| 690 } | |
| 691 let nameString = ""; | |
| 692 if (this.name != null) { | |
| 693 nameString = ` (${this.name})`; | |
| 694 } | |
| 695 return `${this.message}${nameString}: ${Error.safeToString(this.invalidVal
ue)}`; | |
| 696 } | |
| 697 } | |
| 698 dart.defineNamedConstructor(ArgumentError, 'value'); | |
| 699 dart.defineNamedConstructor(ArgumentError, 'notNull'); | |
| 700 dart.setSignature(ArgumentError, { | |
| 701 constructors: () => ({ | |
| 702 ArgumentError: [ArgumentError, [], [dart.dynamic]], | |
| 703 value: [ArgumentError, [dart.dynamic], [String, String]], | |
| 704 notNull: [ArgumentError, [], [String]] | |
| 705 }) | |
| 706 }); | |
| 707 class RangeError extends ArgumentError { | |
| 708 RangeError(message) { | |
| 709 this.start = null; | |
| 710 this.end = null; | |
| 711 super.ArgumentError(message); | |
| 712 } | |
| 713 value(value, name, message) { | |
| 714 if (name === void 0) | |
| 715 name = null; | |
| 716 if (message === void 0) | |
| 717 message = null; | |
| 718 this.start = null; | |
| 719 this.end = null; | |
| 720 super.value(value, name, message != null ? message : "Value not in range")
; | |
| 721 } | |
| 722 range(invalidValue, minValue, maxValue, name, message) { | |
| 723 if (name === void 0) | |
| 724 name = null; | |
| 725 if (message === void 0) | |
| 726 message = null; | |
| 727 this.start = minValue; | |
| 728 this.end = maxValue; | |
| 729 super.value(invalidValue, name, message != null ? message : "Invalid value
"); | |
| 730 } | |
| 731 static index(index, indexable, name, message, length) { | |
| 732 return new IndexError(index, indexable, name, message, length); | |
| 733 } | |
| 734 static checkValueInInterval(value, minValue, maxValue, name, message) { | |
| 735 if (name === void 0) | |
| 736 name = null; | |
| 737 if (message === void 0) | |
| 738 message = null; | |
| 739 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) >
dart.notNull(maxValue)) { | |
| 740 dart.throw(new RangeError.range(value, minValue, maxValue, name, message
)); | |
| 741 } | |
| 742 } | |
| 743 static checkValidIndex(index, indexable, name, length, message) { | |
| 744 if (name === void 0) | |
| 745 name = null; | |
| 746 if (length === void 0) | |
| 747 length = null; | |
| 748 if (message === void 0) | |
| 749 message = null; | |
| 750 if (length == null) | |
| 751 length = dart.as(dart.dload(indexable, 'length'), int); | |
| 752 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length)
) { | |
| 753 if (name == null) | |
| 754 name = "index"; | |
| 755 dart.throw(RangeError.index(index, indexable, name, message, length)); | |
| 756 } | |
| 757 } | |
| 758 static checkValidRange(start, end, length, startName, endName, message) { | |
| 759 if (startName === void 0) | |
| 760 startName = null; | |
| 761 if (endName === void 0) | |
| 762 endName = null; | |
| 763 if (message === void 0) | |
| 764 message = null; | |
| 765 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length))
{ | |
| 766 if (startName == null) | |
| 767 startName = "start"; | |
| 768 dart.throw(new RangeError.range(start, 0, length, startName, message)); | |
| 769 } | |
| 770 if (end != null && (dart.notNull(end) < dart.notNull(start) || dart.notNul
l(end) > dart.notNull(length))) { | |
| 771 if (endName == null) | |
| 772 endName = "end"; | |
| 773 dart.throw(new RangeError.range(end, start, length, endName, message)); | |
| 774 } | |
| 775 } | |
| 776 static checkNotNegative(value, name, message) { | |
| 777 if (name === void 0) | |
| 778 name = null; | |
| 779 if (message === void 0) | |
| 780 message = null; | |
| 781 if (dart.notNull(value) < 0) | |
| 782 dart.throw(new RangeError.range(value, 0, null, name, message)); | |
| 783 } | |
| 784 toString() { | |
| 785 if (!dart.notNull(this[_hasValue])) | |
| 786 return `RangeError: ${this.message}`; | |
| 787 let value = Error.safeToString(this.invalidValue); | |
| 788 let explanation = ""; | |
| 789 if (this.start == null) { | |
| 790 if (this.end != null) { | |
| 791 explanation = `: Not less than or equal to ${this.end}`; | |
| 792 } | |
| 793 } else if (this.end == null) { | |
| 794 explanation = `: Not greater than or equal to ${this.start}`; | |
| 795 } else if (dart.notNull(this.end) > dart.notNull(this.start)) { | |
| 796 explanation = `: Not in range ${this.start}..${this.end}, inclusive.`; | |
| 797 } else if (dart.notNull(this.end) < dart.notNull(this.start)) { | |
| 798 explanation = ": Valid value range is empty"; | |
| 799 } else { | |
| 800 explanation = `: Only valid value is ${this.start}`; | |
| 801 } | |
| 802 return `RangeError: ${this.message} (${value})${explanation}`; | |
| 803 } | |
| 804 } | |
| 805 dart.defineNamedConstructor(RangeError, 'value'); | |
| 806 dart.defineNamedConstructor(RangeError, 'range'); | |
| 807 dart.setSignature(RangeError, { | |
| 808 constructors: () => ({ | |
| 809 RangeError: [RangeError, [dart.dynamic]], | |
| 810 value: [RangeError, [num], [String, String]], | |
| 811 range: [RangeError, [num, int, int], [String, String]], | |
| 812 index: [RangeError, [int, dart.dynamic], [String, String, int]] | |
| 813 }), | |
| 814 statics: () => ({ | |
| 815 checkValueInInterval: [dart.void, [int, int, int], [String, String]], | |
| 816 checkValidIndex: [dart.void, [int, dart.dynamic], [String, int, String]], | |
| 817 checkValidRange: [dart.void, [int, int, int], [String, String, String]], | |
| 818 checkNotNegative: [dart.void, [int], [String, String]] | |
| 819 }), | |
| 820 names: ['checkValueInInterval', 'checkValidIndex', 'checkValidRange', 'check
NotNegative'] | |
| 821 }); | |
| 822 class IndexError extends ArgumentError { | |
| 823 IndexError(invalidValue, indexable, name, message, length) { | |
| 824 if (name === void 0) | |
| 825 name = null; | |
| 826 if (message === void 0) | |
| 827 message = null; | |
| 828 if (length === void 0) | |
| 829 length = null; | |
| 830 this.indexable = indexable; | |
| 831 this.length = length != null ? length : dart.as(dart.dload(indexable, 'len
gth'), int); | |
| 832 super.value(invalidValue, name, message != null ? message : "Index out of
range"); | |
| 833 } | |
| 834 get start() { | |
| 835 return 0; | |
| 836 } | |
| 837 get end() { | |
| 838 return dart.notNull(this.length) - 1; | |
| 839 } | |
| 840 toString() { | |
| 841 dart.assert(this[_hasValue]); | |
| 842 let target = Error.safeToString(this.indexable); | |
| 843 let explanation = `index should be less than ${this.length}`; | |
| 844 if (dart.notNull(dart.as(dart.dsend(this.invalidValue, '<', 0), bool))) { | |
| 845 explanation = "index must not be negative"; | |
| 846 } | |
| 847 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e
xplanation}`; | |
| 848 } | |
| 849 } | |
| 850 IndexError[dart.implements] = () => [RangeError]; | |
| 851 dart.setSignature(IndexError, { | |
| 852 constructors: () => ({IndexError: [IndexError, [int, dart.dynamic], [String,
String, int]]}) | |
| 853 }); | |
| 854 class FallThroughError extends Error { | |
| 855 FallThroughError() { | |
| 856 super.Error(); | |
| 857 } | |
| 858 } | |
| 859 dart.setSignature(FallThroughError, { | |
| 860 constructors: () => ({FallThroughError: [FallThroughError, []]}) | |
| 861 }); | |
| 862 let _className = dart.JsSymbol('_className'); | |
| 863 class AbstractClassInstantiationError extends Error { | |
| 864 AbstractClassInstantiationError(className) { | |
| 865 this[_className] = className; | |
| 866 super.Error(); | |
| 867 } | |
| 868 toString() { | |
| 869 return `Cannot instantiate abstract class: '${this[_className]}'`; | |
| 870 } | |
| 871 } | |
| 872 dart.setSignature(AbstractClassInstantiationError, { | |
| 873 constructors: () => ({AbstractClassInstantiationError: [AbstractClassInstant
iationError, [String]]}) | |
| 874 }); | |
| 875 let _receiver = dart.JsSymbol('_receiver'); | |
| 876 let _memberName = dart.JsSymbol('_memberName'); | |
| 877 let _arguments = dart.JsSymbol('_arguments'); | |
| 878 let _namedArguments = dart.JsSymbol('_namedArguments'); | |
| 879 let _existingArgumentNames = dart.JsSymbol('_existingArgumentNames'); | |
| 880 class NoSuchMethodError extends Error { | |
| 881 NoSuchMethodError(receiver, memberName, positionalArguments, namedArguments,
existingArgumentNames) { | |
| 882 if (existingArgumentNames === void 0) | |
| 883 existingArgumentNames = null; | |
| 884 this[_receiver] = receiver; | |
| 885 this[_memberName] = memberName; | |
| 886 this[_arguments] = positionalArguments; | |
| 887 this[_namedArguments] = namedArguments; | |
| 888 this[_existingArgumentNames] = existingArgumentNames; | |
| 889 super.Error(); | |
| 890 } | |
| 891 toString() { | |
| 892 let sb = new StringBuffer(); | |
| 893 let i = 0; | |
| 894 if (this[_arguments] != null) { | |
| 895 for (; dart.notNull(i) < dart.notNull(this[_arguments][dartx.length]); i
= dart.notNull(i) + 1) { | |
| 896 if (dart.notNull(i) > 0) { | |
| 897 sb.write(", "); | |
| 898 } | |
| 899 sb.write(Error.safeToString(this[_arguments][dartx.get](i))); | |
| 900 } | |
| 901 } | |
| 902 if (this[_namedArguments] != null) { | |
| 903 this[_namedArguments].forEach(dart.fn((key, value) => { | |
| 904 if (dart.notNull(i) > 0) { | |
| 905 sb.write(", "); | |
| 906 } | |
| 907 sb.write(_symbolToString(key)); | |
| 908 sb.write(": "); | |
| 909 sb.write(Error.safeToString(value)); | |
| 910 i = dart.notNull(i) + 1; | |
| 911 }, dart.dynamic, [Symbol, dart.dynamic])); | |
| 912 } | |
| 913 if (this[_existingArgumentNames] == null) { | |
| 914 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n`
+ `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`; | |
| 915 } else { | |
| 916 let actualParameters = dart.toString(sb); | |
| 917 sb = new StringBuffer(); | |
| 918 for (let i = 0; dart.notNull(i) < dart.notNull(this[_existingArgumentNam
es][dartx.length]); i = dart.notNull(i) + 1) { | |
| 919 if (dart.notNull(i) > 0) { | |
| 920 sb.write(", "); | |
| 921 } | |
| 922 sb.write(this[_existingArgumentNames][dartx.get](i)); | |
| 923 } | |
| 924 let formalParameters = dart.toString(sb); | |
| 925 return "NoSuchMethodError: incorrect number of arguments passed to " + `
method named '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_r
eceiver])}\n` + `Tried calling: ${this[_memberName]}(${actualParameters})\n` + `
Found: ${this[_memberName]}(${formalParameters})`; | |
| 926 } | |
| 927 } | |
| 928 } | |
| 929 dart.setSignature(NoSuchMethodError, { | |
| 930 constructors: () => ({NoSuchMethodError: [NoSuchMethodError, [Object, Symbol
, List, Map$(Symbol, dart.dynamic)], [List]]}) | |
| 931 }); | |
| 932 class UnsupportedError extends Error { | |
| 933 UnsupportedError(message) { | |
| 934 this.message = message; | |
| 935 super.Error(); | |
| 936 } | |
| 937 toString() { | |
| 938 return `Unsupported operation: ${this.message}`; | |
| 939 } | |
| 940 } | |
| 941 dart.setSignature(UnsupportedError, { | |
| 942 constructors: () => ({UnsupportedError: [UnsupportedError, [String]]}) | |
| 943 }); | |
| 944 class UnimplementedError extends Error { | |
| 945 UnimplementedError(message) { | |
| 946 if (message === void 0) | |
| 947 message = null; | |
| 948 this.message = message; | |
| 949 super.Error(); | |
| 950 } | |
| 951 toString() { | |
| 952 return this.message != null ? `UnimplementedError: ${this.message}` : "Uni
mplementedError"; | |
| 953 } | |
| 954 } | |
| 955 UnimplementedError[dart.implements] = () => [UnsupportedError]; | |
| 956 dart.setSignature(UnimplementedError, { | |
| 957 constructors: () => ({UnimplementedError: [UnimplementedError, [], [String]]
}) | |
| 958 }); | |
| 959 class StateError extends Error { | |
| 960 StateError(message) { | |
| 961 this.message = message; | |
| 962 super.Error(); | |
| 963 } | |
| 964 toString() { | |
| 965 return `Bad state: ${this.message}`; | |
| 966 } | |
| 967 } | |
| 968 dart.setSignature(StateError, { | |
| 969 constructors: () => ({StateError: [StateError, [String]]}) | |
| 970 }); | |
| 971 class ConcurrentModificationError extends Error { | |
| 972 ConcurrentModificationError(modifiedObject) { | |
| 973 if (modifiedObject === void 0) | |
| 974 modifiedObject = null; | |
| 975 this.modifiedObject = modifiedObject; | |
| 976 super.Error(); | |
| 977 } | |
| 978 toString() { | |
| 979 if (this.modifiedObject == null) { | |
| 980 return "Concurrent modification during iteration."; | |
| 981 } | |
| 982 return "Concurrent modification during iteration: " + `${Error.safeToStrin
g(this.modifiedObject)}.`; | |
| 983 } | |
| 984 } | |
| 985 dart.setSignature(ConcurrentModificationError, { | |
| 986 constructors: () => ({ConcurrentModificationError: [ConcurrentModificationEr
ror, [], [Object]]}) | |
| 987 }); | |
| 988 class OutOfMemoryError extends Object { | |
| 989 OutOfMemoryError() { | |
| 990 } | |
| 991 toString() { | |
| 992 return "Out of Memory"; | |
| 993 } | |
| 994 get stackTrace() { | |
| 995 return null; | |
| 996 } | |
| 997 } | |
| 998 OutOfMemoryError[dart.implements] = () => [Error]; | |
| 999 dart.setSignature(OutOfMemoryError, { | |
| 1000 constructors: () => ({OutOfMemoryError: [OutOfMemoryError, []]}) | |
| 1001 }); | |
| 1002 class StackOverflowError extends Object { | |
| 1003 StackOverflowError() { | |
| 1004 } | |
| 1005 toString() { | |
| 1006 return "Stack Overflow"; | |
| 1007 } | |
| 1008 get stackTrace() { | |
| 1009 return null; | |
| 1010 } | |
| 1011 } | |
| 1012 StackOverflowError[dart.implements] = () => [Error]; | |
| 1013 dart.setSignature(StackOverflowError, { | |
| 1014 constructors: () => ({StackOverflowError: [StackOverflowError, []]}) | |
| 1015 }); | |
| 1016 class CyclicInitializationError extends Error { | |
| 1017 CyclicInitializationError(variableName) { | |
| 1018 if (variableName === void 0) | |
| 1019 variableName = null; | |
| 1020 this.variableName = variableName; | |
| 1021 super.Error(); | |
| 1022 } | |
| 1023 toString() { | |
| 1024 return this.variableName == null ? "Reading static variable during its ini
tialization" : `Reading static variable '${this.variableName}' during its initia
lization`; | |
| 1025 } | |
| 1026 } | |
| 1027 dart.setSignature(CyclicInitializationError, { | |
| 1028 constructors: () => ({CyclicInitializationError: [CyclicInitializationError,
[], [String]]}) | |
| 1029 }); | |
| 1030 class Exception extends Object { | |
| 1031 static new(message) { | |
| 1032 if (message === void 0) | |
| 1033 message = null; | |
| 1034 return new _ExceptionImplementation(message); | |
| 1035 } | |
| 1036 } | |
| 1037 dart.setSignature(Exception, { | |
| 1038 constructors: () => ({new: [Exception, [], [dart.dynamic]]}) | |
| 1039 }); | |
| 1040 class _ExceptionImplementation extends Object { | |
| 1041 _ExceptionImplementation(message) { | |
| 1042 if (message === void 0) | |
| 1043 message = null; | |
| 1044 this.message = message; | |
| 1045 } | |
| 1046 toString() { | |
| 1047 if (this.message == null) | |
| 1048 return "Exception"; | |
| 1049 return `Exception: ${this.message}`; | |
| 1050 } | |
| 1051 } | |
| 1052 _ExceptionImplementation[dart.implements] = () => [Exception]; | |
| 1053 dart.setSignature(_ExceptionImplementation, { | |
| 1054 constructors: () => ({_ExceptionImplementation: [_ExceptionImplementation, [
], [dart.dynamic]]}) | |
| 1055 }); | |
| 1056 class FormatException extends Object { | |
| 1057 FormatException(message, source, offset) { | |
| 1058 if (message === void 0) | |
| 1059 message = ""; | |
| 1060 if (source === void 0) | |
| 1061 source = null; | |
| 1062 if (offset === void 0) | |
| 1063 offset = -1; | |
| 1064 this.message = message; | |
| 1065 this.source = source; | |
| 1066 this.offset = offset; | |
| 1067 } | |
| 1068 toString() { | |
| 1069 let report = "FormatException"; | |
| 1070 if (this.message != null && "" != this.message) { | |
| 1071 report = `${report}: ${this.message}`; | |
| 1072 } | |
| 1073 let offset = this.offset; | |
| 1074 if (!(typeof this.source == 'string')) { | |
| 1075 if (offset != -1) { | |
| 1076 report = dart.notNull(report) + ` (at offset ${offset})`; | |
| 1077 } | |
| 1078 return report; | |
| 1079 } | |
| 1080 if (offset != -1 && (dart.notNull(offset) < 0 || dart.notNull(offset) > da
rt.notNull(dart.as(dart.dload(this.source, 'length'), num)))) { | |
| 1081 offset = -1; | |
| 1082 } | |
| 1083 if (offset == -1) { | |
| 1084 let source = dart.as(this.source, String); | |
| 1085 if (dart.notNull(source[dartx.length]) > 78) { | |
| 1086 source = dart.notNull(source[dartx.substring](0, 75)) + "..."; | |
| 1087 } | |
| 1088 return `${report}\n${source}`; | |
| 1089 } | |
| 1090 let lineNum = 1; | |
| 1091 let lineStart = 0; | |
| 1092 let lastWasCR = null; | |
| 1093 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i
) + 1) { | |
| 1094 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int); | |
| 1095 if (char == 10) { | |
| 1096 if (lineStart != i || !dart.notNull(lastWasCR)) { | |
| 1097 lineNum = dart.notNull(lineNum) + 1; | |
| 1098 } | |
| 1099 lineStart = dart.notNull(i) + 1; | |
| 1100 lastWasCR = false; | |
| 1101 } else if (char == 13) { | |
| 1102 lineNum = dart.notNull(lineNum) + 1; | |
| 1103 lineStart = dart.notNull(i) + 1; | |
| 1104 lastWasCR = true; | |
| 1105 } | |
| 1106 } | |
| 1107 if (dart.notNull(lineNum) > 1) { | |
| 1108 report = dart.notNull(report) + ` (at line ${lineNum}, character ${dart.
notNull(offset) - dart.notNull(lineStart) + 1})\n`; | |
| 1109 } else { | |
| 1110 report = dart.notNull(report) + ` (at character ${dart.notNull(offset) +
1})\n`; | |
| 1111 } | |
| 1112 let lineEnd = dart.as(dart.dload(this.source, 'length'), int); | |
| 1113 for (let i = offset; dart.notNull(i) < dart.notNull(dart.as(dart.dload(thi
s.source, 'length'), num)); i = dart.notNull(i) + 1) { | |
| 1114 let char = dart.as(dart.dsend(this.source, 'codeUnitAt', i), int); | |
| 1115 if (char == 10 || char == 13) { | |
| 1116 lineEnd = i; | |
| 1117 break; | |
| 1118 } | |
| 1119 } | |
| 1120 let length = dart.notNull(lineEnd) - dart.notNull(lineStart); | |
| 1121 let start = lineStart; | |
| 1122 let end = lineEnd; | |
| 1123 let prefix = ""; | |
| 1124 let postfix = ""; | |
| 1125 if (dart.notNull(length) > 78) { | |
| 1126 let index = dart.notNull(offset) - dart.notNull(lineStart); | |
| 1127 if (dart.notNull(index) < 75) { | |
| 1128 end = dart.notNull(start) + 75; | |
| 1129 postfix = "..."; | |
| 1130 } else if (dart.notNull(end) - dart.notNull(offset) < 75) { | |
| 1131 start = dart.notNull(end) - 75; | |
| 1132 prefix = "..."; | |
| 1133 } else { | |
| 1134 start = dart.notNull(offset) - 36; | |
| 1135 end = dart.notNull(offset) + 36; | |
| 1136 prefix = postfix = "..."; | |
| 1137 } | |
| 1138 } | |
| 1139 let slice = dart.as(dart.dsend(this.source, 'substring', start, end), Stri
ng); | |
| 1140 let markOffset = dart.notNull(offset) - dart.notNull(start) + dart.notNull
(prefix[dartx.length]); | |
| 1141 return `${report}${prefix}${slice}${postfix}\n${" "[dartx['*']](markOffset
)}^\n`; | |
| 1142 } | |
| 1143 } | |
| 1144 FormatException[dart.implements] = () => [Exception]; | |
| 1145 dart.setSignature(FormatException, { | |
| 1146 constructors: () => ({FormatException: [FormatException, [], [String, dart.d
ynamic, int]]}) | |
| 1147 }); | |
| 1148 class IntegerDivisionByZeroException extends Object { | |
| 1149 IntegerDivisionByZeroException() { | |
| 1150 } | |
| 1151 toString() { | |
| 1152 return "IntegerDivisionByZeroException"; | |
| 1153 } | |
| 1154 } | |
| 1155 IntegerDivisionByZeroException[dart.implements] = () => [Exception]; | |
| 1156 dart.setSignature(IntegerDivisionByZeroException, { | |
| 1157 constructors: () => ({IntegerDivisionByZeroException: [IntegerDivisionByZero
Exception, []]}) | |
| 1158 }); | |
| 1159 let _getKey = dart.JsSymbol('_getKey'); | |
| 1160 let Expando$ = dart.generic(function(T) { | |
| 1161 class Expando extends Object { | |
| 1162 Expando(name) { | |
| 1163 if (name === void 0) | |
| 1164 name = null; | |
| 1165 this.name = name; | |
| 1166 } | |
| 1167 toString() { | |
| 1168 return `Expando:${this.name}`; | |
| 1169 } | |
| 1170 get(object) { | |
| 1171 let values = _js_helper.Primitives.getProperty(object, Expando$()._EXPAN
DO_PROPERTY_NAME); | |
| 1172 return values == null ? null : dart.as(_js_helper.Primitives.getProperty
(values, this[_getKey]()), T); | |
| 1173 } | |
| 1174 set(object, value) { | |
| 1175 dart.as(value, T); | |
| 1176 let values = _js_helper.Primitives.getProperty(object, Expando$()._EXPAN
DO_PROPERTY_NAME); | |
| 1177 if (values == null) { | |
| 1178 values = new Object(); | |
| 1179 _js_helper.Primitives.setProperty(object, Expando$()._EXPANDO_PROPERTY
_NAME, values); | |
| 1180 } | |
| 1181 _js_helper.Primitives.setProperty(values, this[_getKey](), value); | |
| 1182 return value; | |
| 1183 } | |
| 1184 [_getKey]() { | |
| 1185 let key = dart.as(_js_helper.Primitives.getProperty(this, Expando$()._KE
Y_PROPERTY_NAME), String); | |
| 1186 if (key == null) { | |
| 1187 key = `expando$key$${(() => { | |
| 1188 let x = Expando$()._keyCount; | |
| 1189 Expando$()._keyCount = dart.notNull(x) + 1; | |
| 1190 return x; | |
| 1191 })()}`; | |
| 1192 _js_helper.Primitives.setProperty(this, Expando$()._KEY_PROPERTY_NAME,
key); | |
| 1193 } | |
| 1194 return key; | |
| 1195 } | |
| 1196 } | |
| 1197 dart.setSignature(Expando, { | |
| 1198 constructors: () => ({Expando: [Expando$(T), [], [String]]}), | |
| 1199 methods: () => ({ | |
| 1200 get: [T, [Object]], | |
| 1201 set: [dart.void, [Object, T]], | |
| 1202 [_getKey]: [String, []] | |
| 1203 }) | |
| 1204 }); | |
| 1205 return Expando; | |
| 1206 }); | |
| 1207 let Expando = Expando$(); | |
| 1208 Expando._KEY_PROPERTY_NAME = 'expando$key'; | |
| 1209 Expando._EXPANDO_PROPERTY_NAME = 'expando$values'; | |
| 1210 Expando._keyCount = 0; | |
| 1211 class Function extends Object { | |
| 1212 static apply(f, positionalArguments, namedArguments) { | |
| 1213 if (namedArguments === void 0) | |
| 1214 namedArguments = null; | |
| 1215 return dart.dcall.apply(null, [f].concat(positionalArguments)); | |
| 1216 } | |
| 1217 static _toMangledNames(namedArguments) { | |
| 1218 let result = dart.map(); | |
| 1219 namedArguments.forEach(dart.fn((symbol, value) => { | |
| 1220 result.set(_symbolToString(dart.as(symbol, Symbol)), value); | |
| 1221 })); | |
| 1222 return result; | |
| 1223 } | |
| 1224 } | |
| 1225 dart.setSignature(Function, { | |
| 1226 statics: () => ({ | |
| 1227 apply: [dart.dynamic, [Function, List], [Map$(Symbol, dart.dynamic)]], | |
| 1228 _toMangledNames: [Map$(String, dart.dynamic), [Map$(Symbol, dart.dynamic)]
] | |
| 1229 }), | |
| 1230 names: ['apply', '_toMangledNames'] | |
| 1231 }); | |
| 1232 function identical(a, b) { | |
| 1233 return _js_helper.Primitives.identicalImplementation(a, b); | |
| 1234 } | |
| 1235 dart.fn(identical, bool, [Object, Object]); | |
| 1236 function identityHashCode(object) { | |
| 1237 return _js_helper.objectHashCode(object); | |
| 1238 } | |
| 1239 dart.fn(identityHashCode, () => dart.definiteFunctionType(int, [Object])); | |
| 1240 class int extends num { | |
| 1241 static fromEnvironment(name, opts) { | |
| 1242 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu
ll; | |
| 1243 dart.throw(new UnsupportedError('int.fromEnvironment can only be used as a
const constructor')); | |
| 1244 } | |
| 1245 static parse(source, opts) { | |
| 1246 let radix = opts && 'radix' in opts ? opts.radix : null; | |
| 1247 let onError = opts && 'onError' in opts ? opts.onError : null; | |
| 1248 return _js_helper.Primitives.parseInt(source, radix, onError); | |
| 1249 } | |
| 1250 } | |
| 1251 dart.setSignature(int, { | |
| 1252 constructors: () => ({fromEnvironment: [int, [String], {defaultValue: int}]}
), | |
| 1253 statics: () => ({parse: [int, [String], {radix: int, onError: dart.functionT
ype(int, [String])}]}), | |
| 1254 names: ['parse'] | |
| 1255 }); | |
| 1256 class Invocation extends Object { | |
| 1257 get isAccessor() { | |
| 1258 return dart.notNull(this.isGetter) || dart.notNull(this.isSetter); | |
| 1259 } | |
| 1260 } | |
| 1261 let Iterable$ = dart.generic(function(E) { | |
| 1262 dart.defineExtensionNames([ | |
| 1263 'join' | |
| 1264 ]); | |
| 1265 class Iterable extends Object { | |
| 1266 Iterable() { | |
| 1267 } | |
| 1268 static generate(count, generator) { | |
| 1269 if (generator === void 0) | |
| 1270 generator = null; | |
| 1271 if (dart.notNull(count) <= 0) | |
| 1272 return new (_internal.EmptyIterable$(E))(); | |
| 1273 return new (exports._GeneratorIterable$(E))(count, generator); | |
| 1274 } | |
| 1275 [dart.JsSymbol.iterator]() { | |
| 1276 return new dart.JsIterator(this[dartx.iterator]); | |
| 1277 } | |
| 1278 [dartx.join](separator) { | |
| 1279 if (separator === void 0) | |
| 1280 separator = ""; | |
| 1281 let buffer = new StringBuffer(); | |
| 1282 buffer.writeAll(this, separator); | |
| 1283 return dart.toString(buffer); | |
| 1284 } | |
| 1285 } | |
| 1286 dart.setSignature(Iterable, { | |
| 1287 constructors: () => ({ | |
| 1288 Iterable: [Iterable$(E), []], | |
| 1289 generate: [Iterable$(E), [int], [dart.functionType(E, [int])]] | |
| 1290 }), | |
| 1291 methods: () => ({[dartx.join]: [String, [], [String]]}) | |
| 1292 }); | |
| 1293 return Iterable; | |
| 1294 }); | |
| 1295 let Iterable = Iterable$(); | |
| 1296 let _Generator$ = dart.generic(function(E) { | |
| 1297 let _Generator = dart.typedef('_Generator', () => dart.functionType(E, [int]
)); | |
| 1298 return _Generator; | |
| 1299 }); | |
| 1300 let _Generator = _Generator$(); | |
| 1301 let _end = dart.JsSymbol('_end'); | |
| 1302 let _start = dart.JsSymbol('_start'); | |
| 1303 let _generator = dart.JsSymbol('_generator'); | |
| 1304 let _GeneratorIterable$ = dart.generic(function(E) { | |
| 1305 class _GeneratorIterable extends collection.IterableBase$(E) { | |
| 1306 _GeneratorIterable(end, generator) { | |
| 1307 this[_end] = end; | |
| 1308 this[_start] = 0; | |
| 1309 this[_generator] = dart.as(generator != null ? generator : exports._Gene
ratorIterable$()._id, _Generator$(E)); | |
| 1310 super.IterableBase(); | |
| 1311 } | |
| 1312 slice(start, end, generator) { | |
| 1313 this[_start] = start; | |
| 1314 this[_end] = end; | |
| 1315 this[_generator] = generator; | |
| 1316 super.IterableBase(); | |
| 1317 } | |
| 1318 get iterator() { | |
| 1319 return new (_GeneratorIterator$(E))(this[_start], this[_end], this[_gene
rator]); | |
| 1320 } | |
| 1321 get length() { | |
| 1322 return dart.notNull(this[_end]) - dart.notNull(this[_start]); | |
| 1323 } | |
| 1324 skip(count) { | |
| 1325 RangeError.checkNotNegative(count, "count"); | |
| 1326 if (count == 0) | |
| 1327 return this; | |
| 1328 let newStart = dart.notNull(this[_start]) + dart.notNull(count); | |
| 1329 if (dart.notNull(newStart) >= dart.notNull(this[_end])) | |
| 1330 return new (_internal.EmptyIterable$(E))(); | |
| 1331 return new (exports._GeneratorIterable$(E)).slice(newStart, this[_end],
this[_generator]); | |
| 1332 } | |
| 1333 take(count) { | |
| 1334 RangeError.checkNotNegative(count, "count"); | |
| 1335 if (count == 0) | |
| 1336 return new (_internal.EmptyIterable$(E))(); | |
| 1337 let newEnd = dart.notNull(this[_start]) + dart.notNull(count); | |
| 1338 if (dart.notNull(newEnd) >= dart.notNull(this[_end])) | |
| 1339 return this; | |
| 1340 return new (exports._GeneratorIterable$(E)).slice(this[_start], newEnd,
this[_generator]); | |
| 1341 } | |
| 1342 static _id(n) { | |
| 1343 return n; | |
| 1344 } | |
| 1345 } | |
| 1346 _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength]; | |
| 1347 dart.defineNamedConstructor(_GeneratorIterable, 'slice'); | |
| 1348 dart.setSignature(_GeneratorIterable, { | |
| 1349 constructors: () => ({ | |
| 1350 _GeneratorIterable: [exports._GeneratorIterable$(E), [int, dart.function
Type(E, [int])]], | |
| 1351 slice: [exports._GeneratorIterable$(E), [int, int, _Generator$(E)]] | |
| 1352 }), | |
| 1353 methods: () => ({ | |
| 1354 skip: [Iterable$(E), [int]], | |
| 1355 take: [Iterable$(E), [int]] | |
| 1356 }), | |
| 1357 statics: () => ({_id: [int, [int]]}), | |
| 1358 names: ['_id'] | |
| 1359 }); | |
| 1360 dart.defineExtensionMembers(_GeneratorIterable, ['skip', 'take', 'iterator',
'length']); | |
| 1361 return _GeneratorIterable; | |
| 1362 }); | |
| 1363 dart.defineLazyClassGeneric(exports, '_GeneratorIterable', {get: _GeneratorIte
rable$}); | |
| 1364 let _index = dart.JsSymbol('_index'); | |
| 1365 let _current = dart.JsSymbol('_current'); | |
| 1366 let _GeneratorIterator$ = dart.generic(function(E) { | |
| 1367 class _GeneratorIterator extends Object { | |
| 1368 _GeneratorIterator(index, end, generator) { | |
| 1369 this[_index] = index; | |
| 1370 this[_end] = end; | |
| 1371 this[_generator] = generator; | |
| 1372 this[_current] = null; | |
| 1373 } | |
| 1374 moveNext() { | |
| 1375 if (dart.notNull(this[_index]) < dart.notNull(this[_end])) { | |
| 1376 this[_current] = this[_generator](this[_index]); | |
| 1377 this[_index] = dart.notNull(this[_index]) + 1; | |
| 1378 return true; | |
| 1379 } else { | |
| 1380 this[_current] = null; | |
| 1381 return false; | |
| 1382 } | |
| 1383 } | |
| 1384 get current() { | |
| 1385 return this[_current]; | |
| 1386 } | |
| 1387 } | |
| 1388 _GeneratorIterator[dart.implements] = () => [Iterator$(E)]; | |
| 1389 dart.setSignature(_GeneratorIterator, { | |
| 1390 constructors: () => ({_GeneratorIterator: [_GeneratorIterator$(E), [int, i
nt, _Generator$(E)]]}), | |
| 1391 methods: () => ({moveNext: [bool, []]}) | |
| 1392 }); | |
| 1393 return _GeneratorIterator; | |
| 1394 }); | |
| 1395 let _GeneratorIterator = _GeneratorIterator$(); | |
| 1396 let BidirectionalIterator$ = dart.generic(function(E) { | |
| 1397 class BidirectionalIterator extends Object {} | |
| 1398 BidirectionalIterator[dart.implements] = () => [Iterator$(E)]; | |
| 1399 return BidirectionalIterator; | |
| 1400 }); | |
| 1401 let BidirectionalIterator = BidirectionalIterator$(); | |
| 1402 let Iterator$ = dart.generic(function(E) { | |
| 1403 class Iterator extends Object {} | |
| 1404 return Iterator; | |
| 1405 }); | |
| 1406 let Iterator = Iterator$(); | |
| 1407 let List$ = dart.generic(function(E) { | |
| 1408 class List extends Object { | |
| 1409 static new(length) { | |
| 1410 if (length === void 0) | |
| 1411 length = null; | |
| 1412 let list = null; | |
| 1413 if (length == null) { | |
| 1414 list = []; | |
| 1415 } else { | |
| 1416 if (!(typeof length == 'number') || dart.notNull(length) < 0) { | |
| 1417 dart.throw(new ArgumentError(`Length must be a non-negative integer:
${length}`)); | |
| 1418 } | |
| 1419 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length),
List$())); | |
| 1420 } | |
| 1421 return _interceptors.JSArray$(E).typed(list); | |
| 1422 } | |
| 1423 static filled(length, fill) { | |
| 1424 let result = List$(E).new(length); | |
| 1425 if (length != 0 && fill != null) { | |
| 1426 for (let i = 0; dart.notNull(i) < dart.notNull(result[dartx.length]);
i = dart.notNull(i) + 1) { | |
| 1427 result[dartx.set](i, fill); | |
| 1428 } | |
| 1429 } | |
| 1430 return result; | |
| 1431 } | |
| 1432 static from(elements, opts) { | |
| 1433 let growable = opts && 'growable' in opts ? opts.growable : true; | |
| 1434 let list = List$(E).new(); | |
| 1435 for (let e of elements) { | |
| 1436 list[dartx.add](dart.as(e, E)); | |
| 1437 } | |
| 1438 if (dart.notNull(growable)) | |
| 1439 return list; | |
| 1440 return dart.as(_internal.makeListFixedLength(list), List$(E)); | |
| 1441 } | |
| 1442 static generate(length, generator, opts) { | |
| 1443 let growable = opts && 'growable' in opts ? opts.growable : true; | |
| 1444 let result = null; | |
| 1445 if (dart.notNull(growable)) { | |
| 1446 result = dart.list([], E); | |
| 1447 result[dartx.length] = length; | |
| 1448 } else { | |
| 1449 result = List$(E).new(length); | |
| 1450 } | |
| 1451 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull
(i) + 1) { | |
| 1452 result[dartx.set](i, generator(i)); | |
| 1453 } | |
| 1454 return result; | |
| 1455 } | |
| 1456 [dart.JsSymbol.iterator]() { | |
| 1457 return new dart.JsIterator(this[dartx.iterator]); | |
| 1458 } | |
| 1459 } | |
| 1460 List[dart.implements] = () => [Iterable$(E)]; | |
| 1461 dart.setSignature(List, { | |
| 1462 constructors: () => ({ | |
| 1463 new: [List$(E), [], [int]], | |
| 1464 filled: [List$(E), [int, E]], | |
| 1465 from: [List$(E), [Iterable], {growable: bool}], | |
| 1466 generate: [List$(E), [int, dart.functionType(E, [int])], {growable: bool
}] | |
| 1467 }) | |
| 1468 }); | |
| 1469 return List; | |
| 1470 }); | |
| 1471 let List = List$(); | |
| 1472 let Map$ = dart.generic(function(K, V) { | |
| 1473 class Map extends Object { | |
| 1474 static new() { | |
| 1475 return collection.LinkedHashMap$(K, V).new(); | |
| 1476 } | |
| 1477 static from(other) { | |
| 1478 return collection.LinkedHashMap$(K, V).from(other); | |
| 1479 } | |
| 1480 static identity() { | |
| 1481 return collection.LinkedHashMap$(K, V).identity(); | |
| 1482 } | |
| 1483 static fromIterable(iterable, opts) { | |
| 1484 return collection.LinkedHashMap$(K, V).fromIterable(iterable, opts); | |
| 1485 } | |
| 1486 static fromIterables(keys, values) { | |
| 1487 return collection.LinkedHashMap$(K, V).fromIterables(keys, values); | |
| 1488 } | |
| 1489 } | |
| 1490 dart.setSignature(Map, { | |
| 1491 constructors: () => ({ | |
| 1492 new: [Map$(K, V), []], | |
| 1493 from: [Map$(K, V), [Map$()]], | |
| 1494 identity: [Map$(K, V), []], | |
| 1495 fromIterable: [Map$(K, V), [Iterable], {key: dart.functionType(K, [dart.
dynamic]), value: dart.functionType(V, [dart.dynamic])}], | |
| 1496 fromIterables: [Map$(K, V), [Iterable$(K), Iterable$(V)]] | |
| 1497 }) | |
| 1498 }); | |
| 1499 return Map; | |
| 1500 }); | |
| 1501 let Map = Map$(); | |
| 1502 class Null extends Object { | |
| 1503 static _uninstantiable() { | |
| 1504 dart.throw(new UnsupportedError('class Null cannot be instantiated')); | |
| 1505 } | |
| 1506 toString() { | |
| 1507 return "null"; | |
| 1508 } | |
| 1509 } | |
| 1510 dart.setSignature(Null, { | |
| 1511 constructors: () => ({_uninstantiable: [Null, []]}) | |
| 1512 }); | |
| 1513 num._parseError = false; | |
| 1514 class Pattern extends Object {} | |
| 1515 function print(object) { | |
| 1516 let line = `${object}`; | |
| 1517 if (_internal.printToZone == null) { | |
| 1518 _internal.printToConsole(line); | |
| 1519 } else { | |
| 1520 dart.dcall(_internal.printToZone, line); | |
| 1521 } | |
| 1522 } | |
| 1523 dart.fn(print, dart.void, [Object]); | |
| 1524 class Match extends Object {} | |
| 1525 class RegExp extends Object { | |
| 1526 static new(source, opts) { | |
| 1527 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false; | |
| 1528 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive :
true; | |
| 1529 return new _js_helper.JSSyntaxRegExp(source, {multiLine: multiLine, caseSe
nsitive: caseSensitive}); | |
| 1530 } | |
| 1531 } | |
| 1532 RegExp[dart.implements] = () => [Pattern]; | |
| 1533 dart.setSignature(RegExp, { | |
| 1534 constructors: () => ({new: [RegExp, [String], {multiLine: bool, caseSensitiv
e: bool}]}) | |
| 1535 }); | |
| 1536 let Set$ = dart.generic(function(E) { | |
| 1537 class Set extends collection.IterableBase$(E) { | |
| 1538 static new() { | |
| 1539 return collection.LinkedHashSet$(E).new(); | |
| 1540 } | |
| 1541 static identity() { | |
| 1542 return collection.LinkedHashSet$(E).identity(); | |
| 1543 } | |
| 1544 static from(elements) { | |
| 1545 return collection.LinkedHashSet$(E).from(elements); | |
| 1546 } | |
| 1547 } | |
| 1548 Set[dart.implements] = () => [_internal.EfficientLength]; | |
| 1549 dart.setSignature(Set, { | |
| 1550 constructors: () => ({ | |
| 1551 new: [exports.Set$(E), []], | |
| 1552 identity: [exports.Set$(E), []], | |
| 1553 from: [exports.Set$(E), [Iterable]] | |
| 1554 }) | |
| 1555 }); | |
| 1556 return Set; | |
| 1557 }); | |
| 1558 dart.defineLazyClassGeneric(exports, 'Set', {get: Set$}); | |
| 1559 let Sink$ = dart.generic(function(T) { | |
| 1560 class Sink extends Object {} | |
| 1561 return Sink; | |
| 1562 }); | |
| 1563 let Sink = Sink$(); | |
| 1564 class StackTrace extends Object {} | |
| 1565 let _stop = dart.JsSymbol('_stop'); | |
| 1566 class Stopwatch extends Object { | |
| 1567 get frequency() { | |
| 1568 return Stopwatch._frequency; | |
| 1569 } | |
| 1570 Stopwatch() { | |
| 1571 this[_start] = null; | |
| 1572 this[_stop] = null; | |
| 1573 Stopwatch._initTicker(); | |
| 1574 } | |
| 1575 start() { | |
| 1576 if (dart.notNull(this.isRunning)) | |
| 1577 return; | |
| 1578 if (this[_start] == null) { | |
| 1579 this[_start] = Stopwatch._now(); | |
| 1580 } else { | |
| 1581 this[_start] = dart.notNull(Stopwatch._now()) - (dart.notNull(this[_stop
]) - dart.notNull(this[_start])); | |
| 1582 this[_stop] = null; | |
| 1583 } | |
| 1584 } | |
| 1585 stop() { | |
| 1586 if (!dart.notNull(this.isRunning)) | |
| 1587 return; | |
| 1588 this[_stop] = Stopwatch._now(); | |
| 1589 } | |
| 1590 reset() { | |
| 1591 if (this[_start] == null) | |
| 1592 return; | |
| 1593 this[_start] = Stopwatch._now(); | |
| 1594 if (this[_stop] != null) { | |
| 1595 this[_stop] = this[_start]; | |
| 1596 } | |
| 1597 } | |
| 1598 get elapsedTicks() { | |
| 1599 if (this[_start] == null) { | |
| 1600 return 0; | |
| 1601 } | |
| 1602 return this[_stop] == null ? dart.notNull(Stopwatch._now()) - dart.notNull
(this[_start]) : dart.notNull(this[_stop]) - dart.notNull(this[_start]); | |
| 1603 } | |
| 1604 get elapsed() { | |
| 1605 return new Duration({microseconds: this.elapsedMicroseconds}); | |
| 1606 } | |
| 1607 get elapsedMicroseconds() { | |
| 1608 return (dart.notNull(this.elapsedTicks) * 1000000 / dart.notNull(this.freq
uency))[dartx.truncate](); | |
| 1609 } | |
| 1610 get elapsedMilliseconds() { | |
| 1611 return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequen
cy))[dartx.truncate](); | |
| 1612 } | |
| 1613 get isRunning() { | |
| 1614 return this[_start] != null && this[_stop] == null; | |
| 1615 } | |
| 1616 static _initTicker() { | |
| 1617 _js_helper.Primitives.initTicker(); | |
| 1618 Stopwatch._frequency = _js_helper.Primitives.timerFrequency; | |
| 1619 } | |
| 1620 static _now() { | |
| 1621 return dart.as(dart.dcall(_js_helper.Primitives.timerTicks), int); | |
| 1622 } | |
| 1623 } | |
| 1624 dart.setSignature(Stopwatch, { | |
| 1625 constructors: () => ({Stopwatch: [Stopwatch, []]}), | |
| 1626 methods: () => ({ | |
| 1627 start: [dart.void, []], | |
| 1628 stop: [dart.void, []], | |
| 1629 reset: [dart.void, []] | |
| 1630 }), | |
| 1631 statics: () => ({ | |
| 1632 _initTicker: [dart.void, []], | |
| 1633 _now: [int, []] | |
| 1634 }), | |
| 1635 names: ['_initTicker', '_now'] | |
| 1636 }); | |
| 1637 Stopwatch._frequency = null; | |
| 1638 class String extends Object { | |
| 1639 static fromCharCodes(charCodes, start, end) { | |
| 1640 if (start === void 0) | |
| 1641 start = 0; | |
| 1642 if (end === void 0) | |
| 1643 end = null; | |
| 1644 if (!dart.is(charCodes, _interceptors.JSArray)) { | |
| 1645 return String._stringFromIterable(charCodes, start, end); | |
| 1646 } | |
| 1647 let list = dart.as(charCodes, List); | |
| 1648 let len = list[dartx.length]; | |
| 1649 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) { | |
| 1650 dart.throw(new RangeError.range(start, 0, len)); | |
| 1651 } | |
| 1652 if (end == null) { | |
| 1653 end = len; | |
| 1654 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) >
dart.notNull(len)) { | |
| 1655 dart.throw(new RangeError.range(end, start, len)); | |
| 1656 } | |
| 1657 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) { | |
| 1658 list = list[dartx.sublist](start, end); | |
| 1659 } | |
| 1660 return _js_helper.Primitives.stringFromCharCodes(list); | |
| 1661 } | |
| 1662 static fromCharCode(charCode) { | |
| 1663 return _js_helper.Primitives.stringFromCharCode(charCode); | |
| 1664 } | |
| 1665 static fromEnvironment(name, opts) { | |
| 1666 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu
ll; | |
| 1667 dart.throw(new UnsupportedError('String.fromEnvironment can only be used a
s a const constructor')); | |
| 1668 } | |
| 1669 static _stringFromIterable(charCodes, start, end) { | |
| 1670 if (dart.notNull(start) < 0) | |
| 1671 dart.throw(new RangeError.range(start, 0, charCodes[dartx.length])); | |
| 1672 if (end != null && dart.notNull(end) < dart.notNull(start)) { | |
| 1673 dart.throw(new RangeError.range(end, start, charCodes[dartx.length])); | |
| 1674 } | |
| 1675 let it = charCodes[dartx.iterator]; | |
| 1676 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i)
+ 1) { | |
| 1677 if (!dart.notNull(it.moveNext())) { | |
| 1678 dart.throw(new RangeError.range(start, 0, i)); | |
| 1679 } | |
| 1680 } | |
| 1681 let list = []; | |
| 1682 if (end == null) { | |
| 1683 while (dart.notNull(it.moveNext())) | |
| 1684 list[dartx.add](it.current); | |
| 1685 } else { | |
| 1686 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | |
| 1687 if (!dart.notNull(it.moveNext())) { | |
| 1688 dart.throw(new RangeError.range(end, start, i)); | |
| 1689 } | |
| 1690 list[dartx.add](it.current); | |
| 1691 } | |
| 1692 } | |
| 1693 return _js_helper.Primitives.stringFromCharCodes(list); | |
| 1694 } | |
| 1695 } | |
| 1696 String[dart.implements] = () => [Comparable$(String), Pattern]; | |
| 1697 dart.setSignature(String, { | |
| 1698 constructors: () => ({ | |
| 1699 fromCharCodes: [String, [Iterable$(int)], [int, int]], | |
| 1700 fromCharCode: [String, [int]], | |
| 1701 fromEnvironment: [String, [String], {defaultValue: String}] | |
| 1702 }), | |
| 1703 statics: () => ({_stringFromIterable: [String, [Iterable$(int), int, int]]})
, | |
| 1704 names: ['_stringFromIterable'] | |
| 1705 }); | |
| 1706 dart.defineLazyClass(exports, { | |
| 1707 get Runes() { | |
| 1708 class Runes extends collection.IterableBase$(int) { | |
| 1709 Runes(string) { | |
| 1710 this.string = string; | |
| 1711 super.IterableBase(); | |
| 1712 } | |
| 1713 get iterator() { | |
| 1714 return new RuneIterator(this.string); | |
| 1715 } | |
| 1716 get last() { | |
| 1717 if (this.string[dartx.length] == 0) { | |
| 1718 dart.throw(new StateError('No elements.')); | |
| 1719 } | |
| 1720 let length = this.string[dartx.length]; | |
| 1721 let code = this.string[dartx.codeUnitAt](dart.notNull(length) - 1); | |
| 1722 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string[
dartx.length]) > 1) { | |
| 1723 let previousCode = this.string[dartx.codeUnitAt](dart.notNull(length
) - 2); | |
| 1724 if (dart.notNull(_isLeadSurrogate(previousCode))) { | |
| 1725 return _combineSurrogatePair(previousCode, code); | |
| 1726 } | |
| 1727 } | |
| 1728 return code; | |
| 1729 } | |
| 1730 } | |
| 1731 dart.setSignature(Runes, { | |
| 1732 constructors: () => ({Runes: [exports.Runes, [String]]}) | |
| 1733 }); | |
| 1734 dart.defineExtensionMembers(Runes, ['iterator', 'last']); | |
| 1735 return Runes; | |
| 1736 } | |
| 1737 }); | |
| 1738 function _isLeadSurrogate(code) { | |
| 1739 return (dart.notNull(code) & 64512) == 55296; | |
| 1740 } | |
| 1741 dart.fn(_isLeadSurrogate, bool, [int]); | |
| 1742 function _isTrailSurrogate(code) { | |
| 1743 return (dart.notNull(code) & 64512) == 56320; | |
| 1744 } | |
| 1745 dart.fn(_isTrailSurrogate, bool, [int]); | |
| 1746 function _combineSurrogatePair(start, end) { | |
| 1747 return 65536 + ((dart.notNull(start) & 1023) << 10) + (dart.notNull(end) & 1
023); | |
| 1748 } | |
| 1749 dart.fn(_combineSurrogatePair, int, [int, int]); | |
| 1750 let _position = dart.JsSymbol('_position'); | |
| 1751 let _nextPosition = dart.JsSymbol('_nextPosition'); | |
| 1752 let _currentCodePoint = dart.JsSymbol('_currentCodePoint'); | |
| 1753 let _checkSplitSurrogate = dart.JsSymbol('_checkSplitSurrogate'); | |
| 1754 class RuneIterator extends Object { | |
| 1755 RuneIterator(string) { | |
| 1756 this.string = string; | |
| 1757 this[_position] = 0; | |
| 1758 this[_nextPosition] = 0; | |
| 1759 this[_currentCodePoint] = null; | |
| 1760 } | |
| 1761 at(string, index) { | |
| 1762 this.string = string; | |
| 1763 this[_position] = index; | |
| 1764 this[_nextPosition] = index; | |
| 1765 this[_currentCodePoint] = null; | |
| 1766 RangeError.checkValueInInterval(index, 0, string[dartx.length]); | |
| 1767 this[_checkSplitSurrogate](index); | |
| 1768 } | |
| 1769 [_checkSplitSurrogate](index) { | |
| 1770 if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.str
ing[dartx.length]) && dart.notNull(_isLeadSurrogate(this.string[dartx.codeUnitAt
](dart.notNull(index) - 1))) && dart.notNull(_isTrailSurrogate(this.string[dartx
.codeUnitAt](index)))) { | |
| 1771 dart.throw(new ArgumentError(`Index inside surrogate pair: ${index}`)); | |
| 1772 } | |
| 1773 } | |
| 1774 get rawIndex() { | |
| 1775 return this[_position] != this[_nextPosition] ? this[_position] : null; | |
| 1776 } | |
| 1777 set rawIndex(rawIndex) { | |
| 1778 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex"); | |
| 1779 this.reset(rawIndex); | |
| 1780 this.moveNext(); | |
| 1781 } | |
| 1782 reset(rawIndex) { | |
| 1783 if (rawIndex === void 0) | |
| 1784 rawIndex = 0; | |
| 1785 RangeError.checkValueInInterval(rawIndex, 0, this.string[dartx.length], "r
awIndex"); | |
| 1786 this[_checkSplitSurrogate](rawIndex); | |
| 1787 this[_position] = this[_nextPosition] = rawIndex; | |
| 1788 this[_currentCodePoint] = null; | |
| 1789 } | |
| 1790 get current() { | |
| 1791 return this[_currentCodePoint]; | |
| 1792 } | |
| 1793 get currentSize() { | |
| 1794 return dart.notNull(this[_nextPosition]) - dart.notNull(this[_position]); | |
| 1795 } | |
| 1796 get currentAsString() { | |
| 1797 if (this[_position] == this[_nextPosition]) | |
| 1798 return null; | |
| 1799 if (dart.notNull(this[_position]) + 1 == this[_nextPosition]) | |
| 1800 return this.string[dartx.get](this[_position]); | |
| 1801 return this.string[dartx.substring](this[_position], this[_nextPosition]); | |
| 1802 } | |
| 1803 moveNext() { | |
| 1804 this[_position] = this[_nextPosition]; | |
| 1805 if (this[_position] == this.string[dartx.length]) { | |
| 1806 this[_currentCodePoint] = null; | |
| 1807 return false; | |
| 1808 } | |
| 1809 let codeUnit = this.string[dartx.codeUnitAt](this[_position]); | |
| 1810 let nextPosition = dart.notNull(this[_position]) + 1; | |
| 1811 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition)
< dart.notNull(this.string[dartx.length])) { | |
| 1812 let nextCodeUnit = this.string[dartx.codeUnitAt](nextPosition); | |
| 1813 if (dart.notNull(_isTrailSurrogate(nextCodeUnit))) { | |
| 1814 this[_nextPosition] = dart.notNull(nextPosition) + 1; | |
| 1815 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit
); | |
| 1816 return true; | |
| 1817 } | |
| 1818 } | |
| 1819 this[_nextPosition] = nextPosition; | |
| 1820 this[_currentCodePoint] = codeUnit; | |
| 1821 return true; | |
| 1822 } | |
| 1823 movePrevious() { | |
| 1824 this[_nextPosition] = this[_position]; | |
| 1825 if (this[_position] == 0) { | |
| 1826 this[_currentCodePoint] = null; | |
| 1827 return false; | |
| 1828 } | |
| 1829 let position = dart.notNull(this[_position]) - 1; | |
| 1830 let codeUnit = this.string[dartx.codeUnitAt](position); | |
| 1831 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position) >
0) { | |
| 1832 let prevCodeUnit = this.string[dartx.codeUnitAt](dart.notNull(position)
- 1); | |
| 1833 if (dart.notNull(_isLeadSurrogate(prevCodeUnit))) { | |
| 1834 this[_position] = dart.notNull(position) - 1; | |
| 1835 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit
); | |
| 1836 return true; | |
| 1837 } | |
| 1838 } | |
| 1839 this[_position] = position; | |
| 1840 this[_currentCodePoint] = codeUnit; | |
| 1841 return true; | |
| 1842 } | |
| 1843 } | |
| 1844 RuneIterator[dart.implements] = () => [BidirectionalIterator$(int)]; | |
| 1845 dart.defineNamedConstructor(RuneIterator, 'at'); | |
| 1846 dart.setSignature(RuneIterator, { | |
| 1847 constructors: () => ({ | |
| 1848 RuneIterator: [RuneIterator, [String]], | |
| 1849 at: [RuneIterator, [String, int]] | |
| 1850 }), | |
| 1851 methods: () => ({ | |
| 1852 [_checkSplitSurrogate]: [dart.void, [int]], | |
| 1853 reset: [dart.void, [], [int]], | |
| 1854 moveNext: [bool, []], | |
| 1855 movePrevious: [bool, []] | |
| 1856 }) | |
| 1857 }); | |
| 1858 let _contents = dart.JsSymbol('_contents'); | |
| 1859 let _writeString = dart.JsSymbol('_writeString'); | |
| 1860 class StringBuffer extends Object { | |
| 1861 StringBuffer(content) { | |
| 1862 if (content === void 0) | |
| 1863 content = ""; | |
| 1864 this[_contents] = `${content}`; | |
| 1865 } | |
| 1866 get length() { | |
| 1867 return this[_contents][dartx.length]; | |
| 1868 } | |
| 1869 get isEmpty() { | |
| 1870 return this.length == 0; | |
| 1871 } | |
| 1872 get isNotEmpty() { | |
| 1873 return !dart.notNull(this.isEmpty); | |
| 1874 } | |
| 1875 write(obj) { | |
| 1876 this[_writeString](`${obj}`); | |
| 1877 } | |
| 1878 writeCharCode(charCode) { | |
| 1879 this[_writeString](String.fromCharCode(charCode)); | |
| 1880 } | |
| 1881 writeAll(objects, separator) { | |
| 1882 if (separator === void 0) | |
| 1883 separator = ""; | |
| 1884 let iterator = objects[dartx.iterator]; | |
| 1885 if (!dart.notNull(iterator.moveNext())) | |
| 1886 return; | |
| 1887 if (dart.notNull(separator[dartx.isEmpty])) { | |
| 1888 do { | |
| 1889 this.write(iterator.current); | |
| 1890 } while (dart.notNull(iterator.moveNext())); | |
| 1891 } else { | |
| 1892 this.write(iterator.current); | |
| 1893 while (dart.notNull(iterator.moveNext())) { | |
| 1894 this.write(separator); | |
| 1895 this.write(iterator.current); | |
| 1896 } | |
| 1897 } | |
| 1898 } | |
| 1899 writeln(obj) { | |
| 1900 if (obj === void 0) | |
| 1901 obj = ""; | |
| 1902 this.write(obj); | |
| 1903 this.write("\n"); | |
| 1904 } | |
| 1905 clear() { | |
| 1906 this[_contents] = ""; | |
| 1907 } | |
| 1908 toString() { | |
| 1909 return _js_helper.Primitives.flattenString(this[_contents]); | |
| 1910 } | |
| 1911 [_writeString](str) { | |
| 1912 this[_contents] = _js_helper.Primitives.stringConcatUnchecked(this[_conten
ts], dart.as(str, String)); | |
| 1913 } | |
| 1914 } | |
| 1915 StringBuffer[dart.implements] = () => [StringSink]; | |
| 1916 dart.setSignature(StringBuffer, { | |
| 1917 constructors: () => ({StringBuffer: [StringBuffer, [], [Object]]}), | |
| 1918 methods: () => ({ | |
| 1919 write: [dart.void, [Object]], | |
| 1920 writeCharCode: [dart.void, [int]], | |
| 1921 writeAll: [dart.void, [Iterable], [String]], | |
| 1922 writeln: [dart.void, [], [Object]], | |
| 1923 clear: [dart.void, []], | |
| 1924 [_writeString]: [dart.void, [dart.dynamic]] | |
| 1925 }) | |
| 1926 }); | |
| 1927 class StringSink extends Object {} | |
| 1928 class Symbol extends Object { | |
| 1929 static new(name) { | |
| 1930 return new _internal.Symbol(name); | |
| 1931 } | |
| 1932 } | |
| 1933 dart.setSignature(Symbol, { | |
| 1934 constructors: () => ({new: [Symbol, [String]]}) | |
| 1935 }); | |
| 1936 class Type extends Object {} | |
| 1937 let _writeAuthority = dart.JsSymbol('_writeAuthority'); | |
| 1938 let _userInfo = dart.JsSymbol('_userInfo'); | |
| 1939 let _host = dart.JsSymbol('_host'); | |
| 1940 let _port = dart.JsSymbol('_port'); | |
| 1941 let _path = dart.JsSymbol('_path'); | |
| 1942 let _query = dart.JsSymbol('_query'); | |
| 1943 let _fragment = dart.JsSymbol('_fragment'); | |
| 1944 let _pathSegments = dart.JsSymbol('_pathSegments'); | |
| 1945 let _queryParameters = dart.JsSymbol('_queryParameters'); | |
| 1946 let _merge = dart.JsSymbol('_merge'); | |
| 1947 let _hasDotSegments = dart.JsSymbol('_hasDotSegments'); | |
| 1948 let _removeDotSegments = dart.JsSymbol('_removeDotSegments'); | |
| 1949 let _toWindowsFilePath = dart.JsSymbol('_toWindowsFilePath'); | |
| 1950 let _toFilePath = dart.JsSymbol('_toFilePath'); | |
| 1951 let _isPathAbsolute = dart.JsSymbol('_isPathAbsolute'); | |
| 1952 class Uri extends Object { | |
| 1953 get authority() { | |
| 1954 if (!dart.notNull(this.hasAuthority)) | |
| 1955 return ""; | |
| 1956 let sb = new StringBuffer(); | |
| 1957 this[_writeAuthority](sb); | |
| 1958 return dart.toString(sb); | |
| 1959 } | |
| 1960 get userInfo() { | |
| 1961 return this[_userInfo]; | |
| 1962 } | |
| 1963 get host() { | |
| 1964 if (this[_host] == null) | |
| 1965 return ""; | |
| 1966 if (dart.notNull(this[_host][dartx.startsWith]('['))) { | |
| 1967 return this[_host][dartx.substring](1, dart.notNull(this[_host][dartx.le
ngth]) - 1); | |
| 1968 } | |
| 1969 return this[_host]; | |
| 1970 } | |
| 1971 get port() { | |
| 1972 if (this[_port] == null) | |
| 1973 return Uri._defaultPort(this.scheme); | |
| 1974 return this[_port]; | |
| 1975 } | |
| 1976 static _defaultPort(scheme) { | |
| 1977 if (scheme == "http") | |
| 1978 return 80; | |
| 1979 if (scheme == "https") | |
| 1980 return 443; | |
| 1981 return 0; | |
| 1982 } | |
| 1983 get path() { | |
| 1984 return this[_path]; | |
| 1985 } | |
| 1986 get query() { | |
| 1987 return this[_query] == null ? "" : this[_query]; | |
| 1988 } | |
| 1989 get fragment() { | |
| 1990 return this[_fragment] == null ? "" : this[_fragment]; | |
| 1991 } | |
| 1992 static parse(uri) { | |
| 1993 function isRegName(ch) { | |
| 1994 return dart.notNull(ch) < 128 && !dart.equals(dart.dsend(Uri._regNameTab
le[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0); | |
| 1995 } | |
| 1996 dart.fn(isRegName, bool, [int]); | |
| 1997 let EOI = -1; | |
| 1998 let scheme = ""; | |
| 1999 let userinfo = ""; | |
| 2000 let host = null; | |
| 2001 let port = null; | |
| 2002 let path = null; | |
| 2003 let query = null; | |
| 2004 let fragment = null; | |
| 2005 let index = 0; | |
| 2006 let pathStart = 0; | |
| 2007 let char = EOI; | |
| 2008 function parseAuth() { | |
| 2009 if (index == uri[dartx.length]) { | |
| 2010 char = EOI; | |
| 2011 return; | |
| 2012 } | |
| 2013 let authStart = index; | |
| 2014 let lastColon = -1; | |
| 2015 let lastAt = -1; | |
| 2016 char = uri[dartx.codeUnitAt](index); | |
| 2017 while (dart.notNull(index) < dart.notNull(uri[dartx.length])) { | |
| 2018 char = uri[dartx.codeUnitAt](index); | |
| 2019 if (char == Uri._SLASH || char == Uri._QUESTION || char == Uri._NUMBER
_SIGN) { | |
| 2020 break; | |
| 2021 } | |
| 2022 if (char == Uri._AT_SIGN) { | |
| 2023 lastAt = index; | |
| 2024 lastColon = -1; | |
| 2025 } else if (char == Uri._COLON) { | |
| 2026 lastColon = index; | |
| 2027 } else if (char == Uri._LEFT_BRACKET) { | |
| 2028 lastColon = -1; | |
| 2029 let endBracket = uri[dartx.indexOf](']', dart.notNull(index) + 1); | |
| 2030 if (endBracket == -1) { | |
| 2031 index = uri[dartx.length]; | |
| 2032 char = EOI; | |
| 2033 break; | |
| 2034 } else { | |
| 2035 index = endBracket; | |
| 2036 } | |
| 2037 } | |
| 2038 index = dart.notNull(index) + 1; | |
| 2039 char = EOI; | |
| 2040 } | |
| 2041 let hostStart = authStart; | |
| 2042 let hostEnd = index; | |
| 2043 if (dart.notNull(lastAt) >= 0) { | |
| 2044 userinfo = Uri._makeUserInfo(uri, authStart, lastAt); | |
| 2045 hostStart = dart.notNull(lastAt) + 1; | |
| 2046 } | |
| 2047 if (dart.notNull(lastColon) >= 0) { | |
| 2048 let portNumber = null; | |
| 2049 if (dart.notNull(lastColon) + 1 < dart.notNull(index)) { | |
| 2050 portNumber = 0; | |
| 2051 for (let i = dart.notNull(lastColon) + 1; dart.notNull(i) < dart.not
Null(index); i = dart.notNull(i) + 1) { | |
| 2052 let digit = uri[dartx.codeUnitAt](i); | |
| 2053 if (dart.notNull(Uri._ZERO) > dart.notNull(digit) || dart.notNull(
Uri._NINE) < dart.notNull(digit)) { | |
| 2054 Uri._fail(uri, i, "Invalid port number"); | |
| 2055 } | |
| 2056 portNumber = dart.notNull(portNumber) * 10 + (dart.notNull(digit)
- dart.notNull(Uri._ZERO)); | |
| 2057 } | |
| 2058 } | |
| 2059 port = Uri._makePort(portNumber, scheme); | |
| 2060 hostEnd = lastColon; | |
| 2061 } | |
| 2062 host = Uri._makeHost(uri, hostStart, hostEnd, true); | |
| 2063 if (dart.notNull(index) < dart.notNull(uri[dartx.length])) { | |
| 2064 char = uri[dartx.codeUnitAt](index); | |
| 2065 } | |
| 2066 } | |
| 2067 dart.fn(parseAuth, dart.void, []); | |
| 2068 let NOT_IN_PATH = 0; | |
| 2069 let IN_PATH = 1; | |
| 2070 let ALLOW_AUTH = 2; | |
| 2071 let state = NOT_IN_PATH; | |
| 2072 let i = index; | |
| 2073 while (dart.notNull(i) < dart.notNull(uri[dartx.length])) { | |
| 2074 char = uri[dartx.codeUnitAt](i); | |
| 2075 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { | |
| 2076 state = NOT_IN_PATH; | |
| 2077 break; | |
| 2078 } | |
| 2079 if (char == Uri._SLASH) { | |
| 2080 state = i == 0 ? ALLOW_AUTH : IN_PATH; | |
| 2081 break; | |
| 2082 } | |
| 2083 if (char == Uri._COLON) { | |
| 2084 if (i == 0) | |
| 2085 Uri._fail(uri, 0, "Invalid empty scheme"); | |
| 2086 scheme = Uri._makeScheme(uri, i); | |
| 2087 i = dart.notNull(i) + 1; | |
| 2088 pathStart = i; | |
| 2089 if (i == uri[dartx.length]) { | |
| 2090 char = EOI; | |
| 2091 state = NOT_IN_PATH; | |
| 2092 } else { | |
| 2093 char = uri[dartx.codeUnitAt](i); | |
| 2094 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { | |
| 2095 state = NOT_IN_PATH; | |
| 2096 } else if (char == Uri._SLASH) { | |
| 2097 state = ALLOW_AUTH; | |
| 2098 } else { | |
| 2099 state = IN_PATH; | |
| 2100 } | |
| 2101 } | |
| 2102 break; | |
| 2103 } | |
| 2104 i = dart.notNull(i) + 1; | |
| 2105 char = EOI; | |
| 2106 } | |
| 2107 index = i; | |
| 2108 if (state == ALLOW_AUTH) { | |
| 2109 dart.assert(char == Uri._SLASH); | |
| 2110 index = dart.notNull(index) + 1; | |
| 2111 if (index == uri[dartx.length]) { | |
| 2112 char = EOI; | |
| 2113 state = NOT_IN_PATH; | |
| 2114 } else { | |
| 2115 char = uri[dartx.codeUnitAt](index); | |
| 2116 if (char == Uri._SLASH) { | |
| 2117 index = dart.notNull(index) + 1; | |
| 2118 parseAuth(); | |
| 2119 pathStart = index; | |
| 2120 } | |
| 2121 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN || char == EOI)
{ | |
| 2122 state = NOT_IN_PATH; | |
| 2123 } else { | |
| 2124 state = IN_PATH; | |
| 2125 } | |
| 2126 } | |
| 2127 } | |
| 2128 dart.assert(state == IN_PATH || state == NOT_IN_PATH); | |
| 2129 if (state == IN_PATH) { | |
| 2130 while ((index = dart.notNull(index) + 1) < dart.notNull(uri[dartx.length
])) { | |
| 2131 char = uri[dartx.codeUnitAt](index); | |
| 2132 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { | |
| 2133 break; | |
| 2134 } | |
| 2135 char = EOI; | |
| 2136 } | |
| 2137 state = NOT_IN_PATH; | |
| 2138 } | |
| 2139 dart.assert(state == NOT_IN_PATH); | |
| 2140 let isFile = scheme == "file"; | |
| 2141 let ensureLeadingSlash = host != null; | |
| 2142 path = Uri._makePath(uri, pathStart, index, null, ensureLeadingSlash, isFi
le); | |
| 2143 if (char == Uri._QUESTION) { | |
| 2144 let numberSignIndex = uri[dartx.indexOf]('#', dart.notNull(index) + 1); | |
| 2145 if (dart.notNull(numberSignIndex) < 0) { | |
| 2146 query = Uri._makeQuery(uri, dart.notNull(index) + 1, uri[dartx.length]
, null); | |
| 2147 } else { | |
| 2148 query = Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex,
null); | |
| 2149 fragment = Uri._makeFragment(uri, dart.notNull(numberSignIndex) + 1, u
ri[dartx.length]); | |
| 2150 } | |
| 2151 } else if (char == Uri._NUMBER_SIGN) { | |
| 2152 fragment = Uri._makeFragment(uri, dart.notNull(index) + 1, uri[dartx.len
gth]); | |
| 2153 } | |
| 2154 return new Uri._internal(scheme, userinfo, host, port, path, query, fragme
nt); | |
| 2155 } | |
| 2156 static _fail(uri, index, message) { | |
| 2157 dart.throw(new FormatException(message, uri, index)); | |
| 2158 } | |
| 2159 _internal(scheme, userInfo, host, port, path, query, fragment) { | |
| 2160 this.scheme = scheme; | |
| 2161 this[_userInfo] = userInfo; | |
| 2162 this[_host] = host; | |
| 2163 this[_port] = port; | |
| 2164 this[_path] = path; | |
| 2165 this[_query] = query; | |
| 2166 this[_fragment] = fragment; | |
| 2167 this[_pathSegments] = null; | |
| 2168 this[_queryParameters] = null; | |
| 2169 } | |
| 2170 static new(opts) { | |
| 2171 let scheme = opts && 'scheme' in opts ? opts.scheme : ""; | |
| 2172 let userInfo = opts && 'userInfo' in opts ? opts.userInfo : ""; | |
| 2173 let host = opts && 'host' in opts ? opts.host : null; | |
| 2174 let port = opts && 'port' in opts ? opts.port : null; | |
| 2175 let path = opts && 'path' in opts ? opts.path : null; | |
| 2176 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu
ll; | |
| 2177 let query = opts && 'query' in opts ? opts.query : null; | |
| 2178 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame
ters : null; | |
| 2179 let fragment = opts && 'fragment' in opts ? opts.fragment : null; | |
| 2180 scheme = Uri._makeScheme(scheme, Uri._stringOrNullLength(scheme)); | |
| 2181 userInfo = Uri._makeUserInfo(userInfo, 0, Uri._stringOrNullLength(userInfo
)); | |
| 2182 host = Uri._makeHost(host, 0, Uri._stringOrNullLength(host), false); | |
| 2183 if (query == "") | |
| 2184 query = null; | |
| 2185 query = Uri._makeQuery(query, 0, Uri._stringOrNullLength(query), queryPara
meters); | |
| 2186 fragment = Uri._makeFragment(fragment, 0, Uri._stringOrNullLength(fragment
)); | |
| 2187 port = Uri._makePort(port, scheme); | |
| 2188 let isFile = scheme == "file"; | |
| 2189 if (host == null && (dart.notNull(userInfo[dartx.isNotEmpty]) || port != n
ull || dart.notNull(isFile))) { | |
| 2190 host = ""; | |
| 2191 } | |
| 2192 let ensureLeadingSlash = host != null; | |
| 2193 path = Uri._makePath(path, 0, Uri._stringOrNullLength(path), pathSegments,
ensureLeadingSlash, isFile); | |
| 2194 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme
nt); | |
| 2195 } | |
| 2196 static http(authority, unencodedPath, queryParameters) { | |
| 2197 if (queryParameters === void 0) | |
| 2198 queryParameters = null; | |
| 2199 return Uri._makeHttpUri("http", authority, unencodedPath, queryParameters)
; | |
| 2200 } | |
| 2201 static https(authority, unencodedPath, queryParameters) { | |
| 2202 if (queryParameters === void 0) | |
| 2203 queryParameters = null; | |
| 2204 return Uri._makeHttpUri("https", authority, unencodedPath, queryParameters
); | |
| 2205 } | |
| 2206 static _makeHttpUri(scheme, authority, unencodedPath, queryParameters) { | |
| 2207 let userInfo = ""; | |
| 2208 let host = null; | |
| 2209 let port = null; | |
| 2210 if (authority != null && dart.notNull(authority[dartx.isNotEmpty])) { | |
| 2211 let hostStart = 0; | |
| 2212 let hasUserInfo = false; | |
| 2213 for (let i = 0; dart.notNull(i) < dart.notNull(authority[dartx.length]);
i = dart.notNull(i) + 1) { | |
| 2214 if (authority[dartx.codeUnitAt](i) == Uri._AT_SIGN) { | |
| 2215 hasUserInfo = true; | |
| 2216 userInfo = authority[dartx.substring](0, i); | |
| 2217 hostStart = dart.notNull(i) + 1; | |
| 2218 break; | |
| 2219 } | |
| 2220 } | |
| 2221 let hostEnd = hostStart; | |
| 2222 if (dart.notNull(hostStart) < dart.notNull(authority[dartx.length]) && a
uthority[dartx.codeUnitAt](hostStart) == Uri._LEFT_BRACKET) { | |
| 2223 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]);
hostEnd = dart.notNull(hostEnd) + 1) { | |
| 2224 if (authority[dartx.codeUnitAt](hostEnd) == Uri._RIGHT_BRACKET) | |
| 2225 break; | |
| 2226 } | |
| 2227 if (hostEnd == authority[dartx.length]) { | |
| 2228 dart.throw(new FormatException("Invalid IPv6 host entry.", authority
, hostStart)); | |
| 2229 } | |
| 2230 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); | |
| 2231 hostEnd = dart.notNull(hostEnd) + 1; | |
| 2232 if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](
hostEnd) != Uri._COLON) { | |
| 2233 dart.throw(new FormatException("Invalid end of authority", authority
, hostEnd)); | |
| 2234 } | |
| 2235 } | |
| 2236 let hasPort = false; | |
| 2237 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); ho
stEnd = dart.notNull(hostEnd) + 1) { | |
| 2238 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) { | |
| 2239 let portString = authority[dartx.substring](dart.notNull(hostEnd) +
1); | |
| 2240 if (dart.notNull(portString[dartx.isNotEmpty])) | |
| 2241 port = int.parse(portString); | |
| 2242 break; | |
| 2243 } | |
| 2244 } | |
| 2245 host = authority[dartx.substring](hostStart, hostEnd); | |
| 2246 } | |
| 2247 return Uri.new({scheme: scheme, userInfo: userInfo, host: dart.as(host, St
ring), port: dart.as(port, int), pathSegments: unencodedPath[dartx.split]("/"),
queryParameters: queryParameters}); | |
| 2248 } | |
| 2249 static file(path, opts) { | |
| 2250 let windows = opts && 'windows' in opts ? opts.windows : null; | |
| 2251 windows = windows == null ? Uri._isWindows : windows; | |
| 2252 return dart.notNull(windows) ? dart.as(Uri._makeWindowsFileUrl(path), Uri)
: dart.as(Uri._makeFileUri(path), Uri); | |
| 2253 } | |
| 2254 static get base() { | |
| 2255 let uri = _js_helper.Primitives.currentUri(); | |
| 2256 if (uri != null) | |
| 2257 return Uri.parse(uri); | |
| 2258 dart.throw(new UnsupportedError("'Uri.base' is not supported")); | |
| 2259 } | |
| 2260 static get _isWindows() { | |
| 2261 return false; | |
| 2262 } | |
| 2263 static _checkNonWindowsPathReservedCharacters(segments, argumentError) { | |
| 2264 segments[dartx.forEach](dart.fn(segment => { | |
| 2265 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', "/"), bool))) { | |
| 2266 if (dart.notNull(argumentError)) { | |
| 2267 dart.throw(new ArgumentError(`Illegal path character ${segment}`)); | |
| 2268 } else { | |
| 2269 dart.throw(new UnsupportedError(`Illegal path character ${segment}`)
); | |
| 2270 } | |
| 2271 } | |
| 2272 })); | |
| 2273 } | |
| 2274 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg
ment) { | |
| 2275 if (firstSegment === void 0) | |
| 2276 firstSegment = 0; | |
| 2277 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => { | |
| 2278 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', RegExp.new('["*
/:<>?\\\\|]')), bool))) { | |
| 2279 if (dart.notNull(argumentError)) { | |
| 2280 dart.throw(new ArgumentError("Illegal character in path")); | |
| 2281 } else { | |
| 2282 dart.throw(new UnsupportedError("Illegal character in path")); | |
| 2283 } | |
| 2284 } | |
| 2285 })); | |
| 2286 } | |
| 2287 static _checkWindowsDriveLetter(charCode, argumentError) { | |
| 2288 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)) { | |
| 2289 return; | |
| 2290 } | |
| 2291 if (dart.notNull(argumentError)) { | |
| 2292 dart.throw(new ArgumentError("Illegal drive letter " + dart.notNull(Stri
ng.fromCharCode(charCode)))); | |
| 2293 } else { | |
| 2294 dart.throw(new UnsupportedError("Illegal drive letter " + dart.notNull(S
tring.fromCharCode(charCode)))); | |
| 2295 } | |
| 2296 } | |
| 2297 static _makeFileUri(path) { | |
| 2298 let sep = "/"; | |
| 2299 if (dart.notNull(path[dartx.startsWith](sep))) { | |
| 2300 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)}); | |
| 2301 } else { | |
| 2302 return Uri.new({pathSegments: path[dartx.split](sep)}); | |
| 2303 } | |
| 2304 } | |
| 2305 static _makeWindowsFileUrl(path) { | |
| 2306 if (dart.notNull(path[dartx.startsWith]("\\\\?\\"))) { | |
| 2307 if (dart.notNull(path[dartx.startsWith]("\\\\?\\UNC\\"))) { | |
| 2308 path = `\\${path[dartx.substring](7)}`; | |
| 2309 } else { | |
| 2310 path = path[dartx.substring](4); | |
| 2311 if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1)
!= Uri._COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { | |
| 2312 dart.throw(new ArgumentError("Windows paths with \\\\?\\ prefix must
be absolute")); | |
| 2313 } | |
| 2314 } | |
| 2315 } else { | |
| 2316 path = path[dartx.replaceAll]("/", "\\"); | |
| 2317 } | |
| 2318 let sep = "\\"; | |
| 2319 if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == ":") { | |
| 2320 Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true); | |
| 2321 if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != Uri._BACKSLA
SH) { | |
| 2322 dart.throw(new ArgumentError("Windows paths with drive letter must be
absolute")); | |
| 2323 } | |
| 2324 let pathSegments = path[dartx.split](sep); | |
| 2325 Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1); | |
| 2326 return Uri.new({scheme: "file", pathSegments: pathSegments}); | |
| 2327 } | |
| 2328 if (dart.notNull(path[dartx.length]) > 0 && path[dartx.get](0) == sep) { | |
| 2329 if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == sep) { | |
| 2330 let pathStart = path[dartx.indexOf]("\\", 2); | |
| 2331 let hostPart = pathStart == -1 ? path[dartx.substring](2) : path[dartx
.substring](2, pathStart); | |
| 2332 let pathPart = pathStart == -1 ? "" : path[dartx.substring](dart.notNu
ll(pathStart) + 1); | |
| 2333 let pathSegments = pathPart[dartx.split](sep); | |
| 2334 Uri._checkWindowsPathReservedCharacters(pathSegments, true); | |
| 2335 return Uri.new({scheme: "file", host: hostPart, pathSegments: pathSegm
ents}); | |
| 2336 } else { | |
| 2337 let pathSegments = path[dartx.split](sep); | |
| 2338 Uri._checkWindowsPathReservedCharacters(pathSegments, true); | |
| 2339 return Uri.new({scheme: "file", pathSegments: pathSegments}); | |
| 2340 } | |
| 2341 } else { | |
| 2342 let pathSegments = path[dartx.split](sep); | |
| 2343 Uri._checkWindowsPathReservedCharacters(pathSegments, true); | |
| 2344 return Uri.new({pathSegments: pathSegments}); | |
| 2345 } | |
| 2346 } | |
| 2347 replace(opts) { | |
| 2348 let scheme = opts && 'scheme' in opts ? opts.scheme : null; | |
| 2349 let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null; | |
| 2350 let host = opts && 'host' in opts ? opts.host : null; | |
| 2351 let port = opts && 'port' in opts ? opts.port : null; | |
| 2352 let path = opts && 'path' in opts ? opts.path : null; | |
| 2353 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu
ll; | |
| 2354 let query = opts && 'query' in opts ? opts.query : null; | |
| 2355 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame
ters : null; | |
| 2356 let fragment = opts && 'fragment' in opts ? opts.fragment : null; | |
| 2357 let schemeChanged = false; | |
| 2358 if (scheme != null) { | |
| 2359 scheme = Uri._makeScheme(scheme, scheme[dartx.length]); | |
| 2360 schemeChanged = true; | |
| 2361 } else { | |
| 2362 scheme = this.scheme; | |
| 2363 } | |
| 2364 let isFile = scheme == "file"; | |
| 2365 if (userInfo != null) { | |
| 2366 userInfo = Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]); | |
| 2367 } else { | |
| 2368 userInfo = this.userInfo; | |
| 2369 } | |
| 2370 if (port != null) { | |
| 2371 port = Uri._makePort(port, scheme); | |
| 2372 } else { | |
| 2373 port = this[_port]; | |
| 2374 if (dart.notNull(schemeChanged)) { | |
| 2375 port = Uri._makePort(port, scheme); | |
| 2376 } | |
| 2377 } | |
| 2378 if (host != null) { | |
| 2379 host = Uri._makeHost(host, 0, host[dartx.length], false); | |
| 2380 } else if (dart.notNull(this.hasAuthority)) { | |
| 2381 host = this.host; | |
| 2382 } else if (dart.notNull(userInfo[dartx.isNotEmpty]) || port != null || dar
t.notNull(isFile)) { | |
| 2383 host = ""; | |
| 2384 } | |
| 2385 let ensureLeadingSlash = host != null; | |
| 2386 if (path != null || pathSegments != null) { | |
| 2387 path = Uri._makePath(path, 0, Uri._stringOrNullLength(path), pathSegment
s, ensureLeadingSlash, isFile); | |
| 2388 } else { | |
| 2389 path = this.path; | |
| 2390 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n
otNull(path[dartx.isEmpty])) && !dart.notNull(path[dartx.startsWith]('/'))) { | |
| 2391 path = `/${path}`; | |
| 2392 } | |
| 2393 } | |
| 2394 if (query != null || queryParameters != null) { | |
| 2395 query = Uri._makeQuery(query, 0, Uri._stringOrNullLength(query), queryPa
rameters); | |
| 2396 } else if (dart.notNull(this.hasQuery)) { | |
| 2397 query = this.query; | |
| 2398 } | |
| 2399 if (fragment != null) { | |
| 2400 fragment = Uri._makeFragment(fragment, 0, fragment[dartx.length]); | |
| 2401 } else if (dart.notNull(this.hasFragment)) { | |
| 2402 fragment = this.fragment; | |
| 2403 } | |
| 2404 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme
nt); | |
| 2405 } | |
| 2406 get pathSegments() { | |
| 2407 if (this[_pathSegments] == null) { | |
| 2408 let pathToSplit = !dart.notNull(this.path[dartx.isEmpty]) && this.path[d
artx.codeUnitAt](0) == Uri._SLASH ? this.path[dartx.substring](1) : this.path; | |
| 2409 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})); | |
| 2410 } | |
| 2411 return this[_pathSegments]; | |
| 2412 } | |
| 2413 get queryParameters() { | |
| 2414 if (this[_queryParameters] == null) { | |
| 2415 this[_queryParameters] = new (collection.UnmodifiableMapView$(String, St
ring))(Uri.splitQueryString(this.query)); | |
| 2416 } | |
| 2417 return this[_queryParameters]; | |
| 2418 } | |
| 2419 static _makePort(port, scheme) { | |
| 2420 if (port != null && port == Uri._defaultPort(scheme)) | |
| 2421 return null; | |
| 2422 return port; | |
| 2423 } | |
| 2424 static _makeHost(host, start, end, strictIPv6) { | |
| 2425 if (host == null) | |
| 2426 return null; | |
| 2427 if (start == end) | |
| 2428 return ""; | |
| 2429 if (host[dartx.codeUnitAt](start) == Uri._LEFT_BRACKET) { | |
| 2430 if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != Uri._RIGHT_BRACKET)
{ | |
| 2431 Uri._fail(host, start, 'Missing end `]` to match `[` in host'); | |
| 2432 } | |
| 2433 Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) -
1); | |
| 2434 return host[dartx.substring](start, end)[dartx.toLowerCase](); | |
| 2435 } | |
| 2436 if (!dart.notNull(strictIPv6)) { | |
| 2437 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | |
| 2438 if (host[dartx.codeUnitAt](i) == Uri._COLON) { | |
| 2439 Uri.parseIPv6Address(host, start, end); | |
| 2440 return `[${host}]`; | |
| 2441 } | |
| 2442 } | |
| 2443 } | |
| 2444 return Uri._normalizeRegName(host, start, end); | |
| 2445 } | |
| 2446 static _isRegNameChar(char) { | |
| 2447 return dart.notNull(char) < 127 && !dart.equals(dart.dsend(Uri._regNameTab
le[dartx.get](dart.notNull(char) >> 4), '&', 1 << (dart.notNull(char) & 15)), 0)
; | |
| 2448 } | |
| 2449 static _normalizeRegName(host, start, end) { | |
| 2450 let buffer = null; | |
| 2451 let sectionStart = start; | |
| 2452 let index = start; | |
| 2453 let isNormalized = true; | |
| 2454 while (dart.notNull(index) < dart.notNull(end)) { | |
| 2455 let char = host[dartx.codeUnitAt](index); | |
| 2456 if (char == Uri._PERCENT) { | |
| 2457 let replacement = Uri._normalizeEscape(host, index, true); | |
| 2458 if (replacement == null && dart.notNull(isNormalized)) { | |
| 2459 index = dart.notNull(index) + 3; | |
| 2460 continue; | |
| 2461 } | |
| 2462 if (buffer == null) | |
| 2463 buffer = new StringBuffer(); | |
| 2464 let slice = host[dartx.substring](sectionStart, index); | |
| 2465 if (!dart.notNull(isNormalized)) | |
| 2466 slice = slice[dartx.toLowerCase](); | |
| 2467 buffer.write(slice); | |
| 2468 let sourceLength = 3; | |
| 2469 if (replacement == null) { | |
| 2470 replacement = host[dartx.substring](index, dart.notNull(index) + 3); | |
| 2471 } else if (replacement == "%") { | |
| 2472 replacement = "%25"; | |
| 2473 sourceLength = 1; | |
| 2474 } | |
| 2475 buffer.write(replacement); | |
| 2476 index = dart.notNull(index) + dart.notNull(sourceLength); | |
| 2477 sectionStart = index; | |
| 2478 isNormalized = true; | |
| 2479 } else if (dart.notNull(Uri._isRegNameChar(char))) { | |
| 2480 if (dart.notNull(isNormalized) && dart.notNull(Uri._UPPER_CASE_A) <= d
art.notNull(char) && dart.notNull(Uri._UPPER_CASE_Z) >= dart.notNull(char)) { | |
| 2481 if (buffer == null) | |
| 2482 buffer = new StringBuffer(); | |
| 2483 if (dart.notNull(sectionStart) < dart.notNull(index)) { | |
| 2484 buffer.write(host[dartx.substring](sectionStart, index)); | |
| 2485 sectionStart = index; | |
| 2486 } | |
| 2487 isNormalized = false; | |
| 2488 } | |
| 2489 index = dart.notNull(index) + 1; | |
| 2490 } else if (dart.notNull(Uri._isGeneralDelimiter(char))) { | |
| 2491 Uri._fail(host, index, "Invalid character"); | |
| 2492 } else { | |
| 2493 let sourceLength = 1; | |
| 2494 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 <
dart.notNull(end)) { | |
| 2495 let tail = host[dartx.codeUnitAt](dart.notNull(index) + 1); | |
| 2496 if ((dart.notNull(tail) & 64512) == 56320) { | |
| 2497 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta
il) & 1023; | |
| 2498 sourceLength = 2; | |
| 2499 } | |
| 2500 } | |
| 2501 if (buffer == null) | |
| 2502 buffer = new StringBuffer(); | |
| 2503 let slice = host[dartx.substring](sectionStart, index); | |
| 2504 if (!dart.notNull(isNormalized)) | |
| 2505 slice = slice[dartx.toLowerCase](); | |
| 2506 buffer.write(slice); | |
| 2507 buffer.write(Uri._escapeChar(char)); | |
| 2508 index = dart.notNull(index) + dart.notNull(sourceLength); | |
| 2509 sectionStart = index; | |
| 2510 } | |
| 2511 } | |
| 2512 if (buffer == null) | |
| 2513 return host[dartx.substring](start, end); | |
| 2514 if (dart.notNull(sectionStart) < dart.notNull(end)) { | |
| 2515 let slice = host[dartx.substring](sectionStart, end); | |
| 2516 if (!dart.notNull(isNormalized)) | |
| 2517 slice = slice[dartx.toLowerCase](); | |
| 2518 buffer.write(slice); | |
| 2519 } | |
| 2520 return dart.toString(buffer); | |
| 2521 } | |
| 2522 static _makeScheme(scheme, end) { | |
| 2523 if (end == 0) | |
| 2524 return ""; | |
| 2525 let firstCodeUnit = scheme[dartx.codeUnitAt](0); | |
| 2526 if (!dart.notNull(Uri._isAlphabeticCharacter(firstCodeUnit))) { | |
| 2527 Uri._fail(scheme, 0, "Scheme not starting with alphabetic character"); | |
| 2528 } | |
| 2529 let allLowercase = dart.notNull(firstCodeUnit) >= dart.notNull(Uri._LOWER_
CASE_A); | |
| 2530 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) +
1) { | |
| 2531 let codeUnit = scheme[dartx.codeUnitAt](i); | |
| 2532 if (!dart.notNull(Uri._isSchemeCharacter(codeUnit))) { | |
| 2533 Uri._fail(scheme, i, "Illegal scheme character"); | |
| 2534 } | |
| 2535 if (dart.notNull(codeUnit) < dart.notNull(Uri._LOWER_CASE_A) || dart.not
Null(codeUnit) > dart.notNull(Uri._LOWER_CASE_Z)) { | |
| 2536 allLowercase = false; | |
| 2537 } | |
| 2538 } | |
| 2539 scheme = scheme[dartx.substring](0, end); | |
| 2540 if (!dart.notNull(allLowercase)) | |
| 2541 scheme = scheme[dartx.toLowerCase](); | |
| 2542 return scheme; | |
| 2543 } | |
| 2544 static _makeUserInfo(userInfo, start, end) { | |
| 2545 if (userInfo == null) | |
| 2546 return ""; | |
| 2547 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li
st$(int))); | |
| 2548 } | |
| 2549 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile)
{ | |
| 2550 if (path == null && pathSegments == null) | |
| 2551 return dart.notNull(isFile) ? "/" : ""; | |
| 2552 if (path != null && pathSegments != null) { | |
| 2553 dart.throw(new ArgumentError('Both path and pathSegments specified')); | |
| 2554 } | |
| 2555 let result = null; | |
| 2556 if (path != null) { | |
| 2557 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa
ble, List$(int))); | |
| 2558 } else { | |
| 2559 result = pathSegments[dartx.map](dart.fn(s => Uri._uriEncode(dart.as(Uri
._pathCharTable, List$(int)), dart.as(s, String)), String, [dart.dynamic]))[dart
x.join]("/"); | |
| 2560 } | |
| 2561 if (dart.notNull(dart.as(dart.dload(result, 'isEmpty'), bool))) { | |
| 2562 if (dart.notNull(isFile)) | |
| 2563 return "/"; | |
| 2564 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && !
dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH)) { | |
| 2565 return `/${result}`; | |
| 2566 } | |
| 2567 return dart.as(result, String); | |
| 2568 } | |
| 2569 static _makeQuery(query, start, end, queryParameters) { | |
| 2570 if (query == null && queryParameters == null) | |
| 2571 return null; | |
| 2572 if (query != null && queryParameters != null) { | |
| 2573 dart.throw(new ArgumentError('Both query and queryParameters specified')
); | |
| 2574 } | |
| 2575 if (query != null) | |
| 2576 return Uri._normalize(query, start, end, dart.as(Uri._queryCharTable, Li
st$(int))); | |
| 2577 let result = new StringBuffer(); | |
| 2578 let first = true; | |
| 2579 queryParameters.forEach(dart.fn((key, value) => { | |
| 2580 if (!dart.notNull(first)) { | |
| 2581 result.write("&"); | |
| 2582 } | |
| 2583 first = false; | |
| 2584 result.write(Uri.encodeQueryComponent(dart.as(key, String))); | |
| 2585 if (value != null && !dart.notNull(dart.as(dart.dload(value, 'isEmpty'),
bool))) { | |
| 2586 result.write("="); | |
| 2587 result.write(Uri.encodeQueryComponent(dart.as(value, String))); | |
| 2588 } | |
| 2589 })); | |
| 2590 return dart.toString(result); | |
| 2591 } | |
| 2592 static _makeFragment(fragment, start, end) { | |
| 2593 if (fragment == null) | |
| 2594 return null; | |
| 2595 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L
ist$(int))); | |
| 2596 } | |
| 2597 static _stringOrNullLength(s) { | |
| 2598 return s == null ? 0 : s[dartx.length]; | |
| 2599 } | |
| 2600 static _isHexDigit(char) { | |
| 2601 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) | |
| 2602 return dart.notNull(Uri._ZERO) <= dart.notNull(char); | |
| 2603 char = dart.notNull(char) | 32; | |
| 2604 return dart.notNull(Uri._LOWER_CASE_A) <= dart.notNull(char) && dart.notNu
ll(Uri._LOWER_CASE_F) >= dart.notNull(char); | |
| 2605 } | |
| 2606 static _hexValue(char) { | |
| 2607 dart.assert(Uri._isHexDigit(char)); | |
| 2608 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) | |
| 2609 return dart.notNull(char) - dart.notNull(Uri._ZERO); | |
| 2610 char = dart.notNull(char) | 32; | |
| 2611 return dart.notNull(char) - (dart.notNull(Uri._LOWER_CASE_A) - 10); | |
| 2612 } | |
| 2613 static _normalizeEscape(source, index, lowerCase) { | |
| 2614 dart.assert(source[dartx.codeUnitAt](index) == Uri._PERCENT); | |
| 2615 if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) { | |
| 2616 return "%"; | |
| 2617 } | |
| 2618 let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1); | |
| 2619 let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2); | |
| 2620 if (!dart.notNull(Uri._isHexDigit(firstDigit)) || !dart.notNull(Uri._isHex
Digit(secondDigit))) { | |
| 2621 return "%"; | |
| 2622 } | |
| 2623 let value = dart.notNull(Uri._hexValue(firstDigit)) * 16 + dart.notNull(Ur
i._hexValue(secondDigit)); | |
| 2624 if (dart.notNull(Uri._isUnreservedChar(value))) { | |
| 2625 if (dart.notNull(lowerCase) && dart.notNull(Uri._UPPER_CASE_A) <= dart.n
otNull(value) && dart.notNull(Uri._UPPER_CASE_Z) >= dart.notNull(value)) { | |
| 2626 value = dart.notNull(value) | 32; | |
| 2627 } | |
| 2628 return String.fromCharCode(value); | |
| 2629 } | |
| 2630 if (dart.notNull(firstDigit) >= dart.notNull(Uri._LOWER_CASE_A) || dart.no
tNull(secondDigit) >= dart.notNull(Uri._LOWER_CASE_A)) { | |
| 2631 return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toU
pperCase](); | |
| 2632 } | |
| 2633 return null; | |
| 2634 } | |
| 2635 static _isUnreservedChar(ch) { | |
| 2636 return dart.notNull(ch) < 127 && !dart.equals(dart.dsend(Uri._unreservedTa
ble[dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0); | |
| 2637 } | |
| 2638 static _escapeChar(char) { | |
| 2639 dart.assert(dart.dsend(char, '<=', 1114111)); | |
| 2640 let hexDigits = "0123456789ABCDEF"; | |
| 2641 let codeUnits = null; | |
| 2642 if (dart.notNull(dart.as(dart.dsend(char, '<', 128), bool))) { | |
| 2643 codeUnits = List.new(3); | |
| 2644 codeUnits[dartx.set](0, Uri._PERCENT); | |
| 2645 codeUnits[dartx.set](1, hexDigits[dartx.codeUnitAt](dart.as(dart.dsend(c
har, '>>', 4), int))); | |
| 2646 codeUnits[dartx.set](2, hexDigits[dartx.codeUnitAt](dart.as(dart.dsend(c
har, '&', 15), int))); | |
| 2647 } else { | |
| 2648 let flag = 192; | |
| 2649 let encodedBytes = 2; | |
| 2650 if (dart.notNull(dart.as(dart.dsend(char, '>', 2047), bool))) { | |
| 2651 flag = 224; | |
| 2652 encodedBytes = 3; | |
| 2653 if (dart.notNull(dart.as(dart.dsend(char, '>', 65535), bool))) { | |
| 2654 encodedBytes = 4; | |
| 2655 flag = 240; | |
| 2656 } | |
| 2657 } | |
| 2658 codeUnits = List.new(3 * dart.notNull(encodedBytes)); | |
| 2659 let index = 0; | |
| 2660 while ((encodedBytes = dart.notNull(encodedBytes) - 1) >= 0) { | |
| 2661 let byte = dart.as(dart.dsend(dart.dsend(dart.dsend(char, '>>', 6 * da
rt.notNull(encodedBytes)), '&', 63), '|', flag), int); | |
| 2662 codeUnits[dartx.set](index, Uri._PERCENT); | |
| 2663 codeUnits[dartx.set](dart.notNull(index) + 1, hexDigits[dartx.codeUnit
At](dart.notNull(byte) >> 4)); | |
| 2664 codeUnits[dartx.set](dart.notNull(index) + 2, hexDigits[dartx.codeUnit
At](dart.notNull(byte) & 15)); | |
| 2665 index = dart.notNull(index) + 3; | |
| 2666 flag = 128; | |
| 2667 } | |
| 2668 } | |
| 2669 return String.fromCharCodes(dart.as(codeUnits, Iterable$(int))); | |
| 2670 } | |
| 2671 static _normalize(component, start, end, charTable) { | |
| 2672 let buffer = null; | |
| 2673 let sectionStart = start; | |
| 2674 let index = start; | |
| 2675 while (dart.notNull(index) < dart.notNull(end)) { | |
| 2676 let char = component[dartx.codeUnitAt](index); | |
| 2677 if (dart.notNull(char) < 127 && (dart.notNull(charTable[dartx.get](dart.
notNull(char) >> 4)) & 1 << (dart.notNull(char) & 15)) != 0) { | |
| 2678 index = dart.notNull(index) + 1; | |
| 2679 } else { | |
| 2680 let replacement = null; | |
| 2681 let sourceLength = null; | |
| 2682 if (char == Uri._PERCENT) { | |
| 2683 replacement = Uri._normalizeEscape(component, index, false); | |
| 2684 if (replacement == null) { | |
| 2685 index = dart.notNull(index) + 3; | |
| 2686 continue; | |
| 2687 } | |
| 2688 if ("%" == replacement) { | |
| 2689 replacement = "%25"; | |
| 2690 sourceLength = 1; | |
| 2691 } else { | |
| 2692 sourceLength = 3; | |
| 2693 } | |
| 2694 } else if (dart.notNull(Uri._isGeneralDelimiter(char))) { | |
| 2695 Uri._fail(component, index, "Invalid character"); | |
| 2696 } else { | |
| 2697 sourceLength = 1; | |
| 2698 if ((dart.notNull(char) & 64512) == 55296) { | |
| 2699 if (dart.notNull(index) + 1 < dart.notNull(end)) { | |
| 2700 let tail = component[dartx.codeUnitAt](dart.notNull(index) + 1); | |
| 2701 if ((dart.notNull(tail) & 64512) == 56320) { | |
| 2702 sourceLength = 2; | |
| 2703 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul
l(tail) & 1023; | |
| 2704 } | |
| 2705 } | |
| 2706 } | |
| 2707 replacement = Uri._escapeChar(char); | |
| 2708 } | |
| 2709 if (buffer == null) | |
| 2710 buffer = new StringBuffer(); | |
| 2711 buffer.write(component[dartx.substring](sectionStart, index)); | |
| 2712 buffer.write(replacement); | |
| 2713 index = dart.notNull(index) + dart.notNull(sourceLength); | |
| 2714 sectionStart = index; | |
| 2715 } | |
| 2716 } | |
| 2717 if (buffer == null) { | |
| 2718 return component[dartx.substring](start, end); | |
| 2719 } | |
| 2720 if (dart.notNull(sectionStart) < dart.notNull(end)) { | |
| 2721 buffer.write(component[dartx.substring](sectionStart, end)); | |
| 2722 } | |
| 2723 return dart.toString(buffer); | |
| 2724 } | |
| 2725 static _isSchemeCharacter(ch) { | |
| 2726 return dart.notNull(ch) < 128 && !dart.equals(dart.dsend(Uri._schemeTable[
dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0); | |
| 2727 } | |
| 2728 static _isGeneralDelimiter(ch) { | |
| 2729 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); | |
| 2730 } | |
| 2731 get isAbsolute() { | |
| 2732 return this.scheme != "" && this.fragment == ""; | |
| 2733 } | |
| 2734 [_merge](base, reference) { | |
| 2735 if (dart.notNull(base[dartx.isEmpty])) | |
| 2736 return `/${reference}`; | |
| 2737 let backCount = 0; | |
| 2738 let refStart = 0; | |
| 2739 while (dart.notNull(reference[dartx.startsWith]("../", refStart))) { | |
| 2740 refStart = dart.notNull(refStart) + 3; | |
| 2741 backCount = dart.notNull(backCount) + 1; | |
| 2742 } | |
| 2743 let baseEnd = base[dartx.lastIndexOf]('/'); | |
| 2744 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { | |
| 2745 let newEnd = base[dartx.lastIndexOf]('/', dart.notNull(baseEnd) - 1); | |
| 2746 if (dart.notNull(newEnd) < 0) { | |
| 2747 break; | |
| 2748 } | |
| 2749 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); | |
| 2750 if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(ne
wEnd) + 1) == Uri._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(new
End) + 2) == Uri._DOT)) { | |
| 2751 break; | |
| 2752 } | |
| 2753 baseEnd = newEnd; | |
| 2754 backCount = dart.notNull(backCount) - 1; | |
| 2755 } | |
| 2756 return dart.notNull(base[dartx.substring](0, dart.notNull(baseEnd) + 1)) +
dart.notNull(reference[dartx.substring](dart.notNull(refStart) - 3 * dart.notNu
ll(backCount))); | |
| 2757 } | |
| 2758 [_hasDotSegments](path) { | |
| 2759 if (dart.notNull(path[dartx.length]) > 0 && path[dartx.codeUnitAt](0) == U
ri._DOT) | |
| 2760 return true; | |
| 2761 let index = path[dartx.indexOf]("/."); | |
| 2762 return index != -1; | |
| 2763 } | |
| 2764 [_removeDotSegments](path) { | |
| 2765 if (!dart.notNull(this[_hasDotSegments](path))) | |
| 2766 return path; | |
| 2767 let output = dart.list([], String); | |
| 2768 let appendSlash = false; | |
| 2769 for (let segment of path[dartx.split]("/")) { | |
| 2770 appendSlash = false; | |
| 2771 if (segment == "..") { | |
| 2772 if (!dart.notNull(output[dartx.isEmpty]) && (output[dartx.length] != 1
|| output[dartx.get](0) != "")) | |
| 2773 output[dartx.removeLast](); | |
| 2774 appendSlash = true; | |
| 2775 } else if ("." == segment) { | |
| 2776 appendSlash = true; | |
| 2777 } else { | |
| 2778 output[dartx.add](segment); | |
| 2779 } | |
| 2780 } | |
| 2781 if (dart.notNull(appendSlash)) | |
| 2782 output[dartx.add](""); | |
| 2783 return output[dartx.join]("/"); | |
| 2784 } | |
| 2785 resolve(reference) { | |
| 2786 return this.resolveUri(Uri.parse(reference)); | |
| 2787 } | |
| 2788 resolveUri(reference) { | |
| 2789 let targetScheme = null; | |
| 2790 let targetUserInfo = ""; | |
| 2791 let targetHost = null; | |
| 2792 let targetPort = null; | |
| 2793 let targetPath = null; | |
| 2794 let targetQuery = null; | |
| 2795 if (dart.notNull(reference.scheme[dartx.isNotEmpty])) { | |
| 2796 targetScheme = reference.scheme; | |
| 2797 if (dart.notNull(reference.hasAuthority)) { | |
| 2798 targetUserInfo = reference.userInfo; | |
| 2799 targetHost = reference.host; | |
| 2800 targetPort = dart.notNull(reference.hasPort) ? reference.port : null; | |
| 2801 } | |
| 2802 targetPath = this[_removeDotSegments](reference.path); | |
| 2803 if (dart.notNull(reference.hasQuery)) { | |
| 2804 targetQuery = reference.query; | |
| 2805 } | |
| 2806 } else { | |
| 2807 targetScheme = this.scheme; | |
| 2808 if (dart.notNull(reference.hasAuthority)) { | |
| 2809 targetUserInfo = reference.userInfo; | |
| 2810 targetHost = reference.host; | |
| 2811 targetPort = Uri._makePort(dart.notNull(reference.hasPort) ? reference
.port : null, targetScheme); | |
| 2812 targetPath = this[_removeDotSegments](reference.path); | |
| 2813 if (dart.notNull(reference.hasQuery)) | |
| 2814 targetQuery = reference.query; | |
| 2815 } else { | |
| 2816 if (reference.path == "") { | |
| 2817 targetPath = this[_path]; | |
| 2818 if (dart.notNull(reference.hasQuery)) { | |
| 2819 targetQuery = reference.query; | |
| 2820 } else { | |
| 2821 targetQuery = this[_query]; | |
| 2822 } | |
| 2823 } else { | |
| 2824 if (dart.notNull(reference.path[dartx.startsWith]("/"))) { | |
| 2825 targetPath = this[_removeDotSegments](reference.path); | |
| 2826 } else { | |
| 2827 targetPath = this[_removeDotSegments](this[_merge](this[_path], re
ference.path)); | |
| 2828 } | |
| 2829 if (dart.notNull(reference.hasQuery)) | |
| 2830 targetQuery = reference.query; | |
| 2831 } | |
| 2832 targetUserInfo = this[_userInfo]; | |
| 2833 targetHost = this[_host]; | |
| 2834 targetPort = this[_port]; | |
| 2835 } | |
| 2836 } | |
| 2837 let fragment = dart.notNull(reference.hasFragment) ? reference.fragment :
null; | |
| 2838 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP
ort, targetPath, targetQuery, fragment); | |
| 2839 } | |
| 2840 get hasAuthority() { | |
| 2841 return this[_host] != null; | |
| 2842 } | |
| 2843 get hasPort() { | |
| 2844 return this[_port] != null; | |
| 2845 } | |
| 2846 get hasQuery() { | |
| 2847 return this[_query] != null; | |
| 2848 } | |
| 2849 get hasFragment() { | |
| 2850 return this[_fragment] != null; | |
| 2851 } | |
| 2852 get origin() { | |
| 2853 if (this.scheme == "" || this[_host] == null || this[_host] == "") { | |
| 2854 dart.throw(new StateError(`Cannot use origin without a scheme: ${this}`)
); | |
| 2855 } | |
| 2856 if (this.scheme != "http" && this.scheme != "https") { | |
| 2857 dart.throw(new StateError(`Origin is only applicable schemes http and ht
tps: ${this}`)); | |
| 2858 } | |
| 2859 if (this[_port] == null) | |
| 2860 return `${this.scheme}://${this[_host]}`; | |
| 2861 return `${this.scheme}://${this[_host]}:${this[_port]}`; | |
| 2862 } | |
| 2863 toFilePath(opts) { | |
| 2864 let windows = opts && 'windows' in opts ? opts.windows : null; | |
| 2865 if (this.scheme != "" && this.scheme != "file") { | |
| 2866 dart.throw(new UnsupportedError(`Cannot extract a file path from a ${thi
s.scheme} URI`)); | |
| 2867 } | |
| 2868 if (this.query != "") { | |
| 2869 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w
ith a query component")); | |
| 2870 } | |
| 2871 if (this.fragment != "") { | |
| 2872 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w
ith a fragment component")); | |
| 2873 } | |
| 2874 if (windows == null) | |
| 2875 windows = Uri._isWindows; | |
| 2876 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa
th](); | |
| 2877 } | |
| 2878 [_toFilePath]() { | |
| 2879 if (this.host != "") { | |
| 2880 dart.throw(new UnsupportedError("Cannot extract a non-Windows file path
from a file URI " + "with an authority")); | |
| 2881 } | |
| 2882 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false); | |
| 2883 let result = new StringBuffer(); | |
| 2884 if (dart.notNull(this[_isPathAbsolute])) | |
| 2885 result.write("/"); | |
| 2886 result.writeAll(this.pathSegments, "/"); | |
| 2887 return dart.toString(result); | |
| 2888 } | |
| 2889 [_toWindowsFilePath]() { | |
| 2890 let hasDriveLetter = false; | |
| 2891 let segments = this.pathSegments; | |
| 2892 if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx.get](0)[dar
tx.length] == 2 && segments[dartx.get](0)[dartx.codeUnitAt](1) == Uri._COLON) { | |
| 2893 Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0)
, false); | |
| 2894 Uri._checkWindowsPathReservedCharacters(segments, false, 1); | |
| 2895 hasDriveLetter = true; | |
| 2896 } else { | |
| 2897 Uri._checkWindowsPathReservedCharacters(segments, false); | |
| 2898 } | |
| 2899 let result = new StringBuffer(); | |
| 2900 if (dart.notNull(this[_isPathAbsolute]) && !dart.notNull(hasDriveLetter)) | |
| 2901 result.write("\\"); | |
| 2902 if (this.host != "") { | |
| 2903 result.write("\\"); | |
| 2904 result.write(this.host); | |
| 2905 result.write("\\"); | |
| 2906 } | |
| 2907 result.writeAll(segments, "\\"); | |
| 2908 if (dart.notNull(hasDriveLetter) && segments[dartx.length] == 1) | |
| 2909 result.write("\\"); | |
| 2910 return dart.toString(result); | |
| 2911 } | |
| 2912 get [_isPathAbsolute]() { | |
| 2913 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) | |
| 2914 return false; | |
| 2915 return this.path[dartx.startsWith]('/'); | |
| 2916 } | |
| 2917 [_writeAuthority](ss) { | |
| 2918 if (dart.notNull(this[_userInfo][dartx.isNotEmpty])) { | |
| 2919 ss.write(this[_userInfo]); | |
| 2920 ss.write("@"); | |
| 2921 } | |
| 2922 if (this[_host] != null) | |
| 2923 ss.write(this[_host]); | |
| 2924 if (this[_port] != null) { | |
| 2925 ss.write(":"); | |
| 2926 ss.write(this[_port]); | |
| 2927 } | |
| 2928 } | |
| 2929 toString() { | |
| 2930 let sb = new StringBuffer(); | |
| 2931 Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':'); | |
| 2932 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path[dartx.starts
With]("//")) || this.scheme == "file") { | |
| 2933 sb.write("//"); | |
| 2934 this[_writeAuthority](sb); | |
| 2935 } | |
| 2936 sb.write(this.path); | |
| 2937 if (this[_query] != null) { | |
| 2938 sb.write("?"); | |
| 2939 sb.write(this[_query]); | |
| 2940 } | |
| 2941 if (this[_fragment] != null) { | |
| 2942 sb.write("#"); | |
| 2943 sb.write(this[_fragment]); | |
| 2944 } | |
| 2945 return dart.toString(sb); | |
| 2946 } | |
| 2947 ['=='](other) { | |
| 2948 if (!dart.is(other, Uri)) | |
| 2949 return false; | |
| 2950 let uri = dart.as(other, Uri); | |
| 2951 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; | |
| 2952 } | |
| 2953 get hashCode() { | |
| 2954 function combine(part, current) { | |
| 2955 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+',
dart.hashCode(part)), '&', 1073741823), int); | |
| 2956 } | |
| 2957 dart.fn(combine, int, [dart.dynamic, dart.dynamic]); | |
| 2958 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb
ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1))
))))); | |
| 2959 } | |
| 2960 static _addIfNonEmpty(sb, test, first, second) { | |
| 2961 if ("" != test) { | |
| 2962 sb.write(first); | |
| 2963 sb.write(second); | |
| 2964 } | |
| 2965 } | |
| 2966 static encodeComponent(component) { | |
| 2967 return Uri._uriEncode(dart.as(Uri._unreserved2396Table, List$(int)), compo
nent); | |
| 2968 } | |
| 2969 static encodeQueryComponent(component, opts) { | |
| 2970 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; | |
| 2971 return Uri._uriEncode(dart.as(Uri._unreservedTable, List$(int)), component
, {encoding: encoding, spaceToPlus: true}); | |
| 2972 } | |
| 2973 static decodeComponent(encodedComponent) { | |
| 2974 return Uri._uriDecode(encodedComponent); | |
| 2975 } | |
| 2976 static decodeQueryComponent(encodedComponent, opts) { | |
| 2977 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; | |
| 2978 return Uri._uriDecode(encodedComponent, {plusToSpace: true, encoding: enco
ding}); | |
| 2979 } | |
| 2980 static encodeFull(uri) { | |
| 2981 return Uri._uriEncode(dart.as(Uri._encodeFullTable, List$(int)), uri); | |
| 2982 } | |
| 2983 static decodeFull(uri) { | |
| 2984 return Uri._uriDecode(uri); | |
| 2985 } | |
| 2986 static splitQueryString(query, opts) { | |
| 2987 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; | |
| 2988 return dart.as(query[dartx.split]("&")[dartx.fold](dart.map(), dart.fn((ma
p, element) => { | |
| 2989 let index = dart.as(dart.dsend(element, 'indexOf', "="), int); | |
| 2990 if (index == -1) { | |
| 2991 if (!dart.equals(element, "")) { | |
| 2992 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(element, String
), {encoding: encoding}), ""); | |
| 2993 } | |
| 2994 } else if (index != 0) { | |
| 2995 let key = dart.dsend(element, 'substring', 0, index); | |
| 2996 let value = dart.dsend(element, 'substring', dart.notNull(index) + 1); | |
| 2997 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en
coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding:
encoding})); | |
| 2998 } | |
| 2999 return map; | |
| 3000 })), Map$(String, String)); | |
| 3001 } | |
| 3002 static parseIPv4Address(host) { | |
| 3003 function error(msg) { | |
| 3004 dart.throw(new FormatException(`Illegal IPv4 address, ${msg}`)); | |
| 3005 } | |
| 3006 dart.fn(error, dart.void, [String]); | |
| 3007 let bytes = host[dartx.split]('.'); | |
| 3008 if (bytes[dartx.length] != 4) { | |
| 3009 error('IPv4 address should contain exactly 4 parts'); | |
| 3010 } | |
| 3011 return dart.as(bytes[dartx.map](dart.fn(byteString => { | |
| 3012 let byte = int.parse(dart.as(byteString, String)); | |
| 3013 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) { | |
| 3014 error('each part must be in the range of `0..255`'); | |
| 3015 } | |
| 3016 return byte; | |
| 3017 }))[dartx.toList](), List$(int)); | |
| 3018 } | |
| 3019 static parseIPv6Address(host, start, end) { | |
| 3020 if (start === void 0) | |
| 3021 start = 0; | |
| 3022 if (end === void 0) | |
| 3023 end = null; | |
| 3024 if (end == null) | |
| 3025 end = host[dartx.length]; | |
| 3026 function error(msg, position) { | |
| 3027 if (position === void 0) | |
| 3028 position = null; | |
| 3029 dart.throw(new FormatException(`Illegal IPv6 address, ${msg}`, host, dar
t.as(position, int))); | |
| 3030 } | |
| 3031 dart.fn(error, dart.void, [String], [dart.dynamic]); | |
| 3032 function parseHex(start, end) { | |
| 3033 if (dart.notNull(end) - dart.notNull(start) > 4) { | |
| 3034 error('an IPv6 part can only contain a maximum of 4 hex digits', start
); | |
| 3035 } | |
| 3036 let value = int.parse(host[dartx.substring](start, end), {radix: 16}); | |
| 3037 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) { | |
| 3038 error('each part must be in the range of `0x0..0xFFFF`', start); | |
| 3039 } | |
| 3040 return value; | |
| 3041 } | |
| 3042 dart.fn(parseHex, int, [int, int]); | |
| 3043 if (dart.notNull(host[dartx.length]) < 2) | |
| 3044 error('address is too short'); | |
| 3045 let parts = dart.list([], int); | |
| 3046 let wildcardSeen = false; | |
| 3047 let partStart = start; | |
| 3048 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(
i) + 1) { | |
| 3049 if (host[dartx.codeUnitAt](i) == Uri._COLON) { | |
| 3050 if (i == start) { | |
| 3051 i = dart.notNull(i) + 1; | |
| 3052 if (host[dartx.codeUnitAt](i) != Uri._COLON) { | |
| 3053 error('invalid start colon.', i); | |
| 3054 } | |
| 3055 partStart = i; | |
| 3056 } | |
| 3057 if (i == partStart) { | |
| 3058 if (dart.notNull(wildcardSeen)) { | |
| 3059 error('only one wildcard `::` is allowed', i); | |
| 3060 } | |
| 3061 wildcardSeen = true; | |
| 3062 parts[dartx.add](-1); | |
| 3063 } else { | |
| 3064 parts[dartx.add](parseHex(partStart, i)); | |
| 3065 } | |
| 3066 partStart = dart.notNull(i) + 1; | |
| 3067 } | |
| 3068 } | |
| 3069 if (parts[dartx.length] == 0) | |
| 3070 error('too few parts'); | |
| 3071 let atEnd = partStart == end; | |
| 3072 let isLastWildcard = parts[dartx.last] == -1; | |
| 3073 if (dart.notNull(atEnd) && !dart.notNull(isLastWildcard)) { | |
| 3074 error('expected a part after last `:`', end); | |
| 3075 } | |
| 3076 if (!dart.notNull(atEnd)) { | |
| 3077 try { | |
| 3078 parts[dartx.add](parseHex(partStart, end)); | |
| 3079 } catch (e) { | |
| 3080 try { | |
| 3081 let last = Uri.parseIPv4Address(host[dartx.substring](partStart, end
)); | |
| 3082 parts[dartx.add](dart.notNull(last[dartx.get](0)) << 8 | dart.notNul
l(last[dartx.get](1))); | |
| 3083 parts[dartx.add](dart.notNull(last[dartx.get](2)) << 8 | dart.notNul
l(last[dartx.get](3))); | |
| 3084 } catch (e) { | |
| 3085 error('invalid end of IPv6 address.', partStart); | |
| 3086 } | |
| 3087 | |
| 3088 } | |
| 3089 | |
| 3090 } | |
| 3091 if (dart.notNull(wildcardSeen)) { | |
| 3092 if (dart.notNull(parts[dartx.length]) > 7) { | |
| 3093 error('an address with a wildcard must have less than 7 parts'); | |
| 3094 } | |
| 3095 } else if (parts[dartx.length] != 8) { | |
| 3096 error('an address without a wildcard must contain exactly 8 parts'); | |
| 3097 } | |
| 3098 let bytes = List$(int).new(16); | |
| 3099 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts[dartx.leng
th]); i = dart.notNull(i) + 1) { | |
| 3100 let value = parts[dartx.get](i); | |
| 3101 if (value == -1) { | |
| 3102 let wildCardLength = 9 - dart.notNull(parts[dartx.length]); | |
| 3103 for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); j = da
rt.notNull(j) + 1) { | |
| 3104 bytes[dartx.set](index, 0); | |
| 3105 bytes[dartx.set](dart.notNull(index) + 1, 0); | |
| 3106 index = dart.notNull(index) + 2; | |
| 3107 } | |
| 3108 } else { | |
| 3109 bytes[dartx.set](index, dart.notNull(value) >> 8); | |
| 3110 bytes[dartx.set](dart.notNull(index) + 1, dart.notNull(value) & 255); | |
| 3111 index = dart.notNull(index) + 2; | |
| 3112 } | |
| 3113 } | |
| 3114 return dart.as(bytes, List$(int)); | |
| 3115 } | |
| 3116 static _uriEncode(canonicalTable, text, opts) { | |
| 3117 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; | |
| 3118 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false
; | |
| 3119 function byteToHex(byte, buffer) { | |
| 3120 let hex = '0123456789ABCDEF'; | |
| 3121 dart.dsend(buffer, 'writeCharCode', hex[dartx.codeUnitAt](dart.as(dart.d
send(byte, '>>', 4), int))); | |
| 3122 dart.dsend(buffer, 'writeCharCode', hex[dartx.codeUnitAt](dart.as(dart.d
send(byte, '&', 15), int))); | |
| 3123 } | |
| 3124 dart.fn(byteToHex); | |
| 3125 let result = new StringBuffer(); | |
| 3126 let bytes = encoding.encode(text); | |
| 3127 for (let i = 0; dart.notNull(i) < dart.notNull(bytes[dartx.length]); i = d
art.notNull(i) + 1) { | |
| 3128 let byte = bytes[dartx.get](i); | |
| 3129 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx.get](
dart.notNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) { | |
| 3130 result.writeCharCode(byte); | |
| 3131 } else if (dart.notNull(spaceToPlus) && byte == Uri._SPACE) { | |
| 3132 result.writeCharCode(Uri._PLUS); | |
| 3133 } else { | |
| 3134 result.writeCharCode(Uri._PERCENT); | |
| 3135 byteToHex(byte, result); | |
| 3136 } | |
| 3137 } | |
| 3138 return dart.toString(result); | |
| 3139 } | |
| 3140 static _hexCharPairToByte(s, pos) { | |
| 3141 let byte = 0; | |
| 3142 for (let i = 0; dart.notNull(i) < 2; i = dart.notNull(i) + 1) { | |
| 3143 let charCode = s[dartx.codeUnitAt](dart.notNull(pos) + dart.notNull(i)); | |
| 3144 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) { | |
| 3145 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 48; | |
| 3146 } else { | |
| 3147 charCode = dart.notNull(charCode) | 32; | |
| 3148 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) { | |
| 3149 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 87; | |
| 3150 } else { | |
| 3151 dart.throw(new ArgumentError("Invalid URL encoding")); | |
| 3152 } | |
| 3153 } | |
| 3154 } | |
| 3155 return byte; | |
| 3156 } | |
| 3157 static _uriDecode(text, opts) { | |
| 3158 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false
; | |
| 3159 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; | |
| 3160 let simple = true; | |
| 3161 for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]) && dart
.notNull(simple); i = dart.notNull(i) + 1) { | |
| 3162 let codeUnit = text[dartx.codeUnitAt](i); | |
| 3163 simple = codeUnit != Uri._PERCENT && codeUnit != Uri._PLUS; | |
| 3164 } | |
| 3165 let bytes = null; | |
| 3166 if (dart.notNull(simple)) { | |
| 3167 if (dart.equals(encoding, convert.UTF8) || dart.equals(encoding, convert
.LATIN1)) { | |
| 3168 return text; | |
| 3169 } else { | |
| 3170 bytes = text[dartx.codeUnits]; | |
| 3171 } | |
| 3172 } else { | |
| 3173 bytes = List$(int).new(); | |
| 3174 for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]); i =
dart.notNull(i) + 1) { | |
| 3175 let codeUnit = text[dartx.codeUnitAt](i); | |
| 3176 if (dart.notNull(codeUnit) > 127) { | |
| 3177 dart.throw(new ArgumentError("Illegal percent encoding in URI")); | |
| 3178 } | |
| 3179 if (codeUnit == Uri._PERCENT) { | |
| 3180 if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) { | |
| 3181 dart.throw(new ArgumentError('Truncated URI')); | |
| 3182 } | |
| 3183 bytes[dartx.add](Uri._hexCharPairToByte(text, dart.notNull(i) + 1)); | |
| 3184 i = dart.notNull(i) + 2; | |
| 3185 } else if (dart.notNull(plusToSpace) && codeUnit == Uri._PLUS) { | |
| 3186 bytes[dartx.add](Uri._SPACE); | |
| 3187 } else { | |
| 3188 bytes[dartx.add](codeUnit); | |
| 3189 } | |
| 3190 } | |
| 3191 } | |
| 3192 return encoding.decode(bytes); | |
| 3193 } | |
| 3194 static _isAlphabeticCharacter(codeUnit) { | |
| 3195 return dart.notNull(codeUnit) >= dart.notNull(Uri._LOWER_CASE_A) && dart.n
otNull(codeUnit) <= dart.notNull(Uri._LOWER_CASE_Z) || dart.notNull(codeUnit) >=
dart.notNull(Uri._UPPER_CASE_A) && dart.notNull(codeUnit) <= dart.notNull(Uri._
UPPER_CASE_Z); | |
| 3196 } | |
| 3197 } | |
| 3198 dart.defineNamedConstructor(Uri, '_internal'); | |
| 3199 dart.setSignature(Uri, { | |
| 3200 constructors: () => ({ | |
| 3201 _internal: [Uri, [String, String, String, num, String, String, String]], | |
| 3202 new: [Uri, [], {scheme: String, userInfo: String, host: String, port: int,
path: String, pathSegments: Iterable$(String), query: String, queryParameters:
Map$(String, String), fragment: String}], | |
| 3203 http: [Uri, [String, String], [Map$(String, String)]], | |
| 3204 https: [Uri, [String, String], [Map$(String, String)]], | |
| 3205 file: [Uri, [String], {windows: bool}] | |
| 3206 }), | |
| 3207 methods: () => ({ | |
| 3208 replace: [Uri, [], {scheme: String, userInfo: String, host: String, port:
int, path: String, pathSegments: Iterable$(String), query: String, queryParamete
rs: Map$(String, String), fragment: String}], | |
| 3209 [_merge]: [String, [String, String]], | |
| 3210 [_hasDotSegments]: [bool, [String]], | |
| 3211 [_removeDotSegments]: [String, [String]], | |
| 3212 resolve: [Uri, [String]], | |
| 3213 resolveUri: [Uri, [Uri]], | |
| 3214 toFilePath: [String, [], {windows: bool}], | |
| 3215 [_toFilePath]: [String, []], | |
| 3216 [_toWindowsFilePath]: [String, []], | |
| 3217 [_writeAuthority]: [dart.void, [StringSink]] | |
| 3218 }), | |
| 3219 statics: () => ({ | |
| 3220 _defaultPort: [int, [String]], | |
| 3221 parse: [Uri, [String]], | |
| 3222 _fail: [dart.void, [String, int, String]], | |
| 3223 _makeHttpUri: [Uri, [String, String, String, Map$(String, String)]], | |
| 3224 _checkNonWindowsPathReservedCharacters: [dart.dynamic, [List$(String), boo
l]], | |
| 3225 _checkWindowsPathReservedCharacters: [dart.dynamic, [List$(String), bool],
[int]], | |
| 3226 _checkWindowsDriveLetter: [dart.dynamic, [int, bool]], | |
| 3227 _makeFileUri: [dart.dynamic, [String]], | |
| 3228 _makeWindowsFileUrl: [dart.dynamic, [String]], | |
| 3229 _makePort: [int, [int, String]], | |
| 3230 _makeHost: [String, [String, int, int, bool]], | |
| 3231 _isRegNameChar: [bool, [int]], | |
| 3232 _normalizeRegName: [String, [String, int, int]], | |
| 3233 _makeScheme: [String, [String, int]], | |
| 3234 _makeUserInfo: [String, [String, int, int]], | |
| 3235 _makePath: [String, [String, int, int, Iterable$(String), bool, bool]], | |
| 3236 _makeQuery: [String, [String, int, int, Map$(String, String)]], | |
| 3237 _makeFragment: [String, [String, int, int]], | |
| 3238 _stringOrNullLength: [int, [String]], | |
| 3239 _isHexDigit: [bool, [int]], | |
| 3240 _hexValue: [int, [int]], | |
| 3241 _normalizeEscape: [String, [String, int, bool]], | |
| 3242 _isUnreservedChar: [bool, [int]], | |
| 3243 _escapeChar: [String, [dart.dynamic]], | |
| 3244 _normalize: [String, [String, int, int, List$(int)]], | |
| 3245 _isSchemeCharacter: [bool, [int]], | |
| 3246 _isGeneralDelimiter: [bool, [int]], | |
| 3247 _addIfNonEmpty: [dart.void, [StringBuffer, String, String, String]], | |
| 3248 encodeComponent: [String, [String]], | |
| 3249 encodeQueryComponent: [String, [String], {encoding: convert.Encoding}], | |
| 3250 decodeComponent: [String, [String]], | |
| 3251 decodeQueryComponent: [String, [String], {encoding: convert.Encoding}], | |
| 3252 encodeFull: [String, [String]], | |
| 3253 decodeFull: [String, [String]], | |
| 3254 splitQueryString: [Map$(String, String), [String], {encoding: convert.Enco
ding}], | |
| 3255 parseIPv4Address: [List$(int), [String]], | |
| 3256 parseIPv6Address: [List$(int), [String], [int, int]], | |
| 3257 _uriEncode: [String, [List$(int), String], {encoding: convert.Encoding, sp
aceToPlus: bool}], | |
| 3258 _hexCharPairToByte: [int, [String, int]], | |
| 3259 _uriDecode: [String, [String], {plusToSpace: bool, encoding: convert.Encod
ing}], | |
| 3260 _isAlphabeticCharacter: [bool, [int]] | |
| 3261 }), | |
| 3262 names: ['_defaultPort', 'parse', '_fail', '_makeHttpUri', '_checkNonWindowsP
athReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDri
veLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_is
RegNameChar', '_normalizeRegName', '_makeScheme', '_makeUserInfo', '_makePath',
'_makeQuery', '_makeFragment', '_stringOrNullLength', '_isHexDigit', '_hexValue'
, '_normalizeEscape', '_isUnreservedChar', '_escapeChar', '_normalize', '_isSche
meCharacter', '_isGeneralDelimiter', '_addIfNonEmpty', 'encodeComponent', 'encod
eQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'deco
deFull', 'splitQueryString', 'parseIPv4Address', 'parseIPv6Address', '_uriEncode
', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter'] | |
| 3263 }); | |
| 3264 Uri._SPACE = 32; | |
| 3265 Uri._DOUBLE_QUOTE = 34; | |
| 3266 Uri._NUMBER_SIGN = 35; | |
| 3267 Uri._PERCENT = 37; | |
| 3268 Uri._ASTERISK = 42; | |
| 3269 Uri._PLUS = 43; | |
| 3270 Uri._DOT = 46; | |
| 3271 Uri._SLASH = 47; | |
| 3272 Uri._ZERO = 48; | |
| 3273 Uri._NINE = 57; | |
| 3274 Uri._COLON = 58; | |
| 3275 Uri._LESS = 60; | |
| 3276 Uri._GREATER = 62; | |
| 3277 Uri._QUESTION = 63; | |
| 3278 Uri._AT_SIGN = 64; | |
| 3279 Uri._UPPER_CASE_A = 65; | |
| 3280 Uri._UPPER_CASE_F = 70; | |
| 3281 Uri._UPPER_CASE_Z = 90; | |
| 3282 Uri._LEFT_BRACKET = 91; | |
| 3283 Uri._BACKSLASH = 92; | |
| 3284 Uri._RIGHT_BRACKET = 93; | |
| 3285 Uri._LOWER_CASE_A = 97; | |
| 3286 Uri._LOWER_CASE_F = 102; | |
| 3287 Uri._LOWER_CASE_Z = 122; | |
| 3288 Uri._BAR = 124; | |
| 3289 Uri._unreservedTable = dart.const([0, 0, 24576, 1023, 65534, 34815, 65534, 184
31]); | |
| 3290 Uri._unreserved2396Table = dart.const([0, 0, 26498, 1023, 65534, 34815, 65534,
18431]); | |
| 3291 Uri._encodeFullTable = dart.const([0, 0, 65498, 45055, 65535, 34815, 65534, 18
431]); | |
| 3292 Uri._schemeTable = dart.const([0, 0, 26624, 1023, 65534, 2047, 65534, 2047]); | |
| 3293 Uri._schemeLowerTable = dart.const([0, 0, 26624, 1023, 0, 0, 65534, 2047]); | |
| 3294 Uri._subDelimitersTable = dart.const([0, 0, 32722, 11263, 65534, 34815, 65534,
18431]); | |
| 3295 Uri._genDelimitersTable = dart.const([0, 0, 32776, 33792, 1, 10240, 0, 0]); | |
| 3296 Uri._userinfoTable = dart.const([0, 0, 32722, 12287, 65534, 34815, 65534, 1843
1]); | |
| 3297 Uri._regNameTable = dart.const([0, 0, 32754, 11263, 65534, 34815, 65534, 18431
]); | |
| 3298 Uri._pathCharTable = dart.const([0, 0, 32722, 12287, 65535, 34815, 65534, 1843
1]); | |
| 3299 Uri._pathCharOrSlashTable = dart.const([0, 0, 65490, 12287, 65535, 34815, 6553
4, 18431]); | |
| 3300 Uri._queryCharTable = dart.const([0, 0, 65490, 45055, 65535, 34815, 65534, 184
31]); | |
| 3301 function _symbolToString(symbol) { | |
| 3302 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); | |
| 3303 } | |
| 3304 dart.fn(_symbolToString, String, [Symbol]); | |
| 3305 // Exports: | |
| 3306 exports.Object = Object; | |
| 3307 exports.Deprecated = Deprecated; | |
| 3308 exports.deprecated = deprecated; | |
| 3309 exports.override = override; | |
| 3310 exports.proxy = proxy; | |
| 3311 exports.bool = bool; | |
| 3312 exports.Comparator$ = Comparator$; | |
| 3313 exports.Comparator = Comparator; | |
| 3314 exports.Comparable$ = Comparable$; | |
| 3315 exports.Comparable = Comparable; | |
| 3316 exports.DateTime = DateTime; | |
| 3317 exports.num = num; | |
| 3318 exports.double = double; | |
| 3319 exports.Duration = Duration; | |
| 3320 exports.Error = Error; | |
| 3321 exports.AssertionError = AssertionError; | |
| 3322 exports.TypeError = TypeError; | |
| 3323 exports.CastError = CastError; | |
| 3324 exports.NullThrownError = NullThrownError; | |
| 3325 exports.ArgumentError = ArgumentError; | |
| 3326 exports.RangeError = RangeError; | |
| 3327 exports.IndexError = IndexError; | |
| 3328 exports.FallThroughError = FallThroughError; | |
| 3329 exports.AbstractClassInstantiationError = AbstractClassInstantiationError; | |
| 3330 exports.NoSuchMethodError = NoSuchMethodError; | |
| 3331 exports.UnsupportedError = UnsupportedError; | |
| 3332 exports.UnimplementedError = UnimplementedError; | |
| 3333 exports.StateError = StateError; | |
| 3334 exports.ConcurrentModificationError = ConcurrentModificationError; | |
| 3335 exports.OutOfMemoryError = OutOfMemoryError; | |
| 3336 exports.StackOverflowError = StackOverflowError; | |
| 3337 exports.CyclicInitializationError = CyclicInitializationError; | |
| 3338 exports.Exception = Exception; | |
| 3339 exports.FormatException = FormatException; | |
| 3340 exports.IntegerDivisionByZeroException = IntegerDivisionByZeroException; | |
| 3341 exports.Expando$ = Expando$; | |
| 3342 exports.Expando = Expando; | |
| 3343 exports.Function = Function; | |
| 3344 exports.identical = identical; | |
| 3345 exports.identityHashCode = identityHashCode; | |
| 3346 exports.int = int; | |
| 3347 exports.Invocation = Invocation; | |
| 3348 exports.Iterable$ = Iterable$; | |
| 3349 exports.Iterable = Iterable; | |
| 3350 exports.BidirectionalIterator$ = BidirectionalIterator$; | |
| 3351 exports.BidirectionalIterator = BidirectionalIterator; | |
| 3352 exports.Iterator$ = Iterator$; | |
| 3353 exports.Iterator = Iterator; | |
| 3354 exports.List$ = List$; | |
| 3355 exports.List = List; | |
| 3356 exports.Map$ = Map$; | |
| 3357 exports.Map = Map; | |
| 3358 exports.Null = Null; | |
| 3359 exports.Pattern = Pattern; | |
| 3360 exports.print = print; | |
| 3361 exports.Match = Match; | |
| 3362 exports.RegExp = RegExp; | |
| 3363 exports.Set$ = Set$; | |
| 3364 exports.Sink$ = Sink$; | |
| 3365 exports.Sink = Sink; | |
| 3366 exports.StackTrace = StackTrace; | |
| 3367 exports.Stopwatch = Stopwatch; | |
| 3368 exports.String = String; | |
| 3369 exports.RuneIterator = RuneIterator; | |
| 3370 exports.StringBuffer = StringBuffer; | |
| 3371 exports.StringSink = StringSink; | |
| 3372 exports.Symbol = Symbol; | |
| 3373 exports.Type = Type; | |
| 3374 exports.Uri = Uri; | |
| 3375 }); | |
| OLD | NEW |