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

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

Issue 1524843002: JS: Format if statements with no else on a single line (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebased Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/html.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/core', null, /* Imports */[ 1 dart_library.library('dart/core', null, /* Imports */[
2 "dart/_runtime" 2 "dart/_runtime"
3 ], /* Lazy imports */[ 3 ], /* Lazy imports */[
4 'dart/_js_helper', 4 'dart/_js_helper',
5 'dart/_internal', 5 'dart/_internal',
6 'dart/collection', 6 'dart/collection',
7 'dart/_interceptors', 7 'dart/_interceptors',
8 'dart/convert' 8 'dart/convert'
9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con vert) { 9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con vert) {
10 'use strict'; 10 'use strict';
11 let dartx = dart.dartx; 11 let dartx = dart.dartx;
12 class Object { 12 class Object {
13 constructor() { 13 constructor() {
14 let name = this.constructor.name; 14 let name = this.constructor.name;
15 let result = void 0; 15 let result = void 0;
16 if (name in this) 16 if (name in this) result = this[name](...arguments);
17 result = this[name](...arguments);
18 return result === void 0 ? this : result; 17 return result === void 0 ? this : result;
19 } 18 }
20 ['=='](other) { 19 ['=='](other) {
21 return identical(this, other); 20 return identical(this, other);
22 } 21 }
23 get hashCode() { 22 get hashCode() {
24 return _js_helper.Primitives.objectHashCode(this); 23 return _js_helper.Primitives.objectHashCode(this);
25 } 24 }
26 toString() { 25 toString() {
27 return _js_helper.Primitives.objectToString(this); 26 return _js_helper.Primitives.objectToString(this);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 96 }
98 dart.setSignature(Comparable, { 97 dart.setSignature(Comparable, {
99 statics: () => ({compare: [int, [Comparable$(), Comparable$()]]}), 98 statics: () => ({compare: [int, [Comparable$(), Comparable$()]]}),
100 names: ['compare'] 99 names: ['compare']
101 }); 100 });
102 return Comparable; 101 return Comparable;
103 }); 102 });
104 let Comparable = Comparable$(); 103 let Comparable = Comparable$();
105 class DateTime extends Object { 104 class DateTime extends Object {
106 DateTime(year, month, day, hour, minute, second, millisecond) { 105 DateTime(year, month, day, hour, minute, second, millisecond) {
107 if (month === void 0) 106 if (month === void 0) month = 1;
108 month = 1; 107 if (day === void 0) day = 1;
109 if (day === void 0) 108 if (hour === void 0) hour = 0;
110 day = 1; 109 if (minute === void 0) minute = 0;
111 if (hour === void 0) 110 if (second === void 0) second = 0;
112 hour = 0; 111 if (millisecond === void 0) millisecond = 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) ; 112 this._internal(year, month, day, hour, minute, second, millisecond, false) ;
120 } 113 }
121 utc(year, month, day, hour, minute, second, millisecond) { 114 utc(year, month, day, hour, minute, second, millisecond) {
122 if (month === void 0) 115 if (month === void 0) month = 1;
123 month = 1; 116 if (day === void 0) day = 1;
124 if (day === void 0) 117 if (hour === void 0) hour = 0;
125 day = 1; 118 if (minute === void 0) minute = 0;
126 if (hour === void 0) 119 if (second === void 0) second = 0;
127 hour = 0; 120 if (millisecond === void 0) millisecond = 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); 121 this._internal(year, month, day, hour, minute, second, millisecond, true);
135 } 122 }
136 now() { 123 now() {
137 this._now(); 124 this._now();
138 } 125 }
139 static parse(formattedString) { 126 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))?)?)?$'); 127 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); 128 let match = re.firstMatch(formattedString);
142 if (match != null) { 129 if (match != null) {
143 function parseIntOrZero(matched) { 130 function parseIntOrZero(matched) {
144 if (matched == null) 131 if (matched == null) return 0;
145 return 0;
146 return int.parse(matched); 132 return int.parse(matched);
147 } 133 }
148 dart.fn(parseIntOrZero, int, [String]); 134 dart.fn(parseIntOrZero, int, [String]);
149 function parseDoubleOrZero(matched) { 135 function parseDoubleOrZero(matched) {
150 if (matched == null) 136 if (matched == null) return 0.0;
151 return 0.0;
152 return double.parse(matched); 137 return double.parse(matched);
153 } 138 }
154 dart.fn(parseDoubleOrZero, double, [String]); 139 dart.fn(parseDoubleOrZero, double, [String]);
155 let years = int.parse(match.get(1)); 140 let years = int.parse(match.get(1));
156 let month = int.parse(match.get(2)); 141 let month = int.parse(match.get(2));
157 let day = int.parse(match.get(3)); 142 let day = int.parse(match.get(3));
158 let hour = parseIntOrZero(match.get(4)); 143 let hour = parseIntOrZero(match.get(4));
159 let minute = parseIntOrZero(match.get(5)); 144 let minute = parseIntOrZero(match.get(5));
160 let second = parseIntOrZero(match.get(6)); 145 let second = parseIntOrZero(match.get(6));
161 let addOneMillisecond = false; 146 let addOneMillisecond = false;
(...skipping 25 matching lines...) Expand all
187 dart.throw(new FormatException("Invalid date format", formattedString)); 172 dart.throw(new FormatException("Invalid date format", formattedString));
188 } 173 }
189 } 174 }
190 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { 175 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) {
191 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; 176 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false;
192 this.millisecondsSinceEpoch = millisecondsSinceEpoch; 177 this.millisecondsSinceEpoch = millisecondsSinceEpoch;
193 this.isUtc = isUtc; 178 this.isUtc = isUtc;
194 if (dart.notNull(millisecondsSinceEpoch[dartx.abs]()) > dart.notNull(DateT ime._MAX_MILLISECONDS_SINCE_EPOCH)) { 179 if (dart.notNull(millisecondsSinceEpoch[dartx.abs]()) > dart.notNull(DateT ime._MAX_MILLISECONDS_SINCE_EPOCH)) {
195 dart.throw(new ArgumentError(millisecondsSinceEpoch)); 180 dart.throw(new ArgumentError(millisecondsSinceEpoch));
196 } 181 }
197 if (isUtc == null) 182 if (isUtc == null) dart.throw(new ArgumentError(isUtc));
198 dart.throw(new ArgumentError(isUtc));
199 } 183 }
200 ['=='](other) { 184 ['=='](other) {
201 if (!dart.is(other, DateTime)) 185 if (!dart.is(other, DateTime)) return false;
202 return false;
203 return dart.equals(this.millisecondsSinceEpoch, dart.dload(other, 'millise condsSinceEpoch')) && dart.equals(this.isUtc, dart.dload(other, 'isUtc')); 186 return dart.equals(this.millisecondsSinceEpoch, dart.dload(other, 'millise condsSinceEpoch')) && dart.equals(this.isUtc, dart.dload(other, 'isUtc'));
204 } 187 }
205 isBefore(other) { 188 isBefore(other) {
206 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch); 189 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch);
207 } 190 }
208 isAfter(other) { 191 isAfter(other) {
209 return dart.notNull(this.millisecondsSinceEpoch) > dart.notNull(other.mill isecondsSinceEpoch); 192 return dart.notNull(this.millisecondsSinceEpoch) > dart.notNull(other.mill isecondsSinceEpoch);
210 } 193 }
211 isAtSameMomentAs(other) { 194 isAtSameMomentAs(other) {
212 return this.millisecondsSinceEpoch == other.millisecondsSinceEpoch; 195 return this.millisecondsSinceEpoch == other.millisecondsSinceEpoch;
213 } 196 }
214 compareTo(other) { 197 compareTo(other) {
215 return this.millisecondsSinceEpoch[dartx.compareTo](other.millisecondsSinc eEpoch); 198 return this.millisecondsSinceEpoch[dartx.compareTo](other.millisecondsSinc eEpoch);
216 } 199 }
217 get hashCode() { 200 get hashCode() {
218 return this.millisecondsSinceEpoch; 201 return this.millisecondsSinceEpoch;
219 } 202 }
220 toLocal() { 203 toLocal() {
221 if (dart.notNull(this.isUtc)) { 204 if (dart.notNull(this.isUtc)) {
222 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false}); 205 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false});
223 } 206 }
224 return this; 207 return this;
225 } 208 }
226 toUtc() { 209 toUtc() {
227 if (dart.notNull(this.isUtc)) 210 if (dart.notNull(this.isUtc)) return this;
228 return this;
229 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch , {isUtc: true}); 211 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch , {isUtc: true});
230 } 212 }
231 static _fourDigits(n) { 213 static _fourDigits(n) {
232 let absN = n[dartx.abs](); 214 let absN = n[dartx.abs]();
233 let sign = dart.notNull(n) < 0 ? "-" : ""; 215 let sign = dart.notNull(n) < 0 ? "-" : "";
234 if (dart.notNull(absN) >= 1000) 216 if (dart.notNull(absN) >= 1000) return `${n}`;
235 return `${n}`; 217 if (dart.notNull(absN) >= 100) return `${sign}0${absN}`;
236 if (dart.notNull(absN) >= 100) 218 if (dart.notNull(absN) >= 10) return `${sign}00${absN}`;
237 return `${sign}0${absN}`;
238 if (dart.notNull(absN) >= 10)
239 return `${sign}00${absN}`;
240 return `${sign}000${absN}`; 219 return `${sign}000${absN}`;
241 } 220 }
242 static _sixDigits(n) { 221 static _sixDigits(n) {
243 dart.assert(dart.notNull(n) < -9999 || dart.notNull(n) > 9999); 222 dart.assert(dart.notNull(n) < -9999 || dart.notNull(n) > 9999);
244 let absN = n[dartx.abs](); 223 let absN = n[dartx.abs]();
245 let sign = dart.notNull(n) < 0 ? "-" : "+"; 224 let sign = dart.notNull(n) < 0 ? "-" : "+";
246 if (dart.notNull(absN) >= 100000) 225 if (dart.notNull(absN) >= 100000) return `${sign}${absN}`;
247 return `${sign}${absN}`;
248 return `${sign}0${absN}`; 226 return `${sign}0${absN}`;
249 } 227 }
250 static _threeDigits(n) { 228 static _threeDigits(n) {
251 if (dart.notNull(n) >= 100) 229 if (dart.notNull(n) >= 100) return `${n}`;
252 return `${n}`; 230 if (dart.notNull(n) >= 10) return `0${n}`;
253 if (dart.notNull(n) >= 10)
254 return `0${n}`;
255 return `00${n}`; 231 return `00${n}`;
256 } 232 }
257 static _twoDigits(n) { 233 static _twoDigits(n) {
258 if (dart.notNull(n) >= 10) 234 if (dart.notNull(n) >= 10) return `${n}`;
259 return `${n}`;
260 return `0${n}`; 235 return `0${n}`;
261 } 236 }
262 toString() { 237 toString() {
263 let y = DateTime._fourDigits(this.year); 238 let y = DateTime._fourDigits(this.year);
264 let m = DateTime._twoDigits(this.month); 239 let m = DateTime._twoDigits(this.month);
265 let d = DateTime._twoDigits(this.day); 240 let d = DateTime._twoDigits(this.day);
266 let h = DateTime._twoDigits(this.hour); 241 let h = DateTime._twoDigits(this.hour);
267 let min = DateTime._twoDigits(this.minute); 242 let min = DateTime._twoDigits(this.minute);
268 let sec = DateTime._twoDigits(this.second); 243 let sec = DateTime._twoDigits(this.second);
269 let ms = DateTime._threeDigits(this.millisecond); 244 let ms = DateTime._threeDigits(this.millisecond);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int); 280 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int);
306 } 281 }
307 _now() { 282 _now() {
308 this.isUtc = false; 283 this.isUtc = false;
309 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); 284 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow();
310 } 285 }
311 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut e, second, millisecond, isUtc) { 286 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); 287 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
313 } 288 }
314 get timeZoneName() { 289 get timeZoneName() {
315 if (dart.notNull(this.isUtc)) 290 if (dart.notNull(this.isUtc)) return "UTC";
316 return "UTC";
317 return _js_helper.Primitives.getTimeZoneName(this); 291 return _js_helper.Primitives.getTimeZoneName(this);
318 } 292 }
319 get timeZoneOffset() { 293 get timeZoneOffset() {
320 if (dart.notNull(this.isUtc)) 294 if (dart.notNull(this.isUtc)) return new Duration();
321 return new Duration();
322 return new Duration({minutes: _js_helper.Primitives.getTimeZoneOffsetInMin utes(this)}); 295 return new Duration({minutes: _js_helper.Primitives.getTimeZoneOffsetInMin utes(this)});
323 } 296 }
324 get year() { 297 get year() {
325 return dart.as(_js_helper.Primitives.getYear(this), int); 298 return dart.as(_js_helper.Primitives.getYear(this), int);
326 } 299 }
327 get month() { 300 get month() {
328 return dart.as(_js_helper.Primitives.getMonth(this), int); 301 return dart.as(_js_helper.Primitives.getMonth(this), int);
329 } 302 }
330 get day() { 303 get day() {
331 return dart.as(_js_helper.Primitives.getDay(this), int); 304 return dart.as(_js_helper.Primitives.getDay(this), int);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 DateTime.JULY = 7; 374 DateTime.JULY = 7;
402 DateTime.AUGUST = 8; 375 DateTime.AUGUST = 8;
403 DateTime.SEPTEMBER = 9; 376 DateTime.SEPTEMBER = 9;
404 DateTime.OCTOBER = 10; 377 DateTime.OCTOBER = 10;
405 DateTime.NOVEMBER = 11; 378 DateTime.NOVEMBER = 11;
406 DateTime.DECEMBER = 12; 379 DateTime.DECEMBER = 12;
407 DateTime.MONTHS_PER_YEAR = 12; 380 DateTime.MONTHS_PER_YEAR = 12;
408 DateTime._MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; 381 DateTime._MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
409 class num extends Object { 382 class num extends Object {
410 static parse(input, onError) { 383 static parse(input, onError) {
411 if (onError === void 0) 384 if (onError === void 0) onError = null;
412 onError = null;
413 let source = input[dartx.trim](); 385 let source = input[dartx.trim]();
414 num._parseError = false; 386 num._parseError = false;
415 let result = int.parse(source, {onError: num._onParseErrorInt}); 387 let result = int.parse(source, {onError: num._onParseErrorInt});
416 if (!dart.notNull(num._parseError)) 388 if (!dart.notNull(num._parseError)) return result;
417 return result;
418 num._parseError = false; 389 num._parseError = false;
419 result = double.parse(source, num._onParseErrorDouble); 390 result = double.parse(source, num._onParseErrorDouble);
420 if (!dart.notNull(num._parseError)) 391 if (!dart.notNull(num._parseError)) return result;
421 return result; 392 if (onError == null) dart.throw(new FormatException(input));
422 if (onError == null)
423 dart.throw(new FormatException(input));
424 return onError(input); 393 return onError(input);
425 } 394 }
426 static _onParseErrorInt(_) { 395 static _onParseErrorInt(_) {
427 num._parseError = true; 396 num._parseError = true;
428 return 0; 397 return 0;
429 } 398 }
430 static _onParseErrorDouble(_) { 399 static _onParseErrorDouble(_) {
431 num._parseError = true; 400 num._parseError = true;
432 return 0.0; 401 return 0.0;
433 } 402 }
434 } 403 }
435 num[dart.implements] = () => [Comparable$(num)]; 404 num[dart.implements] = () => [Comparable$(num)];
436 dart.setSignature(num, { 405 dart.setSignature(num, {
437 statics: () => ({ 406 statics: () => ({
438 parse: [num, [String], [dart.functionType(num, [String])]], 407 parse: [num, [String], [dart.functionType(num, [String])]],
439 _onParseErrorInt: [int, [String]], 408 _onParseErrorInt: [int, [String]],
440 _onParseErrorDouble: [double, [String]] 409 _onParseErrorDouble: [double, [String]]
441 }), 410 }),
442 names: ['parse', '_onParseErrorInt', '_onParseErrorDouble'] 411 names: ['parse', '_onParseErrorInt', '_onParseErrorDouble']
443 }); 412 });
444 class double extends num { 413 class double extends num {
445 static parse(source, onError) { 414 static parse(source, onError) {
446 if (onError === void 0) 415 if (onError === void 0) onError = null;
447 onError = null;
448 return _js_helper.Primitives.parseDouble(source, onError); 416 return _js_helper.Primitives.parseDouble(source, onError);
449 } 417 }
450 } 418 }
451 dart.setSignature(double, { 419 dart.setSignature(double, {
452 statics: () => ({parse: [double, [String], [dart.functionType(double, [Strin g])]]}), 420 statics: () => ({parse: [double, [String], [dart.functionType(double, [Strin g])]]}),
453 names: ['parse'] 421 names: ['parse']
454 }); 422 });
455 double.NAN = 0.0 / 0.0; 423 double.NAN = 0.0 / 0.0;
456 double.INFINITY = 1.0 / 0.0; 424 double.INFINITY = 1.0 / 0.0;
457 double.NEGATIVE_INFINITY = -dart.notNull(double.INFINITY); 425 double.NEGATIVE_INFINITY = -dart.notNull(double.INFINITY);
(...skipping 16 matching lines...) Expand all
474 ['+'](other) { 442 ['+'](other) {
475 return new Duration._microseconds(dart.notNull(this[_duration]) + dart.not Null(other[_duration])); 443 return new Duration._microseconds(dart.notNull(this[_duration]) + dart.not Null(other[_duration]));
476 } 444 }
477 ['-'](other) { 445 ['-'](other) {
478 return new Duration._microseconds(dart.notNull(this[_duration]) - dart.not Null(other[_duration])); 446 return new Duration._microseconds(dart.notNull(this[_duration]) - dart.not Null(other[_duration]));
479 } 447 }
480 ['*'](factor) { 448 ['*'](factor) {
481 return new Duration._microseconds((dart.notNull(this[_duration]) * dart.no tNull(factor))[dartx.round]()); 449 return new Duration._microseconds((dart.notNull(this[_duration]) * dart.no tNull(factor))[dartx.round]());
482 } 450 }
483 ['~/'](quotient) { 451 ['~/'](quotient) {
484 if (quotient == 0) 452 if (quotient == 0) dart.throw(new IntegerDivisionByZeroException());
485 dart.throw(new IntegerDivisionByZeroException());
486 return new Duration._microseconds((dart.notNull(this[_duration]) / dart.no tNull(quotient))[dartx.truncate]()); 453 return new Duration._microseconds((dart.notNull(this[_duration]) / dart.no tNull(quotient))[dartx.truncate]());
487 } 454 }
488 ['<'](other) { 455 ['<'](other) {
489 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]); 456 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]);
490 } 457 }
491 ['>'](other) { 458 ['>'](other) {
492 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]); 459 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]);
493 } 460 }
494 ['<='](other) { 461 ['<='](other) {
495 return dart.notNull(this[_duration]) <= dart.notNull(other[_duration]); 462 return dart.notNull(this[_duration]) <= dart.notNull(other[_duration]);
(...skipping 13 matching lines...) Expand all
509 get inSeconds() { 476 get inSeconds() {
510 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_SECOND))[dartx.truncate](); 477 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_SECOND))[dartx.truncate]();
511 } 478 }
512 get inMilliseconds() { 479 get inMilliseconds() {
513 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_MILLISECOND))[dartx.truncate](); 480 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_MILLISECOND))[dartx.truncate]();
514 } 481 }
515 get inMicroseconds() { 482 get inMicroseconds() {
516 return this[_duration]; 483 return this[_duration];
517 } 484 }
518 ['=='](other) { 485 ['=='](other) {
519 if (!dart.is(other, Duration)) 486 if (!dart.is(other, Duration)) return false;
520 return false;
521 return dart.equals(this[_duration], dart.dload(other, _duration)); 487 return dart.equals(this[_duration], dart.dload(other, _duration));
522 } 488 }
523 get hashCode() { 489 get hashCode() {
524 return dart.hashCode(this[_duration]); 490 return dart.hashCode(this[_duration]);
525 } 491 }
526 compareTo(other) { 492 compareTo(other) {
527 return this[_duration][dartx.compareTo](other[_duration]); 493 return this[_duration][dartx.compareTo](other[_duration]);
528 } 494 }
529 toString() { 495 toString() {
530 function sixDigits(n) { 496 function sixDigits(n) {
531 if (dart.notNull(n) >= 100000) 497 if (dart.notNull(n) >= 100000) return `${n}`;
532 return `${n}`; 498 if (dart.notNull(n) >= 10000) return `0${n}`;
533 if (dart.notNull(n) >= 10000) 499 if (dart.notNull(n) >= 1000) return `00${n}`;
534 return `0${n}`; 500 if (dart.notNull(n) >= 100) return `000${n}`;
535 if (dart.notNull(n) >= 1000) 501 if (dart.notNull(n) >= 10) return `0000${n}`;
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}`; 502 return `00000${n}`;
542 } 503 }
543 dart.fn(sixDigits, String, [int]); 504 dart.fn(sixDigits, String, [int]);
544 function twoDigits(n) { 505 function twoDigits(n) {
545 if (dart.notNull(n) >= 10) 506 if (dart.notNull(n) >= 10) return `${n}`;
546 return `${n}`;
547 return `0${n}`; 507 return `0${n}`;
548 } 508 }
549 dart.fn(twoDigits, String, [int]); 509 dart.fn(twoDigits, String, [int]);
550 if (dart.notNull(this.inMicroseconds) < 0) { 510 if (dart.notNull(this.inMicroseconds) < 0) {
551 return `-${this['unary-']()}`; 511 return `-${this['unary-']()}`;
552 } 512 }
553 let twoDigitMinutes = twoDigits(dart.asInt(this.inMinutes[dartx.remainder] (Duration.MINUTES_PER_HOUR))); 513 let twoDigitMinutes = twoDigits(dart.asInt(this.inMinutes[dartx.remainder] (Duration.MINUTES_PER_HOUR)));
554 let twoDigitSeconds = twoDigits(dart.asInt(this.inSeconds[dartx.remainder] (Duration.SECONDS_PER_MINUTE))); 514 let twoDigitSeconds = twoDigits(dart.asInt(this.inSeconds[dartx.remainder] (Duration.SECONDS_PER_MINUTE)));
555 let sixDigitUs = sixDigits(dart.asInt(this.inMicroseconds[dartx.remainder] (Duration.MICROSECONDS_PER_SECOND))); 515 let sixDigitUs = sixDigits(dart.asInt(this.inMicroseconds[dartx.remainder] (Duration.MICROSECONDS_PER_SECOND)));
556 return `${this.inHours}:${twoDigitMinutes}:${twoDigitSeconds}.${sixDigitUs }`; 516 return `${this.inHours}:${twoDigitMinutes}:${twoDigitSeconds}.${sixDigitUs }`;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 NullThrownError() { 609 NullThrownError() {
650 super.Error(); 610 super.Error();
651 } 611 }
652 toString() { 612 toString() {
653 return "Throw of null."; 613 return "Throw of null.";
654 } 614 }
655 } 615 }
656 const _hasValue = dart.JsSymbol('_hasValue'); 616 const _hasValue = dart.JsSymbol('_hasValue');
657 class ArgumentError extends Error { 617 class ArgumentError extends Error {
658 ArgumentError(message) { 618 ArgumentError(message) {
659 if (message === void 0) 619 if (message === void 0) message = null;
660 message = null;
661 this.message = message; 620 this.message = message;
662 this.invalidValue = null; 621 this.invalidValue = null;
663 this[_hasValue] = false; 622 this[_hasValue] = false;
664 this.name = null; 623 this.name = null;
665 super.Error(); 624 super.Error();
666 } 625 }
667 value(value, name, message) { 626 value(value, name, message) {
668 if (name === void 0) 627 if (name === void 0) name = null;
669 name = null; 628 if (message === void 0) message = "Invalid argument";
670 if (message === void 0)
671 message = "Invalid argument";
672 this.name = name; 629 this.name = name;
673 this.message = message; 630 this.message = message;
674 this.invalidValue = value; 631 this.invalidValue = value;
675 this[_hasValue] = true; 632 this[_hasValue] = true;
676 super.Error(); 633 super.Error();
677 } 634 }
678 notNull(name) { 635 notNull(name) {
679 if (name === void 0) 636 if (name === void 0) name = null;
680 name = null;
681 this.value(null, name, "Must not be null"); 637 this.value(null, name, "Must not be null");
682 } 638 }
683 toString() { 639 toString() {
684 if (!dart.notNull(this[_hasValue])) { 640 if (!dart.notNull(this[_hasValue])) {
685 let result = "Invalid arguments(s)"; 641 let result = "Invalid arguments(s)";
686 if (this.message != null) { 642 if (this.message != null) {
687 result = `${result}: ${this.message}`; 643 result = `${result}: ${this.message}`;
688 } 644 }
689 return result; 645 return result;
690 } 646 }
(...skipping 13 matching lines...) Expand all
704 notNull: [ArgumentError, [], [String]] 660 notNull: [ArgumentError, [], [String]]
705 }) 661 })
706 }); 662 });
707 class RangeError extends ArgumentError { 663 class RangeError extends ArgumentError {
708 RangeError(message) { 664 RangeError(message) {
709 this.start = null; 665 this.start = null;
710 this.end = null; 666 this.end = null;
711 super.ArgumentError(message); 667 super.ArgumentError(message);
712 } 668 }
713 value(value, name, message) { 669 value(value, name, message) {
714 if (name === void 0) 670 if (name === void 0) name = null;
715 name = null; 671 if (message === void 0) message = null;
716 if (message === void 0)
717 message = null;
718 this.start = null; 672 this.start = null;
719 this.end = null; 673 this.end = null;
720 super.value(value, name, message != null ? message : "Value not in range") ; 674 super.value(value, name, message != null ? message : "Value not in range") ;
721 } 675 }
722 range(invalidValue, minValue, maxValue, name, message) { 676 range(invalidValue, minValue, maxValue, name, message) {
723 if (name === void 0) 677 if (name === void 0) name = null;
724 name = null; 678 if (message === void 0) message = null;
725 if (message === void 0)
726 message = null;
727 this.start = minValue; 679 this.start = minValue;
728 this.end = maxValue; 680 this.end = maxValue;
729 super.value(invalidValue, name, message != null ? message : "Invalid value "); 681 super.value(invalidValue, name, message != null ? message : "Invalid value ");
730 } 682 }
731 static index(index, indexable, name, message, length) { 683 static index(index, indexable, name, message, length) {
732 return new IndexError(index, indexable, name, message, length); 684 return new IndexError(index, indexable, name, message, length);
733 } 685 }
734 static checkValueInInterval(value, minValue, maxValue, name, message) { 686 static checkValueInInterval(value, minValue, maxValue, name, message) {
735 if (name === void 0) 687 if (name === void 0) name = null;
736 name = null; 688 if (message === void 0) message = null;
737 if (message === void 0)
738 message = null;
739 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) { 689 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) {
740 dart.throw(new RangeError.range(value, minValue, maxValue, name, message )); 690 dart.throw(new RangeError.range(value, minValue, maxValue, name, message ));
741 } 691 }
742 } 692 }
743 static checkValidIndex(index, indexable, name, length, message) { 693 static checkValidIndex(index, indexable, name, length, message) {
744 if (name === void 0) 694 if (name === void 0) name = null;
745 name = null; 695 if (length === void 0) length = null;
746 if (length === void 0) 696 if (message === void 0) message = null;
747 length = null; 697 if (length == null) length = dart.as(dart.dload(indexable, 'length'), int) ;
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) ) { 698 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length) ) {
753 if (name == null) 699 if (name == null) name = "index";
754 name = "index";
755 dart.throw(RangeError.index(index, indexable, name, message, length)); 700 dart.throw(RangeError.index(index, indexable, name, message, length));
756 } 701 }
757 } 702 }
758 static checkValidRange(start, end, length, startName, endName, message) { 703 static checkValidRange(start, end, length, startName, endName, message) {
759 if (startName === void 0) 704 if (startName === void 0) startName = null;
760 startName = null; 705 if (endName === void 0) endName = null;
761 if (endName === void 0) 706 if (message === void 0) message = null;
762 endName = null;
763 if (message === void 0)
764 message = null;
765 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) { 707 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) {
766 if (startName == null) 708 if (startName == null) startName = "start";
767 startName = "start";
768 dart.throw(new RangeError.range(start, 0, length, startName, message)); 709 dart.throw(new RangeError.range(start, 0, length, startName, message));
769 } 710 }
770 if (end != null && (dart.notNull(end) < dart.notNull(start) || dart.notNul l(end) > dart.notNull(length))) { 711 if (end != null && (dart.notNull(end) < dart.notNull(start) || dart.notNul l(end) > dart.notNull(length))) {
771 if (endName == null) 712 if (endName == null) endName = "end";
772 endName = "end";
773 dart.throw(new RangeError.range(end, start, length, endName, message)); 713 dart.throw(new RangeError.range(end, start, length, endName, message));
774 } 714 }
775 } 715 }
776 static checkNotNegative(value, name, message) { 716 static checkNotNegative(value, name, message) {
777 if (name === void 0) 717 if (name === void 0) name = null;
778 name = null; 718 if (message === void 0) message = null;
779 if (message === void 0) 719 if (dart.notNull(value) < 0) dart.throw(new RangeError.range(value, 0, nul l, name, message));
780 message = null;
781 if (dart.notNull(value) < 0)
782 dart.throw(new RangeError.range(value, 0, null, name, message));
783 } 720 }
784 toString() { 721 toString() {
785 if (!dart.notNull(this[_hasValue])) 722 if (!dart.notNull(this[_hasValue])) return `RangeError: ${this.message}`;
786 return `RangeError: ${this.message}`;
787 let value = Error.safeToString(this.invalidValue); 723 let value = Error.safeToString(this.invalidValue);
788 let explanation = ""; 724 let explanation = "";
789 if (this.start == null) { 725 if (this.start == null) {
790 if (this.end != null) { 726 if (this.end != null) {
791 explanation = `: Not less than or equal to ${this.end}`; 727 explanation = `: Not less than or equal to ${this.end}`;
792 } 728 }
793 } else if (this.end == null) { 729 } else if (this.end == null) {
794 explanation = `: Not greater than or equal to ${this.start}`; 730 explanation = `: Not greater than or equal to ${this.start}`;
795 } else if (dart.notNull(this.end) > dart.notNull(this.start)) { 731 } else if (dart.notNull(this.end) > dart.notNull(this.start)) {
796 explanation = `: Not in range ${this.start}..${this.end}, inclusive.`; 732 explanation = `: Not in range ${this.start}..${this.end}, inclusive.`;
(...skipping 17 matching lines...) Expand all
814 statics: () => ({ 750 statics: () => ({
815 checkValueInInterval: [dart.void, [int, int, int], [String, String]], 751 checkValueInInterval: [dart.void, [int, int, int], [String, String]],
816 checkValidIndex: [dart.void, [int, dart.dynamic], [String, int, String]], 752 checkValidIndex: [dart.void, [int, dart.dynamic], [String, int, String]],
817 checkValidRange: [dart.void, [int, int, int], [String, String, String]], 753 checkValidRange: [dart.void, [int, int, int], [String, String, String]],
818 checkNotNegative: [dart.void, [int], [String, String]] 754 checkNotNegative: [dart.void, [int], [String, String]]
819 }), 755 }),
820 names: ['checkValueInInterval', 'checkValidIndex', 'checkValidRange', 'check NotNegative'] 756 names: ['checkValueInInterval', 'checkValidIndex', 'checkValidRange', 'check NotNegative']
821 }); 757 });
822 class IndexError extends ArgumentError { 758 class IndexError extends ArgumentError {
823 IndexError(invalidValue, indexable, name, message, length) { 759 IndexError(invalidValue, indexable, name, message, length) {
824 if (name === void 0) 760 if (name === void 0) name = null;
825 name = null; 761 if (message === void 0) message = null;
826 if (message === void 0) 762 if (length === void 0) length = null;
827 message = null;
828 if (length === void 0)
829 length = null;
830 this.indexable = indexable; 763 this.indexable = indexable;
831 this.length = length != null ? length : dart.as(dart.dload(indexable, 'len gth'), int); 764 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"); 765 super.value(invalidValue, name, message != null ? message : "Index out of range");
833 } 766 }
834 get start() { 767 get start() {
835 return 0; 768 return 0;
836 } 769 }
837 get end() { 770 get end() {
838 return dart.notNull(this.length) - 1; 771 return dart.notNull(this.length) - 1;
839 } 772 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 dart.setSignature(AbstractClassInstantiationError, { 805 dart.setSignature(AbstractClassInstantiationError, {
873 constructors: () => ({AbstractClassInstantiationError: [AbstractClassInstant iationError, [String]]}) 806 constructors: () => ({AbstractClassInstantiationError: [AbstractClassInstant iationError, [String]]})
874 }); 807 });
875 const _receiver = dart.JsSymbol('_receiver'); 808 const _receiver = dart.JsSymbol('_receiver');
876 const _memberName = dart.JsSymbol('_memberName'); 809 const _memberName = dart.JsSymbol('_memberName');
877 const _arguments = dart.JsSymbol('_arguments'); 810 const _arguments = dart.JsSymbol('_arguments');
878 const _namedArguments = dart.JsSymbol('_namedArguments'); 811 const _namedArguments = dart.JsSymbol('_namedArguments');
879 const _existingArgumentNames = dart.JsSymbol('_existingArgumentNames'); 812 const _existingArgumentNames = dart.JsSymbol('_existingArgumentNames');
880 class NoSuchMethodError extends Error { 813 class NoSuchMethodError extends Error {
881 NoSuchMethodError(receiver, memberName, positionalArguments, namedArguments, existingArgumentNames) { 814 NoSuchMethodError(receiver, memberName, positionalArguments, namedArguments, existingArgumentNames) {
882 if (existingArgumentNames === void 0) 815 if (existingArgumentNames === void 0) existingArgumentNames = null;
883 existingArgumentNames = null;
884 this[_receiver] = receiver; 816 this[_receiver] = receiver;
885 this[_memberName] = memberName; 817 this[_memberName] = memberName;
886 this[_arguments] = positionalArguments; 818 this[_arguments] = positionalArguments;
887 this[_namedArguments] = namedArguments; 819 this[_namedArguments] = namedArguments;
888 this[_existingArgumentNames] = existingArgumentNames; 820 this[_existingArgumentNames] = existingArgumentNames;
889 super.Error(); 821 super.Error();
890 } 822 }
891 toString() { 823 toString() {
892 let sb = new StringBuffer(); 824 let sb = new StringBuffer();
893 let i = 0; 825 let i = 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 } 868 }
937 toString() { 869 toString() {
938 return `Unsupported operation: ${this.message}`; 870 return `Unsupported operation: ${this.message}`;
939 } 871 }
940 } 872 }
941 dart.setSignature(UnsupportedError, { 873 dart.setSignature(UnsupportedError, {
942 constructors: () => ({UnsupportedError: [UnsupportedError, [String]]}) 874 constructors: () => ({UnsupportedError: [UnsupportedError, [String]]})
943 }); 875 });
944 class UnimplementedError extends Error { 876 class UnimplementedError extends Error {
945 UnimplementedError(message) { 877 UnimplementedError(message) {
946 if (message === void 0) 878 if (message === void 0) message = null;
947 message = null;
948 this.message = message; 879 this.message = message;
949 super.Error(); 880 super.Error();
950 } 881 }
951 toString() { 882 toString() {
952 return this.message != null ? `UnimplementedError: ${this.message}` : "Uni mplementedError"; 883 return this.message != null ? `UnimplementedError: ${this.message}` : "Uni mplementedError";
953 } 884 }
954 } 885 }
955 UnimplementedError[dart.implements] = () => [UnsupportedError]; 886 UnimplementedError[dart.implements] = () => [UnsupportedError];
956 dart.setSignature(UnimplementedError, { 887 dart.setSignature(UnimplementedError, {
957 constructors: () => ({UnimplementedError: [UnimplementedError, [], [String]] }) 888 constructors: () => ({UnimplementedError: [UnimplementedError, [], [String]] })
958 }); 889 });
959 class StateError extends Error { 890 class StateError extends Error {
960 StateError(message) { 891 StateError(message) {
961 this.message = message; 892 this.message = message;
962 super.Error(); 893 super.Error();
963 } 894 }
964 toString() { 895 toString() {
965 return `Bad state: ${this.message}`; 896 return `Bad state: ${this.message}`;
966 } 897 }
967 } 898 }
968 dart.setSignature(StateError, { 899 dart.setSignature(StateError, {
969 constructors: () => ({StateError: [StateError, [String]]}) 900 constructors: () => ({StateError: [StateError, [String]]})
970 }); 901 });
971 class ConcurrentModificationError extends Error { 902 class ConcurrentModificationError extends Error {
972 ConcurrentModificationError(modifiedObject) { 903 ConcurrentModificationError(modifiedObject) {
973 if (modifiedObject === void 0) 904 if (modifiedObject === void 0) modifiedObject = null;
974 modifiedObject = null;
975 this.modifiedObject = modifiedObject; 905 this.modifiedObject = modifiedObject;
976 super.Error(); 906 super.Error();
977 } 907 }
978 toString() { 908 toString() {
979 if (this.modifiedObject == null) { 909 if (this.modifiedObject == null) {
980 return "Concurrent modification during iteration."; 910 return "Concurrent modification during iteration.";
981 } 911 }
982 return "Concurrent modification during iteration: " + `${Error.safeToStrin g(this.modifiedObject)}.`; 912 return "Concurrent modification during iteration: " + `${Error.safeToStrin g(this.modifiedObject)}.`;
983 } 913 }
984 } 914 }
(...skipping 23 matching lines...) Expand all
1008 get stackTrace() { 938 get stackTrace() {
1009 return null; 939 return null;
1010 } 940 }
1011 } 941 }
1012 StackOverflowError[dart.implements] = () => [Error]; 942 StackOverflowError[dart.implements] = () => [Error];
1013 dart.setSignature(StackOverflowError, { 943 dart.setSignature(StackOverflowError, {
1014 constructors: () => ({StackOverflowError: [StackOverflowError, []]}) 944 constructors: () => ({StackOverflowError: [StackOverflowError, []]})
1015 }); 945 });
1016 class CyclicInitializationError extends Error { 946 class CyclicInitializationError extends Error {
1017 CyclicInitializationError(variableName) { 947 CyclicInitializationError(variableName) {
1018 if (variableName === void 0) 948 if (variableName === void 0) variableName = null;
1019 variableName = null;
1020 this.variableName = variableName; 949 this.variableName = variableName;
1021 super.Error(); 950 super.Error();
1022 } 951 }
1023 toString() { 952 toString() {
1024 return this.variableName == null ? "Reading static variable during its ini tialization" : `Reading static variable '${this.variableName}' during its initia lization`; 953 return this.variableName == null ? "Reading static variable during its ini tialization" : `Reading static variable '${this.variableName}' during its initia lization`;
1025 } 954 }
1026 } 955 }
1027 dart.setSignature(CyclicInitializationError, { 956 dart.setSignature(CyclicInitializationError, {
1028 constructors: () => ({CyclicInitializationError: [CyclicInitializationError, [], [String]]}) 957 constructors: () => ({CyclicInitializationError: [CyclicInitializationError, [], [String]]})
1029 }); 958 });
1030 class Exception extends Object { 959 class Exception extends Object {
1031 static new(message) { 960 static new(message) {
1032 if (message === void 0) 961 if (message === void 0) message = null;
1033 message = null;
1034 return new _ExceptionImplementation(message); 962 return new _ExceptionImplementation(message);
1035 } 963 }
1036 } 964 }
1037 dart.setSignature(Exception, { 965 dart.setSignature(Exception, {
1038 constructors: () => ({new: [Exception, [], [dart.dynamic]]}) 966 constructors: () => ({new: [Exception, [], [dart.dynamic]]})
1039 }); 967 });
1040 class _ExceptionImplementation extends Object { 968 class _ExceptionImplementation extends Object {
1041 _ExceptionImplementation(message) { 969 _ExceptionImplementation(message) {
1042 if (message === void 0) 970 if (message === void 0) message = null;
1043 message = null;
1044 this.message = message; 971 this.message = message;
1045 } 972 }
1046 toString() { 973 toString() {
1047 if (this.message == null) 974 if (this.message == null) return "Exception";
1048 return "Exception";
1049 return `Exception: ${this.message}`; 975 return `Exception: ${this.message}`;
1050 } 976 }
1051 } 977 }
1052 _ExceptionImplementation[dart.implements] = () => [Exception]; 978 _ExceptionImplementation[dart.implements] = () => [Exception];
1053 dart.setSignature(_ExceptionImplementation, { 979 dart.setSignature(_ExceptionImplementation, {
1054 constructors: () => ({_ExceptionImplementation: [_ExceptionImplementation, [ ], [dart.dynamic]]}) 980 constructors: () => ({_ExceptionImplementation: [_ExceptionImplementation, [ ], [dart.dynamic]]})
1055 }); 981 });
1056 class FormatException extends Object { 982 class FormatException extends Object {
1057 FormatException(message, source, offset) { 983 FormatException(message, source, offset) {
1058 if (message === void 0) 984 if (message === void 0) message = "";
1059 message = ""; 985 if (source === void 0) source = null;
1060 if (source === void 0) 986 if (offset === void 0) offset = -1;
1061 source = null;
1062 if (offset === void 0)
1063 offset = -1;
1064 this.message = message; 987 this.message = message;
1065 this.source = source; 988 this.source = source;
1066 this.offset = offset; 989 this.offset = offset;
1067 } 990 }
1068 toString() { 991 toString() {
1069 let report = "FormatException"; 992 let report = "FormatException";
1070 if (this.message != null && "" != this.message) { 993 if (this.message != null && "" != this.message) {
1071 report = `${report}: ${this.message}`; 994 report = `${report}: ${this.message}`;
1072 } 995 }
1073 let offset = this.offset; 996 let offset = this.offset;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 } 1076 }
1154 } 1077 }
1155 IntegerDivisionByZeroException[dart.implements] = () => [Exception]; 1078 IntegerDivisionByZeroException[dart.implements] = () => [Exception];
1156 dart.setSignature(IntegerDivisionByZeroException, { 1079 dart.setSignature(IntegerDivisionByZeroException, {
1157 constructors: () => ({IntegerDivisionByZeroException: [IntegerDivisionByZero Exception, []]}) 1080 constructors: () => ({IntegerDivisionByZeroException: [IntegerDivisionByZero Exception, []]})
1158 }); 1081 });
1159 const _getKey = dart.JsSymbol('_getKey'); 1082 const _getKey = dart.JsSymbol('_getKey');
1160 const Expando$ = dart.generic(function(T) { 1083 const Expando$ = dart.generic(function(T) {
1161 class Expando extends Object { 1084 class Expando extends Object {
1162 Expando(name) { 1085 Expando(name) {
1163 if (name === void 0) 1086 if (name === void 0) name = null;
1164 name = null;
1165 this.name = name; 1087 this.name = name;
1166 } 1088 }
1167 toString() { 1089 toString() {
1168 return `Expando:${this.name}`; 1090 return `Expando:${this.name}`;
1169 } 1091 }
1170 get(object) { 1092 get(object) {
1171 let values = _js_helper.Primitives.getProperty(object, Expando$()._EXPAN DO_PROPERTY_NAME); 1093 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); 1094 return values == null ? null : dart.as(_js_helper.Primitives.getProperty (values, this[_getKey]()), T);
1173 } 1095 }
1174 set(object, value) { 1096 set(object, value) {
(...skipping 28 matching lines...) Expand all
1203 }) 1125 })
1204 }); 1126 });
1205 return Expando; 1127 return Expando;
1206 }); 1128 });
1207 let Expando = Expando$(); 1129 let Expando = Expando$();
1208 Expando._KEY_PROPERTY_NAME = 'expando$key'; 1130 Expando._KEY_PROPERTY_NAME = 'expando$key';
1209 Expando._EXPANDO_PROPERTY_NAME = 'expando$values'; 1131 Expando._EXPANDO_PROPERTY_NAME = 'expando$values';
1210 Expando._keyCount = 0; 1132 Expando._keyCount = 0;
1211 class Function extends Object { 1133 class Function extends Object {
1212 static apply(f, positionalArguments, namedArguments) { 1134 static apply(f, positionalArguments, namedArguments) {
1213 if (namedArguments === void 0) 1135 if (namedArguments === void 0) namedArguments = null;
1214 namedArguments = null;
1215 return dart.dcall.apply(null, [f].concat(positionalArguments)); 1136 return dart.dcall.apply(null, [f].concat(positionalArguments));
1216 } 1137 }
1217 static _toMangledNames(namedArguments) { 1138 static _toMangledNames(namedArguments) {
1218 let result = dart.map(); 1139 let result = dart.map();
1219 namedArguments.forEach(dart.fn((symbol, value) => { 1140 namedArguments.forEach(dart.fn((symbol, value) => {
1220 result.set(_symbolToString(dart.as(symbol, Symbol)), value); 1141 result.set(_symbolToString(dart.as(symbol, Symbol)), value);
1221 })); 1142 }));
1222 return result; 1143 return result;
1223 } 1144 }
1224 } 1145 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 } 1180 }
1260 } 1181 }
1261 const Iterable$ = dart.generic(function(E) { 1182 const Iterable$ = dart.generic(function(E) {
1262 dart.defineExtensionNames([ 1183 dart.defineExtensionNames([
1263 'join' 1184 'join'
1264 ]); 1185 ]);
1265 class Iterable extends Object { 1186 class Iterable extends Object {
1266 Iterable() { 1187 Iterable() {
1267 } 1188 }
1268 static generate(count, generator) { 1189 static generate(count, generator) {
1269 if (generator === void 0) 1190 if (generator === void 0) generator = null;
1270 generator = null; 1191 if (dart.notNull(count) <= 0) return new (_internal.EmptyIterable$(E))() ;
1271 if (dart.notNull(count) <= 0)
1272 return new (_internal.EmptyIterable$(E))();
1273 return new (exports._GeneratorIterable$(E))(count, generator); 1192 return new (exports._GeneratorIterable$(E))(count, generator);
1274 } 1193 }
1275 [dart.JsSymbol.iterator]() { 1194 [dart.JsSymbol.iterator]() {
1276 return new dart.JsIterator(this[dartx.iterator]); 1195 return new dart.JsIterator(this[dartx.iterator]);
1277 } 1196 }
1278 [dartx.join](separator) { 1197 [dartx.join](separator) {
1279 if (separator === void 0) 1198 if (separator === void 0) separator = "";
1280 separator = "";
1281 let buffer = new StringBuffer(); 1199 let buffer = new StringBuffer();
1282 buffer.writeAll(this, separator); 1200 buffer.writeAll(this, separator);
1283 return dart.toString(buffer); 1201 return dart.toString(buffer);
1284 } 1202 }
1285 } 1203 }
1286 dart.setSignature(Iterable, { 1204 dart.setSignature(Iterable, {
1287 constructors: () => ({ 1205 constructors: () => ({
1288 Iterable: [Iterable$(E), []], 1206 Iterable: [Iterable$(E), []],
1289 generate: [Iterable$(E), [int], [dart.functionType(E, [int])]] 1207 generate: [Iterable$(E), [int], [dart.functionType(E, [int])]]
1290 }), 1208 }),
(...skipping 25 matching lines...) Expand all
1316 super.IterableBase(); 1234 super.IterableBase();
1317 } 1235 }
1318 get iterator() { 1236 get iterator() {
1319 return new (_GeneratorIterator$(E))(this[_start], this[_end], this[_gene rator]); 1237 return new (_GeneratorIterator$(E))(this[_start], this[_end], this[_gene rator]);
1320 } 1238 }
1321 get length() { 1239 get length() {
1322 return dart.notNull(this[_end]) - dart.notNull(this[_start]); 1240 return dart.notNull(this[_end]) - dart.notNull(this[_start]);
1323 } 1241 }
1324 skip(count) { 1242 skip(count) {
1325 RangeError.checkNotNegative(count, "count"); 1243 RangeError.checkNotNegative(count, "count");
1326 if (count == 0) 1244 if (count == 0) return this;
1327 return this;
1328 let newStart = dart.notNull(this[_start]) + dart.notNull(count); 1245 let newStart = dart.notNull(this[_start]) + dart.notNull(count);
1329 if (dart.notNull(newStart) >= dart.notNull(this[_end])) 1246 if (dart.notNull(newStart) >= dart.notNull(this[_end])) return new (_int ernal.EmptyIterable$(E))();
1330 return new (_internal.EmptyIterable$(E))();
1331 return new (exports._GeneratorIterable$(E)).slice(newStart, this[_end], this[_generator]); 1247 return new (exports._GeneratorIterable$(E)).slice(newStart, this[_end], this[_generator]);
1332 } 1248 }
1333 take(count) { 1249 take(count) {
1334 RangeError.checkNotNegative(count, "count"); 1250 RangeError.checkNotNegative(count, "count");
1335 if (count == 0) 1251 if (count == 0) return new (_internal.EmptyIterable$(E))();
1336 return new (_internal.EmptyIterable$(E))();
1337 let newEnd = dart.notNull(this[_start]) + dart.notNull(count); 1252 let newEnd = dart.notNull(this[_start]) + dart.notNull(count);
1338 if (dart.notNull(newEnd) >= dart.notNull(this[_end])) 1253 if (dart.notNull(newEnd) >= dart.notNull(this[_end])) return this;
1339 return this;
1340 return new (exports._GeneratorIterable$(E)).slice(this[_start], newEnd, this[_generator]); 1254 return new (exports._GeneratorIterable$(E)).slice(this[_start], newEnd, this[_generator]);
1341 } 1255 }
1342 static _id(n) { 1256 static _id(n) {
1343 return n; 1257 return n;
1344 } 1258 }
1345 } 1259 }
1346 _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength]; 1260 _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength];
1347 dart.defineNamedConstructor(_GeneratorIterable, 'slice'); 1261 dart.defineNamedConstructor(_GeneratorIterable, 'slice');
1348 dart.setSignature(_GeneratorIterable, { 1262 dart.setSignature(_GeneratorIterable, {
1349 constructors: () => ({ 1263 constructors: () => ({
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 }); 1314 });
1401 let BidirectionalIterator = BidirectionalIterator$(); 1315 let BidirectionalIterator = BidirectionalIterator$();
1402 const Iterator$ = dart.generic(function(E) { 1316 const Iterator$ = dart.generic(function(E) {
1403 class Iterator extends Object {} 1317 class Iterator extends Object {}
1404 return Iterator; 1318 return Iterator;
1405 }); 1319 });
1406 let Iterator = Iterator$(); 1320 let Iterator = Iterator$();
1407 const List$ = dart.generic(function(E) { 1321 const List$ = dart.generic(function(E) {
1408 class List extends Object { 1322 class List extends Object {
1409 static new(length) { 1323 static new(length) {
1410 if (length === void 0) 1324 if (length === void 0) length = null;
1411 length = null;
1412 let list = null; 1325 let list = null;
1413 if (length == null) { 1326 if (length == null) {
1414 list = []; 1327 list = [];
1415 } else { 1328 } else {
1416 if (!(typeof length == 'number') || dart.notNull(length) < 0) { 1329 if (!(typeof length == 'number') || dart.notNull(length) < 0) {
1417 dart.throw(new ArgumentError(`Length must be a non-negative integer: ${length}`)); 1330 dart.throw(new ArgumentError(`Length must be a non-negative integer: ${length}`));
1418 } 1331 }
1419 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length), List$())); 1332 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length), List$()));
1420 } 1333 }
1421 return _interceptors.JSArray$(E).typed(list); 1334 return _interceptors.JSArray$(E).typed(list);
1422 } 1335 }
1423 static filled(length, fill) { 1336 static filled(length, fill) {
1424 let result = List$(E).new(length); 1337 let result = List$(E).new(length);
1425 if (length != 0 && fill != null) { 1338 if (length != 0 && fill != null) {
1426 for (let i = 0; dart.notNull(i) < dart.notNull(result[dartx.length]); i = dart.notNull(i) + 1) { 1339 for (let i = 0; dart.notNull(i) < dart.notNull(result[dartx.length]); i = dart.notNull(i) + 1) {
1427 result[dartx.set](i, fill); 1340 result[dartx.set](i, fill);
1428 } 1341 }
1429 } 1342 }
1430 return result; 1343 return result;
1431 } 1344 }
1432 static from(elements, opts) { 1345 static from(elements, opts) {
1433 let growable = opts && 'growable' in opts ? opts.growable : true; 1346 let growable = opts && 'growable' in opts ? opts.growable : true;
1434 let list = List$(E).new(); 1347 let list = List$(E).new();
1435 for (let e of elements) { 1348 for (let e of elements) {
1436 list[dartx.add](dart.as(e, E)); 1349 list[dartx.add](dart.as(e, E));
1437 } 1350 }
1438 if (dart.notNull(growable)) 1351 if (dart.notNull(growable)) return list;
1439 return list;
1440 return dart.as(_internal.makeListFixedLength(list), List$(E)); 1352 return dart.as(_internal.makeListFixedLength(list), List$(E));
1441 } 1353 }
1442 static generate(length, generator, opts) { 1354 static generate(length, generator, opts) {
1443 let growable = opts && 'growable' in opts ? opts.growable : true; 1355 let growable = opts && 'growable' in opts ? opts.growable : true;
1444 let result = null; 1356 let result = null;
1445 if (dart.notNull(growable)) { 1357 if (dart.notNull(growable)) {
1446 result = dart.list([], E); 1358 result = dart.list([], E);
1447 result[dartx.length] = length; 1359 result[dartx.length] = length;
1448 } else { 1360 } else {
1449 result = List$(E).new(length); 1361 result = List$(E).new(length);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 class Stopwatch extends Object { 1478 class Stopwatch extends Object {
1567 get frequency() { 1479 get frequency() {
1568 return Stopwatch._frequency; 1480 return Stopwatch._frequency;
1569 } 1481 }
1570 Stopwatch() { 1482 Stopwatch() {
1571 this[_start] = null; 1483 this[_start] = null;
1572 this[_stop] = null; 1484 this[_stop] = null;
1573 Stopwatch._initTicker(); 1485 Stopwatch._initTicker();
1574 } 1486 }
1575 start() { 1487 start() {
1576 if (dart.notNull(this.isRunning)) 1488 if (dart.notNull(this.isRunning)) return;
1577 return;
1578 if (this[_start] == null) { 1489 if (this[_start] == null) {
1579 this[_start] = Stopwatch._now(); 1490 this[_start] = Stopwatch._now();
1580 } else { 1491 } else {
1581 this[_start] = dart.notNull(Stopwatch._now()) - (dart.notNull(this[_stop ]) - dart.notNull(this[_start])); 1492 this[_start] = dart.notNull(Stopwatch._now()) - (dart.notNull(this[_stop ]) - dart.notNull(this[_start]));
1582 this[_stop] = null; 1493 this[_stop] = null;
1583 } 1494 }
1584 } 1495 }
1585 stop() { 1496 stop() {
1586 if (!dart.notNull(this.isRunning)) 1497 if (!dart.notNull(this.isRunning)) return;
1587 return;
1588 this[_stop] = Stopwatch._now(); 1498 this[_stop] = Stopwatch._now();
1589 } 1499 }
1590 reset() { 1500 reset() {
1591 if (this[_start] == null) 1501 if (this[_start] == null) return;
1592 return;
1593 this[_start] = Stopwatch._now(); 1502 this[_start] = Stopwatch._now();
1594 if (this[_stop] != null) { 1503 if (this[_stop] != null) {
1595 this[_stop] = this[_start]; 1504 this[_stop] = this[_start];
1596 } 1505 }
1597 } 1506 }
1598 get elapsedTicks() { 1507 get elapsedTicks() {
1599 if (this[_start] == null) { 1508 if (this[_start] == null) {
1600 return 0; 1509 return 0;
1601 } 1510 }
1602 return dart.asInt(this[_stop] == null ? dart.notNull(Stopwatch._now()) - d art.notNull(this[_start]) : dart.notNull(this[_stop]) - dart.notNull(this[_start ])); 1511 return dart.asInt(this[_stop] == null ? dart.notNull(Stopwatch._now()) - d art.notNull(this[_start]) : dart.notNull(this[_stop]) - dart.notNull(this[_start ]));
(...skipping 27 matching lines...) Expand all
1630 }), 1539 }),
1631 statics: () => ({ 1540 statics: () => ({
1632 _initTicker: [dart.void, []], 1541 _initTicker: [dart.void, []],
1633 _now: [int, []] 1542 _now: [int, []]
1634 }), 1543 }),
1635 names: ['_initTicker', '_now'] 1544 names: ['_initTicker', '_now']
1636 }); 1545 });
1637 Stopwatch._frequency = null; 1546 Stopwatch._frequency = null;
1638 class String extends Object { 1547 class String extends Object {
1639 static fromCharCodes(charCodes, start, end) { 1548 static fromCharCodes(charCodes, start, end) {
1640 if (start === void 0) 1549 if (start === void 0) start = 0;
1641 start = 0; 1550 if (end === void 0) end = null;
1642 if (end === void 0)
1643 end = null;
1644 if (!dart.is(charCodes, _interceptors.JSArray)) { 1551 if (!dart.is(charCodes, _interceptors.JSArray)) {
1645 return String._stringFromIterable(charCodes, start, end); 1552 return String._stringFromIterable(charCodes, start, end);
1646 } 1553 }
1647 let list = dart.as(charCodes, List); 1554 let list = dart.as(charCodes, List);
1648 let len = list[dartx.length]; 1555 let len = list[dartx.length];
1649 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) { 1556 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) {
1650 dart.throw(new RangeError.range(start, 0, len)); 1557 dart.throw(new RangeError.range(start, 0, len));
1651 } 1558 }
1652 if (end == null) { 1559 if (end == null) {
1653 end = len; 1560 end = len;
1654 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) { 1561 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) {
1655 dart.throw(new RangeError.range(end, start, len)); 1562 dart.throw(new RangeError.range(end, start, len));
1656 } 1563 }
1657 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) { 1564 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) {
1658 list = list[dartx.sublist](start, end); 1565 list = list[dartx.sublist](start, end);
1659 } 1566 }
1660 return _js_helper.Primitives.stringFromCharCodes(list); 1567 return _js_helper.Primitives.stringFromCharCodes(list);
1661 } 1568 }
1662 static fromCharCode(charCode) { 1569 static fromCharCode(charCode) {
1663 return _js_helper.Primitives.stringFromCharCode(charCode); 1570 return _js_helper.Primitives.stringFromCharCode(charCode);
1664 } 1571 }
1665 static fromEnvironment(name, opts) { 1572 static fromEnvironment(name, opts) {
1666 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll; 1573 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')); 1574 dart.throw(new UnsupportedError('String.fromEnvironment can only be used a s a const constructor'));
1668 } 1575 }
1669 static _stringFromIterable(charCodes, start, end) { 1576 static _stringFromIterable(charCodes, start, end) {
1670 if (dart.notNull(start) < 0) 1577 if (dart.notNull(start) < 0) dart.throw(new RangeError.range(start, 0, cha rCodes[dartx.length]));
1671 dart.throw(new RangeError.range(start, 0, charCodes[dartx.length]));
1672 if (end != null && dart.notNull(end) < dart.notNull(start)) { 1578 if (end != null && dart.notNull(end) < dart.notNull(start)) {
1673 dart.throw(new RangeError.range(end, start, charCodes[dartx.length])); 1579 dart.throw(new RangeError.range(end, start, charCodes[dartx.length]));
1674 } 1580 }
1675 let it = charCodes[dartx.iterator]; 1581 let it = charCodes[dartx.iterator];
1676 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) { 1582 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) {
1677 if (!dart.notNull(it.moveNext())) { 1583 if (!dart.notNull(it.moveNext())) {
1678 dart.throw(new RangeError.range(start, 0, i)); 1584 dart.throw(new RangeError.range(start, 0, i));
1679 } 1585 }
1680 } 1586 }
1681 let list = []; 1587 let list = [];
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 } 1679 }
1774 get rawIndex() { 1680 get rawIndex() {
1775 return this[_position] != this[_nextPosition] ? this[_position] : null; 1681 return this[_position] != this[_nextPosition] ? this[_position] : null;
1776 } 1682 }
1777 set rawIndex(rawIndex) { 1683 set rawIndex(rawIndex) {
1778 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex"); 1684 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex");
1779 this.reset(rawIndex); 1685 this.reset(rawIndex);
1780 this.moveNext(); 1686 this.moveNext();
1781 } 1687 }
1782 reset(rawIndex) { 1688 reset(rawIndex) {
1783 if (rawIndex === void 0) 1689 if (rawIndex === void 0) rawIndex = 0;
1784 rawIndex = 0;
1785 RangeError.checkValueInInterval(rawIndex, 0, this.string[dartx.length], "r awIndex"); 1690 RangeError.checkValueInInterval(rawIndex, 0, this.string[dartx.length], "r awIndex");
1786 this[_checkSplitSurrogate](rawIndex); 1691 this[_checkSplitSurrogate](rawIndex);
1787 this[_position] = this[_nextPosition] = rawIndex; 1692 this[_position] = this[_nextPosition] = rawIndex;
1788 this[_currentCodePoint] = null; 1693 this[_currentCodePoint] = null;
1789 } 1694 }
1790 get current() { 1695 get current() {
1791 return dart.asInt(this[_currentCodePoint]); 1696 return dart.asInt(this[_currentCodePoint]);
1792 } 1697 }
1793 get currentSize() { 1698 get currentSize() {
1794 return dart.notNull(this[_nextPosition]) - dart.notNull(this[_position]); 1699 return dart.notNull(this[_nextPosition]) - dart.notNull(this[_position]);
1795 } 1700 }
1796 get currentAsString() { 1701 get currentAsString() {
1797 if (this[_position] == this[_nextPosition]) 1702 if (this[_position] == this[_nextPosition]) return null;
1798 return null; 1703 if (dart.notNull(this[_position]) + 1 == this[_nextPosition]) return this. string[dartx.get](this[_position]);
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]); 1704 return this.string[dartx.substring](this[_position], this[_nextPosition]);
1802 } 1705 }
1803 moveNext() { 1706 moveNext() {
1804 this[_position] = this[_nextPosition]; 1707 this[_position] = this[_nextPosition];
1805 if (this[_position] == this.string[dartx.length]) { 1708 if (this[_position] == this.string[dartx.length]) {
1806 this[_currentCodePoint] = null; 1709 this[_currentCodePoint] = null;
1807 return false; 1710 return false;
1808 } 1711 }
1809 let codeUnit = this.string[dartx.codeUnitAt](this[_position]); 1712 let codeUnit = this.string[dartx.codeUnitAt](this[_position]);
1810 let nextPosition = dart.notNull(this[_position]) + 1; 1713 let nextPosition = dart.notNull(this[_position]) + 1;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 [_checkSplitSurrogate]: [dart.void, [int]], 1755 [_checkSplitSurrogate]: [dart.void, [int]],
1853 reset: [dart.void, [], [int]], 1756 reset: [dart.void, [], [int]],
1854 moveNext: [bool, []], 1757 moveNext: [bool, []],
1855 movePrevious: [bool, []] 1758 movePrevious: [bool, []]
1856 }) 1759 })
1857 }); 1760 });
1858 const _contents = dart.JsSymbol('_contents'); 1761 const _contents = dart.JsSymbol('_contents');
1859 const _writeString = dart.JsSymbol('_writeString'); 1762 const _writeString = dart.JsSymbol('_writeString');
1860 class StringBuffer extends Object { 1763 class StringBuffer extends Object {
1861 StringBuffer(content) { 1764 StringBuffer(content) {
1862 if (content === void 0) 1765 if (content === void 0) content = "";
1863 content = "";
1864 this[_contents] = `${content}`; 1766 this[_contents] = `${content}`;
1865 } 1767 }
1866 get length() { 1768 get length() {
1867 return this[_contents][dartx.length]; 1769 return this[_contents][dartx.length];
1868 } 1770 }
1869 get isEmpty() { 1771 get isEmpty() {
1870 return this.length == 0; 1772 return this.length == 0;
1871 } 1773 }
1872 get isNotEmpty() { 1774 get isNotEmpty() {
1873 return !dart.notNull(this.isEmpty); 1775 return !dart.notNull(this.isEmpty);
1874 } 1776 }
1875 write(obj) { 1777 write(obj) {
1876 this[_writeString](`${obj}`); 1778 this[_writeString](`${obj}`);
1877 } 1779 }
1878 writeCharCode(charCode) { 1780 writeCharCode(charCode) {
1879 this[_writeString](String.fromCharCode(charCode)); 1781 this[_writeString](String.fromCharCode(charCode));
1880 } 1782 }
1881 writeAll(objects, separator) { 1783 writeAll(objects, separator) {
1882 if (separator === void 0) 1784 if (separator === void 0) separator = "";
1883 separator = "";
1884 let iterator = objects[dartx.iterator]; 1785 let iterator = objects[dartx.iterator];
1885 if (!dart.notNull(iterator.moveNext())) 1786 if (!dart.notNull(iterator.moveNext())) return;
1886 return;
1887 if (dart.notNull(separator[dartx.isEmpty])) { 1787 if (dart.notNull(separator[dartx.isEmpty])) {
1888 do { 1788 do {
1889 this.write(iterator.current); 1789 this.write(iterator.current);
1890 } while (dart.notNull(iterator.moveNext())); 1790 } while (dart.notNull(iterator.moveNext()));
1891 } else { 1791 } else {
1892 this.write(iterator.current); 1792 this.write(iterator.current);
1893 while (dart.notNull(iterator.moveNext())) { 1793 while (dart.notNull(iterator.moveNext())) {
1894 this.write(separator); 1794 this.write(separator);
1895 this.write(iterator.current); 1795 this.write(iterator.current);
1896 } 1796 }
1897 } 1797 }
1898 } 1798 }
1899 writeln(obj) { 1799 writeln(obj) {
1900 if (obj === void 0) 1800 if (obj === void 0) obj = "";
1901 obj = "";
1902 this.write(obj); 1801 this.write(obj);
1903 this.write("\n"); 1802 this.write("\n");
1904 } 1803 }
1905 clear() { 1804 clear() {
1906 this[_contents] = ""; 1805 this[_contents] = "";
1907 } 1806 }
1908 toString() { 1807 toString() {
1909 return _js_helper.Primitives.flattenString(this[_contents]); 1808 return _js_helper.Primitives.flattenString(this[_contents]);
1910 } 1809 }
1911 [_writeString](str) { 1810 [_writeString](str) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 const _pathSegments = dart.JsSymbol('_pathSegments'); 1843 const _pathSegments = dart.JsSymbol('_pathSegments');
1945 const _queryParameters = dart.JsSymbol('_queryParameters'); 1844 const _queryParameters = dart.JsSymbol('_queryParameters');
1946 const _merge = dart.JsSymbol('_merge'); 1845 const _merge = dart.JsSymbol('_merge');
1947 const _hasDotSegments = dart.JsSymbol('_hasDotSegments'); 1846 const _hasDotSegments = dart.JsSymbol('_hasDotSegments');
1948 const _removeDotSegments = dart.JsSymbol('_removeDotSegments'); 1847 const _removeDotSegments = dart.JsSymbol('_removeDotSegments');
1949 const _toWindowsFilePath = dart.JsSymbol('_toWindowsFilePath'); 1848 const _toWindowsFilePath = dart.JsSymbol('_toWindowsFilePath');
1950 const _toFilePath = dart.JsSymbol('_toFilePath'); 1849 const _toFilePath = dart.JsSymbol('_toFilePath');
1951 const _isPathAbsolute = dart.JsSymbol('_isPathAbsolute'); 1850 const _isPathAbsolute = dart.JsSymbol('_isPathAbsolute');
1952 class Uri extends Object { 1851 class Uri extends Object {
1953 get authority() { 1852 get authority() {
1954 if (!dart.notNull(this.hasAuthority)) 1853 if (!dart.notNull(this.hasAuthority)) return "";
1955 return "";
1956 let sb = new StringBuffer(); 1854 let sb = new StringBuffer();
1957 this[_writeAuthority](sb); 1855 this[_writeAuthority](sb);
1958 return dart.toString(sb); 1856 return dart.toString(sb);
1959 } 1857 }
1960 get userInfo() { 1858 get userInfo() {
1961 return this[_userInfo]; 1859 return this[_userInfo];
1962 } 1860 }
1963 get host() { 1861 get host() {
1964 if (this[_host] == null) 1862 if (this[_host] == null) return "";
1965 return "";
1966 if (dart.notNull(this[_host][dartx.startsWith]('['))) { 1863 if (dart.notNull(this[_host][dartx.startsWith]('['))) {
1967 return this[_host][dartx.substring](1, dart.notNull(this[_host][dartx.le ngth]) - 1); 1864 return this[_host][dartx.substring](1, dart.notNull(this[_host][dartx.le ngth]) - 1);
1968 } 1865 }
1969 return this[_host]; 1866 return this[_host];
1970 } 1867 }
1971 get port() { 1868 get port() {
1972 if (this[_port] == null) 1869 if (this[_port] == null) return Uri._defaultPort(this.scheme);
1973 return Uri._defaultPort(this.scheme);
1974 return dart.asInt(this[_port]); 1870 return dart.asInt(this[_port]);
1975 } 1871 }
1976 static _defaultPort(scheme) { 1872 static _defaultPort(scheme) {
1977 if (scheme == "http") 1873 if (scheme == "http") return 80;
1978 return 80; 1874 if (scheme == "https") return 443;
1979 if (scheme == "https")
1980 return 443;
1981 return 0; 1875 return 0;
1982 } 1876 }
1983 get path() { 1877 get path() {
1984 return this[_path]; 1878 return this[_path];
1985 } 1879 }
1986 get query() { 1880 get query() {
1987 return this[_query] == null ? "" : this[_query]; 1881 return this[_query] == null ? "" : this[_query];
1988 } 1882 }
1989 get fragment() { 1883 get fragment() {
1990 return this[_fragment] == null ? "" : this[_fragment]; 1884 return this[_fragment] == null ? "" : this[_fragment];
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 char = uri[dartx.codeUnitAt](i); 1968 char = uri[dartx.codeUnitAt](i);
2075 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { 1969 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) {
2076 state = NOT_IN_PATH; 1970 state = NOT_IN_PATH;
2077 break; 1971 break;
2078 } 1972 }
2079 if (char == Uri._SLASH) { 1973 if (char == Uri._SLASH) {
2080 state = i == 0 ? ALLOW_AUTH : IN_PATH; 1974 state = i == 0 ? ALLOW_AUTH : IN_PATH;
2081 break; 1975 break;
2082 } 1976 }
2083 if (char == Uri._COLON) { 1977 if (char == Uri._COLON) {
2084 if (i == 0) 1978 if (i == 0) Uri._fail(uri, 0, "Invalid empty scheme");
2085 Uri._fail(uri, 0, "Invalid empty scheme");
2086 scheme = Uri._makeScheme(uri, i); 1979 scheme = Uri._makeScheme(uri, i);
2087 i = dart.notNull(i) + 1; 1980 i = dart.notNull(i) + 1;
2088 pathStart = i; 1981 pathStart = i;
2089 if (i == uri[dartx.length]) { 1982 if (i == uri[dartx.length]) {
2090 char = EOI; 1983 char = EOI;
2091 state = NOT_IN_PATH; 1984 state = NOT_IN_PATH;
2092 } else { 1985 } else {
2093 char = uri[dartx.codeUnitAt](i); 1986 char = uri[dartx.codeUnitAt](i);
2094 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) { 1987 if (char == Uri._QUESTION || char == Uri._NUMBER_SIGN) {
2095 state = NOT_IN_PATH; 1988 state = NOT_IN_PATH;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 let host = opts && 'host' in opts ? opts.host : null; 2066 let host = opts && 'host' in opts ? opts.host : null;
2174 let port = opts && 'port' in opts ? opts.port : null; 2067 let port = opts && 'port' in opts ? opts.port : null;
2175 let path = opts && 'path' in opts ? opts.path : null; 2068 let path = opts && 'path' in opts ? opts.path : null;
2176 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu ll; 2069 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu ll;
2177 let query = opts && 'query' in opts ? opts.query : null; 2070 let query = opts && 'query' in opts ? opts.query : null;
2178 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame ters : null; 2071 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame ters : null;
2179 let fragment = opts && 'fragment' in opts ? opts.fragment : null; 2072 let fragment = opts && 'fragment' in opts ? opts.fragment : null;
2180 scheme = Uri._makeScheme(scheme, Uri._stringOrNullLength(scheme)); 2073 scheme = Uri._makeScheme(scheme, Uri._stringOrNullLength(scheme));
2181 userInfo = Uri._makeUserInfo(userInfo, 0, Uri._stringOrNullLength(userInfo )); 2074 userInfo = Uri._makeUserInfo(userInfo, 0, Uri._stringOrNullLength(userInfo ));
2182 host = Uri._makeHost(host, 0, Uri._stringOrNullLength(host), false); 2075 host = Uri._makeHost(host, 0, Uri._stringOrNullLength(host), false);
2183 if (query == "") 2076 if (query == "") query = null;
2184 query = null;
2185 query = Uri._makeQuery(query, 0, Uri._stringOrNullLength(query), queryPara meters); 2077 query = Uri._makeQuery(query, 0, Uri._stringOrNullLength(query), queryPara meters);
2186 fragment = Uri._makeFragment(fragment, 0, Uri._stringOrNullLength(fragment )); 2078 fragment = Uri._makeFragment(fragment, 0, Uri._stringOrNullLength(fragment ));
2187 port = Uri._makePort(port, scheme); 2079 port = Uri._makePort(port, scheme);
2188 let isFile = scheme == "file"; 2080 let isFile = scheme == "file";
2189 if (host == null && (dart.notNull(userInfo[dartx.isNotEmpty]) || port != n ull || dart.notNull(isFile))) { 2081 if (host == null && (dart.notNull(userInfo[dartx.isNotEmpty]) || port != n ull || dart.notNull(isFile))) {
2190 host = ""; 2082 host = "";
2191 } 2083 }
2192 let ensureLeadingSlash = host != null; 2084 let ensureLeadingSlash = host != null;
2193 path = Uri._makePath(path, 0, Uri._stringOrNullLength(path), pathSegments, ensureLeadingSlash, isFile); 2085 path = Uri._makePath(path, 0, Uri._stringOrNullLength(path), pathSegments, ensureLeadingSlash, isFile);
2194 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt); 2086 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt);
2195 } 2087 }
2196 static http(authority, unencodedPath, queryParameters) { 2088 static http(authority, unencodedPath, queryParameters) {
2197 if (queryParameters === void 0) 2089 if (queryParameters === void 0) queryParameters = null;
2198 queryParameters = null;
2199 return Uri._makeHttpUri("http", authority, unencodedPath, queryParameters) ; 2090 return Uri._makeHttpUri("http", authority, unencodedPath, queryParameters) ;
2200 } 2091 }
2201 static https(authority, unencodedPath, queryParameters) { 2092 static https(authority, unencodedPath, queryParameters) {
2202 if (queryParameters === void 0) 2093 if (queryParameters === void 0) queryParameters = null;
2203 queryParameters = null;
2204 return Uri._makeHttpUri("https", authority, unencodedPath, queryParameters ); 2094 return Uri._makeHttpUri("https", authority, unencodedPath, queryParameters );
2205 } 2095 }
2206 static _makeHttpUri(scheme, authority, unencodedPath, queryParameters) { 2096 static _makeHttpUri(scheme, authority, unencodedPath, queryParameters) {
2207 let userInfo = ""; 2097 let userInfo = "";
2208 let host = null; 2098 let host = null;
2209 let port = null; 2099 let port = null;
2210 if (authority != null && dart.notNull(authority[dartx.isNotEmpty])) { 2100 if (authority != null && dart.notNull(authority[dartx.isNotEmpty])) {
2211 let hostStart = 0; 2101 let hostStart = 0;
2212 let hasUserInfo = false; 2102 let hasUserInfo = false;
2213 for (let i = 0; dart.notNull(i) < dart.notNull(authority[dartx.length]); i = dart.notNull(i) + 1) { 2103 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) { 2104 if (authority[dartx.codeUnitAt](i) == Uri._AT_SIGN) {
2215 hasUserInfo = true; 2105 hasUserInfo = true;
2216 userInfo = authority[dartx.substring](0, i); 2106 userInfo = authority[dartx.substring](0, i);
2217 hostStart = dart.notNull(i) + 1; 2107 hostStart = dart.notNull(i) + 1;
2218 break; 2108 break;
2219 } 2109 }
2220 } 2110 }
2221 let hostEnd = hostStart; 2111 let hostEnd = hostStart;
2222 if (dart.notNull(hostStart) < dart.notNull(authority[dartx.length]) && a uthority[dartx.codeUnitAt](hostStart) == Uri._LEFT_BRACKET) { 2112 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) { 2113 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); hostEnd = dart.notNull(hostEnd) + 1) {
2224 if (authority[dartx.codeUnitAt](hostEnd) == Uri._RIGHT_BRACKET) 2114 if (authority[dartx.codeUnitAt](hostEnd) == Uri._RIGHT_BRACKET) brea k;
2225 break;
2226 } 2115 }
2227 if (hostEnd == authority[dartx.length]) { 2116 if (hostEnd == authority[dartx.length]) {
2228 dart.throw(new FormatException("Invalid IPv6 host entry.", authority , hostStart)); 2117 dart.throw(new FormatException("Invalid IPv6 host entry.", authority , hostStart));
2229 } 2118 }
2230 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); 2119 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd);
2231 hostEnd = dart.notNull(hostEnd) + 1; 2120 hostEnd = dart.notNull(hostEnd) + 1;
2232 if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt]( hostEnd) != Uri._COLON) { 2121 if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt]( hostEnd) != Uri._COLON) {
2233 dart.throw(new FormatException("Invalid end of authority", authority , hostEnd)); 2122 dart.throw(new FormatException("Invalid end of authority", authority , hostEnd));
2234 } 2123 }
2235 } 2124 }
2236 let hasPort = false; 2125 let hasPort = false;
2237 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); ho stEnd = dart.notNull(hostEnd) + 1) { 2126 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); ho stEnd = dart.notNull(hostEnd) + 1) {
2238 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) { 2127 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) {
2239 let portString = authority[dartx.substring](dart.notNull(hostEnd) + 1); 2128 let portString = authority[dartx.substring](dart.notNull(hostEnd) + 1);
2240 if (dart.notNull(portString[dartx.isNotEmpty])) 2129 if (dart.notNull(portString[dartx.isNotEmpty])) port = int.parse(por tString);
2241 port = int.parse(portString);
2242 break; 2130 break;
2243 } 2131 }
2244 } 2132 }
2245 host = authority[dartx.substring](hostStart, hostEnd); 2133 host = authority[dartx.substring](hostStart, hostEnd);
2246 } 2134 }
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}); 2135 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 } 2136 }
2249 static file(path, opts) { 2137 static file(path, opts) {
2250 let windows = opts && 'windows' in opts ? opts.windows : null; 2138 let windows = opts && 'windows' in opts ? opts.windows : null;
2251 windows = windows == null ? Uri._isWindows : windows; 2139 windows = windows == null ? Uri._isWindows : windows;
2252 return dart.notNull(windows) ? dart.as(Uri._makeWindowsFileUrl(path), Uri) : dart.as(Uri._makeFileUri(path), Uri); 2140 return dart.notNull(windows) ? dart.as(Uri._makeWindowsFileUrl(path), Uri) : dart.as(Uri._makeFileUri(path), Uri);
2253 } 2141 }
2254 static get base() { 2142 static get base() {
2255 let uri = _js_helper.Primitives.currentUri(); 2143 let uri = _js_helper.Primitives.currentUri();
2256 if (uri != null) 2144 if (uri != null) return Uri.parse(uri);
2257 return Uri.parse(uri);
2258 dart.throw(new UnsupportedError("'Uri.base' is not supported")); 2145 dart.throw(new UnsupportedError("'Uri.base' is not supported"));
2259 } 2146 }
2260 static get _isWindows() { 2147 static get _isWindows() {
2261 return false; 2148 return false;
2262 } 2149 }
2263 static _checkNonWindowsPathReservedCharacters(segments, argumentError) { 2150 static _checkNonWindowsPathReservedCharacters(segments, argumentError) {
2264 segments[dartx.forEach](dart.fn(segment => { 2151 segments[dartx.forEach](dart.fn(segment => {
2265 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', "/"), bool))) { 2152 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', "/"), bool))) {
2266 if (dart.notNull(argumentError)) { 2153 if (dart.notNull(argumentError)) {
2267 dart.throw(new ArgumentError(`Illegal path character ${segment}`)); 2154 dart.throw(new ArgumentError(`Illegal path character ${segment}`));
2268 } else { 2155 } else {
2269 dart.throw(new UnsupportedError(`Illegal path character ${segment}`) ); 2156 dart.throw(new UnsupportedError(`Illegal path character ${segment}`) );
2270 } 2157 }
2271 } 2158 }
2272 })); 2159 }));
2273 } 2160 }
2274 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg ment) { 2161 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg ment) {
2275 if (firstSegment === void 0) 2162 if (firstSegment === void 0) firstSegment = 0;
2276 firstSegment = 0;
2277 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => { 2163 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => {
2278 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', RegExp.new('["* /:<>?\\\\|]')), bool))) { 2164 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', RegExp.new('["* /:<>?\\\\|]')), bool))) {
2279 if (dart.notNull(argumentError)) { 2165 if (dart.notNull(argumentError)) {
2280 dart.throw(new ArgumentError("Illegal character in path")); 2166 dart.throw(new ArgumentError("Illegal character in path"));
2281 } else { 2167 } else {
2282 dart.throw(new UnsupportedError("Illegal character in path")); 2168 dart.throw(new UnsupportedError("Illegal character in path"));
2283 } 2169 }
2284 } 2170 }
2285 })); 2171 }));
2286 } 2172 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 } 2296 }
2411 return this[_pathSegments]; 2297 return this[_pathSegments];
2412 } 2298 }
2413 get queryParameters() { 2299 get queryParameters() {
2414 if (this[_queryParameters] == null) { 2300 if (this[_queryParameters] == null) {
2415 this[_queryParameters] = new (collection.UnmodifiableMapView$(String, St ring))(Uri.splitQueryString(this.query)); 2301 this[_queryParameters] = new (collection.UnmodifiableMapView$(String, St ring))(Uri.splitQueryString(this.query));
2416 } 2302 }
2417 return this[_queryParameters]; 2303 return this[_queryParameters];
2418 } 2304 }
2419 static _makePort(port, scheme) { 2305 static _makePort(port, scheme) {
2420 if (port != null && port == Uri._defaultPort(scheme)) 2306 if (port != null && port == Uri._defaultPort(scheme)) return null;
2421 return null;
2422 return port; 2307 return port;
2423 } 2308 }
2424 static _makeHost(host, start, end, strictIPv6) { 2309 static _makeHost(host, start, end, strictIPv6) {
2425 if (host == null) 2310 if (host == null) return null;
2426 return null; 2311 if (start == end) return "";
2427 if (start == end)
2428 return "";
2429 if (host[dartx.codeUnitAt](start) == Uri._LEFT_BRACKET) { 2312 if (host[dartx.codeUnitAt](start) == Uri._LEFT_BRACKET) {
2430 if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != Uri._RIGHT_BRACKET) { 2313 if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != Uri._RIGHT_BRACKET) {
2431 Uri._fail(host, start, 'Missing end `]` to match `[` in host'); 2314 Uri._fail(host, start, 'Missing end `]` to match `[` in host');
2432 } 2315 }
2433 Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1); 2316 Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
2434 return host[dartx.substring](start, end)[dartx.toLowerCase](); 2317 return host[dartx.substring](start, end)[dartx.toLowerCase]();
2435 } 2318 }
2436 if (!dart.notNull(strictIPv6)) { 2319 if (!dart.notNull(strictIPv6)) {
2437 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 2320 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
2438 if (host[dartx.codeUnitAt](i) == Uri._COLON) { 2321 if (host[dartx.codeUnitAt](i) == Uri._COLON) {
(...skipping 13 matching lines...) Expand all
2452 let index = start; 2335 let index = start;
2453 let isNormalized = true; 2336 let isNormalized = true;
2454 while (dart.notNull(index) < dart.notNull(end)) { 2337 while (dart.notNull(index) < dart.notNull(end)) {
2455 let char = host[dartx.codeUnitAt](index); 2338 let char = host[dartx.codeUnitAt](index);
2456 if (char == Uri._PERCENT) { 2339 if (char == Uri._PERCENT) {
2457 let replacement = Uri._normalizeEscape(host, index, true); 2340 let replacement = Uri._normalizeEscape(host, index, true);
2458 if (replacement == null && dart.notNull(isNormalized)) { 2341 if (replacement == null && dart.notNull(isNormalized)) {
2459 index = dart.notNull(index) + 3; 2342 index = dart.notNull(index) + 3;
2460 continue; 2343 continue;
2461 } 2344 }
2462 if (buffer == null) 2345 if (buffer == null) buffer = new StringBuffer();
2463 buffer = new StringBuffer();
2464 let slice = host[dartx.substring](sectionStart, index); 2346 let slice = host[dartx.substring](sectionStart, index);
2465 if (!dart.notNull(isNormalized)) 2347 if (!dart.notNull(isNormalized)) slice = slice[dartx.toLowerCase]();
2466 slice = slice[dartx.toLowerCase]();
2467 buffer.write(slice); 2348 buffer.write(slice);
2468 let sourceLength = 3; 2349 let sourceLength = 3;
2469 if (replacement == null) { 2350 if (replacement == null) {
2470 replacement = host[dartx.substring](index, dart.notNull(index) + 3); 2351 replacement = host[dartx.substring](index, dart.notNull(index) + 3);
2471 } else if (replacement == "%") { 2352 } else if (replacement == "%") {
2472 replacement = "%25"; 2353 replacement = "%25";
2473 sourceLength = 1; 2354 sourceLength = 1;
2474 } 2355 }
2475 buffer.write(replacement); 2356 buffer.write(replacement);
2476 index = dart.notNull(index) + dart.notNull(sourceLength); 2357 index = dart.notNull(index) + dart.notNull(sourceLength);
2477 sectionStart = index; 2358 sectionStart = index;
2478 isNormalized = true; 2359 isNormalized = true;
2479 } else if (dart.notNull(Uri._isRegNameChar(char))) { 2360 } 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)) { 2361 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) 2362 if (buffer == null) buffer = new StringBuffer();
2482 buffer = new StringBuffer();
2483 if (dart.notNull(sectionStart) < dart.notNull(index)) { 2363 if (dart.notNull(sectionStart) < dart.notNull(index)) {
2484 buffer.write(host[dartx.substring](sectionStart, index)); 2364 buffer.write(host[dartx.substring](sectionStart, index));
2485 sectionStart = index; 2365 sectionStart = index;
2486 } 2366 }
2487 isNormalized = false; 2367 isNormalized = false;
2488 } 2368 }
2489 index = dart.notNull(index) + 1; 2369 index = dart.notNull(index) + 1;
2490 } else if (dart.notNull(Uri._isGeneralDelimiter(char))) { 2370 } else if (dart.notNull(Uri._isGeneralDelimiter(char))) {
2491 Uri._fail(host, index, "Invalid character"); 2371 Uri._fail(host, index, "Invalid character");
2492 } else { 2372 } else {
2493 let sourceLength = 1; 2373 let sourceLength = 1;
2494 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) { 2374 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
2495 let tail = host[dartx.codeUnitAt](dart.notNull(index) + 1); 2375 let tail = host[dartx.codeUnitAt](dart.notNull(index) + 1);
2496 if ((dart.notNull(tail) & 64512) == 56320) { 2376 if ((dart.notNull(tail) & 64512) == 56320) {
2497 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta il) & 1023; 2377 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta il) & 1023;
2498 sourceLength = 2; 2378 sourceLength = 2;
2499 } 2379 }
2500 } 2380 }
2501 if (buffer == null) 2381 if (buffer == null) buffer = new StringBuffer();
2502 buffer = new StringBuffer();
2503 let slice = host[dartx.substring](sectionStart, index); 2382 let slice = host[dartx.substring](sectionStart, index);
2504 if (!dart.notNull(isNormalized)) 2383 if (!dart.notNull(isNormalized)) slice = slice[dartx.toLowerCase]();
2505 slice = slice[dartx.toLowerCase]();
2506 buffer.write(slice); 2384 buffer.write(slice);
2507 buffer.write(Uri._escapeChar(char)); 2385 buffer.write(Uri._escapeChar(char));
2508 index = dart.notNull(index) + dart.notNull(sourceLength); 2386 index = dart.notNull(index) + dart.notNull(sourceLength);
2509 sectionStart = index; 2387 sectionStart = index;
2510 } 2388 }
2511 } 2389 }
2512 if (buffer == null) 2390 if (buffer == null) return host[dartx.substring](start, end);
2513 return host[dartx.substring](start, end);
2514 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2391 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2515 let slice = host[dartx.substring](sectionStart, end); 2392 let slice = host[dartx.substring](sectionStart, end);
2516 if (!dart.notNull(isNormalized)) 2393 if (!dart.notNull(isNormalized)) slice = slice[dartx.toLowerCase]();
2517 slice = slice[dartx.toLowerCase]();
2518 buffer.write(slice); 2394 buffer.write(slice);
2519 } 2395 }
2520 return dart.toString(buffer); 2396 return dart.toString(buffer);
2521 } 2397 }
2522 static _makeScheme(scheme, end) { 2398 static _makeScheme(scheme, end) {
2523 if (end == 0) 2399 if (end == 0) return "";
2524 return "";
2525 let firstCodeUnit = scheme[dartx.codeUnitAt](0); 2400 let firstCodeUnit = scheme[dartx.codeUnitAt](0);
2526 if (!dart.notNull(Uri._isAlphabeticCharacter(firstCodeUnit))) { 2401 if (!dart.notNull(Uri._isAlphabeticCharacter(firstCodeUnit))) {
2527 Uri._fail(scheme, 0, "Scheme not starting with alphabetic character"); 2402 Uri._fail(scheme, 0, "Scheme not starting with alphabetic character");
2528 } 2403 }
2529 let allLowercase = dart.notNull(firstCodeUnit) >= dart.notNull(Uri._LOWER_ CASE_A); 2404 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) { 2405 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
2531 let codeUnit = scheme[dartx.codeUnitAt](i); 2406 let codeUnit = scheme[dartx.codeUnitAt](i);
2532 if (!dart.notNull(Uri._isSchemeCharacter(codeUnit))) { 2407 if (!dart.notNull(Uri._isSchemeCharacter(codeUnit))) {
2533 Uri._fail(scheme, i, "Illegal scheme character"); 2408 Uri._fail(scheme, i, "Illegal scheme character");
2534 } 2409 }
2535 if (dart.notNull(codeUnit) < dart.notNull(Uri._LOWER_CASE_A) || dart.not Null(codeUnit) > dart.notNull(Uri._LOWER_CASE_Z)) { 2410 if (dart.notNull(codeUnit) < dart.notNull(Uri._LOWER_CASE_A) || dart.not Null(codeUnit) > dart.notNull(Uri._LOWER_CASE_Z)) {
2536 allLowercase = false; 2411 allLowercase = false;
2537 } 2412 }
2538 } 2413 }
2539 scheme = scheme[dartx.substring](0, end); 2414 scheme = scheme[dartx.substring](0, end);
2540 if (!dart.notNull(allLowercase)) 2415 if (!dart.notNull(allLowercase)) scheme = scheme[dartx.toLowerCase]();
2541 scheme = scheme[dartx.toLowerCase]();
2542 return scheme; 2416 return scheme;
2543 } 2417 }
2544 static _makeUserInfo(userInfo, start, end) { 2418 static _makeUserInfo(userInfo, start, end) {
2545 if (userInfo == null) 2419 if (userInfo == null) return "";
2546 return "";
2547 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li st$(int))); 2420 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li st$(int)));
2548 } 2421 }
2549 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile) { 2422 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile) {
2550 if (path == null && pathSegments == null) 2423 if (path == null && pathSegments == null) return dart.notNull(isFile) ? "/ " : "";
2551 return dart.notNull(isFile) ? "/" : "";
2552 if (path != null && pathSegments != null) { 2424 if (path != null && pathSegments != null) {
2553 dart.throw(new ArgumentError('Both path and pathSegments specified')); 2425 dart.throw(new ArgumentError('Both path and pathSegments specified'));
2554 } 2426 }
2555 let result = null; 2427 let result = null;
2556 if (path != null) { 2428 if (path != null) {
2557 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa ble, List$(int))); 2429 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa ble, List$(int)));
2558 } else { 2430 } 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]("/"); 2431 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 } 2432 }
2561 if (dart.notNull(dart.as(dart.dload(result, 'isEmpty'), bool))) { 2433 if (dart.notNull(dart.as(dart.dload(result, 'isEmpty'), bool))) {
2562 if (dart.notNull(isFile)) 2434 if (dart.notNull(isFile)) return "/";
2563 return "/";
2564 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && ! dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH)) { 2435 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && ! dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH)) {
2565 return `/${result}`; 2436 return `/${result}`;
2566 } 2437 }
2567 return dart.as(result, String); 2438 return dart.as(result, String);
2568 } 2439 }
2569 static _makeQuery(query, start, end, queryParameters) { 2440 static _makeQuery(query, start, end, queryParameters) {
2570 if (query == null && queryParameters == null) 2441 if (query == null && queryParameters == null) return null;
2571 return null;
2572 if (query != null && queryParameters != null) { 2442 if (query != null && queryParameters != null) {
2573 dart.throw(new ArgumentError('Both query and queryParameters specified') ); 2443 dart.throw(new ArgumentError('Both query and queryParameters specified') );
2574 } 2444 }
2575 if (query != null) 2445 if (query != null) return Uri._normalize(query, start, end, dart.as(Uri._q ueryCharTable, List$(int)));
2576 return Uri._normalize(query, start, end, dart.as(Uri._queryCharTable, Li st$(int)));
2577 let result = new StringBuffer(); 2446 let result = new StringBuffer();
2578 let first = true; 2447 let first = true;
2579 queryParameters.forEach(dart.fn((key, value) => { 2448 queryParameters.forEach(dart.fn((key, value) => {
2580 if (!dart.notNull(first)) { 2449 if (!dart.notNull(first)) {
2581 result.write("&"); 2450 result.write("&");
2582 } 2451 }
2583 first = false; 2452 first = false;
2584 result.write(Uri.encodeQueryComponent(dart.as(key, String))); 2453 result.write(Uri.encodeQueryComponent(dart.as(key, String)));
2585 if (value != null && !dart.notNull(dart.as(dart.dload(value, 'isEmpty'), bool))) { 2454 if (value != null && !dart.notNull(dart.as(dart.dload(value, 'isEmpty'), bool))) {
2586 result.write("="); 2455 result.write("=");
2587 result.write(Uri.encodeQueryComponent(dart.as(value, String))); 2456 result.write(Uri.encodeQueryComponent(dart.as(value, String)));
2588 } 2457 }
2589 })); 2458 }));
2590 return dart.toString(result); 2459 return dart.toString(result);
2591 } 2460 }
2592 static _makeFragment(fragment, start, end) { 2461 static _makeFragment(fragment, start, end) {
2593 if (fragment == null) 2462 if (fragment == null) return null;
2594 return null;
2595 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L ist$(int))); 2463 return Uri._normalize(fragment, start, end, dart.as(Uri._queryCharTable, L ist$(int)));
2596 } 2464 }
2597 static _stringOrNullLength(s) { 2465 static _stringOrNullLength(s) {
2598 return s == null ? 0 : s[dartx.length]; 2466 return s == null ? 0 : s[dartx.length];
2599 } 2467 }
2600 static _isHexDigit(char) { 2468 static _isHexDigit(char) {
2601 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) 2469 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) return dart.notNull(Uri ._ZERO) <= dart.notNull(char);
2602 return dart.notNull(Uri._ZERO) <= dart.notNull(char);
2603 char = dart.notNull(char) | 32; 2470 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); 2471 return dart.notNull(Uri._LOWER_CASE_A) <= dart.notNull(char) && dart.notNu ll(Uri._LOWER_CASE_F) >= dart.notNull(char);
2605 } 2472 }
2606 static _hexValue(char) { 2473 static _hexValue(char) {
2607 dart.assert(Uri._isHexDigit(char)); 2474 dart.assert(Uri._isHexDigit(char));
2608 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) 2475 if (dart.notNull(Uri._NINE) >= dart.notNull(char)) return dart.notNull(cha r) - dart.notNull(Uri._ZERO);
2609 return dart.notNull(char) - dart.notNull(Uri._ZERO);
2610 char = dart.notNull(char) | 32; 2476 char = dart.notNull(char) | 32;
2611 return dart.notNull(char) - (dart.notNull(Uri._LOWER_CASE_A) - 10); 2477 return dart.notNull(char) - (dart.notNull(Uri._LOWER_CASE_A) - 10);
2612 } 2478 }
2613 static _normalizeEscape(source, index, lowerCase) { 2479 static _normalizeEscape(source, index, lowerCase) {
2614 dart.assert(source[dartx.codeUnitAt](index) == Uri._PERCENT); 2480 dart.assert(source[dartx.codeUnitAt](index) == Uri._PERCENT);
2615 if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) { 2481 if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) {
2616 return "%"; 2482 return "%";
2617 } 2483 }
2618 let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1); 2484 let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1);
2619 let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2); 2485 let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 if (dart.notNull(index) + 1 < dart.notNull(end)) { 2565 if (dart.notNull(index) + 1 < dart.notNull(end)) {
2700 let tail = component[dartx.codeUnitAt](dart.notNull(index) + 1); 2566 let tail = component[dartx.codeUnitAt](dart.notNull(index) + 1);
2701 if ((dart.notNull(tail) & 64512) == 56320) { 2567 if ((dart.notNull(tail) & 64512) == 56320) {
2702 sourceLength = 2; 2568 sourceLength = 2;
2703 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023; 2569 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023;
2704 } 2570 }
2705 } 2571 }
2706 } 2572 }
2707 replacement = Uri._escapeChar(char); 2573 replacement = Uri._escapeChar(char);
2708 } 2574 }
2709 if (buffer == null) 2575 if (buffer == null) buffer = new StringBuffer();
2710 buffer = new StringBuffer();
2711 buffer.write(component[dartx.substring](sectionStart, index)); 2576 buffer.write(component[dartx.substring](sectionStart, index));
2712 buffer.write(replacement); 2577 buffer.write(replacement);
2713 index = dart.notNull(index) + dart.notNull(sourceLength); 2578 index = dart.notNull(index) + dart.notNull(sourceLength);
2714 sectionStart = index; 2579 sectionStart = index;
2715 } 2580 }
2716 } 2581 }
2717 if (buffer == null) { 2582 if (buffer == null) {
2718 return component[dartx.substring](start, end); 2583 return component[dartx.substring](start, end);
2719 } 2584 }
2720 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2585 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2721 buffer.write(component[dartx.substring](sectionStart, end)); 2586 buffer.write(component[dartx.substring](sectionStart, end));
2722 } 2587 }
2723 return dart.toString(buffer); 2588 return dart.toString(buffer);
2724 } 2589 }
2725 static _isSchemeCharacter(ch) { 2590 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); 2591 return dart.notNull(ch) < 128 && !dart.equals(dart.dsend(Uri._schemeTable[ dartx.get](dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0);
2727 } 2592 }
2728 static _isGeneralDelimiter(ch) { 2593 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); 2594 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 } 2595 }
2731 get isAbsolute() { 2596 get isAbsolute() {
2732 return this.scheme != "" && this.fragment == ""; 2597 return this.scheme != "" && this.fragment == "";
2733 } 2598 }
2734 [_merge](base, reference) { 2599 [_merge](base, reference) {
2735 if (dart.notNull(base[dartx.isEmpty])) 2600 if (dart.notNull(base[dartx.isEmpty])) return `/${reference}`;
2736 return `/${reference}`;
2737 let backCount = 0; 2601 let backCount = 0;
2738 let refStart = 0; 2602 let refStart = 0;
2739 while (dart.notNull(reference[dartx.startsWith]("../", refStart))) { 2603 while (dart.notNull(reference[dartx.startsWith]("../", refStart))) {
2740 refStart = dart.notNull(refStart) + 3; 2604 refStart = dart.notNull(refStart) + 3;
2741 backCount = dart.notNull(backCount) + 1; 2605 backCount = dart.notNull(backCount) + 1;
2742 } 2606 }
2743 let baseEnd = base[dartx.lastIndexOf]('/'); 2607 let baseEnd = base[dartx.lastIndexOf]('/');
2744 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { 2608 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) {
2745 let newEnd = base[dartx.lastIndexOf]('/', dart.notNull(baseEnd) - 1); 2609 let newEnd = base[dartx.lastIndexOf]('/', dart.notNull(baseEnd) - 1);
2746 if (dart.notNull(newEnd) < 0) { 2610 if (dart.notNull(newEnd) < 0) {
2747 break; 2611 break;
2748 } 2612 }
2749 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); 2613 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)) { 2614 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; 2615 break;
2752 } 2616 }
2753 baseEnd = newEnd; 2617 baseEnd = newEnd;
2754 backCount = dart.notNull(backCount) - 1; 2618 backCount = dart.notNull(backCount) - 1;
2755 } 2619 }
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))); 2620 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 } 2621 }
2758 [_hasDotSegments](path) { 2622 [_hasDotSegments](path) {
2759 if (dart.notNull(path[dartx.length]) > 0 && path[dartx.codeUnitAt](0) == U ri._DOT) 2623 if (dart.notNull(path[dartx.length]) > 0 && path[dartx.codeUnitAt](0) == U ri._DOT) return true;
2760 return true;
2761 let index = path[dartx.indexOf]("/."); 2624 let index = path[dartx.indexOf]("/.");
2762 return index != -1; 2625 return index != -1;
2763 } 2626 }
2764 [_removeDotSegments](path) { 2627 [_removeDotSegments](path) {
2765 if (!dart.notNull(this[_hasDotSegments](path))) 2628 if (!dart.notNull(this[_hasDotSegments](path))) return path;
2766 return path;
2767 let output = dart.list([], String); 2629 let output = dart.list([], String);
2768 let appendSlash = false; 2630 let appendSlash = false;
2769 for (let segment of path[dartx.split]("/")) { 2631 for (let segment of path[dartx.split]("/")) {
2770 appendSlash = false; 2632 appendSlash = false;
2771 if (segment == "..") { 2633 if (segment == "..") {
2772 if (!dart.notNull(output[dartx.isEmpty]) && (output[dartx.length] != 1 || output[dartx.get](0) != "")) 2634 if (!dart.notNull(output[dartx.isEmpty]) && (output[dartx.length] != 1 || output[dartx.get](0) != "")) output[dartx.removeLast]();
2773 output[dartx.removeLast]();
2774 appendSlash = true; 2635 appendSlash = true;
2775 } else if ("." == segment) { 2636 } else if ("." == segment) {
2776 appendSlash = true; 2637 appendSlash = true;
2777 } else { 2638 } else {
2778 output[dartx.add](segment); 2639 output[dartx.add](segment);
2779 } 2640 }
2780 } 2641 }
2781 if (dart.notNull(appendSlash)) 2642 if (dart.notNull(appendSlash)) output[dartx.add]("");
2782 output[dartx.add]("");
2783 return output[dartx.join]("/"); 2643 return output[dartx.join]("/");
2784 } 2644 }
2785 resolve(reference) { 2645 resolve(reference) {
2786 return this.resolveUri(Uri.parse(reference)); 2646 return this.resolveUri(Uri.parse(reference));
2787 } 2647 }
2788 resolveUri(reference) { 2648 resolveUri(reference) {
2789 let targetScheme = null; 2649 let targetScheme = null;
2790 let targetUserInfo = ""; 2650 let targetUserInfo = "";
2791 let targetHost = null; 2651 let targetHost = null;
2792 let targetPort = null; 2652 let targetPort = null;
(...skipping 10 matching lines...) Expand all
2803 if (dart.notNull(reference.hasQuery)) { 2663 if (dart.notNull(reference.hasQuery)) {
2804 targetQuery = reference.query; 2664 targetQuery = reference.query;
2805 } 2665 }
2806 } else { 2666 } else {
2807 targetScheme = this.scheme; 2667 targetScheme = this.scheme;
2808 if (dart.notNull(reference.hasAuthority)) { 2668 if (dart.notNull(reference.hasAuthority)) {
2809 targetUserInfo = reference.userInfo; 2669 targetUserInfo = reference.userInfo;
2810 targetHost = reference.host; 2670 targetHost = reference.host;
2811 targetPort = Uri._makePort(dart.notNull(reference.hasPort) ? reference .port : null, targetScheme); 2671 targetPort = Uri._makePort(dart.notNull(reference.hasPort) ? reference .port : null, targetScheme);
2812 targetPath = this[_removeDotSegments](reference.path); 2672 targetPath = this[_removeDotSegments](reference.path);
2813 if (dart.notNull(reference.hasQuery)) 2673 if (dart.notNull(reference.hasQuery)) targetQuery = reference.query;
2814 targetQuery = reference.query;
2815 } else { 2674 } else {
2816 if (reference.path == "") { 2675 if (reference.path == "") {
2817 targetPath = this[_path]; 2676 targetPath = this[_path];
2818 if (dart.notNull(reference.hasQuery)) { 2677 if (dart.notNull(reference.hasQuery)) {
2819 targetQuery = reference.query; 2678 targetQuery = reference.query;
2820 } else { 2679 } else {
2821 targetQuery = this[_query]; 2680 targetQuery = this[_query];
2822 } 2681 }
2823 } else { 2682 } else {
2824 if (dart.notNull(reference.path[dartx.startsWith]("/"))) { 2683 if (dart.notNull(reference.path[dartx.startsWith]("/"))) {
2825 targetPath = this[_removeDotSegments](reference.path); 2684 targetPath = this[_removeDotSegments](reference.path);
2826 } else { 2685 } else {
2827 targetPath = this[_removeDotSegments](this[_merge](this[_path], re ference.path)); 2686 targetPath = this[_removeDotSegments](this[_merge](this[_path], re ference.path));
2828 } 2687 }
2829 if (dart.notNull(reference.hasQuery)) 2688 if (dart.notNull(reference.hasQuery)) targetQuery = reference.query;
2830 targetQuery = reference.query;
2831 } 2689 }
2832 targetUserInfo = this[_userInfo]; 2690 targetUserInfo = this[_userInfo];
2833 targetHost = this[_host]; 2691 targetHost = this[_host];
2834 targetPort = dart.asInt(this[_port]); 2692 targetPort = dart.asInt(this[_port]);
2835 } 2693 }
2836 } 2694 }
2837 let fragment = dart.notNull(reference.hasFragment) ? reference.fragment : null; 2695 let fragment = dart.notNull(reference.hasFragment) ? reference.fragment : null;
2838 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP ort, targetPath, targetQuery, fragment); 2696 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP ort, targetPath, targetQuery, fragment);
2839 } 2697 }
2840 get hasAuthority() { 2698 get hasAuthority() {
2841 return this[_host] != null; 2699 return this[_host] != null;
2842 } 2700 }
2843 get hasPort() { 2701 get hasPort() {
2844 return this[_port] != null; 2702 return this[_port] != null;
2845 } 2703 }
2846 get hasQuery() { 2704 get hasQuery() {
2847 return this[_query] != null; 2705 return this[_query] != null;
2848 } 2706 }
2849 get hasFragment() { 2707 get hasFragment() {
2850 return this[_fragment] != null; 2708 return this[_fragment] != null;
2851 } 2709 }
2852 get origin() { 2710 get origin() {
2853 if (this.scheme == "" || this[_host] == null || this[_host] == "") { 2711 if (this.scheme == "" || this[_host] == null || this[_host] == "") {
2854 dart.throw(new StateError(`Cannot use origin without a scheme: ${this}`) ); 2712 dart.throw(new StateError(`Cannot use origin without a scheme: ${this}`) );
2855 } 2713 }
2856 if (this.scheme != "http" && this.scheme != "https") { 2714 if (this.scheme != "http" && this.scheme != "https") {
2857 dart.throw(new StateError(`Origin is only applicable schemes http and ht tps: ${this}`)); 2715 dart.throw(new StateError(`Origin is only applicable schemes http and ht tps: ${this}`));
2858 } 2716 }
2859 if (this[_port] == null) 2717 if (this[_port] == null) return `${this.scheme}://${this[_host]}`;
2860 return `${this.scheme}://${this[_host]}`;
2861 return `${this.scheme}://${this[_host]}:${this[_port]}`; 2718 return `${this.scheme}://${this[_host]}:${this[_port]}`;
2862 } 2719 }
2863 toFilePath(opts) { 2720 toFilePath(opts) {
2864 let windows = opts && 'windows' in opts ? opts.windows : null; 2721 let windows = opts && 'windows' in opts ? opts.windows : null;
2865 if (this.scheme != "" && this.scheme != "file") { 2722 if (this.scheme != "" && this.scheme != "file") {
2866 dart.throw(new UnsupportedError(`Cannot extract a file path from a ${thi s.scheme} URI`)); 2723 dart.throw(new UnsupportedError(`Cannot extract a file path from a ${thi s.scheme} URI`));
2867 } 2724 }
2868 if (this.query != "") { 2725 if (this.query != "") {
2869 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w ith a query component")); 2726 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w ith a query component"));
2870 } 2727 }
2871 if (this.fragment != "") { 2728 if (this.fragment != "") {
2872 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w ith a fragment component")); 2729 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w ith a fragment component"));
2873 } 2730 }
2874 if (windows == null) 2731 if (windows == null) windows = Uri._isWindows;
2875 windows = Uri._isWindows;
2876 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa th](); 2732 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa th]();
2877 } 2733 }
2878 [_toFilePath]() { 2734 [_toFilePath]() {
2879 if (this.host != "") { 2735 if (this.host != "") {
2880 dart.throw(new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority")); 2736 dart.throw(new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
2881 } 2737 }
2882 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false); 2738 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
2883 let result = new StringBuffer(); 2739 let result = new StringBuffer();
2884 if (dart.notNull(this[_isPathAbsolute])) 2740 if (dart.notNull(this[_isPathAbsolute])) result.write("/");
2885 result.write("/");
2886 result.writeAll(this.pathSegments, "/"); 2741 result.writeAll(this.pathSegments, "/");
2887 return dart.toString(result); 2742 return dart.toString(result);
2888 } 2743 }
2889 [_toWindowsFilePath]() { 2744 [_toWindowsFilePath]() {
2890 let hasDriveLetter = false; 2745 let hasDriveLetter = false;
2891 let segments = this.pathSegments; 2746 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) { 2747 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); 2748 Uri._checkWindowsDriveLetter(segments[dartx.get](0)[dartx.codeUnitAt](0) , false);
2894 Uri._checkWindowsPathReservedCharacters(segments, false, 1); 2749 Uri._checkWindowsPathReservedCharacters(segments, false, 1);
2895 hasDriveLetter = true; 2750 hasDriveLetter = true;
2896 } else { 2751 } else {
2897 Uri._checkWindowsPathReservedCharacters(segments, false); 2752 Uri._checkWindowsPathReservedCharacters(segments, false);
2898 } 2753 }
2899 let result = new StringBuffer(); 2754 let result = new StringBuffer();
2900 if (dart.notNull(this[_isPathAbsolute]) && !dart.notNull(hasDriveLetter)) 2755 if (dart.notNull(this[_isPathAbsolute]) && !dart.notNull(hasDriveLetter)) result.write("\\");
2901 result.write("\\");
2902 if (this.host != "") { 2756 if (this.host != "") {
2903 result.write("\\"); 2757 result.write("\\");
2904 result.write(this.host); 2758 result.write(this.host);
2905 result.write("\\"); 2759 result.write("\\");
2906 } 2760 }
2907 result.writeAll(segments, "\\"); 2761 result.writeAll(segments, "\\");
2908 if (dart.notNull(hasDriveLetter) && segments[dartx.length] == 1) 2762 if (dart.notNull(hasDriveLetter) && segments[dartx.length] == 1) result.wr ite("\\");
2909 result.write("\\");
2910 return dart.toString(result); 2763 return dart.toString(result);
2911 } 2764 }
2912 get [_isPathAbsolute]() { 2765 get [_isPathAbsolute]() {
2913 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) 2766 if (this.path == null || dart.notNull(this.path[dartx.isEmpty])) return fa lse;
2914 return false;
2915 return this.path[dartx.startsWith]('/'); 2767 return this.path[dartx.startsWith]('/');
2916 } 2768 }
2917 [_writeAuthority](ss) { 2769 [_writeAuthority](ss) {
2918 if (dart.notNull(this[_userInfo][dartx.isNotEmpty])) { 2770 if (dart.notNull(this[_userInfo][dartx.isNotEmpty])) {
2919 ss.write(this[_userInfo]); 2771 ss.write(this[_userInfo]);
2920 ss.write("@"); 2772 ss.write("@");
2921 } 2773 }
2922 if (this[_host] != null) 2774 if (this[_host] != null) ss.write(this[_host]);
2923 ss.write(this[_host]);
2924 if (this[_port] != null) { 2775 if (this[_port] != null) {
2925 ss.write(":"); 2776 ss.write(":");
2926 ss.write(this[_port]); 2777 ss.write(this[_port]);
2927 } 2778 }
2928 } 2779 }
2929 toString() { 2780 toString() {
2930 let sb = new StringBuffer(); 2781 let sb = new StringBuffer();
2931 Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':'); 2782 Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':');
2932 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path[dartx.starts With]("//")) || this.scheme == "file") { 2783 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path[dartx.starts With]("//")) || this.scheme == "file") {
2933 sb.write("//"); 2784 sb.write("//");
2934 this[_writeAuthority](sb); 2785 this[_writeAuthority](sb);
2935 } 2786 }
2936 sb.write(this.path); 2787 sb.write(this.path);
2937 if (this[_query] != null) { 2788 if (this[_query] != null) {
2938 sb.write("?"); 2789 sb.write("?");
2939 sb.write(this[_query]); 2790 sb.write(this[_query]);
2940 } 2791 }
2941 if (this[_fragment] != null) { 2792 if (this[_fragment] != null) {
2942 sb.write("#"); 2793 sb.write("#");
2943 sb.write(this[_fragment]); 2794 sb.write(this[_fragment]);
2944 } 2795 }
2945 return dart.toString(sb); 2796 return dart.toString(sb);
2946 } 2797 }
2947 ['=='](other) { 2798 ['=='](other) {
2948 if (!dart.is(other, Uri)) 2799 if (!dart.is(other, Uri)) return false;
2949 return false;
2950 let uri = dart.as(other, Uri); 2800 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; 2801 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 } 2802 }
2953 get hashCode() { 2803 get hashCode() {
2954 function combine(part, current) { 2804 function combine(part, current) {
2955 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823), int); 2805 return dart.as(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823), int);
2956 } 2806 }
2957 dart.fn(combine, int, [dart.dynamic, dart.dynamic]); 2807 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)) ))))); 2808 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 } 2809 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 } 2860 }
3011 return dart.as(bytes[dartx.map](dart.fn(byteString => { 2861 return dart.as(bytes[dartx.map](dart.fn(byteString => {
3012 let byte = int.parse(dart.as(byteString, String)); 2862 let byte = int.parse(dart.as(byteString, String));
3013 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) { 2863 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
3014 error('each part must be in the range of `0..255`'); 2864 error('each part must be in the range of `0..255`');
3015 } 2865 }
3016 return byte; 2866 return byte;
3017 }))[dartx.toList](), List$(int)); 2867 }))[dartx.toList](), List$(int));
3018 } 2868 }
3019 static parseIPv6Address(host, start, end) { 2869 static parseIPv6Address(host, start, end) {
3020 if (start === void 0) 2870 if (start === void 0) start = 0;
3021 start = 0; 2871 if (end === void 0) end = null;
3022 if (end === void 0) 2872 if (end == null) end = host[dartx.length];
3023 end = null;
3024 if (end == null)
3025 end = host[dartx.length];
3026 function error(msg, position) { 2873 function error(msg, position) {
3027 if (position === void 0) 2874 if (position === void 0) position = null;
3028 position = null;
3029 dart.throw(new FormatException(`Illegal IPv6 address, ${msg}`, host, dar t.as(position, int))); 2875 dart.throw(new FormatException(`Illegal IPv6 address, ${msg}`, host, dar t.as(position, int)));
3030 } 2876 }
3031 dart.fn(error, dart.void, [String], [dart.dynamic]); 2877 dart.fn(error, dart.void, [String], [dart.dynamic]);
3032 function parseHex(start, end) { 2878 function parseHex(start, end) {
3033 if (dart.notNull(end) - dart.notNull(start) > 4) { 2879 if (dart.notNull(end) - dart.notNull(start) > 4) {
3034 error('an IPv6 part can only contain a maximum of 4 hex digits', start ); 2880 error('an IPv6 part can only contain a maximum of 4 hex digits', start );
3035 } 2881 }
3036 let value = int.parse(host[dartx.substring](start, end), {radix: 16}); 2882 let value = int.parse(host[dartx.substring](start, end), {radix: 16});
3037 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) { 2883 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
3038 error('each part must be in the range of `0x0..0xFFFF`', start); 2884 error('each part must be in the range of `0x0..0xFFFF`', start);
3039 } 2885 }
3040 return value; 2886 return value;
3041 } 2887 }
3042 dart.fn(parseHex, int, [int, int]); 2888 dart.fn(parseHex, int, [int, int]);
3043 if (dart.notNull(host[dartx.length]) < 2) 2889 if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
3044 error('address is too short');
3045 let parts = dart.list([], int); 2890 let parts = dart.list([], int);
3046 let wildcardSeen = false; 2891 let wildcardSeen = false;
3047 let partStart = start; 2892 let partStart = start;
3048 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 2893 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
3049 if (host[dartx.codeUnitAt](i) == Uri._COLON) { 2894 if (host[dartx.codeUnitAt](i) == Uri._COLON) {
3050 if (i == start) { 2895 if (i == start) {
3051 i = dart.notNull(i) + 1; 2896 i = dart.notNull(i) + 1;
3052 if (host[dartx.codeUnitAt](i) != Uri._COLON) { 2897 if (host[dartx.codeUnitAt](i) != Uri._COLON) {
3053 error('invalid start colon.', i); 2898 error('invalid start colon.', i);
3054 } 2899 }
3055 partStart = i; 2900 partStart = i;
3056 } 2901 }
3057 if (i == partStart) { 2902 if (i == partStart) {
3058 if (dart.notNull(wildcardSeen)) { 2903 if (dart.notNull(wildcardSeen)) {
3059 error('only one wildcard `::` is allowed', i); 2904 error('only one wildcard `::` is allowed', i);
3060 } 2905 }
3061 wildcardSeen = true; 2906 wildcardSeen = true;
3062 parts[dartx.add](-1); 2907 parts[dartx.add](-1);
3063 } else { 2908 } else {
3064 parts[dartx.add](parseHex(partStart, i)); 2909 parts[dartx.add](parseHex(partStart, i));
3065 } 2910 }
3066 partStart = dart.notNull(i) + 1; 2911 partStart = dart.notNull(i) + 1;
3067 } 2912 }
3068 } 2913 }
3069 if (parts[dartx.length] == 0) 2914 if (parts[dartx.length] == 0) error('too few parts');
3070 error('too few parts');
3071 let atEnd = partStart == end; 2915 let atEnd = partStart == end;
3072 let isLastWildcard = parts[dartx.last] == -1; 2916 let isLastWildcard = parts[dartx.last] == -1;
3073 if (dart.notNull(atEnd) && !dart.notNull(isLastWildcard)) { 2917 if (dart.notNull(atEnd) && !dart.notNull(isLastWildcard)) {
3074 error('expected a part after last `:`', end); 2918 error('expected a part after last `:`', end);
3075 } 2919 }
3076 if (!dart.notNull(atEnd)) { 2920 if (!dart.notNull(atEnd)) {
3077 try { 2921 try {
3078 parts[dartx.add](parseHex(partStart, end)); 2922 parts[dartx.add](parseHex(partStart, end));
3079 } catch (e) { 2923 } catch (e) {
3080 try { 2924 try {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
3366 exports.StackTrace = StackTrace; 3210 exports.StackTrace = StackTrace;
3367 exports.Stopwatch = Stopwatch; 3211 exports.Stopwatch = Stopwatch;
3368 exports.String = String; 3212 exports.String = String;
3369 exports.RuneIterator = RuneIterator; 3213 exports.RuneIterator = RuneIterator;
3370 exports.StringBuffer = StringBuffer; 3214 exports.StringBuffer = StringBuffer;
3371 exports.StringSink = StringSink; 3215 exports.StringSink = StringSink;
3372 exports.Symbol = Symbol; 3216 exports.Symbol = Symbol;
3373 exports.Type = Type; 3217 exports.Type = Type;
3374 exports.Uri = Uri; 3218 exports.Uri = Uri;
3375 }); 3219 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/html.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698