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

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

Issue 1047023002: use == and != to enable handling null/undefined (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var core; 1 var core;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class Object { 4 class Object {
5 constructor() { 5 constructor() {
6 var name = this.constructor.name; 6 var name = this.constructor.name;
7 var init = this[name]; 7 var init = this[name];
8 var result = void 0; 8 var result = void 0;
9 if (init) 9 if (init)
10 result = init.apply(this, arguments); 10 result = init.apply(this, arguments);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (millisecond === void 0) 102 if (millisecond === void 0)
103 millisecond = 0; 103 millisecond = 0;
104 this[_internal$](year, month, day, hour, minute, second, millisecond, true ); 104 this[_internal$](year, month, day, hour, minute, second, millisecond, true );
105 } 105 }
106 now() { 106 now() {
107 this[_now](); 107 this[_now]();
108 } 108 }
109 static parse(formattedString) { 109 static parse(formattedString) {
110 let re = new RegExp('^([+-]?\\d{4,6})-?(\\d\\d)-?(\\d\\d)' + '(?:[ T](\\d\ \d)(?::?(\\d\\d)(?::?(\\d\\d)(.\\d{1,6})?)?)?' + '( ?[zZ]| ?([-+])(\\d\\d)(?::?( \\d\\d))?)?)?$'); 110 let re = new RegExp('^([+-]?\\d{4,6})-?(\\d\\d)-?(\\d\\d)' + '(?:[ T](\\d\ \d)(?::?(\\d\\d)(?::?(\\d\\d)(.\\d{1,6})?)?)?' + '( ?[zZ]| ?([-+])(\\d\\d)(?::?( \\d\\d))?)?)?$');
111 let match = re.firstMatch(formattedString); 111 let match = re.firstMatch(formattedString);
112 if (match !== null) { 112 if (match != null) {
113 // Function parseIntOrZero: (String) → int 113 // Function parseIntOrZero: (String) → int
114 function parseIntOrZero(matched) { 114 function parseIntOrZero(matched) {
115 if (matched === null) 115 if (matched == null)
116 return 0; 116 return 0;
117 return int.parse(matched); 117 return int.parse(matched);
118 } 118 }
119 // Function parseDoubleOrZero: (String) → double 119 // Function parseDoubleOrZero: (String) → double
120 function parseDoubleOrZero(matched) { 120 function parseDoubleOrZero(matched) {
121 if (matched === null) 121 if (matched == null)
122 return 0.0; 122 return 0.0;
123 return double.parse(matched); 123 return double.parse(matched);
124 } 124 }
125 let years = int.parse(match.get(1)); 125 let years = int.parse(match.get(1));
126 let month = int.parse(match.get(2)); 126 let month = int.parse(match.get(2));
127 let day = int.parse(match.get(3)); 127 let day = int.parse(match.get(3));
128 let hour = parseIntOrZero(match.get(4)); 128 let hour = parseIntOrZero(match.get(4));
129 let minute = parseIntOrZero(match.get(5)); 129 let minute = parseIntOrZero(match.get(5));
130 let second = parseIntOrZero(match.get(6)); 130 let second = parseIntOrZero(match.get(6));
131 let addOneMillisecond = false; 131 let addOneMillisecond = false;
132 let millisecond = (dart.notNull(parseDoubleOrZero(match.get(7))) * 1000) .round(); 132 let millisecond = (dart.notNull(parseDoubleOrZero(match.get(7))) * 1000) .round();
133 if (millisecond === 1000) { 133 if (millisecond == 1000) {
134 addOneMillisecond = true; 134 addOneMillisecond = true;
135 millisecond = 999; 135 millisecond = 999;
136 } 136 }
137 let isUtc = false; 137 let isUtc = false;
138 if (match.get(8) !== null) { 138 if (match.get(8) != null) {
139 isUtc = true; 139 isUtc = true;
140 if (match.get(9) !== null) { 140 if (match.get(9) != null) {
141 let sign = dart.equals(match.get(9), '-') ? -1 : 1; 141 let sign = match.get(9) == '-' ? -1 : 1;
142 let hourDifference = int.parse(match.get(10)); 142 let hourDifference = int.parse(match.get(10));
143 let minuteDifference = parseIntOrZero(match.get(11)); 143 let minuteDifference = parseIntOrZero(match.get(11));
144 minuteDifference = 60 * dart.notNull(hourDifference); 144 minuteDifference = 60 * dart.notNull(hourDifference);
145 minute = dart.notNull(sign) * dart.notNull(minuteDifference); 145 minute = dart.notNull(sign) * dart.notNull(minuteDifference);
146 } 146 }
147 } 147 }
148 let millisecondsSinceEpoch = DateTime[_brokenDownDateToMillisecondsSince Epoch](years, month, day, hour, minute, second, millisecond, isUtc); 148 let millisecondsSinceEpoch = DateTime[_brokenDownDateToMillisecondsSince Epoch](years, month, day, hour, minute, second, millisecond, isUtc);
149 if (millisecondsSinceEpoch === null) { 149 if (millisecondsSinceEpoch == null) {
150 throw new FormatException("Time out of range", formattedString); 150 throw new FormatException("Time out of range", formattedString);
151 } 151 }
152 if (addOneMillisecond) 152 if (addOneMillisecond)
153 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1; 153 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1;
154 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc}); 154 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc});
155 } else { 155 } else {
156 throw new FormatException("Invalid date format", formattedString); 156 throw new FormatException("Invalid date format", formattedString);
157 } 157 }
158 } 158 }
159 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { 159 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) {
160 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; 160 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false;
161 this.millisecondsSinceEpoch = millisecondsSinceEpoch; 161 this.millisecondsSinceEpoch = millisecondsSinceEpoch;
162 this.isUtc = isUtc; 162 this.isUtc = isUtc;
163 if (dart.notNull(millisecondsSinceEpoch.abs()) > dart.notNull(DateTime[_MA X_MILLISECONDS_SINCE_EPOCH])) { 163 if (dart.notNull(millisecondsSinceEpoch.abs()) > dart.notNull(DateTime[_MA X_MILLISECONDS_SINCE_EPOCH])) {
164 throw new ArgumentError(millisecondsSinceEpoch); 164 throw new ArgumentError(millisecondsSinceEpoch);
165 } 165 }
166 if (isUtc === null) 166 if (isUtc == null)
167 throw new ArgumentError(isUtc); 167 throw new ArgumentError(isUtc);
168 } 168 }
169 ['=='](other) { 169 ['=='](other) {
170 if (!dart.notNull(dart.is(other, DateTime))) 170 if (!dart.notNull(dart.is(other, DateTime)))
171 return false; 171 return false;
172 return this.millisecondsSinceEpoch === dart.dload(other, 'millisecondsSinc eEpoch') && this.isUtc === dart.dload(other, 'isUtc'); 172 return dart.equals(this.millisecondsSinceEpoch, dart.dload(other, 'millise condsSinceEpoch')) && dart.equals(this.isUtc, dart.dload(other, 'isUtc'));
173 } 173 }
174 isBefore(other) { 174 isBefore(other) {
175 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch); 175 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch);
176 } 176 }
177 isAfter(other) { 177 isAfter(other) {
178 return dart.notNull(this.millisecondsSinceEpoch) > dart.notNull(other.mill isecondsSinceEpoch); 178 return dart.notNull(this.millisecondsSinceEpoch) > dart.notNull(other.mill isecondsSinceEpoch);
179 } 179 }
180 isAtSameMomentAs(other) { 180 isAtSameMomentAs(other) {
181 return this.millisecondsSinceEpoch === other.millisecondsSinceEpoch; 181 return this.millisecondsSinceEpoch == other.millisecondsSinceEpoch;
182 } 182 }
183 compareTo(other) { 183 compareTo(other) {
184 return this.millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch) ; 184 return this.millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch) ;
185 } 185 }
186 get hashCode() { 186 get hashCode() {
187 return this.millisecondsSinceEpoch; 187 return this.millisecondsSinceEpoch;
188 } 188 }
189 toLocal() { 189 toLocal() {
190 if (this.isUtc) { 190 if (this.isUtc) {
191 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false}); 191 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false});
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 onError = null; 351 onError = null;
352 let source = input.trim(); 352 let source = input.trim();
353 num[_parseError] = false; 353 num[_parseError] = false;
354 let result = int.parse(source, {onError: num[_onParseErrorInt]}); 354 let result = int.parse(source, {onError: num[_onParseErrorInt]});
355 if (!dart.notNull(num[_parseError])) 355 if (!dart.notNull(num[_parseError]))
356 return result; 356 return result;
357 num[_parseError] = false; 357 num[_parseError] = false;
358 result = double.parse(source, num[_onParseErrorDouble]); 358 result = double.parse(source, num[_onParseErrorDouble]);
359 if (!dart.notNull(num[_parseError])) 359 if (!dart.notNull(num[_parseError]))
360 return result; 360 return result;
361 if (onError === null) 361 if (onError == null)
362 throw new FormatException(input); 362 throw new FormatException(input);
363 return onError(input); 363 return onError(input);
364 } 364 }
365 static [_onParseErrorInt](_) { 365 static [_onParseErrorInt](_) {
366 num[_parseError] = true; 366 num[_parseError] = true;
367 return 0; 367 return 0;
368 } 368 }
369 static [_onParseErrorDouble](_) { 369 static [_onParseErrorDouble](_) {
370 num[_parseError] = true; 370 num[_parseError] = true;
371 return 0.0; 371 return 0.0;
(...skipping 30 matching lines...) Expand all
402 ['+'](other) { 402 ['+'](other) {
403 return new Duration[_microseconds](dart.notNull(this[_duration]) + dart.no tNull(other[_duration])); 403 return new Duration[_microseconds](dart.notNull(this[_duration]) + dart.no tNull(other[_duration]));
404 } 404 }
405 ['-'](other) { 405 ['-'](other) {
406 return new Duration[_microseconds](dart.notNull(this[_duration]) - dart.no tNull(other[_duration])); 406 return new Duration[_microseconds](dart.notNull(this[_duration]) - dart.no tNull(other[_duration]));
407 } 407 }
408 ['*'](factor) { 408 ['*'](factor) {
409 return new Duration[_microseconds]((dart.notNull(this[_duration]) * dart.n otNull(factor)).round()); 409 return new Duration[_microseconds]((dart.notNull(this[_duration]) * dart.n otNull(factor)).round());
410 } 410 }
411 ['~/'](quotient) { 411 ['~/'](quotient) {
412 if (quotient === 0) 412 if (quotient == 0)
413 throw new IntegerDivisionByZeroException(); 413 throw new IntegerDivisionByZeroException();
414 return new Duration[_microseconds]((dart.notNull(this[_duration]) / dart.n otNull(quotient)).truncate()); 414 return new Duration[_microseconds]((dart.notNull(this[_duration]) / dart.n otNull(quotient)).truncate());
415 } 415 }
416 ['<'](other) { 416 ['<'](other) {
417 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]); 417 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]);
418 } 418 }
419 ['>'](other) { 419 ['>'](other) {
420 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]); 420 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]);
421 } 421 }
422 ['<='](other) { 422 ['<='](other) {
(...skipping 16 matching lines...) Expand all
439 } 439 }
440 get inMilliseconds() { 440 get inMilliseconds() {
441 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_MILLISECOND)).truncate(); 441 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_MILLISECOND)).truncate();
442 } 442 }
443 get inMicroseconds() { 443 get inMicroseconds() {
444 return this[_duration]; 444 return this[_duration];
445 } 445 }
446 ['=='](other) { 446 ['=='](other) {
447 if (!dart.is(other, Duration)) 447 if (!dart.is(other, Duration))
448 return false; 448 return false;
449 return this[_duration] === dart.dload(other, '_duration'); 449 return dart.equals(this[_duration], dart.dload(other, '_duration'));
450 } 450 }
451 get hashCode() { 451 get hashCode() {
452 return this[_duration].hashCode; 452 return this[_duration].hashCode;
453 } 453 }
454 compareTo(other) { 454 compareTo(other) {
455 return this[_duration].compareTo(other[_duration]); 455 return this[_duration].compareTo(other[_duration]);
456 } 456 }
457 toString() { 457 toString() {
458 // Function sixDigits: (int) → String 458 // Function sixDigits: (int) → String
459 function sixDigits(n) { 459 function sixDigits(n) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n otNull(Duration.MINUTES_PER_HOUR); 509 Duration.SECONDS_PER_HOUR = dart.notNull(Duration.SECONDS_PER_MINUTE) * dart.n otNull(Duration.MINUTES_PER_HOUR);
510 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY); 510 Duration.SECONDS_PER_DAY = dart.notNull(Duration.SECONDS_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY);
511 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY); 511 Duration.MINUTES_PER_DAY = dart.notNull(Duration.MINUTES_PER_HOUR) * dart.notN ull(Duration.HOURS_PER_DAY);
512 Duration.ZERO = new Duration({seconds: 0}); 512 Duration.ZERO = new Duration({seconds: 0});
513 let _stringToSafeString = dart.JsSymbol('_stringToSafeString'); 513 let _stringToSafeString = dart.JsSymbol('_stringToSafeString');
514 let _objectToString = dart.JsSymbol('_objectToString'); 514 let _objectToString = dart.JsSymbol('_objectToString');
515 class Error extends Object { 515 class Error extends Object {
516 Error() { 516 Error() {
517 } 517 }
518 static safeToString(object) { 518 static safeToString(object) {
519 if (dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == 'b oolean') || dart.notNull(null === object)) { 519 if (dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == 'b oolean') || dart.notNull(null == object)) {
520 return object.toString(); 520 return object.toString();
521 } 521 }
522 if (typeof object == 'string') { 522 if (typeof object == 'string') {
523 return Error[_stringToSafeString](object); 523 return Error[_stringToSafeString](object);
524 } 524 }
525 return Error[_objectToString](object); 525 return Error[_objectToString](object);
526 } 526 }
527 static [_stringToSafeString](string) { 527 static [_stringToSafeString](string) {
528 return _js_helper.jsonEncodeNative(string); 528 return _js_helper.jsonEncodeNative(string);
529 } 529 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 super.Error(); 568 super.Error();
569 } 569 }
570 notNull(name) { 570 notNull(name) {
571 if (name === void 0) 571 if (name === void 0)
572 name = null; 572 name = null;
573 this.value(null, name, "Must not be null"); 573 this.value(null, name, "Must not be null");
574 } 574 }
575 toString() { 575 toString() {
576 if (!dart.notNull(this[_hasValue])) { 576 if (!dart.notNull(this[_hasValue])) {
577 let result = "Invalid arguments(s)"; 577 let result = "Invalid arguments(s)";
578 if (this.message !== null) { 578 if (this.message != null) {
579 result = `${result}: ${this.message}`; 579 result = `${result}: ${this.message}`;
580 } 580 }
581 return result; 581 return result;
582 } 582 }
583 let nameString = ""; 583 let nameString = "";
584 if (this.name !== null) { 584 if (this.name != null) {
585 nameString = ` (${this.name})`; 585 nameString = ` (${this.name})`;
586 } 586 }
587 return `${this.message}${nameString}: ${Error.safeToString(this.invalidVal ue)}`; 587 return `${this.message}${nameString}: ${Error.safeToString(this.invalidVal ue)}`;
588 } 588 }
589 } 589 }
590 dart.defineNamedConstructor(ArgumentError, 'value'); 590 dart.defineNamedConstructor(ArgumentError, 'value');
591 dart.defineNamedConstructor(ArgumentError, 'notNull'); 591 dart.defineNamedConstructor(ArgumentError, 'notNull');
592 class RangeError extends ArgumentError { 592 class RangeError extends ArgumentError {
593 RangeError(message) { 593 RangeError(message) {
594 this.start = null; 594 this.start = null;
595 this.end = null; 595 this.end = null;
596 super.ArgumentError(message); 596 super.ArgumentError(message);
597 } 597 }
598 value(value, name, message) { 598 value(value, name, message) {
599 if (name === void 0) 599 if (name === void 0)
600 name = null; 600 name = null;
601 if (message === void 0) 601 if (message === void 0)
602 message = null; 602 message = null;
603 this.start = null; 603 this.start = null;
604 this.end = null; 604 this.end = null;
605 super.value(value, name, message !== null ? message : "Value not in range" ); 605 super.value(value, name, message != null ? message : "Value not in range") ;
606 } 606 }
607 range(invalidValue, minValue, maxValue, name, message) { 607 range(invalidValue, minValue, maxValue, name, message) {
608 if (name === void 0) 608 if (name === void 0)
609 name = null; 609 name = null;
610 if (message === void 0) 610 if (message === void 0)
611 message = null; 611 message = null;
612 this.start = minValue; 612 this.start = minValue;
613 this.end = maxValue; 613 this.end = maxValue;
614 super.value(invalidValue, name, message !== null ? message : "Invalid valu e"); 614 super.value(invalidValue, name, message != null ? message : "Invalid value ");
615 } 615 }
616 index(index, indexable, name, message, length) { 616 index(index, indexable, name, message, length) {
617 return new IndexError(index, indexable, name, message, length); 617 return new IndexError(index, indexable, name, message, length);
618 } 618 }
619 static checkValueInInterval(value, minValue, maxValue, name, message) { 619 static checkValueInInterval(value, minValue, maxValue, name, message) {
620 if (name === void 0) 620 if (name === void 0)
621 name = null; 621 name = null;
622 if (message === void 0) 622 if (message === void 0)
623 message = null; 623 message = null;
624 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) { 624 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) {
625 throw new RangeError.range(value, minValue, maxValue, name, message); 625 throw new RangeError.range(value, minValue, maxValue, name, message);
626 } 626 }
627 } 627 }
628 static checkValidIndex(index, indexable, name, length, message) { 628 static checkValidIndex(index, indexable, name, length, message) {
629 if (name === void 0) 629 if (name === void 0)
630 name = null; 630 name = null;
631 if (length === void 0) 631 if (length === void 0)
632 length = null; 632 length = null;
633 if (message === void 0) 633 if (message === void 0)
634 message = null; 634 message = null;
635 if (length === null) 635 if (length == null)
636 length = dart.as(dart.dload(indexable, 'length'), int); 636 length = dart.as(dart.dload(indexable, 'length'), int);
637 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length) ) { 637 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length) ) {
638 if (name === null) 638 if (name == null)
639 name = "index"; 639 name = "index";
640 throw new RangeError.index(index, indexable, name, message, length); 640 throw new RangeError.index(index, indexable, name, message, length);
641 } 641 }
642 } 642 }
643 static checkValidRange(start, end, length, startName, endName, message) { 643 static checkValidRange(start, end, length, startName, endName, message) {
644 if (startName === void 0) 644 if (startName === void 0)
645 startName = null; 645 startName = null;
646 if (endName === void 0) 646 if (endName === void 0)
647 endName = null; 647 endName = null;
648 if (message === void 0) 648 if (message === void 0)
649 message = null; 649 message = null;
650 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) { 650 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) {
651 if (startName === null) 651 if (startName == null)
652 startName = "start"; 652 startName = "start";
653 throw new RangeError.range(start, 0, length, startName, message); 653 throw new RangeError.range(start, 0, length, startName, message);
654 } 654 }
655 if (end !== null && (dart.notNull(end) < dart.notNull(start) || dart.notNu ll(end) > dart.notNull(length))) { 655 if (end != null && (dart.notNull(end) < dart.notNull(start) || dart.notNul l(end) > dart.notNull(length))) {
656 if (endName === null) 656 if (endName == null)
657 endName = "end"; 657 endName = "end";
658 throw new RangeError.range(end, start, length, endName, message); 658 throw new RangeError.range(end, start, length, endName, message);
659 } 659 }
660 } 660 }
661 static checkNotNegative(value, name, message) { 661 static checkNotNegative(value, name, message) {
662 if (name === void 0) 662 if (name === void 0)
663 name = null; 663 name = null;
664 if (message === void 0) 664 if (message === void 0)
665 message = null; 665 message = null;
666 if (dart.notNull(value) < 0) 666 if (dart.notNull(value) < 0)
667 throw new RangeError.range(value, 0, null, name, message); 667 throw new RangeError.range(value, 0, null, name, message);
668 } 668 }
669 toString() { 669 toString() {
670 if (!dart.notNull(this[_hasValue])) 670 if (!dart.notNull(this[_hasValue]))
671 return `RangeError: ${this.message}`; 671 return `RangeError: ${this.message}`;
672 let value = Error.safeToString(this.invalidValue); 672 let value = Error.safeToString(this.invalidValue);
673 let explanation = ""; 673 let explanation = "";
674 if (this.start === null) { 674 if (this.start == null) {
675 if (this.end !== null) { 675 if (this.end != null) {
676 explanation = `: Not less than or equal to ${this.end}`; 676 explanation = `: Not less than or equal to ${this.end}`;
677 } 677 }
678 } else if (this.end === null) { 678 } else if (this.end == null) {
679 explanation = `: Not greater than or equal to ${this.start}`; 679 explanation = `: Not greater than or equal to ${this.start}`;
680 } else if (dart.notNull(this.end) > dart.notNull(this.start)) { 680 } else if (dart.notNull(this.end) > dart.notNull(this.start)) {
681 explanation = `: Not in range ${this.start}..${this.end}, inclusive.`; 681 explanation = `: Not in range ${this.start}..${this.end}, inclusive.`;
682 } else if (dart.notNull(this.end) < dart.notNull(this.start)) { 682 } else if (dart.notNull(this.end) < dart.notNull(this.start)) {
683 explanation = ": Valid value range is empty"; 683 explanation = ": Valid value range is empty";
684 } else { 684 } else {
685 explanation = `: Only valid value is ${this.start}`; 685 explanation = `: Only valid value is ${this.start}`;
686 } 686 }
687 return `RangeError: ${this.message} (${value})${explanation}`; 687 return `RangeError: ${this.message} (${value})${explanation}`;
688 } 688 }
689 } 689 }
690 dart.defineNamedConstructor(RangeError, 'value'); 690 dart.defineNamedConstructor(RangeError, 'value');
691 dart.defineNamedConstructor(RangeError, 'range'); 691 dart.defineNamedConstructor(RangeError, 'range');
692 dart.defineNamedConstructor(RangeError, 'index'); 692 dart.defineNamedConstructor(RangeError, 'index');
693 class IndexError extends ArgumentError { 693 class IndexError extends ArgumentError {
694 IndexError(invalidValue, indexable, name, message, length) { 694 IndexError(invalidValue, indexable, name, message, length) {
695 if (name === void 0) 695 if (name === void 0)
696 name = null; 696 name = null;
697 if (message === void 0) 697 if (message === void 0)
698 message = null; 698 message = null;
699 if (length === void 0) 699 if (length === void 0)
700 length = null; 700 length = null;
701 this.indexable = indexable; 701 this.indexable = indexable;
702 this.length = dart.as(length !== null ? length : dart.dload(indexable, 'le ngth'), int); 702 this.length = dart.as(length != null ? length : dart.dload(indexable, 'len gth'), int);
703 super.value(invalidValue, name, message !== null ? message : "Index out of range"); 703 super.value(invalidValue, name, message != null ? message : "Index out of range");
704 } 704 }
705 get start() { 705 get start() {
706 return 0; 706 return 0;
707 } 707 }
708 get end() { 708 get end() {
709 return dart.notNull(this.length) - 1; 709 return dart.notNull(this.length) - 1;
710 } 710 }
711 toString() { 711 toString() {
712 dart.assert(this[_hasValue]); 712 dart.assert(this[_hasValue]);
713 let target = Error.safeToString(this.indexable); 713 let target = Error.safeToString(this.indexable);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 this[_receiver] = receiver; 745 this[_receiver] = receiver;
746 this[_memberName] = memberName; 746 this[_memberName] = memberName;
747 this[_arguments] = positionalArguments; 747 this[_arguments] = positionalArguments;
748 this[_namedArguments] = namedArguments; 748 this[_namedArguments] = namedArguments;
749 this[_existingArgumentNames] = existingArgumentNames; 749 this[_existingArgumentNames] = existingArgumentNames;
750 super.Error(); 750 super.Error();
751 } 751 }
752 toString() { 752 toString() {
753 let sb = new StringBuffer(); 753 let sb = new StringBuffer();
754 let i = 0; 754 let i = 0;
755 if (this[_arguments] !== null) { 755 if (this[_arguments] != null) {
756 for (; dart.notNull(i) < dart.notNull(this[_arguments].length); i = dart .notNull(i) + 1) { 756 for (; dart.notNull(i) < dart.notNull(this[_arguments].length); i = dart .notNull(i) + 1) {
757 if (dart.notNull(i) > 0) { 757 if (dart.notNull(i) > 0) {
758 sb.write(", "); 758 sb.write(", ");
759 } 759 }
760 sb.write(Error.safeToString(this[_arguments].get(i))); 760 sb.write(Error.safeToString(this[_arguments].get(i)));
761 } 761 }
762 } 762 }
763 if (this[_namedArguments] !== null) { 763 if (this[_namedArguments] != null) {
764 this[_namedArguments].forEach(((key, value) => { 764 this[_namedArguments].forEach(((key, value) => {
765 if (dart.notNull(i) > 0) { 765 if (dart.notNull(i) > 0) {
766 sb.write(", "); 766 sb.write(", ");
767 } 767 }
768 sb.write(_symbolToString(key)); 768 sb.write(_symbolToString(key));
769 sb.write(": "); 769 sb.write(": ");
770 sb.write(Error.safeToString(value)); 770 sb.write(Error.safeToString(value));
771 i = dart.notNull(i) + 1; 771 i = dart.notNull(i) + 1;
772 }).bind(this)); 772 }).bind(this));
773 } 773 }
774 if (this[_existingArgumentNames] === null) { 774 if (this[_existingArgumentNames] == null) {
775 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`; 775 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`;
776 } else { 776 } else {
777 let actualParameters = sb.toString(); 777 let actualParameters = sb.toString();
778 sb = new StringBuffer(); 778 sb = new StringBuffer();
779 for (let i = 0; dart.notNull(i) < dart.notNull(this[_existingArgumentNam es].length); i = dart.notNull(i) + 1) { 779 for (let i = 0; dart.notNull(i) < dart.notNull(this[_existingArgumentNam es].length); i = dart.notNull(i) + 1) {
780 if (dart.notNull(i) > 0) { 780 if (dart.notNull(i) > 0) {
781 sb.write(", "); 781 sb.write(", ");
782 } 782 }
783 sb.write(this[_existingArgumentNames].get(i)); 783 sb.write(this[_existingArgumentNames].get(i));
784 } 784 }
(...skipping 12 matching lines...) Expand all
797 } 797 }
798 } 798 }
799 class UnimplementedError extends Error { 799 class UnimplementedError extends Error {
800 UnimplementedError(message) { 800 UnimplementedError(message) {
801 if (message === void 0) 801 if (message === void 0)
802 message = null; 802 message = null;
803 this.message = message; 803 this.message = message;
804 super.Error(); 804 super.Error();
805 } 805 }
806 toString() { 806 toString() {
807 return this.message !== null ? `UnimplementedError: ${this.message}` : "Un implementedError"; 807 return this.message != null ? `UnimplementedError: ${this.message}` : "Uni mplementedError";
808 } 808 }
809 } 809 }
810 class StateError extends Error { 810 class StateError extends Error {
811 StateError(message) { 811 StateError(message) {
812 this.message = message; 812 this.message = message;
813 super.Error(); 813 super.Error();
814 } 814 }
815 toString() { 815 toString() {
816 return `Bad state: ${this.message}`; 816 return `Bad state: ${this.message}`;
817 } 817 }
818 } 818 }
819 class ConcurrentModificationError extends Error { 819 class ConcurrentModificationError extends Error {
820 ConcurrentModificationError(modifiedObject) { 820 ConcurrentModificationError(modifiedObject) {
821 if (modifiedObject === void 0) 821 if (modifiedObject === void 0)
822 modifiedObject = null; 822 modifiedObject = null;
823 this.modifiedObject = modifiedObject; 823 this.modifiedObject = modifiedObject;
824 super.Error(); 824 super.Error();
825 } 825 }
826 toString() { 826 toString() {
827 if (this.modifiedObject === null) { 827 if (this.modifiedObject == null) {
828 return "Concurrent modification during iteration."; 828 return "Concurrent modification during iteration.";
829 } 829 }
830 return "Concurrent modification during iteration: " + `${Error.safeToStrin g(this.modifiedObject)}.`; 830 return "Concurrent modification during iteration: " + `${Error.safeToStrin g(this.modifiedObject)}.`;
831 } 831 }
832 } 832 }
833 class OutOfMemoryError extends Object { 833 class OutOfMemoryError extends Object {
834 OutOfMemoryError() { 834 OutOfMemoryError() {
835 } 835 }
836 toString() { 836 toString() {
837 return "Out of Memory"; 837 return "Out of Memory";
(...skipping 13 matching lines...) Expand all
851 } 851 }
852 } 852 }
853 class CyclicInitializationError extends Error { 853 class CyclicInitializationError extends Error {
854 CyclicInitializationError(variableName) { 854 CyclicInitializationError(variableName) {
855 if (variableName === void 0) 855 if (variableName === void 0)
856 variableName = null; 856 variableName = null;
857 this.variableName = variableName; 857 this.variableName = variableName;
858 super.Error(); 858 super.Error();
859 } 859 }
860 toString() { 860 toString() {
861 return this.variableName === null ? "Reading static variable during its in itialization" : `Reading static variable '${this.variableName}' during its initi alization`; 861 return this.variableName == null ? "Reading static variable during its ini tialization" : `Reading static variable '${this.variableName}' during its initia lization`;
862 } 862 }
863 } 863 }
864 class Exception extends Object { 864 class Exception extends Object {
865 Exception(message) { 865 Exception(message) {
866 if (message === void 0) 866 if (message === void 0)
867 message = null; 867 message = null;
868 return new _ExceptionImplementation(message); 868 return new _ExceptionImplementation(message);
869 } 869 }
870 } 870 }
871 class _ExceptionImplementation extends Object { 871 class _ExceptionImplementation extends Object {
872 _ExceptionImplementation(message) { 872 _ExceptionImplementation(message) {
873 if (message === void 0) 873 if (message === void 0)
874 message = null; 874 message = null;
875 this.message = message; 875 this.message = message;
876 } 876 }
877 toString() { 877 toString() {
878 if (this.message === null) 878 if (this.message == null)
879 return "Exception"; 879 return "Exception";
880 return `Exception: ${this.message}`; 880 return `Exception: ${this.message}`;
881 } 881 }
882 } 882 }
883 class FormatException extends Object { 883 class FormatException extends Object {
884 FormatException(message, source, offset) { 884 FormatException(message, source, offset) {
885 if (message === void 0) 885 if (message === void 0)
886 message = ""; 886 message = "";
887 if (source === void 0) 887 if (source === void 0)
888 source = null; 888 source = null;
889 if (offset === void 0) 889 if (offset === void 0)
890 offset = -1; 890 offset = -1;
891 this.message = message; 891 this.message = message;
892 this.source = source; 892 this.source = source;
893 this.offset = offset; 893 this.offset = offset;
894 } 894 }
895 toString() { 895 toString() {
896 let report = "FormatException"; 896 let report = "FormatException";
897 if (dart.notNull(this.message !== null) && dart.notNull(!dart.equals("", t his.message))) { 897 if (dart.notNull(this.message != null) && dart.notNull("" != this.message) ) {
898 report = `${report}: ${this.message}`; 898 report = `${report}: ${this.message}`;
899 } 899 }
900 let offset = this.offset; 900 let offset = this.offset;
901 if (!(typeof this.source == 'string')) { 901 if (!(typeof this.source == 'string')) {
902 if (offset !== -1) { 902 if (offset != -1) {
903 report = ` (at offset ${offset})`; 903 report = ` (at offset ${offset})`;
904 } 904 }
905 return report; 905 return report;
906 } 906 }
907 if (offset !== -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(t his.source, 'length')))) { 907 if (offset != -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(th is.source, 'length')))) {
908 offset = -1; 908 offset = -1;
909 } 909 }
910 if (offset === -1) { 910 if (offset == -1) {
911 let source = dart.as(this.source, String); 911 let source = dart.as(this.source, String);
912 if (dart.notNull(source.length) > 78) { 912 if (dart.notNull(source.length) > 78) {
913 source = String['+'](source.substring(0, 75), "..."); 913 source = String['+'](source.substring(0, 75), "...");
914 } 914 }
915 return `${report}\n${source}`; 915 return `${report}\n${source}`;
916 } 916 }
917 let lineNum = 1; 917 let lineNum = 1;
918 let lineStart = 0; 918 let lineStart = 0;
919 let lastWasCR = null; 919 let lastWasCR = null;
920 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i ) + 1) { 920 for (let i = 0; dart.notNull(i) < dart.notNull(offset); i = dart.notNull(i ) + 1) {
921 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 921 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
922 if (char === 10) { 922 if (char == 10) {
923 if (lineStart !== i || !dart.notNull(lastWasCR)) { 923 if (lineStart != i || !dart.notNull(lastWasCR)) {
924 lineNum = dart.notNull(lineNum) + 1; 924 lineNum = dart.notNull(lineNum) + 1;
925 } 925 }
926 lineStart = dart.notNull(i) + 1; 926 lineStart = dart.notNull(i) + 1;
927 lastWasCR = false; 927 lastWasCR = false;
928 } else if (char === 13) { 928 } else if (char == 13) {
929 lineNum = dart.notNull(lineNum) + 1; 929 lineNum = dart.notNull(lineNum) + 1;
930 lineStart = dart.notNull(i) + 1; 930 lineStart = dart.notNull(i) + 1;
931 lastWasCR = true; 931 lastWasCR = true;
932 } 932 }
933 } 933 }
934 if (dart.notNull(lineNum) > 1) { 934 if (dart.notNull(lineNum) > 1) {
935 report = ` (at line ${lineNum}, character ${dart.notNull(offset) - dart. notNull(lineStart) + 1})\n`; 935 report = ` (at line ${lineNum}, character ${dart.notNull(offset) - dart. notNull(lineStart) + 1})\n`;
936 } else { 936 } else {
937 report = ` (at character ${dart.notNull(offset) + 1})\n`; 937 report = ` (at character ${dart.notNull(offset) + 1})\n`;
938 } 938 }
939 let lineEnd = dart.as(dart.dload(this.source, 'length'), int); 939 let lineEnd = dart.as(dart.dload(this.source, 'length'), int);
940 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i = dart.n otNull(i) + 1) { 940 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i = dart.n otNull(i) + 1) {
941 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 941 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
942 if (char === 10 || char === 13) { 942 if (char == 10 || char == 13) {
943 lineEnd = i; 943 lineEnd = i;
944 break; 944 break;
945 } 945 }
946 } 946 }
947 let length = dart.notNull(lineEnd) - dart.notNull(lineStart); 947 let length = dart.notNull(lineEnd) - dart.notNull(lineStart);
948 let start = lineStart; 948 let start = lineStart;
949 let end = lineEnd; 949 let end = lineEnd;
950 let prefix = ""; 950 let prefix = "";
951 let postfix = ""; 951 let postfix = "";
952 if (dart.notNull(length) > 78) { 952 if (dart.notNull(length) > 78) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 Expando(name) { 984 Expando(name) {
985 if (name === void 0) 985 if (name === void 0)
986 name = null; 986 name = null;
987 this.name = name; 987 this.name = name;
988 } 988 }
989 toString() { 989 toString() {
990 return `Expando:${this.name}`; 990 return `Expando:${this.name}`;
991 } 991 }
992 get(object) { 992 get(object) {
993 let values = _js_helper.Primitives.getProperty(object, Expando[_EXPANDO_ PROPERTY_NAME]); 993 let values = _js_helper.Primitives.getProperty(object, Expando[_EXPANDO_ PROPERTY_NAME]);
994 return dart.as(values === null ? null : _js_helper.Primitives.getPropert y(values, this[_getKey]()), T); 994 return dart.as(values == null ? null : _js_helper.Primitives.getProperty (values, this[_getKey]()), T);
995 } 995 }
996 set(object, value) { 996 set(object, value) {
997 let values = _js_helper.Primitives.getProperty(object, Expando[_EXPANDO_ PROPERTY_NAME]); 997 let values = _js_helper.Primitives.getProperty(object, Expando[_EXPANDO_ PROPERTY_NAME]);
998 if (values === null) { 998 if (values == null) {
999 values = new Object(); 999 values = new Object();
1000 _js_helper.Primitives.setProperty(object, Expando[_EXPANDO_PROPERTY_NA ME], values); 1000 _js_helper.Primitives.setProperty(object, Expando[_EXPANDO_PROPERTY_NA ME], values);
1001 } 1001 }
1002 _js_helper.Primitives.setProperty(values, this[_getKey](), value); 1002 _js_helper.Primitives.setProperty(values, this[_getKey](), value);
1003 } 1003 }
1004 [_getKey]() { 1004 [_getKey]() {
1005 let key = dart.as(_js_helper.Primitives.getProperty(this, Expando[_KEY_P ROPERTY_NAME]), String); 1005 let key = dart.as(_js_helper.Primitives.getProperty(this, Expando[_KEY_P ROPERTY_NAME]), String);
1006 if (key === null) { 1006 if (key == null) {
1007 key = `expando$key$${((x) => Expando[_keyCount] = dart.notNull(x) + 1, x)(Expando[_keyCount])}`; 1007 key = `expando$key$${((x) => Expando[_keyCount] = dart.notNull(x) + 1, x)(Expando[_keyCount])}`;
1008 _js_helper.Primitives.setProperty(this, Expando[_KEY_PROPERTY_NAME], k ey); 1008 _js_helper.Primitives.setProperty(this, Expando[_KEY_PROPERTY_NAME], k ey);
1009 } 1009 }
1010 return key; 1010 return key;
1011 } 1011 }
1012 } 1012 }
1013 Expando._KEY_PROPERTY_NAME = 'expando$key'; 1013 Expando._KEY_PROPERTY_NAME = 'expando$key';
1014 Expando._EXPANDO_PROPERTY_NAME = 'expando$values'; 1014 Expando._EXPANDO_PROPERTY_NAME = 'expando$values';
1015 Expando._keyCount = 0; 1015 Expando._keyCount = 0;
1016 return Expando; 1016 return Expando;
1017 }); 1017 });
1018 let Expando = Expando$(dart.dynamic); 1018 let Expando = Expando$(dart.dynamic);
1019 let _toMangledNames = dart.JsSymbol('_toMangledNames'); 1019 let _toMangledNames = dart.JsSymbol('_toMangledNames');
1020 class Function extends Object { 1020 class Function extends Object {
1021 static apply(f, positionalArguments, namedArguments) { 1021 static apply(f, positionalArguments, namedArguments) {
1022 if (namedArguments === void 0) 1022 if (namedArguments === void 0)
1023 namedArguments = null; 1023 namedArguments = null;
1024 return _js_helper.Primitives.applyFunction(f, positionalArguments, namedAr guments === null ? null : Function[_toMangledNames](namedArguments)); 1024 return _js_helper.Primitives.applyFunction(f, positionalArguments, namedAr guments == null ? null : Function[_toMangledNames](namedArguments));
1025 } 1025 }
1026 static [_toMangledNames](namedArguments) { 1026 static [_toMangledNames](namedArguments) {
1027 let result = dart.as(dart.map(), Map$(String, dynamic)); 1027 let result = dart.as(dart.map(), Map$(String, dynamic));
1028 namedArguments.forEach(dart.closureWrap((symbol, value) => { 1028 namedArguments.forEach(dart.closureWrap((symbol, value) => {
1029 result.set(_symbolToString(dart.as(symbol, Symbol)), value); 1029 result.set(_symbolToString(dart.as(symbol, Symbol)), value);
1030 }, "(Symbol, dynamic) → void")); 1030 }, "(Symbol, dynamic) → void"));
1031 return result; 1031 return result;
1032 } 1032 }
1033 } 1033 }
1034 // Function identical: (Object, Object) → bool 1034 // Function identical: (Object, Object) → bool
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 let Iterable = Iterable$(dart.dynamic); 1090 let Iterable = Iterable$(dart.dynamic);
1091 let _end = dart.JsSymbol('_end'); 1091 let _end = dart.JsSymbol('_end');
1092 let _start = dart.JsSymbol('_start'); 1092 let _start = dart.JsSymbol('_start');
1093 let _generator = dart.JsSymbol('_generator'); 1093 let _generator = dart.JsSymbol('_generator');
1094 let _id = dart.JsSymbol('_id'); 1094 let _id = dart.JsSymbol('_id');
1095 let _GeneratorIterable$ = dart.generic(function(E) { 1095 let _GeneratorIterable$ = dart.generic(function(E) {
1096 class _GeneratorIterable extends collection.IterableBase$(E) { 1096 class _GeneratorIterable extends collection.IterableBase$(E) {
1097 _GeneratorIterable(end$, generator) { 1097 _GeneratorIterable(end$, generator) {
1098 this[_end] = end$; 1098 this[_end] = end$;
1099 this[_start] = 0; 1099 this[_start] = 0;
1100 this[_generator] = dart.as(generator !== null ? generator : _GeneratorIt erable[_id], _Generator); 1100 this[_generator] = dart.as(generator != null ? generator : _GeneratorIte rable[_id], _Generator);
1101 super.IterableBase(); 1101 super.IterableBase();
1102 } 1102 }
1103 slice(start$, end$, generator$) { 1103 slice(start$, end$, generator$) {
1104 this[_start] = start$; 1104 this[_start] = start$;
1105 this[_end] = end$; 1105 this[_end] = end$;
1106 this[_generator] = generator$; 1106 this[_generator] = generator$;
1107 super.IterableBase(); 1107 super.IterableBase();
1108 } 1108 }
1109 get iterator() { 1109 get iterator() {
1110 return new _GeneratorIterator(this[_start], this[_end], this[_generator] ); 1110 return new _GeneratorIterator(this[_start], this[_end], this[_generator] );
1111 } 1111 }
1112 get length() { 1112 get length() {
1113 return dart.notNull(this[_end]) - dart.notNull(this[_start]); 1113 return dart.notNull(this[_end]) - dart.notNull(this[_start]);
1114 } 1114 }
1115 skip(count) { 1115 skip(count) {
1116 RangeError.checkNotNegative(count, "count"); 1116 RangeError.checkNotNegative(count, "count");
1117 if (count === 0) 1117 if (count == 0)
1118 return this; 1118 return this;
1119 let newStart = dart.notNull(this[_start]) + dart.notNull(count); 1119 let newStart = dart.notNull(this[_start]) + dart.notNull(count);
1120 if (dart.notNull(newStart) >= dart.notNull(this[_end])) 1120 if (dart.notNull(newStart) >= dart.notNull(this[_end]))
1121 return new _internal.EmptyIterable(); 1121 return new _internal.EmptyIterable();
1122 return new _GeneratorIterable.slice(newStart, this[_end], this[_generato r]); 1122 return new _GeneratorIterable.slice(newStart, this[_end], this[_generato r]);
1123 } 1123 }
1124 take(count) { 1124 take(count) {
1125 RangeError.checkNotNegative(count, "count"); 1125 RangeError.checkNotNegative(count, "count");
1126 if (count === 0) 1126 if (count == 0)
1127 return new _internal.EmptyIterable(); 1127 return new _internal.EmptyIterable();
1128 let newEnd = dart.notNull(this[_start]) + dart.notNull(count); 1128 let newEnd = dart.notNull(this[_start]) + dart.notNull(count);
1129 if (dart.notNull(newEnd) >= dart.notNull(this[_end])) 1129 if (dart.notNull(newEnd) >= dart.notNull(this[_end]))
1130 return this; 1130 return this;
1131 return new _GeneratorIterable.slice(this[_start], newEnd, this[_generato r]); 1131 return new _GeneratorIterable.slice(this[_start], newEnd, this[_generato r]);
1132 } 1132 }
1133 static [_id](n) { 1133 static [_id](n) {
1134 return n; 1134 return n;
1135 } 1135 }
1136 } 1136 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 class Iterator extends Object { 1175 class Iterator extends Object {
1176 } 1176 }
1177 return Iterator; 1177 return Iterator;
1178 }); 1178 });
1179 let Iterator = Iterator$(dart.dynamic); 1179 let Iterator = Iterator$(dart.dynamic);
1180 let List$ = dart.generic(function(E) { 1180 let List$ = dart.generic(function(E) {
1181 class List extends Object { 1181 class List extends Object {
1182 List(length) { 1182 List(length) {
1183 if (length === void 0) 1183 if (length === void 0)
1184 length = new _ListConstructorSentinel(); 1184 length = new _ListConstructorSentinel();
1185 if (length === new _ListConstructorSentinel()) { 1185 if (dart.equals(length, new _ListConstructorSentinel())) {
1186 return new _interceptors.JSArray.emptyGrowable(); 1186 return new _interceptors.JSArray.emptyGrowable();
1187 } 1187 }
1188 return new _interceptors.JSArray.fixed(length); 1188 return new _interceptors.JSArray.fixed(length);
1189 } 1189 }
1190 filled(length, fill) { 1190 filled(length, fill) {
1191 let result = new _interceptors.JSArray.fixed(length); 1191 let result = new _interceptors.JSArray.fixed(length);
1192 if (length !== 0 && dart.notNull(fill !== null)) { 1192 if (length != 0 && dart.notNull(fill != null)) {
1193 for (let i = 0; dart.notNull(i) < dart.notNull(result.length); i = dar t.notNull(i) + 1) { 1193 for (let i = 0; dart.notNull(i) < dart.notNull(result.length); i = dar t.notNull(i) + 1) {
1194 result.set(i, fill); 1194 result.set(i, fill);
1195 } 1195 }
1196 } 1196 }
1197 return dart.as(result, List$(E)); 1197 return dart.as(result, List$(E));
1198 } 1198 }
1199 from(elements, opts) { 1199 from(elements, opts) {
1200 let growable = opts && 'growable' in opts ? opts.growable : true; 1200 let growable = opts && 'growable' in opts ? opts.growable : true;
1201 return null; 1201 return null;
1202 } 1202 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 toString() { 1256 toString() {
1257 return "null"; 1257 return "null";
1258 } 1258 }
1259 } 1259 }
1260 dart.defineNamedConstructor(Null, _uninstantiable); 1260 dart.defineNamedConstructor(Null, _uninstantiable);
1261 class Pattern extends Object { 1261 class Pattern extends Object {
1262 } 1262 }
1263 // Function print: (Object) → void 1263 // Function print: (Object) → void
1264 function print(object) { 1264 function print(object) {
1265 let line = `${object}`; 1265 let line = `${object}`;
1266 if (_internal.printToZone === null) { 1266 if (_internal.printToZone == null) {
1267 _internal.printToConsole(line); 1267 _internal.printToConsole(line);
1268 } else { 1268 } else {
1269 dart.dinvokef(_internal.printToZone, line); 1269 dart.dinvokef(_internal.printToZone, line);
1270 } 1270 }
1271 } 1271 }
1272 class Match extends Object { 1272 class Match extends Object {
1273 } 1273 }
1274 class RegExp extends Object { 1274 class RegExp extends Object {
1275 RegExp(source, opts) { 1275 RegExp(source, opts) {
1276 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false; 1276 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 return Stopwatch[_frequency]; 1311 return Stopwatch[_frequency];
1312 } 1312 }
1313 Stopwatch() { 1313 Stopwatch() {
1314 this[_start] = null; 1314 this[_start] = null;
1315 this[_stop] = null; 1315 this[_stop] = null;
1316 Stopwatch[_initTicker](); 1316 Stopwatch[_initTicker]();
1317 } 1317 }
1318 start() { 1318 start() {
1319 if (this.isRunning) 1319 if (this.isRunning)
1320 return; 1320 return;
1321 if (this[_start] === null) { 1321 if (this[_start] == null) {
1322 this[_start] = Stopwatch[_now](); 1322 this[_start] = Stopwatch[_now]();
1323 } else { 1323 } else {
1324 this[_start] = dart.notNull(Stopwatch[_now]()) - (dart.notNull(this[_sto p]) - dart.notNull(this[_start])); 1324 this[_start] = dart.notNull(Stopwatch[_now]()) - (dart.notNull(this[_sto p]) - dart.notNull(this[_start]));
1325 this[_stop] = null; 1325 this[_stop] = null;
1326 } 1326 }
1327 } 1327 }
1328 stop() { 1328 stop() {
1329 if (!dart.notNull(this.isRunning)) 1329 if (!dart.notNull(this.isRunning))
1330 return; 1330 return;
1331 this[_stop] = Stopwatch[_now](); 1331 this[_stop] = Stopwatch[_now]();
1332 } 1332 }
1333 reset() { 1333 reset() {
1334 if (this[_start] === null) 1334 if (this[_start] == null)
1335 return; 1335 return;
1336 this[_start] = Stopwatch[_now](); 1336 this[_start] = Stopwatch[_now]();
1337 if (this[_stop] !== null) { 1337 if (this[_stop] != null) {
1338 this[_stop] = this[_start]; 1338 this[_stop] = this[_start];
1339 } 1339 }
1340 } 1340 }
1341 get elapsedTicks() { 1341 get elapsedTicks() {
1342 if (this[_start] === null) { 1342 if (this[_start] == null) {
1343 return 0; 1343 return 0;
1344 } 1344 }
1345 return this[_stop] === null ? dart.notNull(Stopwatch[_now]()) - dart.notNu ll(this[_start]) : dart.notNull(this[_stop]) - dart.notNull(this[_start]); 1345 return this[_stop] == null ? dart.notNull(Stopwatch[_now]()) - dart.notNul l(this[_start]) : dart.notNull(this[_stop]) - dart.notNull(this[_start]);
1346 } 1346 }
1347 get elapsed() { 1347 get elapsed() {
1348 return new Duration({microseconds: this.elapsedMicroseconds}); 1348 return new Duration({microseconds: this.elapsedMicroseconds});
1349 } 1349 }
1350 get elapsedMicroseconds() { 1350 get elapsedMicroseconds() {
1351 return (dart.notNull(this.elapsedTicks) * 1000000 / dart.notNull(this.freq uency)).truncate(); 1351 return (dart.notNull(this.elapsedTicks) * 1000000 / dart.notNull(this.freq uency)).truncate();
1352 } 1352 }
1353 get elapsedMilliseconds() { 1353 get elapsedMilliseconds() {
1354 return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequen cy)).truncate(); 1354 return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequen cy)).truncate();
1355 } 1355 }
1356 get isRunning() { 1356 get isRunning() {
1357 return this[_start] !== null && this[_stop] === null; 1357 return this[_start] != null && this[_stop] == null;
1358 } 1358 }
1359 static [_initTicker]() { 1359 static [_initTicker]() {
1360 _js_helper.Primitives.initTicker(); 1360 _js_helper.Primitives.initTicker();
1361 Stopwatch[_frequency] = _js_helper.Primitives.timerFrequency; 1361 Stopwatch[_frequency] = _js_helper.Primitives.timerFrequency;
1362 } 1362 }
1363 static [_now]() { 1363 static [_now]() {
1364 return dart.as(dart.dinvoke(_js_helper.Primitives, 'timerTicks'), int); 1364 return dart.as(dart.dinvoke(_js_helper.Primitives, 'timerTicks'), int);
1365 } 1365 }
1366 } 1366 }
1367 Stopwatch._frequency = null; 1367 Stopwatch._frequency = null;
1368 let _stringFromIterable = dart.JsSymbol('_stringFromIterable'); 1368 let _stringFromIterable = dart.JsSymbol('_stringFromIterable');
1369 class String extends Object { 1369 class String extends Object {
1370 fromCharCodes(charCodes, start, end) { 1370 fromCharCodes(charCodes, start, end) {
1371 if (start === void 0) 1371 if (start === void 0)
1372 start = 0; 1372 start = 0;
1373 if (end === void 0) 1373 if (end === void 0)
1374 end = null; 1374 end = null;
1375 if (!dart.is(charCodes, _interceptors.JSArray)) { 1375 if (!dart.is(charCodes, _interceptors.JSArray)) {
1376 return String[_stringFromIterable](charCodes, start, end); 1376 return String[_stringFromIterable](charCodes, start, end);
1377 } 1377 }
1378 let list = dart.as(charCodes, List); 1378 let list = dart.as(charCodes, List);
1379 let len = list.length; 1379 let len = list.length;
1380 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) { 1380 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) {
1381 throw new RangeError.range(start, 0, len); 1381 throw new RangeError.range(start, 0, len);
1382 } 1382 }
1383 if (end === null) { 1383 if (end == null) {
1384 end = len; 1384 end = len;
1385 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) { 1385 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) {
1386 throw new RangeError.range(end, start, len); 1386 throw new RangeError.range(end, start, len);
1387 } 1387 }
1388 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) { 1388 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) {
1389 list = list.sublist(start, end); 1389 list = list.sublist(start, end);
1390 } 1390 }
1391 return _js_helper.Primitives.stringFromCharCodes(list); 1391 return _js_helper.Primitives.stringFromCharCodes(list);
1392 } 1392 }
1393 fromCharCode(charCode) { 1393 fromCharCode(charCode) {
1394 return _js_helper.Primitives.stringFromCharCode(charCode); 1394 return _js_helper.Primitives.stringFromCharCode(charCode);
1395 } 1395 }
1396 fromEnvironment(name, opts) { 1396 fromEnvironment(name, opts) {
1397 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll; 1397 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll;
1398 throw new UnsupportedError('String.fromEnvironment can only be used as a c onst constructor'); 1398 throw new UnsupportedError('String.fromEnvironment can only be used as a c onst constructor');
1399 } 1399 }
1400 static [_stringFromIterable](charCodes, start, end) { 1400 static [_stringFromIterable](charCodes, start, end) {
1401 if (dart.notNull(start) < 0) 1401 if (dart.notNull(start) < 0)
1402 throw new RangeError.range(start, 0, charCodes.length); 1402 throw new RangeError.range(start, 0, charCodes.length);
1403 if (end !== null && dart.notNull(end) < dart.notNull(start)) { 1403 if (end != null && dart.notNull(end) < dart.notNull(start)) {
1404 throw new RangeError.range(end, start, charCodes.length); 1404 throw new RangeError.range(end, start, charCodes.length);
1405 } 1405 }
1406 let it = charCodes.iterator; 1406 let it = charCodes.iterator;
1407 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) { 1407 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) {
1408 if (!dart.notNull(it.moveNext())) { 1408 if (!dart.notNull(it.moveNext())) {
1409 throw new RangeError.range(start, 0, i); 1409 throw new RangeError.range(start, 0, i);
1410 } 1410 }
1411 } 1411 }
1412 let list = new List.from([]); 1412 let list = new List.from([]);
1413 if (end === null) { 1413 if (end == null) {
1414 while (it.moveNext()) 1414 while (it.moveNext())
1415 list.add(it.current); 1415 list.add(it.current);
1416 } else { 1416 } else {
1417 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 1417 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
1418 if (!dart.notNull(it.moveNext())) { 1418 if (!dart.notNull(it.moveNext())) {
1419 throw new RangeError.range(end, start, i); 1419 throw new RangeError.range(end, start, i);
1420 } 1420 }
1421 list.add(it.current); 1421 list.add(it.current);
1422 } 1422 }
1423 } 1423 }
1424 return _js_helper.Primitives.stringFromCharCodes(list); 1424 return _js_helper.Primitives.stringFromCharCodes(list);
1425 } 1425 }
1426 } 1426 }
1427 dart.defineNamedConstructor(String, 'fromCharCodes'); 1427 dart.defineNamedConstructor(String, 'fromCharCodes');
1428 dart.defineNamedConstructor(String, 'fromCharCode'); 1428 dart.defineNamedConstructor(String, 'fromCharCode');
1429 dart.defineNamedConstructor(String, 'fromEnvironment'); 1429 dart.defineNamedConstructor(String, 'fromEnvironment');
1430 dart.defineLazyClass(exports, { 1430 dart.defineLazyClass(exports, {
1431 get Runes() { 1431 get Runes() {
1432 class Runes extends collection.IterableBase$(int) { 1432 class Runes extends collection.IterableBase$(int) {
1433 Runes(string) { 1433 Runes(string) {
1434 this.string = string; 1434 this.string = string;
1435 super.IterableBase(); 1435 super.IterableBase();
1436 } 1436 }
1437 get iterator() { 1437 get iterator() {
1438 return new RuneIterator(this.string); 1438 return new RuneIterator(this.string);
1439 } 1439 }
1440 get last() { 1440 get last() {
1441 if (this.string.length === 0) { 1441 if (this.string.length == 0) {
1442 throw new StateError('No elements.'); 1442 throw new StateError('No elements.');
1443 } 1443 }
1444 let length = this.string.length; 1444 let length = this.string.length;
1445 let code = this.string.codeUnitAt(dart.notNull(length) - 1); 1445 let code = this.string.codeUnitAt(dart.notNull(length) - 1);
1446 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string. length) > 1) { 1446 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string. length) > 1) {
1447 let previousCode = this.string.codeUnitAt(dart.notNull(length) - 2); 1447 let previousCode = this.string.codeUnitAt(dart.notNull(length) - 2);
1448 if (_isLeadSurrogate(previousCode)) { 1448 if (_isLeadSurrogate(previousCode)) {
1449 return _combineSurrogatePair(previousCode, code); 1449 return _combineSurrogatePair(previousCode, code);
1450 } 1450 }
1451 } 1451 }
1452 return code; 1452 return code;
1453 } 1453 }
1454 } 1454 }
1455 return Runes; 1455 return Runes;
1456 } 1456 }
1457 }); 1457 });
1458 // Function _isLeadSurrogate: (int) → bool 1458 // Function _isLeadSurrogate: (int) → bool
1459 function _isLeadSurrogate(code) { 1459 function _isLeadSurrogate(code) {
1460 return (dart.notNull(code) & 64512) === 55296; 1460 return (dart.notNull(code) & 64512) == 55296;
1461 } 1461 }
1462 // Function _isTrailSurrogate: (int) → bool 1462 // Function _isTrailSurrogate: (int) → bool
1463 function _isTrailSurrogate(code) { 1463 function _isTrailSurrogate(code) {
1464 return (dart.notNull(code) & 64512) === 56320; 1464 return (dart.notNull(code) & 64512) == 56320;
1465 } 1465 }
1466 // Function _combineSurrogatePair: (int, int) → int 1466 // Function _combineSurrogatePair: (int, int) → int
1467 function _combineSurrogatePair(start, end) { 1467 function _combineSurrogatePair(start, end) {
1468 return 65536 + ((dart.notNull(start) & 1023) << 10) + (dart.notNull(end) & 1 023); 1468 return 65536 + ((dart.notNull(start) & 1023) << 10) + (dart.notNull(end) & 1 023);
1469 } 1469 }
1470 let _position = dart.JsSymbol('_position'); 1470 let _position = dart.JsSymbol('_position');
1471 let _nextPosition = dart.JsSymbol('_nextPosition'); 1471 let _nextPosition = dart.JsSymbol('_nextPosition');
1472 let _currentCodePoint = dart.JsSymbol('_currentCodePoint'); 1472 let _currentCodePoint = dart.JsSymbol('_currentCodePoint');
1473 let _checkSplitSurrogate = dart.JsSymbol('_checkSplitSurrogate'); 1473 let _checkSplitSurrogate = dart.JsSymbol('_checkSplitSurrogate');
1474 class RuneIterator extends Object { 1474 class RuneIterator extends Object {
(...skipping 10 matching lines...) Expand all
1485 this[_currentCodePoint] = null; 1485 this[_currentCodePoint] = null;
1486 RangeError.checkValueInInterval(index, 0, string.length); 1486 RangeError.checkValueInInterval(index, 0, string.length);
1487 this[_checkSplitSurrogate](index); 1487 this[_checkSplitSurrogate](index);
1488 } 1488 }
1489 [_checkSplitSurrogate](index) { 1489 [_checkSplitSurrogate](index) {
1490 if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.str ing.length) && dart.notNull(_isLeadSurrogate(this.string.codeUnitAt(dart.notNull (index) - 1))) && dart.notNull(_isTrailSurrogate(this.string.codeUnitAt(index))) ) { 1490 if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.str ing.length) && dart.notNull(_isLeadSurrogate(this.string.codeUnitAt(dart.notNull (index) - 1))) && dart.notNull(_isTrailSurrogate(this.string.codeUnitAt(index))) ) {
1491 throw new ArgumentError(`Index inside surrogate pair: ${index}`); 1491 throw new ArgumentError(`Index inside surrogate pair: ${index}`);
1492 } 1492 }
1493 } 1493 }
1494 get rawIndex() { 1494 get rawIndex() {
1495 return this[_position] !== this[_nextPosition] ? this[_position] : null; 1495 return this[_position] != this[_nextPosition] ? this[_position] : null;
1496 } 1496 }
1497 set rawIndex(rawIndex) { 1497 set rawIndex(rawIndex) {
1498 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex"); 1498 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex");
1499 this.reset(rawIndex); 1499 this.reset(rawIndex);
1500 this.moveNext(); 1500 this.moveNext();
1501 } 1501 }
1502 reset(rawIndex) { 1502 reset(rawIndex) {
1503 if (rawIndex === void 0) 1503 if (rawIndex === void 0)
1504 rawIndex = 0; 1504 rawIndex = 0;
1505 RangeError.checkValueInInterval(rawIndex, 0, this.string.length, "rawIndex "); 1505 RangeError.checkValueInInterval(rawIndex, 0, this.string.length, "rawIndex ");
1506 this[_checkSplitSurrogate](rawIndex); 1506 this[_checkSplitSurrogate](rawIndex);
1507 this[_position] = this[_nextPosition] = rawIndex; 1507 this[_position] = this[_nextPosition] = rawIndex;
1508 this[_currentCodePoint] = null; 1508 this[_currentCodePoint] = null;
1509 } 1509 }
1510 get current() { 1510 get current() {
1511 return this[_currentCodePoint]; 1511 return this[_currentCodePoint];
1512 } 1512 }
1513 get currentSize() { 1513 get currentSize() {
1514 return dart.notNull(this[_nextPosition]) - dart.notNull(this[_position]); 1514 return dart.notNull(this[_nextPosition]) - dart.notNull(this[_position]);
1515 } 1515 }
1516 get currentAsString() { 1516 get currentAsString() {
1517 if (this[_position] === this[_nextPosition]) 1517 if (this[_position] == this[_nextPosition])
1518 return null; 1518 return null;
1519 if (dart.notNull(this[_position]) + 1 === this[_nextPosition]) 1519 if (dart.notNull(this[_position]) + 1 == this[_nextPosition])
1520 return this.string.get(this[_position]); 1520 return this.string.get(this[_position]);
1521 return this.string.substring(this[_position], this[_nextPosition]); 1521 return this.string.substring(this[_position], this[_nextPosition]);
1522 } 1522 }
1523 moveNext() { 1523 moveNext() {
1524 this[_position] = this[_nextPosition]; 1524 this[_position] = this[_nextPosition];
1525 if (this[_position] === this.string.length) { 1525 if (this[_position] == this.string.length) {
1526 this[_currentCodePoint] = null; 1526 this[_currentCodePoint] = null;
1527 return false; 1527 return false;
1528 } 1528 }
1529 let codeUnit = this.string.codeUnitAt(this[_position]); 1529 let codeUnit = this.string.codeUnitAt(this[_position]);
1530 let nextPosition = dart.notNull(this[_position]) + 1; 1530 let nextPosition = dart.notNull(this[_position]) + 1;
1531 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition) < dart.notNull(this.string.length)) { 1531 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition) < dart.notNull(this.string.length)) {
1532 let nextCodeUnit = this.string.codeUnitAt(nextPosition); 1532 let nextCodeUnit = this.string.codeUnitAt(nextPosition);
1533 if (_isTrailSurrogate(nextCodeUnit)) { 1533 if (_isTrailSurrogate(nextCodeUnit)) {
1534 this[_nextPosition] = dart.notNull(nextPosition) + 1; 1534 this[_nextPosition] = dart.notNull(nextPosition) + 1;
1535 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit ); 1535 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit );
1536 return true; 1536 return true;
1537 } 1537 }
1538 } 1538 }
1539 this[_nextPosition] = nextPosition; 1539 this[_nextPosition] = nextPosition;
1540 this[_currentCodePoint] = codeUnit; 1540 this[_currentCodePoint] = codeUnit;
1541 return true; 1541 return true;
1542 } 1542 }
1543 movePrevious() { 1543 movePrevious() {
1544 this[_nextPosition] = this[_position]; 1544 this[_nextPosition] = this[_position];
1545 if (this[_position] === 0) { 1545 if (this[_position] == 0) {
1546 this[_currentCodePoint] = null; 1546 this[_currentCodePoint] = null;
1547 return false; 1547 return false;
1548 } 1548 }
1549 let position = dart.notNull(this[_position]) - 1; 1549 let position = dart.notNull(this[_position]) - 1;
1550 let codeUnit = this.string.codeUnitAt(position); 1550 let codeUnit = this.string.codeUnitAt(position);
1551 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position) > 0) { 1551 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position) > 0) {
1552 let prevCodeUnit = this.string.codeUnitAt(dart.notNull(position) - 1); 1552 let prevCodeUnit = this.string.codeUnitAt(dart.notNull(position) - 1);
1553 if (_isLeadSurrogate(prevCodeUnit)) { 1553 if (_isLeadSurrogate(prevCodeUnit)) {
1554 this[_position] = dart.notNull(position) - 1; 1554 this[_position] = dart.notNull(position) - 1;
1555 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit ); 1555 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit );
(...skipping 11 matching lines...) Expand all
1567 class StringBuffer extends Object { 1567 class StringBuffer extends Object {
1568 StringBuffer(content) { 1568 StringBuffer(content) {
1569 if (content === void 0) 1569 if (content === void 0)
1570 content = ""; 1570 content = "";
1571 this[_contents] = `${content}`; 1571 this[_contents] = `${content}`;
1572 } 1572 }
1573 get length() { 1573 get length() {
1574 return this[_contents].length; 1574 return this[_contents].length;
1575 } 1575 }
1576 get isEmpty() { 1576 get isEmpty() {
1577 return this.length === 0; 1577 return this.length == 0;
1578 } 1578 }
1579 get isNotEmpty() { 1579 get isNotEmpty() {
1580 return !dart.notNull(this.isEmpty); 1580 return !dart.notNull(this.isEmpty);
1581 } 1581 }
1582 write(obj) { 1582 write(obj) {
1583 this[_writeString](`${obj}`); 1583 this[_writeString](`${obj}`);
1584 } 1584 }
1585 writeCharCode(charCode) { 1585 writeCharCode(charCode) {
1586 this[_writeString](new String.fromCharCode(charCode)); 1586 this[_writeString](new String.fromCharCode(charCode));
1587 } 1587 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 if (!dart.notNull(this.hasAuthority)) 1709 if (!dart.notNull(this.hasAuthority))
1710 return ""; 1710 return "";
1711 let sb = new StringBuffer(); 1711 let sb = new StringBuffer();
1712 this[_writeAuthority](sb); 1712 this[_writeAuthority](sb);
1713 return sb.toString(); 1713 return sb.toString();
1714 } 1714 }
1715 get userInfo() { 1715 get userInfo() {
1716 return this[_userInfo]; 1716 return this[_userInfo];
1717 } 1717 }
1718 get host() { 1718 get host() {
1719 if (this[_host] === null) 1719 if (this[_host] == null)
1720 return ""; 1720 return "";
1721 if (this[_host].startsWith('[')) { 1721 if (this[_host].startsWith('[')) {
1722 return this[_host].substring(1, dart.notNull(this[_host].length) - 1); 1722 return this[_host].substring(1, dart.notNull(this[_host].length) - 1);
1723 } 1723 }
1724 return this[_host]; 1724 return this[_host];
1725 } 1725 }
1726 get port() { 1726 get port() {
1727 if (this[_port] === null) 1727 if (this[_port] == null)
1728 return Uri[_defaultPort](this.scheme); 1728 return Uri[_defaultPort](this.scheme);
1729 return this[_port]; 1729 return this[_port];
1730 } 1730 }
1731 static [_defaultPort](scheme) { 1731 static [_defaultPort](scheme) {
1732 if (dart.equals(scheme, "http")) 1732 if (scheme == "http")
1733 return 80; 1733 return 80;
1734 if (dart.equals(scheme, "https")) 1734 if (scheme == "https")
1735 return 443; 1735 return 443;
1736 return 0; 1736 return 0;
1737 } 1737 }
1738 get path() { 1738 get path() {
1739 return this[_path]; 1739 return this[_path];
1740 } 1740 }
1741 get query() { 1741 get query() {
1742 return this[_query] === null ? "" : this[_query]; 1742 return this[_query] == null ? "" : this[_query];
1743 } 1743 }
1744 get fragment() { 1744 get fragment() {
1745 return this[_fragment] === null ? "" : this[_fragment]; 1745 return this[_fragment] == null ? "" : this[_fragment];
1746 } 1746 }
1747 static parse(uri) { 1747 static parse(uri) {
1748 // Function isRegName: (int) → bool 1748 // Function isRegName: (int) → bool
1749 function isRegName(ch) { 1749 function isRegName(ch) {
1750 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary( Uri[_regNameTable].get(dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15) ), 0)); 1750 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary( Uri[_regNameTable].get(dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15) ), 0));
1751 } 1751 }
1752 let EOI = -1; 1752 let EOI = -1;
1753 let scheme = ""; 1753 let scheme = "";
1754 let userinfo = ""; 1754 let userinfo = "";
1755 let host = null; 1755 let host = null;
1756 let port = null; 1756 let port = null;
1757 let path = null; 1757 let path = null;
1758 let query = null; 1758 let query = null;
1759 let fragment = null; 1759 let fragment = null;
1760 let index = 0; 1760 let index = 0;
1761 let pathStart = 0; 1761 let pathStart = 0;
1762 let char = EOI; 1762 let char = EOI;
1763 // Function parseAuth: () → void 1763 // Function parseAuth: () → void
1764 function parseAuth() { 1764 function parseAuth() {
1765 if (index === uri.length) { 1765 if (index == uri.length) {
1766 char = EOI; 1766 char = EOI;
1767 return; 1767 return;
1768 } 1768 }
1769 let authStart = index; 1769 let authStart = index;
1770 let lastColon = -1; 1770 let lastColon = -1;
1771 let lastAt = -1; 1771 let lastAt = -1;
1772 char = uri.codeUnitAt(index); 1772 char = uri.codeUnitAt(index);
1773 while (dart.notNull(index) < dart.notNull(uri.length)) { 1773 while (dart.notNull(index) < dart.notNull(uri.length)) {
1774 char = uri.codeUnitAt(index); 1774 char = uri.codeUnitAt(index);
1775 if (char === Uri[_SLASH] || char === Uri[_QUESTION] || char === Uri[_N UMBER_SIGN]) { 1775 if (char == Uri[_SLASH] || char == Uri[_QUESTION] || char == Uri[_NUMB ER_SIGN]) {
1776 break; 1776 break;
1777 } 1777 }
1778 if (char === Uri[_AT_SIGN]) { 1778 if (char == Uri[_AT_SIGN]) {
1779 lastAt = index; 1779 lastAt = index;
1780 lastColon = -1; 1780 lastColon = -1;
1781 } else if (char === Uri[_COLON]) { 1781 } else if (char == Uri[_COLON]) {
1782 lastColon = index; 1782 lastColon = index;
1783 } else if (char === Uri[_LEFT_BRACKET]) { 1783 } else if (char == Uri[_LEFT_BRACKET]) {
1784 lastColon = -1; 1784 lastColon = -1;
1785 let endBracket = uri.indexOf(']', dart.notNull(index) + 1); 1785 let endBracket = uri.indexOf(']', dart.notNull(index) + 1);
1786 if (endBracket === -1) { 1786 if (endBracket == -1) {
1787 index = uri.length; 1787 index = uri.length;
1788 char = EOI; 1788 char = EOI;
1789 break; 1789 break;
1790 } else { 1790 } else {
1791 index = endBracket; 1791 index = endBracket;
1792 } 1792 }
1793 } 1793 }
1794 index = dart.notNull(index) + 1; 1794 index = dart.notNull(index) + 1;
1795 char = EOI; 1795 char = EOI;
1796 } 1796 }
(...skipping 23 matching lines...) Expand all
1820 char = uri.codeUnitAt(index); 1820 char = uri.codeUnitAt(index);
1821 } 1821 }
1822 } 1822 }
1823 let NOT_IN_PATH = 0; 1823 let NOT_IN_PATH = 0;
1824 let IN_PATH = 1; 1824 let IN_PATH = 1;
1825 let ALLOW_AUTH = 2; 1825 let ALLOW_AUTH = 2;
1826 let state = NOT_IN_PATH; 1826 let state = NOT_IN_PATH;
1827 let i = index; 1827 let i = index;
1828 while (dart.notNull(i) < dart.notNull(uri.length)) { 1828 while (dart.notNull(i) < dart.notNull(uri.length)) {
1829 char = uri.codeUnitAt(i); 1829 char = uri.codeUnitAt(i);
1830 if (char === Uri[_QUESTION] || char === Uri[_NUMBER_SIGN]) { 1830 if (char == Uri[_QUESTION] || char == Uri[_NUMBER_SIGN]) {
1831 state = NOT_IN_PATH; 1831 state = NOT_IN_PATH;
1832 break; 1832 break;
1833 } 1833 }
1834 if (char === Uri[_SLASH]) { 1834 if (char == Uri[_SLASH]) {
1835 state = i === 0 ? ALLOW_AUTH : IN_PATH; 1835 state = i == 0 ? ALLOW_AUTH : IN_PATH;
1836 break; 1836 break;
1837 } 1837 }
1838 if (char === Uri[_COLON]) { 1838 if (char == Uri[_COLON]) {
1839 if (i === 0) 1839 if (i == 0)
1840 Uri[_fail](uri, 0, "Invalid empty scheme"); 1840 Uri[_fail](uri, 0, "Invalid empty scheme");
1841 scheme = Uri[_makeScheme](uri, i); 1841 scheme = Uri[_makeScheme](uri, i);
1842 i = dart.notNull(i) + 1; 1842 i = dart.notNull(i) + 1;
1843 pathStart = i; 1843 pathStart = i;
1844 if (i === uri.length) { 1844 if (i == uri.length) {
1845 char = EOI; 1845 char = EOI;
1846 state = NOT_IN_PATH; 1846 state = NOT_IN_PATH;
1847 } else { 1847 } else {
1848 char = uri.codeUnitAt(i); 1848 char = uri.codeUnitAt(i);
1849 if (char === Uri[_QUESTION] || char === Uri[_NUMBER_SIGN]) { 1849 if (char == Uri[_QUESTION] || char == Uri[_NUMBER_SIGN]) {
1850 state = NOT_IN_PATH; 1850 state = NOT_IN_PATH;
1851 } else if (char === Uri[_SLASH]) { 1851 } else if (char == Uri[_SLASH]) {
1852 state = ALLOW_AUTH; 1852 state = ALLOW_AUTH;
1853 } else { 1853 } else {
1854 state = IN_PATH; 1854 state = IN_PATH;
1855 } 1855 }
1856 } 1856 }
1857 break; 1857 break;
1858 } 1858 }
1859 i = dart.notNull(i) + 1; 1859 i = dart.notNull(i) + 1;
1860 char = EOI; 1860 char = EOI;
1861 } 1861 }
1862 index = i; 1862 index = i;
1863 if (state === ALLOW_AUTH) { 1863 if (state == ALLOW_AUTH) {
1864 dart.assert(char === Uri[_SLASH]); 1864 dart.assert(char == Uri[_SLASH]);
1865 index = dart.notNull(index) + 1; 1865 index = dart.notNull(index) + 1;
1866 if (index === uri.length) { 1866 if (index == uri.length) {
1867 char = EOI; 1867 char = EOI;
1868 state = NOT_IN_PATH; 1868 state = NOT_IN_PATH;
1869 } else { 1869 } else {
1870 char = uri.codeUnitAt(index); 1870 char = uri.codeUnitAt(index);
1871 if (char === Uri[_SLASH]) { 1871 if (char == Uri[_SLASH]) {
1872 index = dart.notNull(index) + 1; 1872 index = dart.notNull(index) + 1;
1873 parseAuth(); 1873 parseAuth();
1874 pathStart = index; 1874 pathStart = index;
1875 } 1875 }
1876 if (char === Uri[_QUESTION] || char === Uri[_NUMBER_SIGN] || char === EOI) { 1876 if (char == Uri[_QUESTION] || char == Uri[_NUMBER_SIGN] || char == EOI ) {
1877 state = NOT_IN_PATH; 1877 state = NOT_IN_PATH;
1878 } else { 1878 } else {
1879 state = IN_PATH; 1879 state = IN_PATH;
1880 } 1880 }
1881 } 1881 }
1882 } 1882 }
1883 dart.assert(state === IN_PATH || state === NOT_IN_PATH); 1883 dart.assert(state == IN_PATH || state == NOT_IN_PATH);
1884 if (state === IN_PATH) { 1884 if (state == IN_PATH) {
1885 while ((index = dart.notNull(index) + 1) < dart.notNull(uri.length)) { 1885 while ((index = dart.notNull(index) + 1) < dart.notNull(uri.length)) {
1886 char = uri.codeUnitAt(index); 1886 char = uri.codeUnitAt(index);
1887 if (char === Uri[_QUESTION] || char === Uri[_NUMBER_SIGN]) { 1887 if (char == Uri[_QUESTION] || char == Uri[_NUMBER_SIGN]) {
1888 break; 1888 break;
1889 } 1889 }
1890 char = EOI; 1890 char = EOI;
1891 } 1891 }
1892 state = NOT_IN_PATH; 1892 state = NOT_IN_PATH;
1893 } 1893 }
1894 dart.assert(state === NOT_IN_PATH); 1894 dart.assert(state == NOT_IN_PATH);
1895 let isFile = dart.equals(scheme, "file"); 1895 let isFile = scheme == "file";
1896 let ensureLeadingSlash = host !== null; 1896 let ensureLeadingSlash = host != null;
1897 path = Uri[_makePath](uri, pathStart, index, null, ensureLeadingSlash, isF ile); 1897 path = Uri[_makePath](uri, pathStart, index, null, ensureLeadingSlash, isF ile);
1898 if (char === Uri[_QUESTION]) { 1898 if (char == Uri[_QUESTION]) {
1899 let numberSignIndex = uri.indexOf('#', dart.notNull(index) + 1); 1899 let numberSignIndex = uri.indexOf('#', dart.notNull(index) + 1);
1900 if (dart.notNull(numberSignIndex) < 0) { 1900 if (dart.notNull(numberSignIndex) < 0) {
1901 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, uri.length, null ); 1901 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, uri.length, null );
1902 } else { 1902 } else {
1903 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, numberSignIndex, null); 1903 query = Uri[_makeQuery](uri, dart.notNull(index) + 1, numberSignIndex, null);
1904 fragment = Uri[_makeFragment](uri, dart.notNull(numberSignIndex) + 1, uri.length); 1904 fragment = Uri[_makeFragment](uri, dart.notNull(numberSignIndex) + 1, uri.length);
1905 } 1905 }
1906 } else if (char === Uri[_NUMBER_SIGN]) { 1906 } else if (char == Uri[_NUMBER_SIGN]) {
1907 fragment = Uri[_makeFragment](uri, dart.notNull(index) + 1, uri.length); 1907 fragment = Uri[_makeFragment](uri, dart.notNull(index) + 1, uri.length);
1908 } 1908 }
1909 return new Uri[_internal$](scheme, userinfo, host, port, path, query, frag ment); 1909 return new Uri[_internal$](scheme, userinfo, host, port, path, query, frag ment);
1910 } 1910 }
1911 static [_fail](uri, index, message) { 1911 static [_fail](uri, index, message) {
1912 throw new FormatException(message, uri, index); 1912 throw new FormatException(message, uri, index);
1913 } 1913 }
1914 [_internal$](scheme, userInfo$, host$, port$, path$, query$, fragment$) { 1914 [_internal$](scheme, userInfo$, host$, port$, path$, query$, fragment$) {
1915 this.scheme = scheme; 1915 this.scheme = scheme;
1916 this[_userInfo] = userInfo$; 1916 this[_userInfo] = userInfo$;
(...skipping 11 matching lines...) Expand all
1928 let host = opts && 'host' in opts ? opts.host : null; 1928 let host = opts && 'host' in opts ? opts.host : null;
1929 let port = opts && 'port' in opts ? opts.port : null; 1929 let port = opts && 'port' in opts ? opts.port : null;
1930 let path = opts && 'path' in opts ? opts.path : null; 1930 let path = opts && 'path' in opts ? opts.path : null;
1931 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu ll; 1931 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu ll;
1932 let query = opts && 'query' in opts ? opts.query : null; 1932 let query = opts && 'query' in opts ? opts.query : null;
1933 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame ters : null; 1933 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame ters : null;
1934 let fragment = opts && 'fragment' in opts ? opts.fragment : null; 1934 let fragment = opts && 'fragment' in opts ? opts.fragment : null;
1935 scheme = Uri[_makeScheme](scheme, Uri[_stringOrNullLength](scheme)); 1935 scheme = Uri[_makeScheme](scheme, Uri[_stringOrNullLength](scheme));
1936 userInfo = Uri[_makeUserInfo](userInfo, 0, Uri[_stringOrNullLength](userIn fo)); 1936 userInfo = Uri[_makeUserInfo](userInfo, 0, Uri[_stringOrNullLength](userIn fo));
1937 host = Uri[_makeHost](host, 0, Uri[_stringOrNullLength](host), false); 1937 host = Uri[_makeHost](host, 0, Uri[_stringOrNullLength](host), false);
1938 if (dart.equals(query, "")) 1938 if (query == "")
1939 query = null; 1939 query = null;
1940 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), queryPa rameters); 1940 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), queryPa rameters);
1941 fragment = Uri[_makeFragment](fragment, 0, Uri[_stringOrNullLength](fragme nt)); 1941 fragment = Uri[_makeFragment](fragment, 0, Uri[_stringOrNullLength](fragme nt));
1942 port = Uri[_makePort](port, scheme); 1942 port = Uri[_makePort](port, scheme);
1943 let isFile = dart.equals(scheme, "file"); 1943 let isFile = scheme == "file";
1944 if (dart.notNull(host === null) && (dart.notNull(userInfo.isNotEmpty) || p ort !== null || dart.notNull(isFile))) { 1944 if (dart.notNull(host == null) && (dart.notNull(userInfo.isNotEmpty) || po rt != null || dart.notNull(isFile))) {
1945 host = ""; 1945 host = "";
1946 } 1946 }
1947 let ensureLeadingSlash = host !== null; 1947 let ensureLeadingSlash = host != null;
1948 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegment s, ensureLeadingSlash, isFile); 1948 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegment s, ensureLeadingSlash, isFile);
1949 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment); 1949 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment);
1950 } 1950 }
1951 http(authority, unencodedPath, queryParameters) { 1951 http(authority, unencodedPath, queryParameters) {
1952 if (queryParameters === void 0) 1952 if (queryParameters === void 0)
1953 queryParameters = null; 1953 queryParameters = null;
1954 return Uri[_makeHttpUri]("http", authority, unencodedPath, queryParameters ); 1954 return Uri[_makeHttpUri]("http", authority, unencodedPath, queryParameters );
1955 } 1955 }
1956 https(authority, unencodedPath, queryParameters) { 1956 https(authority, unencodedPath, queryParameters) {
1957 if (queryParameters === void 0) 1957 if (queryParameters === void 0)
1958 queryParameters = null; 1958 queryParameters = null;
1959 return Uri[_makeHttpUri]("https", authority, unencodedPath, queryParameter s); 1959 return Uri[_makeHttpUri]("https", authority, unencodedPath, queryParameter s);
1960 } 1960 }
1961 static [_makeHttpUri](scheme, authority, unencodedPath, queryParameters) { 1961 static [_makeHttpUri](scheme, authority, unencodedPath, queryParameters) {
1962 let userInfo = ""; 1962 let userInfo = "";
1963 let host = null; 1963 let host = null;
1964 let port = null; 1964 let port = null;
1965 if (dart.notNull(authority !== null) && dart.notNull(authority.isNotEmpty) ) { 1965 if (dart.notNull(authority != null) && dart.notNull(authority.isNotEmpty)) {
1966 let hostStart = 0; 1966 let hostStart = 0;
1967 let hasUserInfo = false; 1967 let hasUserInfo = false;
1968 for (let i = 0; dart.notNull(i) < dart.notNull(authority.length); i = da rt.notNull(i) + 1) { 1968 for (let i = 0; dart.notNull(i) < dart.notNull(authority.length); i = da rt.notNull(i) + 1) {
1969 if (authority.codeUnitAt(i) === Uri[_AT_SIGN]) { 1969 if (authority.codeUnitAt(i) == Uri[_AT_SIGN]) {
1970 hasUserInfo = true; 1970 hasUserInfo = true;
1971 userInfo = authority.substring(0, i); 1971 userInfo = authority.substring(0, i);
1972 hostStart = dart.notNull(i) + 1; 1972 hostStart = dart.notNull(i) + 1;
1973 break; 1973 break;
1974 } 1974 }
1975 } 1975 }
1976 let hostEnd = hostStart; 1976 let hostEnd = hostStart;
1977 if (dart.notNull(hostStart) < dart.notNull(authority.length) && authorit y.codeUnitAt(hostStart) === Uri[_LEFT_BRACKET]) { 1977 if (dart.notNull(hostStart) < dart.notNull(authority.length) && authorit y.codeUnitAt(hostStart) == Uri[_LEFT_BRACKET]) {
1978 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd = dart.notNull(hostEnd) + 1) { 1978 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd = dart.notNull(hostEnd) + 1) {
1979 if (authority.codeUnitAt(hostEnd) === Uri[_RIGHT_BRACKET]) 1979 if (authority.codeUnitAt(hostEnd) == Uri[_RIGHT_BRACKET])
1980 break; 1980 break;
1981 } 1981 }
1982 if (hostEnd === authority.length) { 1982 if (hostEnd == authority.length) {
1983 throw new FormatException("Invalid IPv6 host entry.", authority, hos tStart); 1983 throw new FormatException("Invalid IPv6 host entry.", authority, hos tStart);
1984 } 1984 }
1985 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); 1985 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd);
1986 hostEnd = dart.notNull(hostEnd) + 1; 1986 hostEnd = dart.notNull(hostEnd) + 1;
1987 if (hostEnd !== authority.length && authority.codeUnitAt(hostEnd) !== Uri[_COLON]) { 1987 if (hostEnd != authority.length && authority.codeUnitAt(hostEnd) != Ur i[_COLON]) {
1988 throw new FormatException("Invalid end of authority", authority, hos tEnd); 1988 throw new FormatException("Invalid end of authority", authority, hos tEnd);
1989 } 1989 }
1990 } 1990 }
1991 let hasPort = false; 1991 let hasPort = false;
1992 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd = dart.notNull(hostEnd) + 1) { 1992 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); hostEnd = dart.notNull(hostEnd) + 1) {
1993 if (authority.codeUnitAt(hostEnd) === Uri[_COLON]) { 1993 if (authority.codeUnitAt(hostEnd) == Uri[_COLON]) {
1994 let portString = authority.substring(dart.notNull(hostEnd) + 1); 1994 let portString = authority.substring(dart.notNull(hostEnd) + 1);
1995 if (portString.isNotEmpty) 1995 if (portString.isNotEmpty)
1996 port = int.parse(portString); 1996 port = int.parse(portString);
1997 break; 1997 break;
1998 } 1998 }
1999 } 1999 }
2000 host = authority.substring(hostStart, hostEnd); 2000 host = authority.substring(hostStart, hostEnd);
2001 } 2001 }
2002 return new Uri({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath.split("/"), queryPa rameters: queryParameters}); 2002 return new Uri({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath.split("/"), queryPa rameters: queryParameters});
2003 } 2003 }
2004 file(path, opts) { 2004 file(path, opts) {
2005 let windows = opts && 'windows' in opts ? opts.windows : null; 2005 let windows = opts && 'windows' in opts ? opts.windows : null;
2006 windows = windows === null ? Uri[_isWindows] : windows; 2006 windows = windows == null ? Uri[_isWindows] : windows;
2007 return dart.as(windows ? Uri[_makeWindowsFileUrl](path) : Uri[_makeFileUri ](path), Uri); 2007 return dart.as(windows ? Uri[_makeWindowsFileUrl](path) : Uri[_makeFileUri ](path), Uri);
2008 } 2008 }
2009 static get base() { 2009 static get base() {
2010 let uri = _js_helper.Primitives.currentUri(); 2010 let uri = _js_helper.Primitives.currentUri();
2011 if (uri !== null) 2011 if (uri != null)
2012 return Uri.parse(uri); 2012 return Uri.parse(uri);
2013 throw new UnsupportedError("'Uri.base' is not supported"); 2013 throw new UnsupportedError("'Uri.base' is not supported");
2014 } 2014 }
2015 static get [_isWindows]() { 2015 static get [_isWindows]() {
2016 return false; 2016 return false;
2017 } 2017 }
2018 static [_checkNonWindowsPathReservedCharacters](segments, argumentError) { 2018 static [_checkNonWindowsPathReservedCharacters](segments, argumentError) {
2019 segments.forEach(dart.closureWrap((segment) => { 2019 segments.forEach(dart.closureWrap((segment) => {
2020 if (dart.dinvoke(segment, 'contains', "/")) { 2020 if (dart.dinvoke(segment, 'contains', "/")) {
2021 if (argumentError) { 2021 if (argumentError) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 } else { 2056 } else {
2057 return new Uri({pathSegments: path.split(sep)}); 2057 return new Uri({pathSegments: path.split(sep)});
2058 } 2058 }
2059 } 2059 }
2060 static [_makeWindowsFileUrl](path) { 2060 static [_makeWindowsFileUrl](path) {
2061 if (path.startsWith("\\\\?\\")) { 2061 if (path.startsWith("\\\\?\\")) {
2062 if (path.startsWith("\\\\?\\UNC\\")) { 2062 if (path.startsWith("\\\\?\\UNC\\")) {
2063 path = `\\${path.substring(7)}`; 2063 path = `\\${path.substring(7)}`;
2064 } else { 2064 } else {
2065 path = path.substring(4); 2065 path = path.substring(4);
2066 if (dart.notNull(path.length) < 3 || path.codeUnitAt(1) !== Uri[_COLON ] || path.codeUnitAt(2) !== Uri[_BACKSLASH]) { 2066 if (dart.notNull(path.length) < 3 || path.codeUnitAt(1) != Uri[_COLON] || path.codeUnitAt(2) != Uri[_BACKSLASH]) {
2067 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute"); 2067 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute");
2068 } 2068 }
2069 } 2069 }
2070 } else { 2070 } else {
2071 path = path.replaceAll("/", "\\"); 2071 path = path.replaceAll("/", "\\");
2072 } 2072 }
2073 let sep = "\\"; 2073 let sep = "\\";
2074 if (dart.notNull(path.length) > 1 && dart.notNull(dart.equals(path.get(1), ":"))) { 2074 if (dart.notNull(path.length) > 1 && dart.notNull(path.get(1) == ":")) {
2075 Uri[_checkWindowsDriveLetter](path.codeUnitAt(0), true); 2075 Uri[_checkWindowsDriveLetter](path.codeUnitAt(0), true);
2076 if (path.length === 2 || path.codeUnitAt(2) !== Uri[_BACKSLASH]) { 2076 if (path.length == 2 || path.codeUnitAt(2) != Uri[_BACKSLASH]) {
2077 throw new ArgumentError("Windows paths with drive letter must be absol ute"); 2077 throw new ArgumentError("Windows paths with drive letter must be absol ute");
2078 } 2078 }
2079 let pathSegments = path.split(sep); 2079 let pathSegments = path.split(sep);
2080 Uri[_checkWindowsPathReservedCharacters](pathSegments, true, 1); 2080 Uri[_checkWindowsPathReservedCharacters](pathSegments, true, 1);
2081 return new Uri({scheme: "file", pathSegments: pathSegments}); 2081 return new Uri({scheme: "file", pathSegments: pathSegments});
2082 } 2082 }
2083 if (dart.notNull(path.length) > 0 && dart.notNull(dart.equals(path.get(0), sep))) { 2083 if (dart.notNull(path.length) > 0 && dart.notNull(path.get(0) == sep)) {
2084 if (dart.notNull(path.length) > 1 && dart.notNull(dart.equals(path.get(1 ), sep))) { 2084 if (dart.notNull(path.length) > 1 && dart.notNull(path.get(1) == sep)) {
2085 let pathStart = path.indexOf("\\", 2); 2085 let pathStart = path.indexOf("\\", 2);
2086 let hostPart = pathStart === -1 ? path.substring(2) : path.substring(2 , pathStart); 2086 let hostPart = pathStart == -1 ? path.substring(2) : path.substring(2, pathStart);
2087 let pathPart = pathStart === -1 ? "" : path.substring(dart.notNull(pat hStart) + 1); 2087 let pathPart = pathStart == -1 ? "" : path.substring(dart.notNull(path Start) + 1);
2088 let pathSegments = pathPart.split(sep); 2088 let pathSegments = pathPart.split(sep);
2089 Uri[_checkWindowsPathReservedCharacters](pathSegments, true); 2089 Uri[_checkWindowsPathReservedCharacters](pathSegments, true);
2090 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents}); 2090 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents});
2091 } else { 2091 } else {
2092 let pathSegments = path.split(sep); 2092 let pathSegments = path.split(sep);
2093 Uri[_checkWindowsPathReservedCharacters](pathSegments, true); 2093 Uri[_checkWindowsPathReservedCharacters](pathSegments, true);
2094 return new Uri({scheme: "file", pathSegments: pathSegments}); 2094 return new Uri({scheme: "file", pathSegments: pathSegments});
2095 } 2095 }
2096 } else { 2096 } else {
2097 let pathSegments = path.split(sep); 2097 let pathSegments = path.split(sep);
2098 Uri[_checkWindowsPathReservedCharacters](pathSegments, true); 2098 Uri[_checkWindowsPathReservedCharacters](pathSegments, true);
2099 return new Uri({pathSegments: pathSegments}); 2099 return new Uri({pathSegments: pathSegments});
2100 } 2100 }
2101 } 2101 }
2102 replace(opts) { 2102 replace(opts) {
2103 let scheme = opts && 'scheme' in opts ? opts.scheme : null; 2103 let scheme = opts && 'scheme' in opts ? opts.scheme : null;
2104 let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null; 2104 let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
2105 let host = opts && 'host' in opts ? opts.host : null; 2105 let host = opts && 'host' in opts ? opts.host : null;
2106 let port = opts && 'port' in opts ? opts.port : null; 2106 let port = opts && 'port' in opts ? opts.port : null;
2107 let path = opts && 'path' in opts ? opts.path : null; 2107 let path = opts && 'path' in opts ? opts.path : null;
2108 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu ll; 2108 let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : nu ll;
2109 let query = opts && 'query' in opts ? opts.query : null; 2109 let query = opts && 'query' in opts ? opts.query : null;
2110 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame ters : null; 2110 let queryParameters = opts && 'queryParameters' in opts ? opts.queryParame ters : null;
2111 let fragment = opts && 'fragment' in opts ? opts.fragment : null; 2111 let fragment = opts && 'fragment' in opts ? opts.fragment : null;
2112 let schemeChanged = false; 2112 let schemeChanged = false;
2113 if (scheme !== null) { 2113 if (scheme != null) {
2114 scheme = Uri[_makeScheme](scheme, scheme.length); 2114 scheme = Uri[_makeScheme](scheme, scheme.length);
2115 schemeChanged = true; 2115 schemeChanged = true;
2116 } else { 2116 } else {
2117 scheme = this.scheme; 2117 scheme = this.scheme;
2118 } 2118 }
2119 let isFile = dart.equals(scheme, "file"); 2119 let isFile = scheme == "file";
2120 if (userInfo !== null) { 2120 if (userInfo != null) {
2121 userInfo = Uri[_makeUserInfo](userInfo, 0, userInfo.length); 2121 userInfo = Uri[_makeUserInfo](userInfo, 0, userInfo.length);
2122 } else { 2122 } else {
2123 userInfo = this.userInfo; 2123 userInfo = this.userInfo;
2124 } 2124 }
2125 if (port !== null) { 2125 if (port != null) {
2126 port = Uri[_makePort](port, scheme); 2126 port = Uri[_makePort](port, scheme);
2127 } else { 2127 } else {
2128 port = this[_port]; 2128 port = this[_port];
2129 if (schemeChanged) { 2129 if (schemeChanged) {
2130 port = Uri[_makePort](port, scheme); 2130 port = Uri[_makePort](port, scheme);
2131 } 2131 }
2132 } 2132 }
2133 if (host !== null) { 2133 if (host != null) {
2134 host = Uri[_makeHost](host, 0, host.length, false); 2134 host = Uri[_makeHost](host, 0, host.length, false);
2135 } else if (this.hasAuthority) { 2135 } else if (this.hasAuthority) {
2136 host = this.host; 2136 host = this.host;
2137 } else if (dart.notNull(userInfo.isNotEmpty) || port !== null || dart.notN ull(isFile)) { 2137 } else if (dart.notNull(userInfo.isNotEmpty) || port != null || dart.notNu ll(isFile)) {
2138 host = ""; 2138 host = "";
2139 } 2139 }
2140 let ensureLeadingSlash = host !== null; 2140 let ensureLeadingSlash = host != null;
2141 if (dart.notNull(path !== null) || dart.notNull(pathSegments !== null)) { 2141 if (dart.notNull(path != null) || dart.notNull(pathSegments != null)) {
2142 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegme nts, ensureLeadingSlash, isFile); 2142 path = Uri[_makePath](path, 0, Uri[_stringOrNullLength](path), pathSegme nts, ensureLeadingSlash, isFile);
2143 } else { 2143 } else {
2144 path = this.path; 2144 path = this.path;
2145 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n otNull(path.isEmpty)) && !dart.notNull(path.startsWith('/'))) { 2145 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n otNull(path.isEmpty)) && !dart.notNull(path.startsWith('/'))) {
2146 path = `/${path}`; 2146 path = `/${path}`;
2147 } 2147 }
2148 } 2148 }
2149 if (dart.notNull(query !== null) || dart.notNull(queryParameters !== null) ) { 2149 if (dart.notNull(query != null) || dart.notNull(queryParameters != null)) {
2150 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), query Parameters); 2150 query = Uri[_makeQuery](query, 0, Uri[_stringOrNullLength](query), query Parameters);
2151 } else if (this.hasQuery) { 2151 } else if (this.hasQuery) {
2152 query = this.query; 2152 query = this.query;
2153 } 2153 }
2154 if (fragment !== null) { 2154 if (fragment != null) {
2155 fragment = Uri[_makeFragment](fragment, 0, fragment.length); 2155 fragment = Uri[_makeFragment](fragment, 0, fragment.length);
2156 } else if (this.hasFragment) { 2156 } else if (this.hasFragment) {
2157 fragment = this.fragment; 2157 fragment = this.fragment;
2158 } 2158 }
2159 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment); 2159 return new Uri[_internal$](scheme, userInfo, host, port, path, query, frag ment);
2160 } 2160 }
2161 get pathSegments() { 2161 get pathSegments() {
2162 if (this[_pathSegments] === null) { 2162 if (this[_pathSegments] == null) {
2163 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) === Uri[_SLASH] ? this.path.substring(1) : this.path; 2163 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) == Uri[_SLASH] ? this.path.substring(1) : this.path;
2164 this[_pathSegments] = dart.as(new collection.UnmodifiableListView(dart.e quals(pathToSplit, "") ? /* Unimplemented const */new List$(String).from([]) : p athToSplit.split("/").map(Uri.decodeComponent).toList({growable: false})), List$ (String)); 2164 this[_pathSegments] = dart.as(new collection.UnmodifiableListView(pathTo Split == "" ? /* Unimplemented const */new List$(String).from([]) : pathToSplit. split("/").map(Uri.decodeComponent).toList({growable: false})), List$(String));
2165 } 2165 }
2166 return this[_pathSegments]; 2166 return this[_pathSegments];
2167 } 2167 }
2168 get queryParameters() { 2168 get queryParameters() {
2169 if (this[_queryParameters] === null) { 2169 if (this[_queryParameters] == null) {
2170 this[_queryParameters] = dart.as(new collection.UnmodifiableMapView(Uri. splitQueryString(this.query)), Map$(String, String)); 2170 this[_queryParameters] = dart.as(new collection.UnmodifiableMapView(Uri. splitQueryString(this.query)), Map$(String, String));
2171 } 2171 }
2172 return this[_queryParameters]; 2172 return this[_queryParameters];
2173 } 2173 }
2174 static [_makePort](port, scheme) { 2174 static [_makePort](port, scheme) {
2175 if (port !== null && port === Uri[_defaultPort](scheme)) 2175 if (port != null && port == Uri[_defaultPort](scheme))
2176 return null; 2176 return null;
2177 return port; 2177 return port;
2178 } 2178 }
2179 static [_makeHost](host, start, end, strictIPv6) { 2179 static [_makeHost](host, start, end, strictIPv6) {
2180 if (host === null) 2180 if (host == null)
2181 return null; 2181 return null;
2182 if (start === end) 2182 if (start == end)
2183 return ""; 2183 return "";
2184 if (host.codeUnitAt(start) === Uri[_LEFT_BRACKET]) { 2184 if (host.codeUnitAt(start) == Uri[_LEFT_BRACKET]) {
2185 if (host.codeUnitAt(dart.notNull(end) - 1) !== Uri[_RIGHT_BRACKET]) { 2185 if (host.codeUnitAt(dart.notNull(end) - 1) != Uri[_RIGHT_BRACKET]) {
2186 Uri[_fail](host, start, 'Missing end `]` to match `[` in host'); 2186 Uri[_fail](host, start, 'Missing end `]` to match `[` in host');
2187 } 2187 }
2188 Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1); 2188 Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
2189 return host.substring(start, end).toLowerCase(); 2189 return host.substring(start, end).toLowerCase();
2190 } 2190 }
2191 if (!dart.notNull(strictIPv6)) { 2191 if (!dart.notNull(strictIPv6)) {
2192 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 2192 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
2193 if (host.codeUnitAt(i) === Uri[_COLON]) { 2193 if (host.codeUnitAt(i) == Uri[_COLON]) {
2194 Uri.parseIPv6Address(host, start, end); 2194 Uri.parseIPv6Address(host, start, end);
2195 return `[${host}]`; 2195 return `[${host}]`;
2196 } 2196 }
2197 } 2197 }
2198 } 2198 }
2199 return Uri[_normalizeRegName](host, start, end); 2199 return Uri[_normalizeRegName](host, start, end);
2200 } 2200 }
2201 static [_isRegNameChar](char) { 2201 static [_isRegNameChar](char) {
2202 return dart.notNull(char) < 127 && dart.notNull(!dart.equals(dart.dbinary( Uri[_regNameTable].get(dart.notNull(char) >> 4), '&', 1 << (dart.notNull(char) & 15)), 0)); 2202 return dart.notNull(char) < 127 && dart.notNull(!dart.equals(dart.dbinary( Uri[_regNameTable].get(dart.notNull(char) >> 4), '&', 1 << (dart.notNull(char) & 15)), 0));
2203 } 2203 }
2204 static [_normalizeRegName](host, start, end) { 2204 static [_normalizeRegName](host, start, end) {
2205 let buffer = null; 2205 let buffer = null;
2206 let sectionStart = start; 2206 let sectionStart = start;
2207 let index = start; 2207 let index = start;
2208 let isNormalized = true; 2208 let isNormalized = true;
2209 while (dart.notNull(index) < dart.notNull(end)) { 2209 while (dart.notNull(index) < dart.notNull(end)) {
2210 let char = host.codeUnitAt(index); 2210 let char = host.codeUnitAt(index);
2211 if (char === Uri[_PERCENT]) { 2211 if (char == Uri[_PERCENT]) {
2212 let replacement = Uri[_normalizeEscape](host, index, true); 2212 let replacement = Uri[_normalizeEscape](host, index, true);
2213 if (dart.notNull(replacement === null) && dart.notNull(isNormalized)) { 2213 if (dart.notNull(replacement == null) && dart.notNull(isNormalized)) {
2214 index = 3; 2214 index = 3;
2215 continue; 2215 continue;
2216 } 2216 }
2217 if (buffer === null) 2217 if (buffer == null)
2218 buffer = new StringBuffer(); 2218 buffer = new StringBuffer();
2219 let slice = host.substring(sectionStart, index); 2219 let slice = host.substring(sectionStart, index);
2220 if (!dart.notNull(isNormalized)) 2220 if (!dart.notNull(isNormalized))
2221 slice = slice.toLowerCase(); 2221 slice = slice.toLowerCase();
2222 buffer.write(slice); 2222 buffer.write(slice);
2223 let sourceLength = 3; 2223 let sourceLength = 3;
2224 if (replacement === null) { 2224 if (replacement == null) {
2225 replacement = host.substring(index, dart.notNull(index) + 3); 2225 replacement = host.substring(index, dart.notNull(index) + 3);
2226 } else if (dart.equals(replacement, "%")) { 2226 } else if (replacement == "%") {
2227 replacement = "%25"; 2227 replacement = "%25";
2228 sourceLength = 1; 2228 sourceLength = 1;
2229 } 2229 }
2230 buffer.write(replacement); 2230 buffer.write(replacement);
2231 index = sourceLength; 2231 index = sourceLength;
2232 sectionStart = index; 2232 sectionStart = index;
2233 isNormalized = true; 2233 isNormalized = true;
2234 } else if (Uri[_isRegNameChar](char)) { 2234 } else if (Uri[_isRegNameChar](char)) {
2235 if (dart.notNull(isNormalized) && dart.notNull(Uri[_UPPER_CASE_A]) <= dart.notNull(char) && dart.notNull(Uri[_UPPER_CASE_Z]) >= dart.notNull(char)) { 2235 if (dart.notNull(isNormalized) && dart.notNull(Uri[_UPPER_CASE_A]) <= dart.notNull(char) && dart.notNull(Uri[_UPPER_CASE_Z]) >= dart.notNull(char)) {
2236 if (buffer === null) 2236 if (buffer == null)
2237 buffer = new StringBuffer(); 2237 buffer = new StringBuffer();
2238 if (dart.notNull(sectionStart) < dart.notNull(index)) { 2238 if (dart.notNull(sectionStart) < dart.notNull(index)) {
2239 buffer.write(host.substring(sectionStart, index)); 2239 buffer.write(host.substring(sectionStart, index));
2240 sectionStart = index; 2240 sectionStart = index;
2241 } 2241 }
2242 isNormalized = false; 2242 isNormalized = false;
2243 } 2243 }
2244 index = dart.notNull(index) + 1; 2244 index = dart.notNull(index) + 1;
2245 } else if (Uri[_isGeneralDelimiter](char)) { 2245 } else if (Uri[_isGeneralDelimiter](char)) {
2246 Uri[_fail](host, index, "Invalid character"); 2246 Uri[_fail](host, index, "Invalid character");
2247 } else { 2247 } else {
2248 let sourceLength = 1; 2248 let sourceLength = 1;
2249 if ((dart.notNull(char) & 64512) === 55296 && dart.notNull(index) + 1 < dart.notNull(end)) { 2249 if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
2250 let tail = host.codeUnitAt(dart.notNull(index) + 1); 2250 let tail = host.codeUnitAt(dart.notNull(index) + 1);
2251 if ((dart.notNull(tail) & 64512) === 56320) { 2251 if ((dart.notNull(tail) & 64512) == 56320) {
2252 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta il) & 1023; 2252 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta il) & 1023;
2253 sourceLength = 2; 2253 sourceLength = 2;
2254 } 2254 }
2255 } 2255 }
2256 if (buffer === null) 2256 if (buffer == null)
2257 buffer = new StringBuffer(); 2257 buffer = new StringBuffer();
2258 let slice = host.substring(sectionStart, index); 2258 let slice = host.substring(sectionStart, index);
2259 if (!dart.notNull(isNormalized)) 2259 if (!dart.notNull(isNormalized))
2260 slice = slice.toLowerCase(); 2260 slice = slice.toLowerCase();
2261 buffer.write(slice); 2261 buffer.write(slice);
2262 buffer.write(Uri[_escapeChar](char)); 2262 buffer.write(Uri[_escapeChar](char));
2263 index = sourceLength; 2263 index = sourceLength;
2264 sectionStart = index; 2264 sectionStart = index;
2265 } 2265 }
2266 } 2266 }
2267 if (buffer === null) 2267 if (buffer == null)
2268 return host.substring(start, end); 2268 return host.substring(start, end);
2269 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2269 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2270 let slice = host.substring(sectionStart, end); 2270 let slice = host.substring(sectionStart, end);
2271 if (!dart.notNull(isNormalized)) 2271 if (!dart.notNull(isNormalized))
2272 slice = slice.toLowerCase(); 2272 slice = slice.toLowerCase();
2273 buffer.write(slice); 2273 buffer.write(slice);
2274 } 2274 }
2275 return buffer.toString(); 2275 return buffer.toString();
2276 } 2276 }
2277 static [_makeScheme](scheme, end) { 2277 static [_makeScheme](scheme, end) {
2278 if (end === 0) 2278 if (end == 0)
2279 return ""; 2279 return "";
2280 let firstCodeUnit = scheme.codeUnitAt(0); 2280 let firstCodeUnit = scheme.codeUnitAt(0);
2281 if (!dart.notNull(Uri[_isAlphabeticCharacter](firstCodeUnit))) { 2281 if (!dart.notNull(Uri[_isAlphabeticCharacter](firstCodeUnit))) {
2282 Uri[_fail](scheme, 0, "Scheme not starting with alphabetic character"); 2282 Uri[_fail](scheme, 0, "Scheme not starting with alphabetic character");
2283 } 2283 }
2284 let allLowercase = dart.notNull(firstCodeUnit) >= dart.notNull(Uri[_LOWER_ CASE_A]); 2284 let allLowercase = dart.notNull(firstCodeUnit) >= dart.notNull(Uri[_LOWER_ CASE_A]);
2285 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) { 2285 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
2286 let codeUnit = scheme.codeUnitAt(i); 2286 let codeUnit = scheme.codeUnitAt(i);
2287 if (!dart.notNull(Uri[_isSchemeCharacter](codeUnit))) { 2287 if (!dart.notNull(Uri[_isSchemeCharacter](codeUnit))) {
2288 Uri[_fail](scheme, i, "Illegal scheme character"); 2288 Uri[_fail](scheme, i, "Illegal scheme character");
2289 } 2289 }
2290 if (dart.notNull(codeUnit) < dart.notNull(Uri[_LOWER_CASE_A]) || dart.no tNull(codeUnit) > dart.notNull(Uri[_LOWER_CASE_Z])) { 2290 if (dart.notNull(codeUnit) < dart.notNull(Uri[_LOWER_CASE_A]) || dart.no tNull(codeUnit) > dart.notNull(Uri[_LOWER_CASE_Z])) {
2291 allLowercase = false; 2291 allLowercase = false;
2292 } 2292 }
2293 } 2293 }
2294 scheme = scheme.substring(0, end); 2294 scheme = scheme.substring(0, end);
2295 if (!dart.notNull(allLowercase)) 2295 if (!dart.notNull(allLowercase))
2296 scheme = scheme.toLowerCase(); 2296 scheme = scheme.toLowerCase();
2297 return scheme; 2297 return scheme;
2298 } 2298 }
2299 static [_makeUserInfo](userInfo, start, end) { 2299 static [_makeUserInfo](userInfo, start, end) {
2300 if (userInfo === null) 2300 if (userInfo == null)
2301 return ""; 2301 return "";
2302 return Uri[_normalize](userInfo, start, end, dart.as(Uri[_userinfoTable], List$(int))); 2302 return Uri[_normalize](userInfo, start, end, dart.as(Uri[_userinfoTable], List$(int)));
2303 } 2303 }
2304 static [_makePath](path, start, end, pathSegments, ensureLeadingSlash, isFil e) { 2304 static [_makePath](path, start, end, pathSegments, ensureLeadingSlash, isFil e) {
2305 if (dart.notNull(path === null) && dart.notNull(pathSegments === null)) 2305 if (dart.notNull(path == null) && dart.notNull(pathSegments == null))
2306 return isFile ? "/" : ""; 2306 return isFile ? "/" : "";
2307 if (dart.notNull(path !== null) && dart.notNull(pathSegments !== null)) { 2307 if (dart.notNull(path != null) && dart.notNull(pathSegments != null)) {
2308 throw new ArgumentError('Both path and pathSegments specified'); 2308 throw new ArgumentError('Both path and pathSegments specified');
2309 } 2309 }
2310 let result = null; 2310 let result = null;
2311 if (path !== null) { 2311 if (path != null) {
2312 result = Uri[_normalize](path, start, end, dart.as(Uri[_pathCharOrSlashT able], List$(int))); 2312 result = Uri[_normalize](path, start, end, dart.as(Uri[_pathCharOrSlashT able], List$(int)));
2313 } else { 2313 } else {
2314 result = pathSegments.map(dart.closureWrap((s) => Uri[_uriEncode](dart.a s(Uri[_pathCharTable], List$(int)), dart.as(s, String)), "(String) → dynamic")). join("/"); 2314 result = pathSegments.map(dart.closureWrap((s) => Uri[_uriEncode](dart.a s(Uri[_pathCharTable], List$(int)), dart.as(s, String)), "(String) → dynamic")). join("/");
2315 } 2315 }
2316 if (dart.dload(result, 'isEmpty')) { 2316 if (dart.dload(result, 'isEmpty')) {
2317 if (isFile) 2317 if (isFile)
2318 return "/"; 2318 return "/";
2319 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dinvoke(result, 'codeUnitAt', 0), Uri[_SLASH]))) { 2319 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dinvoke(result, 'codeUnitAt', 0), Uri[_SLASH]))) {
2320 return `/${result}`; 2320 return `/${result}`;
2321 } 2321 }
2322 return dart.as(result, String); 2322 return dart.as(result, String);
2323 } 2323 }
2324 static [_makeQuery](query, start, end, queryParameters) { 2324 static [_makeQuery](query, start, end, queryParameters) {
2325 if (dart.notNull(query === null) && dart.notNull(queryParameters === null) ) 2325 if (dart.notNull(query == null) && dart.notNull(queryParameters == null))
2326 return null; 2326 return null;
2327 if (dart.notNull(query !== null) && dart.notNull(queryParameters !== null) ) { 2327 if (dart.notNull(query != null) && dart.notNull(queryParameters != null)) {
2328 throw new ArgumentError('Both query and queryParameters specified'); 2328 throw new ArgumentError('Both query and queryParameters specified');
2329 } 2329 }
2330 if (query !== null) 2330 if (query != null)
2331 return Uri[_normalize](query, start, end, dart.as(Uri[_queryCharTable], List$(int))); 2331 return Uri[_normalize](query, start, end, dart.as(Uri[_queryCharTable], List$(int)));
2332 let result = new StringBuffer(); 2332 let result = new StringBuffer();
2333 let first = true; 2333 let first = true;
2334 queryParameters.forEach(dart.closureWrap(((key, value) => { 2334 queryParameters.forEach(dart.closureWrap(((key, value) => {
2335 if (!dart.notNull(first)) { 2335 if (!dart.notNull(first)) {
2336 result.write("&"); 2336 result.write("&");
2337 } 2337 }
2338 first = false; 2338 first = false;
2339 result.write(Uri.encodeQueryComponent(dart.as(key, String))); 2339 result.write(Uri.encodeQueryComponent(dart.as(key, String)));
2340 if (dart.notNull(value !== null) && dart.notNull(dart.dunary('!', dart.d load(value, 'isEmpty')))) { 2340 if (dart.notNull(value != null) && dart.notNull(dart.dunary('!', dart.dl oad(value, 'isEmpty')))) {
2341 result.write("="); 2341 result.write("=");
2342 result.write(Uri.encodeQueryComponent(dart.as(value, String))); 2342 result.write(Uri.encodeQueryComponent(dart.as(value, String)));
2343 } 2343 }
2344 }).bind(this), "(String, String) → void")); 2344 }).bind(this), "(String, String) → void"));
2345 return result.toString(); 2345 return result.toString();
2346 } 2346 }
2347 static [_makeFragment](fragment, start, end) { 2347 static [_makeFragment](fragment, start, end) {
2348 if (fragment === null) 2348 if (fragment == null)
2349 return null; 2349 return null;
2350 return Uri[_normalize](fragment, start, end, dart.as(Uri[_queryCharTable], List$(int))); 2350 return Uri[_normalize](fragment, start, end, dart.as(Uri[_queryCharTable], List$(int)));
2351 } 2351 }
2352 static [_stringOrNullLength](s) { 2352 static [_stringOrNullLength](s) {
2353 return s === null ? 0 : s.length; 2353 return s == null ? 0 : s.length;
2354 } 2354 }
2355 static [_isHexDigit](char) { 2355 static [_isHexDigit](char) {
2356 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char)) 2356 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char))
2357 return dart.notNull(Uri[_ZERO]) <= dart.notNull(char); 2357 return dart.notNull(Uri[_ZERO]) <= dart.notNull(char);
2358 char = 32; 2358 char = 32;
2359 return dart.notNull(Uri[_LOWER_CASE_A]) <= dart.notNull(char) && dart.notN ull(Uri[_LOWER_CASE_F]) >= dart.notNull(char); 2359 return dart.notNull(Uri[_LOWER_CASE_A]) <= dart.notNull(char) && dart.notN ull(Uri[_LOWER_CASE_F]) >= dart.notNull(char);
2360 } 2360 }
2361 static [_hexValue](char) { 2361 static [_hexValue](char) {
2362 dart.assert(Uri[_isHexDigit](char)); 2362 dart.assert(Uri[_isHexDigit](char));
2363 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char)) 2363 if (dart.notNull(Uri[_NINE]) >= dart.notNull(char))
2364 return dart.notNull(char) - dart.notNull(Uri[_ZERO]); 2364 return dart.notNull(char) - dart.notNull(Uri[_ZERO]);
2365 char = 32; 2365 char = 32;
2366 return dart.notNull(char) - (dart.notNull(Uri[_LOWER_CASE_A]) - 10); 2366 return dart.notNull(char) - (dart.notNull(Uri[_LOWER_CASE_A]) - 10);
2367 } 2367 }
2368 static [_normalizeEscape](source, index, lowerCase) { 2368 static [_normalizeEscape](source, index, lowerCase) {
2369 dart.assert(source.codeUnitAt(index) === Uri[_PERCENT]); 2369 dart.assert(source.codeUnitAt(index) == Uri[_PERCENT]);
2370 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) { 2370 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) {
2371 return "%"; 2371 return "%";
2372 } 2372 }
2373 let firstDigit = source.codeUnitAt(dart.notNull(index) + 1); 2373 let firstDigit = source.codeUnitAt(dart.notNull(index) + 1);
2374 let secondDigit = source.codeUnitAt(dart.notNull(index) + 2); 2374 let secondDigit = source.codeUnitAt(dart.notNull(index) + 2);
2375 if (!dart.notNull(Uri[_isHexDigit](firstDigit)) || !dart.notNull(Uri[_isHe xDigit](secondDigit))) { 2375 if (!dart.notNull(Uri[_isHexDigit](firstDigit)) || !dart.notNull(Uri[_isHe xDigit](secondDigit))) {
2376 return "%"; 2376 return "%";
2377 } 2377 }
2378 let value = dart.notNull(Uri[_hexValue](firstDigit)) * 16 + dart.notNull(U ri[_hexValue](secondDigit)); 2378 let value = dart.notNull(Uri[_hexValue](firstDigit)) * 16 + dart.notNull(U ri[_hexValue](secondDigit));
2379 if (Uri[_isUnreservedChar](value)) { 2379 if (Uri[_isUnreservedChar](value)) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 } 2422 }
2423 } 2423 }
2424 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int))); 2424 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int)));
2425 } 2425 }
2426 static [_normalize](component, start, end, charTable) { 2426 static [_normalize](component, start, end, charTable) {
2427 let buffer = null; 2427 let buffer = null;
2428 let sectionStart = start; 2428 let sectionStart = start;
2429 let index = start; 2429 let index = start;
2430 while (dart.notNull(index) < dart.notNull(end)) { 2430 while (dart.notNull(index) < dart.notNull(end)) {
2431 let char = component.codeUnitAt(index); 2431 let char = component.codeUnitAt(index);
2432 if (dart.notNull(char) < 127 && (dart.notNull(charTable.get(dart.notNull (char) >> 4)) & 1 << (dart.notNull(char) & 15)) !== 0) { 2432 if (dart.notNull(char) < 127 && (dart.notNull(charTable.get(dart.notNull (char) >> 4)) & 1 << (dart.notNull(char) & 15)) != 0) {
2433 index = dart.notNull(index) + 1; 2433 index = dart.notNull(index) + 1;
2434 } else { 2434 } else {
2435 let replacement = null; 2435 let replacement = null;
2436 let sourceLength = null; 2436 let sourceLength = null;
2437 if (char === Uri[_PERCENT]) { 2437 if (char == Uri[_PERCENT]) {
2438 replacement = Uri[_normalizeEscape](component, index, false); 2438 replacement = Uri[_normalizeEscape](component, index, false);
2439 if (replacement === null) { 2439 if (replacement == null) {
2440 index = 3; 2440 index = 3;
2441 continue; 2441 continue;
2442 } 2442 }
2443 if (dart.equals("%", replacement)) { 2443 if ("%" == replacement) {
2444 replacement = "%25"; 2444 replacement = "%25";
2445 sourceLength = 1; 2445 sourceLength = 1;
2446 } else { 2446 } else {
2447 sourceLength = 3; 2447 sourceLength = 3;
2448 } 2448 }
2449 } else if (Uri[_isGeneralDelimiter](char)) { 2449 } else if (Uri[_isGeneralDelimiter](char)) {
2450 Uri[_fail](component, index, "Invalid character"); 2450 Uri[_fail](component, index, "Invalid character");
2451 } else { 2451 } else {
2452 sourceLength = 1; 2452 sourceLength = 1;
2453 if ((dart.notNull(char) & 64512) === 55296) { 2453 if ((dart.notNull(char) & 64512) == 55296) {
2454 if (dart.notNull(index) + 1 < dart.notNull(end)) { 2454 if (dart.notNull(index) + 1 < dart.notNull(end)) {
2455 let tail = component.codeUnitAt(dart.notNull(index) + 1); 2455 let tail = component.codeUnitAt(dart.notNull(index) + 1);
2456 if ((dart.notNull(tail) & 64512) === 56320) { 2456 if ((dart.notNull(tail) & 64512) == 56320) {
2457 sourceLength = 2; 2457 sourceLength = 2;
2458 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023; 2458 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023;
2459 } 2459 }
2460 } 2460 }
2461 } 2461 }
2462 replacement = Uri[_escapeChar](char); 2462 replacement = Uri[_escapeChar](char);
2463 } 2463 }
2464 if (buffer === null) 2464 if (buffer == null)
2465 buffer = new StringBuffer(); 2465 buffer = new StringBuffer();
2466 buffer.write(component.substring(sectionStart, index)); 2466 buffer.write(component.substring(sectionStart, index));
2467 buffer.write(replacement); 2467 buffer.write(replacement);
2468 index = sourceLength; 2468 index = sourceLength;
2469 sectionStart = index; 2469 sectionStart = index;
2470 } 2470 }
2471 } 2471 }
2472 if (buffer === null) { 2472 if (buffer == null) {
2473 return component.substring(start, end); 2473 return component.substring(start, end);
2474 } 2474 }
2475 if (dart.notNull(sectionStart) < dart.notNull(end)) { 2475 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2476 buffer.write(component.substring(sectionStart, end)); 2476 buffer.write(component.substring(sectionStart, end));
2477 } 2477 }
2478 return buffer.toString(); 2478 return buffer.toString();
2479 } 2479 }
2480 static [_isSchemeCharacter](ch) { 2480 static [_isSchemeCharacter](ch) {
2481 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary(Ur i[_schemeTable].get(dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0)); 2481 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary(Ur i[_schemeTable].get(dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
2482 } 2482 }
2483 static [_isGeneralDelimiter](ch) { 2483 static [_isGeneralDelimiter](ch) {
2484 return dart.notNull(ch) <= dart.notNull(Uri[_RIGHT_BRACKET]) && dart.notNu ll(!dart.equals(dart.dbinary(Uri[_genDelimitersTable].get(dart.notNull(ch) >> 4) , '&', 1 << (dart.notNull(ch) & 15)), 0)); 2484 return dart.notNull(ch) <= dart.notNull(Uri[_RIGHT_BRACKET]) && dart.notNu ll(!dart.equals(dart.dbinary(Uri[_genDelimitersTable].get(dart.notNull(ch) >> 4) , '&', 1 << (dart.notNull(ch) & 15)), 0));
2485 } 2485 }
2486 get isAbsolute() { 2486 get isAbsolute() {
2487 return dart.notNull(!dart.equals(this.scheme, "")) && dart.notNull(dart.eq uals(this.fragment, "")); 2487 return dart.notNull(this.scheme != "") && dart.notNull(this.fragment == "" );
2488 } 2488 }
2489 [_merge](base, reference) { 2489 [_merge](base, reference) {
2490 if (base.isEmpty) 2490 if (base.isEmpty)
2491 return `/${reference}`; 2491 return `/${reference}`;
2492 let backCount = 0; 2492 let backCount = 0;
2493 let refStart = 0; 2493 let refStart = 0;
2494 while (reference.startsWith("../", refStart)) { 2494 while (reference.startsWith("../", refStart)) {
2495 refStart = 3; 2495 refStart = 3;
2496 backCount = dart.notNull(backCount) + 1; 2496 backCount = dart.notNull(backCount) + 1;
2497 } 2497 }
2498 let baseEnd = base.lastIndexOf('/'); 2498 let baseEnd = base.lastIndexOf('/');
2499 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) { 2499 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) {
2500 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1); 2500 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1);
2501 if (dart.notNull(newEnd) < 0) { 2501 if (dart.notNull(newEnd) < 0) {
2502 break; 2502 break;
2503 } 2503 }
2504 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd); 2504 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
2505 if ((delta === 2 || delta === 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) === Uri[_DOT] && (delta === 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) === Uri[_DOT])) { 2505 if ((delta == 2 || delta == 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) == Uri[_DOT] && (delta == 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) == Uri[_DOT])) {
2506 break; 2506 break;
2507 } 2507 }
2508 baseEnd = newEnd; 2508 baseEnd = newEnd;
2509 backCount = dart.notNull(backCount) - 1; 2509 backCount = dart.notNull(backCount) - 1;
2510 } 2510 }
2511 return String['+'](base.substring(0, dart.notNull(baseEnd) + 1), reference .substring(dart.notNull(refStart) - 3 * dart.notNull(backCount))); 2511 return String['+'](base.substring(0, dart.notNull(baseEnd) + 1), reference .substring(dart.notNull(refStart) - 3 * dart.notNull(backCount)));
2512 } 2512 }
2513 [_hasDotSegments](path) { 2513 [_hasDotSegments](path) {
2514 if (dart.notNull(path.length) > 0 && path.codeUnitAt(0) === Uri[_DOT]) 2514 if (dart.notNull(path.length) > 0 && path.codeUnitAt(0) == Uri[_DOT])
2515 return true; 2515 return true;
2516 let index = path.indexOf("/."); 2516 let index = path.indexOf("/.");
2517 return index !== -1; 2517 return index != -1;
2518 } 2518 }
2519 [_removeDotSegments](path) { 2519 [_removeDotSegments](path) {
2520 if (!dart.notNull(this[_hasDotSegments](path))) 2520 if (!dart.notNull(this[_hasDotSegments](path)))
2521 return path; 2521 return path;
2522 let output = dart.as(new List.from([]), List$(String)); 2522 let output = dart.as(new List.from([]), List$(String));
2523 let appendSlash = false; 2523 let appendSlash = false;
2524 for (let segment of path.split("/")) { 2524 for (let segment of path.split("/")) {
2525 appendSlash = false; 2525 appendSlash = false;
2526 if (dart.equals(segment, "..")) { 2526 if (segment == "..") {
2527 if (!dart.notNull(output.isEmpty) && (output.length !== 1 || dart.notN ull(!dart.equals(output.get(0), "")))) 2527 if (!dart.notNull(output.isEmpty) && (output.length != 1 || dart.notNu ll(output.get(0) != "")))
2528 output.removeLast(); 2528 output.removeLast();
2529 appendSlash = true; 2529 appendSlash = true;
2530 } else if (dart.equals(".", segment)) { 2530 } else if ("." == segment) {
2531 appendSlash = true; 2531 appendSlash = true;
2532 } else { 2532 } else {
2533 output.add(segment); 2533 output.add(segment);
2534 } 2534 }
2535 } 2535 }
2536 if (appendSlash) 2536 if (appendSlash)
2537 output.add(""); 2537 output.add("");
2538 return output.join("/"); 2538 return output.join("/");
2539 } 2539 }
2540 resolve(reference) { 2540 resolve(reference) {
(...skipping 20 matching lines...) Expand all
2561 } else { 2561 } else {
2562 targetScheme = this.scheme; 2562 targetScheme = this.scheme;
2563 if (reference.hasAuthority) { 2563 if (reference.hasAuthority) {
2564 targetUserInfo = reference.userInfo; 2564 targetUserInfo = reference.userInfo;
2565 targetHost = reference.host; 2565 targetHost = reference.host;
2566 targetPort = Uri[_makePort](reference.hasPort ? reference.port : null, targetScheme); 2566 targetPort = Uri[_makePort](reference.hasPort ? reference.port : null, targetScheme);
2567 targetPath = this[_removeDotSegments](reference.path); 2567 targetPath = this[_removeDotSegments](reference.path);
2568 if (reference.hasQuery) 2568 if (reference.hasQuery)
2569 targetQuery = reference.query; 2569 targetQuery = reference.query;
2570 } else { 2570 } else {
2571 if (dart.equals(reference.path, "")) { 2571 if (reference.path == "") {
2572 targetPath = this[_path]; 2572 targetPath = this[_path];
2573 if (reference.hasQuery) { 2573 if (reference.hasQuery) {
2574 targetQuery = reference.query; 2574 targetQuery = reference.query;
2575 } else { 2575 } else {
2576 targetQuery = this[_query]; 2576 targetQuery = this[_query];
2577 } 2577 }
2578 } else { 2578 } else {
2579 if (reference.path.startsWith("/")) { 2579 if (reference.path.startsWith("/")) {
2580 targetPath = this[_removeDotSegments](reference.path); 2580 targetPath = this[_removeDotSegments](reference.path);
2581 } else { 2581 } else {
2582 targetPath = this[_removeDotSegments](this[_merge](this[_path], re ference.path)); 2582 targetPath = this[_removeDotSegments](this[_merge](this[_path], re ference.path));
2583 } 2583 }
2584 if (reference.hasQuery) 2584 if (reference.hasQuery)
2585 targetQuery = reference.query; 2585 targetQuery = reference.query;
2586 } 2586 }
2587 targetUserInfo = this[_userInfo]; 2587 targetUserInfo = this[_userInfo];
2588 targetHost = this[_host]; 2588 targetHost = this[_host];
2589 targetPort = this[_port]; 2589 targetPort = this[_port];
2590 } 2590 }
2591 } 2591 }
2592 let fragment = reference.hasFragment ? reference.fragment : null; 2592 let fragment = reference.hasFragment ? reference.fragment : null;
2593 return new Uri[_internal$](targetScheme, targetUserInfo, targetHost, targe tPort, targetPath, targetQuery, fragment); 2593 return new Uri[_internal$](targetScheme, targetUserInfo, targetHost, targe tPort, targetPath, targetQuery, fragment);
2594 } 2594 }
2595 get hasAuthority() { 2595 get hasAuthority() {
2596 return this[_host] !== null; 2596 return this[_host] != null;
2597 } 2597 }
2598 get hasPort() { 2598 get hasPort() {
2599 return this[_port] !== null; 2599 return this[_port] != null;
2600 } 2600 }
2601 get hasQuery() { 2601 get hasQuery() {
2602 return this[_query] !== null; 2602 return this[_query] != null;
2603 } 2603 }
2604 get hasFragment() { 2604 get hasFragment() {
2605 return this[_fragment] !== null; 2605 return this[_fragment] != null;
2606 } 2606 }
2607 get origin() { 2607 get origin() {
2608 if (dart.notNull(dart.equals(this.scheme, "")) || dart.notNull(this[_host] === null) || dart.notNull(dart.equals(this[_host], ""))) { 2608 if (dart.notNull(this.scheme == "") || dart.notNull(this[_host] == null) | | dart.notNull(this[_host] == "")) {
2609 throw new StateError(`Cannot use origin without a scheme: ${this}`); 2609 throw new StateError(`Cannot use origin without a scheme: ${this}`);
2610 } 2610 }
2611 if (dart.notNull(!dart.equals(this.scheme, "http")) && dart.notNull(!dart. equals(this.scheme, "https"))) { 2611 if (dart.notNull(this.scheme != "http") && dart.notNull(this.scheme != "ht tps")) {
2612 throw new StateError(`Origin is only applicable schemes http and https: ${this}`); 2612 throw new StateError(`Origin is only applicable schemes http and https: ${this}`);
2613 } 2613 }
2614 if (this[_port] === null) 2614 if (this[_port] == null)
2615 return `${this.scheme}://${this[_host]}`; 2615 return `${this.scheme}://${this[_host]}`;
2616 return `${this.scheme}://${this[_host]}:${this[_port]}`; 2616 return `${this.scheme}://${this[_host]}:${this[_port]}`;
2617 } 2617 }
2618 toFilePath(opts) { 2618 toFilePath(opts) {
2619 let windows = opts && 'windows' in opts ? opts.windows : null; 2619 let windows = opts && 'windows' in opts ? opts.windows : null;
2620 if (dart.notNull(!dart.equals(this.scheme, "")) && dart.notNull(!dart.equa ls(this.scheme, "file"))) { 2620 if (dart.notNull(this.scheme != "") && dart.notNull(this.scheme != "file") ) {
2621 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch eme} URI`); 2621 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch eme} URI`);
2622 } 2622 }
2623 if (!dart.equals(this.query, "")) { 2623 if (this.query != "") {
2624 throw new UnsupportedError("Cannot extract a file path from a URI with a query component"); 2624 throw new UnsupportedError("Cannot extract a file path from a URI with a query component");
2625 } 2625 }
2626 if (!dart.equals(this.fragment, "")) { 2626 if (this.fragment != "") {
2627 throw new UnsupportedError("Cannot extract a file path from a URI with a fragment component"); 2627 throw new UnsupportedError("Cannot extract a file path from a URI with a fragment component");
2628 } 2628 }
2629 if (windows === null) 2629 if (windows == null)
2630 windows = Uri[_isWindows]; 2630 windows = Uri[_isWindows];
2631 return windows ? this[_toWindowsFilePath]() : this[_toFilePath](); 2631 return windows ? this[_toWindowsFilePath]() : this[_toFilePath]();
2632 } 2632 }
2633 [_toFilePath]() { 2633 [_toFilePath]() {
2634 if (!dart.equals(this.host, "")) { 2634 if (this.host != "") {
2635 throw new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"); 2635 throw new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority");
2636 } 2636 }
2637 Uri[_checkNonWindowsPathReservedCharacters](this.pathSegments, false); 2637 Uri[_checkNonWindowsPathReservedCharacters](this.pathSegments, false);
2638 let result = new StringBuffer(); 2638 let result = new StringBuffer();
2639 if (this[_isPathAbsolute]) 2639 if (this[_isPathAbsolute])
2640 result.write("/"); 2640 result.write("/");
2641 result.writeAll(this.pathSegments, "/"); 2641 result.writeAll(this.pathSegments, "/");
2642 return result.toString(); 2642 return result.toString();
2643 } 2643 }
2644 [_toWindowsFilePath]() { 2644 [_toWindowsFilePath]() {
2645 let hasDriveLetter = false; 2645 let hasDriveLetter = false;
2646 let segments = this.pathSegments; 2646 let segments = this.pathSegments;
2647 if (dart.notNull(segments.length) > 0 && segments.get(0).length === 2 && s egments.get(0).codeUnitAt(1) === Uri[_COLON]) { 2647 if (dart.notNull(segments.length) > 0 && segments.get(0).length == 2 && se gments.get(0).codeUnitAt(1) == Uri[_COLON]) {
2648 Uri[_checkWindowsDriveLetter](segments.get(0).codeUnitAt(0), false); 2648 Uri[_checkWindowsDriveLetter](segments.get(0).codeUnitAt(0), false);
2649 Uri[_checkWindowsPathReservedCharacters](segments, false, 1); 2649 Uri[_checkWindowsPathReservedCharacters](segments, false, 1);
2650 hasDriveLetter = true; 2650 hasDriveLetter = true;
2651 } else { 2651 } else {
2652 Uri[_checkWindowsPathReservedCharacters](segments, false); 2652 Uri[_checkWindowsPathReservedCharacters](segments, false);
2653 } 2653 }
2654 let result = new StringBuffer(); 2654 let result = new StringBuffer();
2655 if (dart.notNull(this[_isPathAbsolute]) && !dart.notNull(hasDriveLetter)) 2655 if (dart.notNull(this[_isPathAbsolute]) && !dart.notNull(hasDriveLetter))
2656 result.write("\\"); 2656 result.write("\\");
2657 if (!dart.equals(this.host, "")) { 2657 if (this.host != "") {
2658 result.write("\\"); 2658 result.write("\\");
2659 result.write(this.host); 2659 result.write(this.host);
2660 result.write("\\"); 2660 result.write("\\");
2661 } 2661 }
2662 result.writeAll(segments, "\\"); 2662 result.writeAll(segments, "\\");
2663 if (dart.notNull(hasDriveLetter) && segments.length === 1) 2663 if (dart.notNull(hasDriveLetter) && segments.length == 1)
2664 result.write("\\"); 2664 result.write("\\");
2665 return result.toString(); 2665 return result.toString();
2666 } 2666 }
2667 get [_isPathAbsolute]() { 2667 get [_isPathAbsolute]() {
2668 if (dart.notNull(this.path === null) || dart.notNull(this.path.isEmpty)) 2668 if (dart.notNull(this.path == null) || dart.notNull(this.path.isEmpty))
2669 return false; 2669 return false;
2670 return this.path.startsWith('/'); 2670 return this.path.startsWith('/');
2671 } 2671 }
2672 [_writeAuthority](ss) { 2672 [_writeAuthority](ss) {
2673 if (this[_userInfo].isNotEmpty) { 2673 if (this[_userInfo].isNotEmpty) {
2674 ss.write(this[_userInfo]); 2674 ss.write(this[_userInfo]);
2675 ss.write("@"); 2675 ss.write("@");
2676 } 2676 }
2677 if (this[_host] !== null) 2677 if (this[_host] != null)
2678 ss.write(this[_host]); 2678 ss.write(this[_host]);
2679 if (this[_port] !== null) { 2679 if (this[_port] != null) {
2680 ss.write(":"); 2680 ss.write(":");
2681 ss.write(this[_port]); 2681 ss.write(this[_port]);
2682 } 2682 }
2683 } 2683 }
2684 toString() { 2684 toString() {
2685 let sb = new StringBuffer(); 2685 let sb = new StringBuffer();
2686 Uri[_addIfNonEmpty](sb, this.scheme, this.scheme, ':'); 2686 Uri[_addIfNonEmpty](sb, this.scheme, this.scheme, ':');
2687 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path.startsWith(" //")) || dart.notNull(dart.equals(this.scheme, "file"))) { 2687 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path.startsWith(" //")) || dart.notNull(this.scheme == "file")) {
2688 sb.write("//"); 2688 sb.write("//");
2689 this[_writeAuthority](sb); 2689 this[_writeAuthority](sb);
2690 } 2690 }
2691 sb.write(this.path); 2691 sb.write(this.path);
2692 if (this[_query] !== null) { 2692 if (this[_query] != null) {
2693 sb.write("?"); 2693 sb.write("?");
2694 sb.write(this[_query]); 2694 sb.write(this[_query]);
2695 } 2695 }
2696 if (this[_fragment] !== null) { 2696 if (this[_fragment] != null) {
2697 sb.write("#"); 2697 sb.write("#");
2698 sb.write(this[_fragment]); 2698 sb.write(this[_fragment]);
2699 } 2699 }
2700 return sb.toString(); 2700 return sb.toString();
2701 } 2701 }
2702 ['=='](other) { 2702 ['=='](other) {
2703 if (!dart.is(other, Uri)) 2703 if (!dart.is(other, Uri))
2704 return false; 2704 return false;
2705 let uri = dart.as(other, Uri); 2705 let uri = dart.as(other, Uri);
2706 return dart.notNull(dart.equals(this.scheme, uri.scheme)) && this.hasAutho rity === uri.hasAuthority && dart.notNull(dart.equals(this.userInfo, uri.userInf o)) && dart.notNull(dart.equals(this.host, uri.host)) && this.port === uri.port && dart.notNull(dart.equals(this.path, uri.path)) && this.hasQuery === uri.hasQu ery && dart.notNull(dart.equals(this.query, uri.query)) && this.hasFragment === uri.hasFragment && dart.notNull(dart.equals(this.fragment, uri.fragment)); 2706 return dart.notNull(this.scheme == uri.scheme) && this.hasAuthority == uri .hasAuthority && dart.notNull(this.userInfo == uri.userInfo) && dart.notNull(thi s.host == uri.host) && this.port == uri.port && dart.notNull(this.path == uri.pa th) && this.hasQuery == uri.hasQuery && dart.notNull(this.query == uri.query) && this.hasFragment == uri.hasFragment && dart.notNull(this.fragment == uri.fragme nt);
2707 } 2707 }
2708 get hashCode() { 2708 get hashCode() {
2709 // Function combine: (dynamic, dynamic) → int 2709 // Function combine: (dynamic, dynamic) → int
2710 function combine(part, current) { 2710 function combine(part, current) {
2711 return dart.as(dart.dbinary(dart.dbinary(dart.dbinary(current, '*', 31), '+', dart.dload(part, 'hashCode')), '&', 1073741823), int); 2711 return dart.as(dart.dbinary(dart.dbinary(dart.dbinary(current, '*', 31), '+', dart.dload(part, 'hashCode')), '&', 1073741823), int);
2712 } 2712 }
2713 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) ))))); 2713 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) )))));
2714 } 2714 }
2715 static [_addIfNonEmpty](sb, test, first, second) { 2715 static [_addIfNonEmpty](sb, test, first, second) {
2716 if (!dart.equals("", test)) { 2716 if ("" != test) {
2717 sb.write(first); 2717 sb.write(first);
2718 sb.write(second); 2718 sb.write(second);
2719 } 2719 }
2720 } 2720 }
2721 static encodeComponent(component) { 2721 static encodeComponent(component) {
2722 return Uri[_uriEncode](dart.as(Uri[_unreserved2396Table], List$(int)), com ponent); 2722 return Uri[_uriEncode](dart.as(Uri[_unreserved2396Table], List$(int)), com ponent);
2723 } 2723 }
2724 static encodeQueryComponent(component, opts) { 2724 static encodeQueryComponent(component, opts) {
2725 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2725 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2726 return Uri[_uriEncode](dart.as(Uri[_unreservedTable], List$(int)), compone nt, {encoding: encoding, spaceToPlus: true}); 2726 return Uri[_uriEncode](dart.as(Uri[_unreservedTable], List$(int)), compone nt, {encoding: encoding, spaceToPlus: true});
2727 } 2727 }
2728 static decodeComponent(encodedComponent) { 2728 static decodeComponent(encodedComponent) {
2729 return Uri[_uriDecode](encodedComponent); 2729 return Uri[_uriDecode](encodedComponent);
2730 } 2730 }
2731 static decodeQueryComponent(encodedComponent, opts) { 2731 static decodeQueryComponent(encodedComponent, opts) {
2732 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2732 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2733 return Uri[_uriDecode](encodedComponent, {plusToSpace: true, encoding: enc oding}); 2733 return Uri[_uriDecode](encodedComponent, {plusToSpace: true, encoding: enc oding});
2734 } 2734 }
2735 static encodeFull(uri) { 2735 static encodeFull(uri) {
2736 return Uri[_uriEncode](dart.as(Uri[_encodeFullTable], List$(int)), uri); 2736 return Uri[_uriEncode](dart.as(Uri[_encodeFullTable], List$(int)), uri);
2737 } 2737 }
2738 static decodeFull(uri) { 2738 static decodeFull(uri) {
2739 return Uri[_uriDecode](uri); 2739 return Uri[_uriDecode](uri);
2740 } 2740 }
2741 static splitQueryString(query, opts) { 2741 static splitQueryString(query, opts) {
2742 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2742 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2743 return dart.as(query.split("&").fold(dart.map(), dart.closureWrap((map, el ement) => { 2743 return dart.as(query.split("&").fold(dart.map(), dart.closureWrap((map, el ement) => {
2744 let index = dart.as(dart.dinvoke(element, 'indexOf', "="), int); 2744 let index = dart.as(dart.dinvoke(element, 'indexOf', "="), int);
2745 if (index === -1) { 2745 if (index == -1) {
2746 if (!dart.equals(element, "")) { 2746 if (!dart.equals(element, "")) {
2747 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(element, String ), {encoding: encoding}), ""); 2747 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(element, String ), {encoding: encoding}), "");
2748 } 2748 }
2749 } else if (index !== 0) { 2749 } else if (index != 0) {
2750 let key = dart.dinvoke(element, 'substring', 0, index); 2750 let key = dart.dinvoke(element, 'substring', 0, index);
2751 let value = dart.dinvoke(element, 'substring', dart.notNull(index) + 1 ); 2751 let value = dart.dinvoke(element, 'substring', dart.notNull(index) + 1 );
2752 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding: encoding})); 2752 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding: encoding}));
2753 } 2753 }
2754 return map; 2754 return map;
2755 }, "(dynamic, String) → dynamic")), Map$(String, String)); 2755 }, "(dynamic, String) → dynamic")), Map$(String, String));
2756 } 2756 }
2757 static parseIPv4Address(host) { 2757 static parseIPv4Address(host) {
2758 // Function error: (String) → void 2758 // Function error: (String) → void
2759 function error(msg) { 2759 function error(msg) {
2760 throw new FormatException(`Illegal IPv4 address, ${msg}`); 2760 throw new FormatException(`Illegal IPv4 address, ${msg}`);
2761 } 2761 }
2762 let bytes = host.split('.'); 2762 let bytes = host.split('.');
2763 if (bytes.length !== 4) { 2763 if (bytes.length != 4) {
2764 error('IPv4 address should contain exactly 4 parts'); 2764 error('IPv4 address should contain exactly 4 parts');
2765 } 2765 }
2766 return dart.as(bytes.map(dart.closureWrap((byteString) => { 2766 return dart.as(bytes.map(dart.closureWrap((byteString) => {
2767 let byte = int.parse(dart.as(byteString, String)); 2767 let byte = int.parse(dart.as(byteString, String));
2768 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) { 2768 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
2769 error('each part must be in the range of `0..255`'); 2769 error('each part must be in the range of `0..255`');
2770 } 2770 }
2771 return byte; 2771 return byte;
2772 }, "(String) → dynamic")).toList(), List$(int)); 2772 }, "(String) → dynamic")).toList(), List$(int));
2773 } 2773 }
2774 static parseIPv6Address(host, start, end) { 2774 static parseIPv6Address(host, start, end) {
2775 if (start === void 0) 2775 if (start === void 0)
2776 start = 0; 2776 start = 0;
2777 if (end === void 0) 2777 if (end === void 0)
2778 end = null; 2778 end = null;
2779 if (end === null) 2779 if (end == null)
2780 end = host.length; 2780 end = host.length;
2781 // Function error: (String, [dynamic]) → void 2781 // Function error: (String, [dynamic]) → void
2782 function error(msg, position) { 2782 function error(msg, position) {
2783 if (position === void 0) 2783 if (position === void 0)
2784 position = null; 2784 position = null;
2785 throw new FormatException(`Illegal IPv6 address, ${msg}`, host, dart.as( position, int)); 2785 throw new FormatException(`Illegal IPv6 address, ${msg}`, host, dart.as( position, int));
2786 } 2786 }
2787 // Function parseHex: (int, int) → int 2787 // Function parseHex: (int, int) → int
2788 function parseHex(start, end) { 2788 function parseHex(start, end) {
2789 if (dart.notNull(end) - dart.notNull(start) > 4) { 2789 if (dart.notNull(end) - dart.notNull(start) > 4) {
2790 error('an IPv6 part can only contain a maximum of 4 hex digits', start ); 2790 error('an IPv6 part can only contain a maximum of 4 hex digits', start );
2791 } 2791 }
2792 let value = int.parse(host.substring(start, end), {radix: 16}); 2792 let value = int.parse(host.substring(start, end), {radix: 16});
2793 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) { 2793 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
2794 error('each part must be in the range of `0x0..0xFFFF`', start); 2794 error('each part must be in the range of `0x0..0xFFFF`', start);
2795 } 2795 }
2796 return value; 2796 return value;
2797 } 2797 }
2798 if (dart.notNull(host.length) < 2) 2798 if (dart.notNull(host.length) < 2)
2799 error('address is too short'); 2799 error('address is too short');
2800 let parts = dart.as(new List.from([]), List$(int)); 2800 let parts = dart.as(new List.from([]), List$(int));
2801 let wildcardSeen = false; 2801 let wildcardSeen = false;
2802 let partStart = start; 2802 let partStart = start;
2803 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 2803 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
2804 if (host.codeUnitAt(i) === Uri[_COLON]) { 2804 if (host.codeUnitAt(i) == Uri[_COLON]) {
2805 if (i === start) { 2805 if (i == start) {
2806 i = dart.notNull(i) + 1; 2806 i = dart.notNull(i) + 1;
2807 if (host.codeUnitAt(i) !== Uri[_COLON]) { 2807 if (host.codeUnitAt(i) != Uri[_COLON]) {
2808 error('invalid start colon.', i); 2808 error('invalid start colon.', i);
2809 } 2809 }
2810 partStart = i; 2810 partStart = i;
2811 } 2811 }
2812 if (i === partStart) { 2812 if (i == partStart) {
2813 if (wildcardSeen) { 2813 if (wildcardSeen) {
2814 error('only one wildcard `::` is allowed', i); 2814 error('only one wildcard `::` is allowed', i);
2815 } 2815 }
2816 wildcardSeen = true; 2816 wildcardSeen = true;
2817 parts.add(-1); 2817 parts.add(-1);
2818 } else { 2818 } else {
2819 parts.add(parseHex(partStart, i)); 2819 parts.add(parseHex(partStart, i));
2820 } 2820 }
2821 partStart = dart.notNull(i) + 1; 2821 partStart = dart.notNull(i) + 1;
2822 } 2822 }
2823 } 2823 }
2824 if (parts.length === 0) 2824 if (parts.length == 0)
2825 error('too few parts'); 2825 error('too few parts');
2826 let atEnd = partStart === end; 2826 let atEnd = partStart == end;
2827 let isLastWildcard = parts.last === -1; 2827 let isLastWildcard = parts.last == -1;
2828 if (dart.notNull(atEnd) && !dart.notNull(isLastWildcard)) { 2828 if (dart.notNull(atEnd) && !dart.notNull(isLastWildcard)) {
2829 error('expected a part after last `:`', end); 2829 error('expected a part after last `:`', end);
2830 } 2830 }
2831 if (!dart.notNull(atEnd)) { 2831 if (!dart.notNull(atEnd)) {
2832 try { 2832 try {
2833 parts.add(parseHex(partStart, end)); 2833 parts.add(parseHex(partStart, end));
2834 } catch (e) { 2834 } catch (e) {
2835 try { 2835 try {
2836 let last = Uri.parseIPv4Address(host.substring(partStart, end)); 2836 let last = Uri.parseIPv4Address(host.substring(partStart, end));
2837 parts.add(dart.notNull(last.get(0)) << 8 | dart.notNull(last.get(1)) ); 2837 parts.add(dart.notNull(last.get(0)) << 8 | dart.notNull(last.get(1)) );
2838 parts.add(dart.notNull(last.get(2)) << 8 | dart.notNull(last.get(3)) ); 2838 parts.add(dart.notNull(last.get(2)) << 8 | dart.notNull(last.get(3)) );
2839 } catch (e) { 2839 } catch (e) {
2840 error('invalid end of IPv6 address.', partStart); 2840 error('invalid end of IPv6 address.', partStart);
2841 } 2841 }
2842 2842
2843 } 2843 }
2844 2844
2845 } 2845 }
2846 if (wildcardSeen) { 2846 if (wildcardSeen) {
2847 if (dart.notNull(parts.length) > 7) { 2847 if (dart.notNull(parts.length) > 7) {
2848 error('an address with a wildcard must have less than 7 parts'); 2848 error('an address with a wildcard must have less than 7 parts');
2849 } 2849 }
2850 } else if (parts.length !== 8) { 2850 } else if (parts.length != 8) {
2851 error('an address without a wildcard must contain exactly 8 parts'); 2851 error('an address without a wildcard must contain exactly 8 parts');
2852 } 2852 }
2853 let bytes = new List(16); 2853 let bytes = new List(16);
2854 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts.length); i = dart.notNull(i) + 1) { 2854 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts.length); i = dart.notNull(i) + 1) {
2855 let value = parts.get(i); 2855 let value = parts.get(i);
2856 if (value === -1) { 2856 if (value == -1) {
2857 let wildCardLength = 9 - dart.notNull(parts.length); 2857 let wildCardLength = 9 - dart.notNull(parts.length);
2858 for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); j = da rt.notNull(j) + 1) { 2858 for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); j = da rt.notNull(j) + 1) {
2859 bytes.set(index, 0); 2859 bytes.set(index, 0);
2860 bytes.set(dart.notNull(index) + 1, 0); 2860 bytes.set(dart.notNull(index) + 1, 0);
2861 index = 2; 2861 index = 2;
2862 } 2862 }
2863 } else { 2863 } else {
2864 bytes.set(index, dart.notNull(value) >> 8); 2864 bytes.set(index, dart.notNull(value) >> 8);
2865 bytes.set(dart.notNull(index) + 1, dart.notNull(value) & 255); 2865 bytes.set(dart.notNull(index) + 1, dart.notNull(value) & 255);
2866 index = 2; 2866 index = 2;
2867 } 2867 }
2868 } 2868 }
2869 return dart.as(bytes, List$(int)); 2869 return dart.as(bytes, List$(int));
2870 } 2870 }
2871 static [_uriEncode](canonicalTable, text, opts) { 2871 static [_uriEncode](canonicalTable, text, opts) {
2872 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2872 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2873 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false ; 2873 let spaceToPlus = opts && 'spaceToPlus' in opts ? opts.spaceToPlus : false ;
2874 // Function byteToHex: (dynamic, dynamic) → dynamic 2874 // Function byteToHex: (dynamic, dynamic) → dynamic
2875 function byteToHex(byte, buffer) { 2875 function byteToHex(byte, buffer) {
2876 let hex = '0123456789ABCDEF'; 2876 let hex = '0123456789ABCDEF';
2877 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '>>', 4), int))); 2877 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '>>', 4), int)));
2878 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '&', 15), int))); 2878 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '&', 15), int)));
2879 } 2879 }
2880 let result = new StringBuffer(); 2880 let result = new StringBuffer();
2881 let bytes = encoding.encode(text); 2881 let bytes = encoding.encode(text);
2882 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not Null(i) + 1) { 2882 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); i = dart.not Null(i) + 1) {
2883 let byte = bytes.get(i); 2883 let byte = bytes.get(i);
2884 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable.get(dart.no tNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) !== 0) { 2884 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable.get(dart.no tNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) != 0) {
2885 result.writeCharCode(byte); 2885 result.writeCharCode(byte);
2886 } else if (dart.notNull(spaceToPlus) && byte === Uri[_SPACE]) { 2886 } else if (dart.notNull(spaceToPlus) && byte == Uri[_SPACE]) {
2887 result.writeCharCode(Uri[_PLUS]); 2887 result.writeCharCode(Uri[_PLUS]);
2888 } else { 2888 } else {
2889 result.writeCharCode(Uri[_PERCENT]); 2889 result.writeCharCode(Uri[_PERCENT]);
2890 byteToHex(byte, result); 2890 byteToHex(byte, result);
2891 } 2891 }
2892 } 2892 }
2893 return result.toString(); 2893 return result.toString();
2894 } 2894 }
2895 static [_hexCharPairToByte](s, pos) { 2895 static [_hexCharPairToByte](s, pos) {
2896 let byte = 0; 2896 let byte = 0;
(...skipping 11 matching lines...) Expand all
2908 } 2908 }
2909 } 2909 }
2910 return byte; 2910 return byte;
2911 } 2911 }
2912 static [_uriDecode](text, opts) { 2912 static [_uriDecode](text, opts) {
2913 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false ; 2913 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false ;
2914 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 2914 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
2915 let simple = true; 2915 let simple = true;
2916 for (let i = 0; dart.notNull(i) < dart.notNull(text.length) && dart.notNul l(simple); i = dart.notNull(i) + 1) { 2916 for (let i = 0; dart.notNull(i) < dart.notNull(text.length) && dart.notNul l(simple); i = dart.notNull(i) + 1) {
2917 let codeUnit = text.codeUnitAt(i); 2917 let codeUnit = text.codeUnitAt(i);
2918 simple = codeUnit !== Uri[_PERCENT] && codeUnit !== Uri[_PLUS]; 2918 simple = codeUnit != Uri[_PERCENT] && codeUnit != Uri[_PLUS];
2919 } 2919 }
2920 let bytes = null; 2920 let bytes = null;
2921 if (simple) { 2921 if (simple) {
2922 if (dart.notNull(dart.equals(encoding, convert.UTF8)) || dart.notNull(da rt.equals(encoding, convert.LATIN1))) { 2922 if (dart.notNull(dart.equals(encoding, convert.UTF8)) || dart.notNull(da rt.equals(encoding, convert.LATIN1))) {
2923 return text; 2923 return text;
2924 } else { 2924 } else {
2925 bytes = text.codeUnits; 2925 bytes = text.codeUnits;
2926 } 2926 }
2927 } else { 2927 } else {
2928 bytes = dart.as(new List(), List$(int)); 2928 bytes = dart.as(new List(), List$(int));
2929 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.no tNull(i) + 1) { 2929 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); i = dart.no tNull(i) + 1) {
2930 let codeUnit = text.codeUnitAt(i); 2930 let codeUnit = text.codeUnitAt(i);
2931 if (dart.notNull(codeUnit) > 127) { 2931 if (dart.notNull(codeUnit) > 127) {
2932 throw new ArgumentError("Illegal percent encoding in URI"); 2932 throw new ArgumentError("Illegal percent encoding in URI");
2933 } 2933 }
2934 if (codeUnit === Uri[_PERCENT]) { 2934 if (codeUnit == Uri[_PERCENT]) {
2935 if (dart.notNull(i) + 3 > dart.notNull(text.length)) { 2935 if (dart.notNull(i) + 3 > dart.notNull(text.length)) {
2936 throw new ArgumentError('Truncated URI'); 2936 throw new ArgumentError('Truncated URI');
2937 } 2937 }
2938 bytes.add(Uri[_hexCharPairToByte](text, dart.notNull(i) + 1)); 2938 bytes.add(Uri[_hexCharPairToByte](text, dart.notNull(i) + 1));
2939 i = 2; 2939 i = 2;
2940 } else if (dart.notNull(plusToSpace) && codeUnit === Uri[_PLUS]) { 2940 } else if (dart.notNull(plusToSpace) && codeUnit == Uri[_PLUS]) {
2941 bytes.add(Uri[_SPACE]); 2941 bytes.add(Uri[_SPACE]);
2942 } else { 2942 } else {
2943 bytes.add(codeUnit); 2943 bytes.add(codeUnit);
2944 } 2944 }
2945 } 2945 }
2946 } 2946 }
2947 return encoding.decode(bytes); 2947 return encoding.decode(bytes);
2948 } 2948 }
2949 static [_isAlphabeticCharacter](codeUnit) { 2949 static [_isAlphabeticCharacter](codeUnit) {
2950 return dart.notNull(codeUnit) >= dart.notNull(Uri[_LOWER_CASE_A]) && dart. notNull(codeUnit) <= dart.notNull(Uri[_LOWER_CASE_Z]) || dart.notNull(codeUnit) >= dart.notNull(Uri[_UPPER_CASE_A]) && dart.notNull(codeUnit) <= dart.notNull(Ur i[_UPPER_CASE_Z]); 2950 return dart.notNull(codeUnit) >= dart.notNull(Uri[_LOWER_CASE_A]) && dart. notNull(codeUnit) <= dart.notNull(Uri[_LOWER_CASE_Z]) || dart.notNull(codeUnit) >= dart.notNull(Uri[_UPPER_CASE_A]) && dart.notNull(codeUnit) <= dart.notNull(Ur i[_UPPER_CASE_Z]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 Uri._regNameTable = /* Unimplemented const */new List.from([0, 0, 32754, 11263 , 65534, 34815, 65534, 18431]); 2990 Uri._regNameTable = /* Unimplemented const */new List.from([0, 0, 32754, 11263 , 65534, 34815, 65534, 18431]);
2991 Uri._pathCharTable = /* Unimplemented const */new List.from([0, 0, 32722, 1228 7, 65535, 34815, 65534, 18431]); 2991 Uri._pathCharTable = /* Unimplemented const */new List.from([0, 0, 32722, 1228 7, 65535, 34815, 65534, 18431]);
2992 Uri._pathCharOrSlashTable = /* Unimplemented const */new List.from([0, 0, 6549 0, 12287, 65535, 34815, 65534, 18431]); 2992 Uri._pathCharOrSlashTable = /* Unimplemented const */new List.from([0, 0, 6549 0, 12287, 65535, 34815, 65534, 18431]);
2993 Uri._queryCharTable = /* Unimplemented const */new List.from([0, 0, 65490, 450 55, 65535, 34815, 65534, 18431]); 2993 Uri._queryCharTable = /* Unimplemented const */new List.from([0, 0, 65490, 450 55, 65535, 34815, 65534, 18431]);
2994 // Function _symbolToString: (Symbol) → String 2994 // Function _symbolToString: (Symbol) → String
2995 function _symbolToString(symbol) { 2995 function _symbolToString(symbol) {
2996 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); 2996 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol));
2997 } 2997 }
2998 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic 2998 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic
2999 function _symbolMapToStringMap(map) { 2999 function _symbolMapToStringMap(map) {
3000 if (map === null) 3000 if (map == null)
3001 return null; 3001 return null;
3002 let result = new Map(); 3002 let result = new Map();
3003 map.forEach((key, value) => { 3003 map.forEach((key, value) => {
3004 result.set(_symbolToString(key), value); 3004 result.set(_symbolToString(key), value);
3005 }); 3005 });
3006 return result; 3006 return result;
3007 } 3007 }
3008 class _ListConstructorSentinel extends Object { 3008 class _ListConstructorSentinel extends Object {
3009 _ListConstructorSentinel() { 3009 _ListConstructorSentinel() {
3010 } 3010 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 exports.StackTrace = StackTrace; 3070 exports.StackTrace = StackTrace;
3071 exports.Stopwatch = Stopwatch; 3071 exports.Stopwatch = Stopwatch;
3072 exports.String = String; 3072 exports.String = String;
3073 exports.RuneIterator = RuneIterator; 3073 exports.RuneIterator = RuneIterator;
3074 exports.StringBuffer = StringBuffer; 3074 exports.StringBuffer = StringBuffer;
3075 exports.StringSink = StringSink; 3075 exports.StringSink = StringSink;
3076 exports.Symbol = Symbol; 3076 exports.Symbol = Symbol;
3077 exports.Type = Type; 3077 exports.Type = Type;
3078 exports.Uri = Uri; 3078 exports.Uri = Uri;
3079 })(core || (core = {})); 3079 })(core || (core = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698