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

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

Issue 1233553005: Fixes #254 - Better stacktrace support (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: format fix Created 5 years, 5 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 dart_library.library('dart/core', null, /* Imports */[ 1 dart_library.library('dart/core', null, /* Imports */[
2 "dart_runtime/dart" 2 "dart_runtime/dart"
3 ], /* Lazy imports */[ 3 ], /* Lazy imports */[
4 'dart/_js_helper', 4 'dart/_js_helper',
5 'dart/_internal', 5 'dart/_internal',
6 'dart/collection', 6 'dart/collection',
7 'dart/_interceptors', 7 'dart/_interceptors',
8 'dart/convert' 8 'dart/convert'
9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con vert) { 9 ], function(exports, dart, _js_helper, _internal, collection, _interceptors, con vert) {
10 'use strict'; 10 'use strict';
11 let dartx = dart.dartx; 11 let dartx = dart.dartx;
12 class Object { 12 class Object {
13 constructor() { 13 constructor() {
14 let name = this.constructor.name; 14 let name = this.constructor.name;
15 let result = void 0; 15 let result = void 0;
16 if (name in this) 16 if (name in this)
17 result = this[name](...arguments); 17 result = this[name](...arguments);
18 return result === void 0 ? this : result; 18 return result === void 0 ? this : result;
19 } 19 }
20 ['=='](other) { 20 ['=='](other) {
21 return identical(this, other); 21 return identical(this, other);
22 } 22 }
23 get hashCode() { 23 get hashCode() {
24 return _js_helper.Primitives.objectHashCode(this); 24 return _js_helper.Primitives.objectHashCode(this);
25 } 25 }
26 toString() { 26 toString() {
27 return _js_helper.Primitives.objectToString(this); 27 return _js_helper.Primitives.objectToString(this);
28 } 28 }
29 noSuchMethod(invocation) { 29 noSuchMethod(invocation) {
30 throw new NoSuchMethodError(this, invocation.memberName, invocation.positi onalArguments, invocation.namedArguments); 30 dart.throw(new NoSuchMethodError(this, invocation.memberName, invocation.p ositionalArguments, invocation.namedArguments));
31 } 31 }
32 get runtimeType() { 32 get runtimeType() {
33 return dart.realRuntimeType(this); 33 return dart.realRuntimeType(this);
34 } 34 }
35 } 35 }
36 dart.setSignature(Object, { 36 dart.setSignature(Object, {
37 constructors: () => ({Object: [Object, []]}), 37 constructors: () => ({Object: [Object, []]}),
38 methods: () => ({ 38 methods: () => ({
39 '==': [bool, [dart.dynamic]], 39 '==': [bool, [dart.dynamic]],
40 toString: [String, []], 40 toString: [String, []],
(...skipping 27 matching lines...) Expand all
68 dart.setSignature(_Proxy, { 68 dart.setSignature(_Proxy, {
69 constructors: () => ({_Proxy: [_Proxy, []]}) 69 constructors: () => ({_Proxy: [_Proxy, []]})
70 }); 70 });
71 let proxy = dart.const(new _Proxy()); 71 let proxy = dart.const(new _Proxy());
72 dart.defineExtensionNames([ 72 dart.defineExtensionNames([
73 'toString' 73 'toString'
74 ]); 74 ]);
75 class bool extends Object { 75 class bool extends Object {
76 static fromEnvironment(name, opts) { 76 static fromEnvironment(name, opts) {
77 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : fa lse; 77 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : fa lse;
78 throw new UnsupportedError('bool.fromEnvironment can only be used as a con st constructor'); 78 dart.throw(new UnsupportedError('bool.fromEnvironment can only be used as a const constructor'));
79 } 79 }
80 toString() { 80 toString() {
81 return this ? "true" : "false"; 81 return this ? "true" : "false";
82 } 82 }
83 } 83 }
84 dart.setSignature(bool, { 84 dart.setSignature(bool, {
85 constructors: () => ({fromEnvironment: [bool, [String], {defaultValue: bool} ]}) 85 constructors: () => ({fromEnvironment: [bool, [String], {defaultValue: bool} ]})
86 }); 86 });
87 let Comparator$ = dart.generic(function(T) { 87 let Comparator$ = dart.generic(function(T) {
88 let Comparator = dart.typedef('Comparator', () => dart.functionType(int, [T, T])); 88 let Comparator = dart.typedef('Comparator', () => dart.functionType(int, [T, T]));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (match.get(9) != null) { 170 if (match.get(9) != null) {
171 let sign = match.get(9) == '-' ? -1 : 1; 171 let sign = match.get(9) == '-' ? -1 : 1;
172 let hourDifference = int.parse(match.get(10)); 172 let hourDifference = int.parse(match.get(10));
173 let minuteDifference = parseIntOrZero(match.get(11)); 173 let minuteDifference = parseIntOrZero(match.get(11));
174 minuteDifference = dart.notNull(minuteDifference) + 60 * dart.notNul l(hourDifference); 174 minuteDifference = dart.notNull(minuteDifference) + 60 * dart.notNul l(hourDifference);
175 minute = dart.notNull(minute) - dart.notNull(sign) * dart.notNull(mi nuteDifference); 175 minute = dart.notNull(minute) - dart.notNull(sign) * dart.notNull(mi nuteDifference);
176 } 176 }
177 } 177 }
178 let millisecondsSinceEpoch = DateTime._brokenDownDateToMillisecondsSince Epoch(years, month, day, hour, minute, second, millisecond, isUtc); 178 let millisecondsSinceEpoch = DateTime._brokenDownDateToMillisecondsSince Epoch(years, month, day, hour, minute, second, millisecond, isUtc);
179 if (millisecondsSinceEpoch == null) { 179 if (millisecondsSinceEpoch == null) {
180 throw new FormatException("Time out of range", formattedString); 180 dart.throw(new FormatException("Time out of range", formattedString));
181 } 181 }
182 if (dart.notNull(addOneMillisecond)) { 182 if (dart.notNull(addOneMillisecond)) {
183 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1; 183 millisecondsSinceEpoch = dart.notNull(millisecondsSinceEpoch) + 1;
184 } 184 }
185 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc}); 185 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc});
186 } else { 186 } else {
187 throw new FormatException("Invalid date format", formattedString); 187 dart.throw(new FormatException("Invalid date format", formattedString));
188 } 188 }
189 } 189 }
190 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) { 190 fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opts) {
191 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false; 191 let isUtc = opts && 'isUtc' in opts ? opts.isUtc : false;
192 this.millisecondsSinceEpoch = millisecondsSinceEpoch; 192 this.millisecondsSinceEpoch = millisecondsSinceEpoch;
193 this.isUtc = isUtc; 193 this.isUtc = isUtc;
194 if (dart.notNull(millisecondsSinceEpoch[dartx.abs]()) > dart.notNull(DateT ime._MAX_MILLISECONDS_SINCE_EPOCH)) { 194 if (dart.notNull(millisecondsSinceEpoch[dartx.abs]()) > dart.notNull(DateT ime._MAX_MILLISECONDS_SINCE_EPOCH)) {
195 throw new ArgumentError(millisecondsSinceEpoch); 195 dart.throw(new ArgumentError(millisecondsSinceEpoch));
196 } 196 }
197 if (isUtc == null) 197 if (isUtc == null)
198 throw new ArgumentError(isUtc); 198 dart.throw(new ArgumentError(isUtc));
199 } 199 }
200 ['=='](other) { 200 ['=='](other) {
201 if (!dart.is(other, DateTime)) 201 if (!dart.is(other, DateTime))
202 return false; 202 return false;
203 return dart.equals(this.millisecondsSinceEpoch, dart.dload(other, 'millise condsSinceEpoch')) && dart.equals(this.isUtc, dart.dload(other, 'isUtc')); 203 return dart.equals(this.millisecondsSinceEpoch, dart.dload(other, 'millise condsSinceEpoch')) && dart.equals(this.isUtc, dart.dload(other, 'isUtc'));
204 } 204 }
205 isBefore(other) { 205 isBefore(other) {
206 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch); 206 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch);
207 } 207 }
208 isAfter(other) { 208 isAfter(other) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 subtract(duration) { 294 subtract(duration) {
295 let ms = this.millisecondsSinceEpoch; 295 let ms = this.millisecondsSinceEpoch;
296 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc}); 296 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc});
297 } 297 }
298 difference(other) { 298 difference(other) {
299 let ms = this.millisecondsSinceEpoch; 299 let ms = this.millisecondsSinceEpoch;
300 let otherMs = other.millisecondsSinceEpoch; 300 let otherMs = other.millisecondsSinceEpoch;
301 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )}); 301 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )});
302 } 302 }
303 _internal(year, month, day, hour, minute, second, millisecond, isUtc) { 303 _internal(year, month, day, hour, minute, second, millisecond, isUtc) {
304 this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw_(new ArgumentE rror(isUtc)); 304 this.isUtc = typeof isUtc == 'boolean' ? isUtc : dart.throw(new ArgumentEr ror(isUtc));
305 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int); 305 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int);
306 } 306 }
307 _now() { 307 _now() {
308 this.isUtc = false; 308 this.isUtc = false;
309 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow(); 309 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow();
310 } 310 }
311 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut e, second, millisecond, isUtc) { 311 static _brokenDownDateToMillisecondsSinceEpoch(year, month, day, hour, minut e, second, millisecond, isUtc) {
312 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int); 312 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
313 } 313 }
314 get timeZoneName() { 314 get timeZoneName() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 let source = input[dartx.trim](); 413 let source = input[dartx.trim]();
414 num._parseError = false; 414 num._parseError = false;
415 let result = int.parse(source, {onError: num._onParseErrorInt}); 415 let result = int.parse(source, {onError: num._onParseErrorInt});
416 if (!dart.notNull(num._parseError)) 416 if (!dart.notNull(num._parseError))
417 return result; 417 return result;
418 num._parseError = false; 418 num._parseError = false;
419 result = double.parse(source, num._onParseErrorDouble); 419 result = double.parse(source, num._onParseErrorDouble);
420 if (!dart.notNull(num._parseError)) 420 if (!dart.notNull(num._parseError))
421 return result; 421 return result;
422 if (onError == null) 422 if (onError == null)
423 throw new FormatException(input); 423 dart.throw(new FormatException(input));
424 return onError(input); 424 return onError(input);
425 } 425 }
426 static _onParseErrorInt(_) { 426 static _onParseErrorInt(_) {
427 num._parseError = true; 427 num._parseError = true;
428 return 0; 428 return 0;
429 } 429 }
430 static _onParseErrorDouble(_) { 430 static _onParseErrorDouble(_) {
431 num._parseError = true; 431 num._parseError = true;
432 return 0.0; 432 return 0.0;
433 } 433 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return new Duration._microseconds(dart.notNull(this[_duration]) + dart.not Null(other[_duration])); 475 return new Duration._microseconds(dart.notNull(this[_duration]) + dart.not Null(other[_duration]));
476 } 476 }
477 ['-'](other) { 477 ['-'](other) {
478 return new Duration._microseconds(dart.notNull(this[_duration]) - dart.not Null(other[_duration])); 478 return new Duration._microseconds(dart.notNull(this[_duration]) - dart.not Null(other[_duration]));
479 } 479 }
480 ['*'](factor) { 480 ['*'](factor) {
481 return new Duration._microseconds((dart.notNull(this[_duration]) * dart.no tNull(factor))[dartx.round]()); 481 return new Duration._microseconds((dart.notNull(this[_duration]) * dart.no tNull(factor))[dartx.round]());
482 } 482 }
483 ['~/'](quotient) { 483 ['~/'](quotient) {
484 if (quotient == 0) 484 if (quotient == 0)
485 throw new IntegerDivisionByZeroException(); 485 dart.throw(new IntegerDivisionByZeroException());
486 return new Duration._microseconds((dart.notNull(this[_duration]) / dart.no tNull(quotient)).truncate()); 486 return new Duration._microseconds((dart.notNull(this[_duration]) / dart.no tNull(quotient)).truncate());
487 } 487 }
488 ['<'](other) { 488 ['<'](other) {
489 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]); 489 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]);
490 } 490 }
491 ['>'](other) { 491 ['>'](other) {
492 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]); 492 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]);
493 } 493 }
494 ['<='](other) { 494 ['<='](other) {
495 return dart.notNull(this[_duration]) <= dart.notNull(other[_duration]); 495 return dart.notNull(this[_duration]) <= dart.notNull(other[_duration]);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 } 730 }
731 static index(index, indexable, name, message, length) { 731 static index(index, indexable, name, message, length) {
732 return new IndexError(index, indexable, name, message, length); 732 return new IndexError(index, indexable, name, message, length);
733 } 733 }
734 static checkValueInInterval(value, minValue, maxValue, name, message) { 734 static checkValueInInterval(value, minValue, maxValue, name, message) {
735 if (name === void 0) 735 if (name === void 0)
736 name = null; 736 name = null;
737 if (message === void 0) 737 if (message === void 0)
738 message = null; 738 message = null;
739 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) { 739 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) {
740 throw new RangeError.range(value, minValue, maxValue, name, message); 740 dart.throw(new RangeError.range(value, minValue, maxValue, name, message ));
741 } 741 }
742 } 742 }
743 static checkValidIndex(index, indexable, name, length, message) { 743 static checkValidIndex(index, indexable, name, length, message) {
744 if (name === void 0) 744 if (name === void 0)
745 name = null; 745 name = null;
746 if (length === void 0) 746 if (length === void 0)
747 length = null; 747 length = null;
748 if (message === void 0) 748 if (message === void 0)
749 message = null; 749 message = null;
750 if (length == null) 750 if (length == null)
751 length = dart.as(dart.dload(indexable, 'length'), int); 751 length = dart.as(dart.dload(indexable, 'length'), int);
752 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length) ) { 752 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length) ) {
753 if (name == null) 753 if (name == null)
754 name = "index"; 754 name = "index";
755 throw RangeError.index(index, indexable, name, message, length); 755 dart.throw(RangeError.index(index, indexable, name, message, length));
756 } 756 }
757 } 757 }
758 static checkValidRange(start, end, length, startName, endName, message) { 758 static checkValidRange(start, end, length, startName, endName, message) {
759 if (startName === void 0) 759 if (startName === void 0)
760 startName = null; 760 startName = null;
761 if (endName === void 0) 761 if (endName === void 0)
762 endName = null; 762 endName = null;
763 if (message === void 0) 763 if (message === void 0)
764 message = null; 764 message = null;
765 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) { 765 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) {
766 if (startName == null) 766 if (startName == null)
767 startName = "start"; 767 startName = "start";
768 throw new RangeError.range(start, 0, length, startName, message); 768 dart.throw(new RangeError.range(start, 0, length, startName, message));
769 } 769 }
770 if (end != null && (dart.notNull(end) < dart.notNull(start) || dart.notNul l(end) > dart.notNull(length))) { 770 if (end != null && (dart.notNull(end) < dart.notNull(start) || dart.notNul l(end) > dart.notNull(length))) {
771 if (endName == null) 771 if (endName == null)
772 endName = "end"; 772 endName = "end";
773 throw new RangeError.range(end, start, length, endName, message); 773 dart.throw(new RangeError.range(end, start, length, endName, message));
774 } 774 }
775 } 775 }
776 static checkNotNegative(value, name, message) { 776 static checkNotNegative(value, name, message) {
777 if (name === void 0) 777 if (name === void 0)
778 name = null; 778 name = null;
779 if (message === void 0) 779 if (message === void 0)
780 message = null; 780 message = null;
781 if (dart.notNull(value) < 0) 781 if (dart.notNull(value) < 0)
782 throw new RangeError.range(value, 0, null, name, message); 782 dart.throw(new RangeError.range(value, 0, null, name, message));
783 } 783 }
784 toString() { 784 toString() {
785 if (!dart.notNull(this[_hasValue])) 785 if (!dart.notNull(this[_hasValue]))
786 return `RangeError: ${this.message}`; 786 return `RangeError: ${this.message}`;
787 let value = Error.safeToString(this.invalidValue); 787 let value = Error.safeToString(this.invalidValue);
788 let explanation = ""; 788 let explanation = "";
789 if (this.start == null) { 789 if (this.start == null) {
790 if (this.end != null) { 790 if (this.end != null) {
791 explanation = `: Not less than or equal to ${this.end}`; 791 explanation = `: Not less than or equal to ${this.end}`;
792 } 792 }
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 return _js_helper.Primitives.identicalImplementation(a, b); 1232 return _js_helper.Primitives.identicalImplementation(a, b);
1233 } 1233 }
1234 dart.fn(identical, bool, [Object, Object]); 1234 dart.fn(identical, bool, [Object, Object]);
1235 function identityHashCode(object) { 1235 function identityHashCode(object) {
1236 return _js_helper.objectHashCode(object); 1236 return _js_helper.objectHashCode(object);
1237 } 1237 }
1238 dart.fn(identityHashCode, () => dart.definiteFunctionType(int, [Object])); 1238 dart.fn(identityHashCode, () => dart.definiteFunctionType(int, [Object]));
1239 class int extends num { 1239 class int extends num {
1240 static fromEnvironment(name, opts) { 1240 static fromEnvironment(name, opts) {
1241 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll; 1241 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll;
1242 throw new UnsupportedError('int.fromEnvironment can only be used as a cons t constructor'); 1242 dart.throw(new UnsupportedError('int.fromEnvironment can only be used as a const constructor'));
1243 } 1243 }
1244 static parse(source, opts) { 1244 static parse(source, opts) {
1245 let radix = opts && 'radix' in opts ? opts.radix : null; 1245 let radix = opts && 'radix' in opts ? opts.radix : null;
1246 let onError = opts && 'onError' in opts ? opts.onError : null; 1246 let onError = opts && 'onError' in opts ? opts.onError : null;
1247 return _js_helper.Primitives.parseInt(source, radix, onError); 1247 return _js_helper.Primitives.parseInt(source, radix, onError);
1248 } 1248 }
1249 } 1249 }
1250 dart.setSignature(int, { 1250 dart.setSignature(int, {
1251 constructors: () => ({fromEnvironment: [int, [String], {defaultValue: int}]} ), 1251 constructors: () => ({fromEnvironment: [int, [String], {defaultValue: int}]} ),
1252 statics: () => ({parse: [int, [String], {radix: int, onError: dart.functionT ype(int, [String])}]}), 1252 statics: () => ({parse: [int, [String], {radix: int, onError: dart.functionT ype(int, [String])}]}),
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 let List$ = dart.generic(function(E) { 1406 let List$ = dart.generic(function(E) {
1407 class List extends Object { 1407 class List extends Object {
1408 static new(length) { 1408 static new(length) {
1409 if (length === void 0) 1409 if (length === void 0)
1410 length = null; 1410 length = null;
1411 let list = null; 1411 let list = null;
1412 if (length == null) { 1412 if (length == null) {
1413 list = []; 1413 list = [];
1414 } else { 1414 } else {
1415 if (!(typeof length == 'number') || dart.notNull(length) < 0) { 1415 if (!(typeof length == 'number') || dart.notNull(length) < 0) {
1416 throw new ArgumentError(`Length must be a non-negative integer: ${le ngth}`); 1416 dart.throw(new ArgumentError(`Length must be a non-negative integer: ${length}`));
1417 } 1417 }
1418 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length), List$())); 1418 list = _interceptors.JSArray.markFixedList(dart.as(new Array(length), List$()));
1419 } 1419 }
1420 return _interceptors.JSArray$(E).typed(list); 1420 return _interceptors.JSArray$(E).typed(list);
1421 } 1421 }
1422 static filled(length, fill) { 1422 static filled(length, fill) {
1423 let result = List$(E).new(length); 1423 let result = List$(E).new(length);
1424 if (length != 0 && fill != null) { 1424 if (length != 0 && fill != null) {
1425 for (let i = 0; dart.notNull(i) < dart.notNull(result[dartx.length]); i = dart.notNull(i) + 1) { 1425 for (let i = 0; dart.notNull(i) < dart.notNull(result[dartx.length]); i = dart.notNull(i) + 1) {
1426 result[dartx.set](i, fill); 1426 result[dartx.set](i, fill);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 identity: [Map$(K, V), []], 1493 identity: [Map$(K, V), []],
1494 fromIterable: [Map$(K, V), [Iterable], {key: dart.functionType(K, [dart. dynamic]), value: dart.functionType(V, [dart.dynamic])}], 1494 fromIterable: [Map$(K, V), [Iterable], {key: dart.functionType(K, [dart. dynamic]), value: dart.functionType(V, [dart.dynamic])}],
1495 fromIterables: [Map$(K, V), [Iterable$(K), Iterable$(V)]] 1495 fromIterables: [Map$(K, V), [Iterable$(K), Iterable$(V)]]
1496 }) 1496 })
1497 }); 1497 });
1498 return Map; 1498 return Map;
1499 }); 1499 });
1500 let Map = Map$(); 1500 let Map = Map$();
1501 class Null extends Object { 1501 class Null extends Object {
1502 static _uninstantiable() { 1502 static _uninstantiable() {
1503 throw new UnsupportedError('class Null cannot be instantiated'); 1503 dart.throw(new UnsupportedError('class Null cannot be instantiated'));
1504 } 1504 }
1505 toString() { 1505 toString() {
1506 return "null"; 1506 return "null";
1507 } 1507 }
1508 } 1508 }
1509 dart.setSignature(Null, { 1509 dart.setSignature(Null, {
1510 constructors: () => ({_uninstantiable: [Null, []]}) 1510 constructors: () => ({_uninstantiable: [Null, []]})
1511 }); 1511 });
1512 num._parseError = false; 1512 num._parseError = false;
1513 class Pattern extends Object {} 1513 class Pattern extends Object {}
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 if (start === void 0) 1639 if (start === void 0)
1640 start = 0; 1640 start = 0;
1641 if (end === void 0) 1641 if (end === void 0)
1642 end = null; 1642 end = null;
1643 if (!dart.is(charCodes, _interceptors.JSArray)) { 1643 if (!dart.is(charCodes, _interceptors.JSArray)) {
1644 return String._stringFromIterable(charCodes, start, end); 1644 return String._stringFromIterable(charCodes, start, end);
1645 } 1645 }
1646 let list = dart.as(charCodes, List); 1646 let list = dart.as(charCodes, List);
1647 let len = list[dartx.length]; 1647 let len = list[dartx.length];
1648 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) { 1648 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) {
1649 throw new RangeError.range(start, 0, len); 1649 dart.throw(new RangeError.range(start, 0, len));
1650 } 1650 }
1651 if (end == null) { 1651 if (end == null) {
1652 end = len; 1652 end = len;
1653 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) { 1653 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) {
1654 throw new RangeError.range(end, start, len); 1654 dart.throw(new RangeError.range(end, start, len));
1655 } 1655 }
1656 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) { 1656 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) {
1657 list = list[dartx.sublist](start, end); 1657 list = list[dartx.sublist](start, end);
1658 } 1658 }
1659 return _js_helper.Primitives.stringFromCharCodes(list); 1659 return _js_helper.Primitives.stringFromCharCodes(list);
1660 } 1660 }
1661 static fromCharCode(charCode) { 1661 static fromCharCode(charCode) {
1662 return _js_helper.Primitives.stringFromCharCode(charCode); 1662 return _js_helper.Primitives.stringFromCharCode(charCode);
1663 } 1663 }
1664 static fromEnvironment(name, opts) { 1664 static fromEnvironment(name, opts) {
1665 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll; 1665 let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : nu ll;
1666 throw new UnsupportedError('String.fromEnvironment can only be used as a c onst constructor'); 1666 dart.throw(new UnsupportedError('String.fromEnvironment can only be used a s a const constructor'));
1667 } 1667 }
1668 static _stringFromIterable(charCodes, start, end) { 1668 static _stringFromIterable(charCodes, start, end) {
1669 if (dart.notNull(start) < 0) 1669 if (dart.notNull(start) < 0)
1670 throw new RangeError.range(start, 0, charCodes[dartx.length]); 1670 dart.throw(new RangeError.range(start, 0, charCodes[dartx.length]));
1671 if (end != null && dart.notNull(end) < dart.notNull(start)) { 1671 if (end != null && dart.notNull(end) < dart.notNull(start)) {
1672 throw new RangeError.range(end, start, charCodes[dartx.length]); 1672 dart.throw(new RangeError.range(end, start, charCodes[dartx.length]));
1673 } 1673 }
1674 let it = charCodes[dartx.iterator]; 1674 let it = charCodes[dartx.iterator];
1675 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) { 1675 for (let i = 0; dart.notNull(i) < dart.notNull(start); i = dart.notNull(i) + 1) {
1676 if (!dart.notNull(it.moveNext())) { 1676 if (!dart.notNull(it.moveNext())) {
1677 throw new RangeError.range(start, 0, i); 1677 dart.throw(new RangeError.range(start, 0, i));
1678 } 1678 }
1679 } 1679 }
1680 let list = []; 1680 let list = [];
1681 if (end == null) { 1681 if (end == null) {
1682 while (dart.notNull(it.moveNext())) 1682 while (dart.notNull(it.moveNext()))
1683 list[dartx.add](it.current); 1683 list[dartx.add](it.current);
1684 } else { 1684 } else {
1685 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 1685 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
1686 if (!dart.notNull(it.moveNext())) { 1686 if (!dart.notNull(it.moveNext())) {
1687 throw new RangeError.range(end, start, i); 1687 dart.throw(new RangeError.range(end, start, i));
1688 } 1688 }
1689 list[dartx.add](it.current); 1689 list[dartx.add](it.current);
1690 } 1690 }
1691 } 1691 }
1692 return _js_helper.Primitives.stringFromCharCodes(list); 1692 return _js_helper.Primitives.stringFromCharCodes(list);
1693 } 1693 }
1694 } 1694 }
1695 String[dart.implements] = () => [Comparable$(String), Pattern]; 1695 String[dart.implements] = () => [Comparable$(String), Pattern];
1696 dart.setSignature(String, { 1696 dart.setSignature(String, {
1697 constructors: () => ({ 1697 constructors: () => ({
1698 fromCharCodes: [String, [Iterable$(int)], [int, int]], 1698 fromCharCodes: [String, [Iterable$(int)], [int, int]],
1699 fromCharCode: [String, [int]], 1699 fromCharCode: [String, [int]],
1700 fromEnvironment: [String, [String], {defaultValue: String}] 1700 fromEnvironment: [String, [String], {defaultValue: String}]
1701 }), 1701 }),
1702 statics: () => ({_stringFromIterable: [String, [Iterable$(int), int, int]]}) , 1702 statics: () => ({_stringFromIterable: [String, [Iterable$(int), int, int]]}) ,
1703 names: ['_stringFromIterable'] 1703 names: ['_stringFromIterable']
1704 }); 1704 });
1705 dart.defineLazyClass(exports, { 1705 dart.defineLazyClass(exports, {
1706 get Runes() { 1706 get Runes() {
1707 class Runes extends collection.IterableBase$(int) { 1707 class Runes extends collection.IterableBase$(int) {
1708 Runes(string) { 1708 Runes(string) {
1709 this.string = string; 1709 this.string = string;
1710 super.IterableBase(); 1710 super.IterableBase();
1711 } 1711 }
1712 get iterator() { 1712 get iterator() {
1713 return new RuneIterator(this.string); 1713 return new RuneIterator(this.string);
1714 } 1714 }
1715 get last() { 1715 get last() {
1716 if (this.string[dartx.length] == 0) { 1716 if (this.string[dartx.length] == 0) {
1717 throw new StateError('No elements.'); 1717 dart.throw(new StateError('No elements.'));
1718 } 1718 }
1719 let length = this.string[dartx.length]; 1719 let length = this.string[dartx.length];
1720 let code = this.string[dartx.codeUnitAt](dart.notNull(length) - 1); 1720 let code = this.string[dartx.codeUnitAt](dart.notNull(length) - 1);
1721 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string[ dartx.length]) > 1) { 1721 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string[ dartx.length]) > 1) {
1722 let previousCode = this.string[dartx.codeUnitAt](dart.notNull(length ) - 2); 1722 let previousCode = this.string[dartx.codeUnitAt](dart.notNull(length ) - 2);
1723 if (dart.notNull(_isLeadSurrogate(previousCode))) { 1723 if (dart.notNull(_isLeadSurrogate(previousCode))) {
1724 return _combineSurrogatePair(previousCode, code); 1724 return _combineSurrogatePair(previousCode, code);
1725 } 1725 }
1726 } 1726 }
1727 return code; 1727 return code;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 at(string, index) { 1760 at(string, index) {
1761 this.string = string; 1761 this.string = string;
1762 this[_position] = index; 1762 this[_position] = index;
1763 this[_nextPosition] = index; 1763 this[_nextPosition] = index;
1764 this[_currentCodePoint] = null; 1764 this[_currentCodePoint] = null;
1765 RangeError.checkValueInInterval(index, 0, string[dartx.length]); 1765 RangeError.checkValueInInterval(index, 0, string[dartx.length]);
1766 this[_checkSplitSurrogate](index); 1766 this[_checkSplitSurrogate](index);
1767 } 1767 }
1768 [_checkSplitSurrogate](index) { 1768 [_checkSplitSurrogate](index) {
1769 if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.str ing[dartx.length]) && dart.notNull(_isLeadSurrogate(this.string[dartx.codeUnitAt ](dart.notNull(index) - 1))) && dart.notNull(_isTrailSurrogate(this.string[dartx .codeUnitAt](index)))) { 1769 if (dart.notNull(index) > 0 && dart.notNull(index) < dart.notNull(this.str ing[dartx.length]) && dart.notNull(_isLeadSurrogate(this.string[dartx.codeUnitAt ](dart.notNull(index) - 1))) && dart.notNull(_isTrailSurrogate(this.string[dartx .codeUnitAt](index)))) {
1770 throw new ArgumentError(`Index inside surrogate pair: ${index}`); 1770 dart.throw(new ArgumentError(`Index inside surrogate pair: ${index}`));
1771 } 1771 }
1772 } 1772 }
1773 get rawIndex() { 1773 get rawIndex() {
1774 return this[_position] != this[_nextPosition] ? this[_position] : null; 1774 return this[_position] != this[_nextPosition] ? this[_position] : null;
1775 } 1775 }
1776 set rawIndex(rawIndex) { 1776 set rawIndex(rawIndex) {
1777 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex"); 1777 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex");
1778 this.reset(rawIndex); 1778 this.reset(rawIndex);
1779 this.moveNext(); 1779 this.moveNext();
1780 } 1780 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 } else { 2146 } else {
2147 query = Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null); 2147 query = Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null);
2148 fragment = Uri._makeFragment(uri, dart.notNull(numberSignIndex) + 1, u ri[dartx.length]); 2148 fragment = Uri._makeFragment(uri, dart.notNull(numberSignIndex) + 1, u ri[dartx.length]);
2149 } 2149 }
2150 } else if (char == Uri._NUMBER_SIGN) { 2150 } else if (char == Uri._NUMBER_SIGN) {
2151 fragment = Uri._makeFragment(uri, dart.notNull(index) + 1, uri[dartx.len gth]); 2151 fragment = Uri._makeFragment(uri, dart.notNull(index) + 1, uri[dartx.len gth]);
2152 } 2152 }
2153 return new Uri._internal(scheme, userinfo, host, port, path, query, fragme nt); 2153 return new Uri._internal(scheme, userinfo, host, port, path, query, fragme nt);
2154 } 2154 }
2155 static _fail(uri, index, message) { 2155 static _fail(uri, index, message) {
2156 throw new FormatException(message, uri, index); 2156 dart.throw(new FormatException(message, uri, index));
2157 } 2157 }
2158 _internal(scheme, userInfo, host, port, path, query, fragment) { 2158 _internal(scheme, userInfo, host, port, path, query, fragment) {
2159 this.scheme = scheme; 2159 this.scheme = scheme;
2160 this[_userInfo] = userInfo; 2160 this[_userInfo] = userInfo;
2161 this[_host] = host; 2161 this[_host] = host;
2162 this[_port] = port; 2162 this[_port] = port;
2163 this[_path] = path; 2163 this[_path] = path;
2164 this[_query] = query; 2164 this[_query] = query;
2165 this[_fragment] = fragment; 2165 this[_fragment] = fragment;
2166 this[_pathSegments] = null; 2166 this[_pathSegments] = null;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 break; 2217 break;
2218 } 2218 }
2219 } 2219 }
2220 let hostEnd = hostStart; 2220 let hostEnd = hostStart;
2221 if (dart.notNull(hostStart) < dart.notNull(authority[dartx.length]) && a uthority[dartx.codeUnitAt](hostStart) == Uri._LEFT_BRACKET) { 2221 if (dart.notNull(hostStart) < dart.notNull(authority[dartx.length]) && a uthority[dartx.codeUnitAt](hostStart) == Uri._LEFT_BRACKET) {
2222 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); hostEnd = dart.notNull(hostEnd) + 1) { 2222 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); hostEnd = dart.notNull(hostEnd) + 1) {
2223 if (authority[dartx.codeUnitAt](hostEnd) == Uri._RIGHT_BRACKET) 2223 if (authority[dartx.codeUnitAt](hostEnd) == Uri._RIGHT_BRACKET)
2224 break; 2224 break;
2225 } 2225 }
2226 if (hostEnd == authority[dartx.length]) { 2226 if (hostEnd == authority[dartx.length]) {
2227 throw new FormatException("Invalid IPv6 host entry.", authority, hos tStart); 2227 dart.throw(new FormatException("Invalid IPv6 host entry.", authority , hostStart));
2228 } 2228 }
2229 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd); 2229 Uri.parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd);
2230 hostEnd = dart.notNull(hostEnd) + 1; 2230 hostEnd = dart.notNull(hostEnd) + 1;
2231 if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt]( hostEnd) != Uri._COLON) { 2231 if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt]( hostEnd) != Uri._COLON) {
2232 throw new FormatException("Invalid end of authority", authority, hos tEnd); 2232 dart.throw(new FormatException("Invalid end of authority", authority , hostEnd));
2233 } 2233 }
2234 } 2234 }
2235 let hasPort = false; 2235 let hasPort = false;
2236 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); ho stEnd = dart.notNull(hostEnd) + 1) { 2236 for (; dart.notNull(hostEnd) < dart.notNull(authority[dartx.length]); ho stEnd = dart.notNull(hostEnd) + 1) {
2237 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) { 2237 if (authority[dartx.codeUnitAt](hostEnd) == Uri._COLON) {
2238 let portString = authority[dartx.substring](dart.notNull(hostEnd) + 1); 2238 let portString = authority[dartx.substring](dart.notNull(hostEnd) + 1);
2239 if (dart.notNull(portString[dartx.isNotEmpty])) 2239 if (dart.notNull(portString[dartx.isNotEmpty]))
2240 port = int.parse(portString); 2240 port = int.parse(portString);
2241 break; 2241 break;
2242 } 2242 }
2243 } 2243 }
2244 host = authority[dartx.substring](hostStart, hostEnd); 2244 host = authority[dartx.substring](hostStart, hostEnd);
2245 } 2245 }
2246 return Uri.new({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath[dartx.split]("/"), queryParameters: queryParameters}); 2246 return Uri.new({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath[dartx.split]("/"), queryParameters: queryParameters});
2247 } 2247 }
2248 static file(path, opts) { 2248 static file(path, opts) {
2249 let windows = opts && 'windows' in opts ? opts.windows : null; 2249 let windows = opts && 'windows' in opts ? opts.windows : null;
2250 windows = windows == null ? Uri._isWindows : windows; 2250 windows = windows == null ? Uri._isWindows : windows;
2251 return dart.notNull(windows) ? dart.as(Uri._makeWindowsFileUrl(path), Uri) : dart.as(Uri._makeFileUri(path), Uri); 2251 return dart.notNull(windows) ? dart.as(Uri._makeWindowsFileUrl(path), Uri) : dart.as(Uri._makeFileUri(path), Uri);
2252 } 2252 }
2253 static get base() { 2253 static get base() {
2254 let uri = _js_helper.Primitives.currentUri(); 2254 let uri = _js_helper.Primitives.currentUri();
2255 if (uri != null) 2255 if (uri != null)
2256 return Uri.parse(uri); 2256 return Uri.parse(uri);
2257 throw new UnsupportedError("'Uri.base' is not supported"); 2257 dart.throw(new UnsupportedError("'Uri.base' is not supported"));
2258 } 2258 }
2259 static get _isWindows() { 2259 static get _isWindows() {
2260 return false; 2260 return false;
2261 } 2261 }
2262 static _checkNonWindowsPathReservedCharacters(segments, argumentError) { 2262 static _checkNonWindowsPathReservedCharacters(segments, argumentError) {
2263 segments[dartx.forEach](dart.fn(segment => { 2263 segments[dartx.forEach](dart.fn(segment => {
2264 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', "/"), bool))) { 2264 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', "/"), bool))) {
2265 if (dart.notNull(argumentError)) { 2265 if (dart.notNull(argumentError)) {
2266 throw new ArgumentError(`Illegal path character ${segment}`); 2266 dart.throw(new ArgumentError(`Illegal path character ${segment}`));
2267 } else { 2267 } else {
2268 throw new UnsupportedError(`Illegal path character ${segment}`); 2268 dart.throw(new UnsupportedError(`Illegal path character ${segment}`) );
2269 } 2269 }
2270 } 2270 }
2271 })); 2271 }));
2272 } 2272 }
2273 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg ment) { 2273 static _checkWindowsPathReservedCharacters(segments, argumentError, firstSeg ment) {
2274 if (firstSegment === void 0) 2274 if (firstSegment === void 0)
2275 firstSegment = 0; 2275 firstSegment = 0;
2276 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => { 2276 segments[dartx.skip](firstSegment)[dartx.forEach](dart.fn(segment => {
2277 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', RegExp.new('["* /:<>?\\\\|]')), bool))) { 2277 if (dart.notNull(dart.as(dart.dsend(segment, 'contains', RegExp.new('["* /:<>?\\\\|]')), bool))) {
2278 if (dart.notNull(argumentError)) { 2278 if (dart.notNull(argumentError)) {
2279 throw new ArgumentError("Illegal character in path"); 2279 dart.throw(new ArgumentError("Illegal character in path"));
2280 } else { 2280 } else {
2281 throw new UnsupportedError("Illegal character in path"); 2281 dart.throw(new UnsupportedError("Illegal character in path"));
2282 } 2282 }
2283 } 2283 }
2284 })); 2284 }));
2285 } 2285 }
2286 static _checkWindowsDriveLetter(charCode, argumentError) { 2286 static _checkWindowsDriveLetter(charCode, argumentError) {
2287 if (dart.notNull(Uri._UPPER_CASE_A) <= dart.notNull(charCode) && dart.notN ull(charCode) <= dart.notNull(Uri._UPPER_CASE_Z) || dart.notNull(Uri._LOWER_CASE _A) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri._LOW ER_CASE_Z)) { 2287 if (dart.notNull(Uri._UPPER_CASE_A) <= dart.notNull(charCode) && dart.notN ull(charCode) <= dart.notNull(Uri._UPPER_CASE_Z) || dart.notNull(Uri._LOWER_CASE _A) <= dart.notNull(charCode) && dart.notNull(charCode) <= dart.notNull(Uri._LOW ER_CASE_Z)) {
2288 return; 2288 return;
2289 } 2289 }
2290 if (dart.notNull(argumentError)) { 2290 if (dart.notNull(argumentError)) {
2291 throw new ArgumentError("Illegal drive letter " + dart.notNull(String.fr omCharCode(charCode))); 2291 dart.throw(new ArgumentError("Illegal drive letter " + dart.notNull(Stri ng.fromCharCode(charCode))));
2292 } else { 2292 } else {
2293 throw new UnsupportedError("Illegal drive letter " + dart.notNull(String .fromCharCode(charCode))); 2293 dart.throw(new UnsupportedError("Illegal drive letter " + dart.notNull(S tring.fromCharCode(charCode))));
2294 } 2294 }
2295 } 2295 }
2296 static _makeFileUri(path) { 2296 static _makeFileUri(path) {
2297 let sep = "/"; 2297 let sep = "/";
2298 if (dart.notNull(path[dartx.startsWith](sep))) { 2298 if (dart.notNull(path[dartx.startsWith](sep))) {
2299 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)}); 2299 return Uri.new({scheme: "file", pathSegments: path[dartx.split](sep)});
2300 } else { 2300 } else {
2301 return Uri.new({pathSegments: path[dartx.split](sep)}); 2301 return Uri.new({pathSegments: path[dartx.split](sep)});
2302 } 2302 }
2303 } 2303 }
2304 static _makeWindowsFileUrl(path) { 2304 static _makeWindowsFileUrl(path) {
2305 if (dart.notNull(path[dartx.startsWith]("\\\\?\\"))) { 2305 if (dart.notNull(path[dartx.startsWith]("\\\\?\\"))) {
2306 if (dart.notNull(path[dartx.startsWith]("\\\\?\\UNC\\"))) { 2306 if (dart.notNull(path[dartx.startsWith]("\\\\?\\UNC\\"))) {
2307 path = `\\${path[dartx.substring](7)}`; 2307 path = `\\${path[dartx.substring](7)}`;
2308 } else { 2308 } else {
2309 path = path[dartx.substring](4); 2309 path = path[dartx.substring](4);
2310 if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != Uri._COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) { 2310 if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != Uri._COLON || path[dartx.codeUnitAt](2) != Uri._BACKSLASH) {
2311 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute"); 2311 dart.throw(new ArgumentError("Windows paths with \\\\?\\ prefix must be absolute"));
2312 } 2312 }
2313 } 2313 }
2314 } else { 2314 } else {
2315 path = path[dartx.replaceAll]("/", "\\"); 2315 path = path[dartx.replaceAll]("/", "\\");
2316 } 2316 }
2317 let sep = "\\"; 2317 let sep = "\\";
2318 if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == ":") { 2318 if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == ":") {
2319 Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true); 2319 Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
2320 if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != Uri._BACKSLA SH) { 2320 if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != Uri._BACKSLA SH) {
2321 throw new ArgumentError("Windows paths with drive letter must be absol ute"); 2321 dart.throw(new ArgumentError("Windows paths with drive letter must be absolute"));
2322 } 2322 }
2323 let pathSegments = path[dartx.split](sep); 2323 let pathSegments = path[dartx.split](sep);
2324 Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1); 2324 Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
2325 return Uri.new({scheme: "file", pathSegments: pathSegments}); 2325 return Uri.new({scheme: "file", pathSegments: pathSegments});
2326 } 2326 }
2327 if (dart.notNull(path[dartx.length]) > 0 && path[dartx.get](0) == sep) { 2327 if (dart.notNull(path[dartx.length]) > 0 && path[dartx.get](0) == sep) {
2328 if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == sep) { 2328 if (dart.notNull(path[dartx.length]) > 1 && path[dartx.get](1) == sep) {
2329 let pathStart = path[dartx.indexOf]("\\", 2); 2329 let pathStart = path[dartx.indexOf]("\\", 2);
2330 let hostPart = pathStart == -1 ? path[dartx.substring](2) : path[dartx .substring](2, pathStart); 2330 let hostPart = pathStart == -1 ? path[dartx.substring](2) : path[dartx .substring](2, pathStart);
2331 let pathPart = pathStart == -1 ? "" : path[dartx.substring](dart.notNu ll(pathStart) + 1); 2331 let pathPart = pathStart == -1 ? "" : path[dartx.substring](dart.notNu ll(pathStart) + 1);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 } 2542 }
2543 static _makeUserInfo(userInfo, start, end) { 2543 static _makeUserInfo(userInfo, start, end) {
2544 if (userInfo == null) 2544 if (userInfo == null)
2545 return ""; 2545 return "";
2546 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li st$(int))); 2546 return Uri._normalize(userInfo, start, end, dart.as(Uri._userinfoTable, Li st$(int)));
2547 } 2547 }
2548 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile) { 2548 static _makePath(path, start, end, pathSegments, ensureLeadingSlash, isFile) {
2549 if (path == null && pathSegments == null) 2549 if (path == null && pathSegments == null)
2550 return dart.notNull(isFile) ? "/" : ""; 2550 return dart.notNull(isFile) ? "/" : "";
2551 if (path != null && pathSegments != null) { 2551 if (path != null && pathSegments != null) {
2552 throw new ArgumentError('Both path and pathSegments specified'); 2552 dart.throw(new ArgumentError('Both path and pathSegments specified'));
2553 } 2553 }
2554 let result = null; 2554 let result = null;
2555 if (path != null) { 2555 if (path != null) {
2556 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa ble, List$(int))); 2556 result = Uri._normalize(path, start, end, dart.as(Uri._pathCharOrSlashTa ble, List$(int)));
2557 } else { 2557 } else {
2558 result = pathSegments[dartx.map](dart.fn(s => Uri._uriEncode(dart.as(Uri ._pathCharTable, List$(int)), dart.as(s, String)), String, [dart.dynamic]))[dart x.join]("/"); 2558 result = pathSegments[dartx.map](dart.fn(s => Uri._uriEncode(dart.as(Uri ._pathCharTable, List$(int)), dart.as(s, String)), String, [dart.dynamic]))[dart x.join]("/");
2559 } 2559 }
2560 if (dart.notNull(dart.as(dart.dload(result, 'isEmpty'), bool))) { 2560 if (dart.notNull(dart.as(dart.dload(result, 'isEmpty'), bool))) {
2561 if (dart.notNull(isFile)) 2561 if (dart.notNull(isFile))
2562 return "/"; 2562 return "/";
2563 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && ! dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH)) { 2563 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && ! dart.equals(dart.dsend(result, 'codeUnitAt', 0), Uri._SLASH)) {
2564 return `/${result}`; 2564 return `/${result}`;
2565 } 2565 }
2566 return dart.as(result, String); 2566 return dart.as(result, String);
2567 } 2567 }
2568 static _makeQuery(query, start, end, queryParameters) { 2568 static _makeQuery(query, start, end, queryParameters) {
2569 if (query == null && queryParameters == null) 2569 if (query == null && queryParameters == null)
2570 return null; 2570 return null;
2571 if (query != null && queryParameters != null) { 2571 if (query != null && queryParameters != null) {
2572 throw new ArgumentError('Both query and queryParameters specified'); 2572 dart.throw(new ArgumentError('Both query and queryParameters specified') );
2573 } 2573 }
2574 if (query != null) 2574 if (query != null)
2575 return Uri._normalize(query, start, end, dart.as(Uri._queryCharTable, Li st$(int))); 2575 return Uri._normalize(query, start, end, dart.as(Uri._queryCharTable, Li st$(int)));
2576 let result = new StringBuffer(); 2576 let result = new StringBuffer();
2577 let first = true; 2577 let first = true;
2578 queryParameters.forEach(dart.fn((key, value) => { 2578 queryParameters.forEach(dart.fn((key, value) => {
2579 if (!dart.notNull(first)) { 2579 if (!dart.notNull(first)) {
2580 result.write("&"); 2580 result.write("&");
2581 } 2581 }
2582 first = false; 2582 first = false;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 return this[_port] != null; 2843 return this[_port] != null;
2844 } 2844 }
2845 get hasQuery() { 2845 get hasQuery() {
2846 return this[_query] != null; 2846 return this[_query] != null;
2847 } 2847 }
2848 get hasFragment() { 2848 get hasFragment() {
2849 return this[_fragment] != null; 2849 return this[_fragment] != null;
2850 } 2850 }
2851 get origin() { 2851 get origin() {
2852 if (this.scheme == "" || this[_host] == null || this[_host] == "") { 2852 if (this.scheme == "" || this[_host] == null || this[_host] == "") {
2853 throw new StateError(`Cannot use origin without a scheme: ${this}`); 2853 dart.throw(new StateError(`Cannot use origin without a scheme: ${this}`) );
2854 } 2854 }
2855 if (this.scheme != "http" && this.scheme != "https") { 2855 if (this.scheme != "http" && this.scheme != "https") {
2856 throw new StateError(`Origin is only applicable schemes http and https: ${this}`); 2856 dart.throw(new StateError(`Origin is only applicable schemes http and ht tps: ${this}`));
2857 } 2857 }
2858 if (this[_port] == null) 2858 if (this[_port] == null)
2859 return `${this.scheme}://${this[_host]}`; 2859 return `${this.scheme}://${this[_host]}`;
2860 return `${this.scheme}://${this[_host]}:${this[_port]}`; 2860 return `${this.scheme}://${this[_host]}:${this[_port]}`;
2861 } 2861 }
2862 toFilePath(opts) { 2862 toFilePath(opts) {
2863 let windows = opts && 'windows' in opts ? opts.windows : null; 2863 let windows = opts && 'windows' in opts ? opts.windows : null;
2864 if (this.scheme != "" && this.scheme != "file") { 2864 if (this.scheme != "" && this.scheme != "file") {
2865 throw new UnsupportedError(`Cannot extract a file path from a ${this.sch eme} URI`); 2865 dart.throw(new UnsupportedError(`Cannot extract a file path from a ${thi s.scheme} URI`));
2866 } 2866 }
2867 if (this.query != "") { 2867 if (this.query != "") {
2868 throw new UnsupportedError("Cannot extract a file path from a URI with a query component"); 2868 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w ith a query component"));
2869 } 2869 }
2870 if (this.fragment != "") { 2870 if (this.fragment != "") {
2871 throw new UnsupportedError("Cannot extract a file path from a URI with a fragment component"); 2871 dart.throw(new UnsupportedError("Cannot extract a file path from a URI w ith a fragment component"));
2872 } 2872 }
2873 if (windows == null) 2873 if (windows == null)
2874 windows = Uri._isWindows; 2874 windows = Uri._isWindows;
2875 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa th](); 2875 return dart.notNull(windows) ? this[_toWindowsFilePath]() : this[_toFilePa th]();
2876 } 2876 }
2877 [_toFilePath]() { 2877 [_toFilePath]() {
2878 if (this.host != "") { 2878 if (this.host != "") {
2879 throw new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"); 2879 dart.throw(new UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
2880 } 2880 }
2881 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false); 2881 Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
2882 let result = new StringBuffer(); 2882 let result = new StringBuffer();
2883 if (dart.notNull(this[_isPathAbsolute])) 2883 if (dart.notNull(this[_isPathAbsolute]))
2884 result.write("/"); 2884 result.write("/");
2885 result.writeAll(this.pathSegments, "/"); 2885 result.writeAll(this.pathSegments, "/");
2886 return dart.toString(result); 2886 return dart.toString(result);
2887 } 2887 }
2888 [_toWindowsFilePath]() { 2888 [_toWindowsFilePath]() {
2889 let hasDriveLetter = false; 2889 let hasDriveLetter = false;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 } else if (index != 0) { 2993 } else if (index != 0) {
2994 let key = dart.dsend(element, 'substring', 0, index); 2994 let key = dart.dsend(element, 'substring', 0, index);
2995 let value = dart.dsend(element, 'substring', dart.notNull(index) + 1); 2995 let value = dart.dsend(element, 'substring', dart.notNull(index) + 1);
2996 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding: encoding})); 2996 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), Uri.decodeQueryComponent(dart.as(value, String), {encoding: encoding}));
2997 } 2997 }
2998 return map; 2998 return map;
2999 })), Map$(String, String)); 2999 })), Map$(String, String));
3000 } 3000 }
3001 static parseIPv4Address(host) { 3001 static parseIPv4Address(host) {
3002 function error(msg) { 3002 function error(msg) {
3003 throw new FormatException(`Illegal IPv4 address, ${msg}`); 3003 dart.throw(new FormatException(`Illegal IPv4 address, ${msg}`));
3004 } 3004 }
3005 dart.fn(error, dart.void, [String]); 3005 dart.fn(error, dart.void, [String]);
3006 let bytes = host[dartx.split]('.'); 3006 let bytes = host[dartx.split]('.');
3007 if (bytes[dartx.length] != 4) { 3007 if (bytes[dartx.length] != 4) {
3008 error('IPv4 address should contain exactly 4 parts'); 3008 error('IPv4 address should contain exactly 4 parts');
3009 } 3009 }
3010 return dart.as(bytes[dartx.map](dart.fn(byteString => { 3010 return dart.as(bytes[dartx.map](dart.fn(byteString => {
3011 let byte = int.parse(dart.as(byteString, String)); 3011 let byte = int.parse(dart.as(byteString, String));
3012 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) { 3012 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
3013 error('each part must be in the range of `0..255`'); 3013 error('each part must be in the range of `0..255`');
3014 } 3014 }
3015 return byte; 3015 return byte;
3016 }))[dartx.toList](), List$(int)); 3016 }))[dartx.toList](), List$(int));
3017 } 3017 }
3018 static parseIPv6Address(host, start, end) { 3018 static parseIPv6Address(host, start, end) {
3019 if (start === void 0) 3019 if (start === void 0)
3020 start = 0; 3020 start = 0;
3021 if (end === void 0) 3021 if (end === void 0)
3022 end = null; 3022 end = null;
3023 if (end == null) 3023 if (end == null)
3024 end = host[dartx.length]; 3024 end = host[dartx.length];
3025 function error(msg, position) { 3025 function error(msg, position) {
3026 if (position === void 0) 3026 if (position === void 0)
3027 position = null; 3027 position = null;
3028 throw new FormatException(`Illegal IPv6 address, ${msg}`, host, dart.as( position, int)); 3028 dart.throw(new FormatException(`Illegal IPv6 address, ${msg}`, host, dar t.as(position, int)));
3029 } 3029 }
3030 dart.fn(error, dart.void, [String], [dart.dynamic]); 3030 dart.fn(error, dart.void, [String], [dart.dynamic]);
3031 function parseHex(start, end) { 3031 function parseHex(start, end) {
3032 if (dart.notNull(end) - dart.notNull(start) > 4) { 3032 if (dart.notNull(end) - dart.notNull(start) > 4) {
3033 error('an IPv6 part can only contain a maximum of 4 hex digits', start ); 3033 error('an IPv6 part can only contain a maximum of 4 hex digits', start );
3034 } 3034 }
3035 let value = int.parse(host[dartx.substring](start, end), {radix: 16}); 3035 let value = int.parse(host[dartx.substring](start, end), {radix: 16});
3036 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) { 3036 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
3037 error('each part must be in the range of `0x0..0xFFFF`', start); 3037 error('each part must be in the range of `0x0..0xFFFF`', start);
3038 } 3038 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 let byte = 0; 3140 let byte = 0;
3141 for (let i = 0; dart.notNull(i) < 2; i = dart.notNull(i) + 1) { 3141 for (let i = 0; dart.notNull(i) < 2; i = dart.notNull(i) + 1) {
3142 let charCode = s[dartx.codeUnitAt](dart.notNull(pos) + dart.notNull(i)); 3142 let charCode = s[dartx.codeUnitAt](dart.notNull(pos) + dart.notNull(i));
3143 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) { 3143 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) {
3144 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 48; 3144 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 48;
3145 } else { 3145 } else {
3146 charCode = dart.notNull(charCode) | 32; 3146 charCode = dart.notNull(charCode) | 32;
3147 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) { 3147 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) {
3148 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 87; 3148 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 87;
3149 } else { 3149 } else {
3150 throw new ArgumentError("Invalid URL encoding"); 3150 dart.throw(new ArgumentError("Invalid URL encoding"));
3151 } 3151 }
3152 } 3152 }
3153 } 3153 }
3154 return byte; 3154 return byte;
3155 } 3155 }
3156 static _uriDecode(text, opts) { 3156 static _uriDecode(text, opts) {
3157 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false ; 3157 let plusToSpace = opts && 'plusToSpace' in opts ? opts.plusToSpace : false ;
3158 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8; 3158 let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
3159 let simple = true; 3159 let simple = true;
3160 for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]) && dart .notNull(simple); i = dart.notNull(i) + 1) { 3160 for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]) && dart .notNull(simple); i = dart.notNull(i) + 1) {
3161 let codeUnit = text[dartx.codeUnitAt](i); 3161 let codeUnit = text[dartx.codeUnitAt](i);
3162 simple = codeUnit != Uri._PERCENT && codeUnit != Uri._PLUS; 3162 simple = codeUnit != Uri._PERCENT && codeUnit != Uri._PLUS;
3163 } 3163 }
3164 let bytes = null; 3164 let bytes = null;
3165 if (dart.notNull(simple)) { 3165 if (dart.notNull(simple)) {
3166 if (dart.equals(encoding, convert.UTF8) || dart.equals(encoding, convert .LATIN1)) { 3166 if (dart.equals(encoding, convert.UTF8) || dart.equals(encoding, convert .LATIN1)) {
3167 return text; 3167 return text;
3168 } else { 3168 } else {
3169 bytes = text[dartx.codeUnits]; 3169 bytes = text[dartx.codeUnits];
3170 } 3170 }
3171 } else { 3171 } else {
3172 bytes = List$(int).new(); 3172 bytes = List$(int).new();
3173 for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]); i = dart.notNull(i) + 1) { 3173 for (let i = 0; dart.notNull(i) < dart.notNull(text[dartx.length]); i = dart.notNull(i) + 1) {
3174 let codeUnit = text[dartx.codeUnitAt](i); 3174 let codeUnit = text[dartx.codeUnitAt](i);
3175 if (dart.notNull(codeUnit) > 127) { 3175 if (dart.notNull(codeUnit) > 127) {
3176 throw new ArgumentError("Illegal percent encoding in URI"); 3176 dart.throw(new ArgumentError("Illegal percent encoding in URI"));
3177 } 3177 }
3178 if (codeUnit == Uri._PERCENT) { 3178 if (codeUnit == Uri._PERCENT) {
3179 if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) { 3179 if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) {
3180 throw new ArgumentError('Truncated URI'); 3180 dart.throw(new ArgumentError('Truncated URI'));
3181 } 3181 }
3182 bytes[dartx.add](Uri._hexCharPairToByte(text, dart.notNull(i) + 1)); 3182 bytes[dartx.add](Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
3183 i = dart.notNull(i) + 2; 3183 i = dart.notNull(i) + 2;
3184 } else if (dart.notNull(plusToSpace) && codeUnit == Uri._PLUS) { 3184 } else if (dart.notNull(plusToSpace) && codeUnit == Uri._PLUS) {
3185 bytes[dartx.add](Uri._SPACE); 3185 bytes[dartx.add](Uri._SPACE);
3186 } else { 3186 } else {
3187 bytes[dartx.add](codeUnit); 3187 bytes[dartx.add](codeUnit);
3188 } 3188 }
3189 } 3189 }
3190 } 3190 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 exports.StackTrace = StackTrace; 3365 exports.StackTrace = StackTrace;
3366 exports.Stopwatch = Stopwatch; 3366 exports.Stopwatch = Stopwatch;
3367 exports.String = String; 3367 exports.String = String;
3368 exports.RuneIterator = RuneIterator; 3368 exports.RuneIterator = RuneIterator;
3369 exports.StringBuffer = StringBuffer; 3369 exports.StringBuffer = StringBuffer;
3370 exports.StringSink = StringSink; 3370 exports.StringSink = StringSink;
3371 exports.Symbol = Symbol; 3371 exports.Symbol = Symbol;
3372 exports.Type = Type; 3372 exports.Type = Type;
3373 exports.Uri = Uri; 3373 exports.Uri = Uri;
3374 }); 3374 });
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