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

Side by Side Diff: test/codegen/expect/dart/core.js

Issue 977613002: Make int and double nullable by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: actually upload changes Created 5 years, 9 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
OLDNEW
1 var core; 1 var core;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _symbolToString: (Symbol) → String 4 // Function _symbolToString: (Symbol) → String
5 function _symbolToString(symbol) { 5 function _symbolToString(symbol) {
6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); 6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol));
7 } 7 }
8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic 8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic
9 function _symbolMapToStringMap(map) { 9 function _symbolMapToStringMap(map) {
10 if (map === null) 10 if (map === null)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return 0.0; 113 return 0.0;
114 return double.parse(matched); 114 return double.parse(matched);
115 } 115 }
116 let years = int.parse(match.get(1)); 116 let years = int.parse(match.get(1));
117 let month = int.parse(match.get(2)); 117 let month = int.parse(match.get(2));
118 let day = int.parse(match.get(3)); 118 let day = int.parse(match.get(3));
119 let hour = parseIntOrZero(match.get(4)); 119 let hour = parseIntOrZero(match.get(4));
120 let minute = parseIntOrZero(match.get(5)); 120 let minute = parseIntOrZero(match.get(5));
121 let second = parseIntOrZero(match.get(6)); 121 let second = parseIntOrZero(match.get(6));
122 let addOneMillisecond = false; 122 let addOneMillisecond = false;
123 let millisecond = (parseDoubleOrZero(match.get(7)) * 1000).round(); 123 let millisecond = (dart.notNull(parseDoubleOrZero(match.get(7))) * 1000) .round();
124 if (millisecond === 1000) { 124 if (millisecond === 1000) {
125 addOneMillisecond = true; 125 addOneMillisecond = true;
126 millisecond = 999; 126 millisecond = 999;
127 } 127 }
128 let isUtc = false; 128 let isUtc = false;
129 if (match.get(8) !== null) { 129 if (match.get(8) !== null) {
130 isUtc = true; 130 isUtc = true;
131 if (match.get(9) !== null) { 131 if (match.get(9) !== null) {
132 let sign = dart.equals(match.get(9), '-') ? -1 : 1; 132 let sign = dart.equals(match.get(9), '-') ? -1 : 1;
133 let hourDifference = int.parse(match.get(10)); 133 let hourDifference = int.parse(match.get(10));
134 let minuteDifference = parseIntOrZero(match.get(11)); 134 let minuteDifference = parseIntOrZero(match.get(11));
135 minuteDifference = 60 * hourDifference; 135 minuteDifference = 60 * dart.notNull(hourDifference);
136 minute = sign * minuteDifference; 136 minute = dart.notNull(sign) * dart.notNull(minuteDifference);
137 } 137 }
138 } 138 }
139 let millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(yea rs, month, day, hour, minute, second, millisecond, isUtc); 139 let millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(yea rs, month, day, hour, minute, second, millisecond, isUtc);
140 if (millisecondsSinceEpoch === null) { 140 if (millisecondsSinceEpoch === null) {
141 throw new FormatException("Time out of range", formattedString); 141 throw new FormatException("Time out of range", formattedString);
142 } 142 }
143 if (addOneMillisecond) 143 if (addOneMillisecond)
144 millisecondsSinceEpoch++; 144 dart.notNull(millisecondsSinceEpoch)++;
145 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc}); 145 return new DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch, { isUtc: isUtc});
146 } else { 146 } else {
147 throw new FormatException("Invalid date format", formattedString); 147 throw new FormatException("Invalid date format", formattedString);
148 } 148 }
149 } 149 }
150 DateTime$fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opt$) { 150 DateTime$fromMillisecondsSinceEpoch(millisecondsSinceEpoch, opt$) {
151 let isUtc = opt$.isUtc === void 0 ? false : opt$.isUtc; 151 let isUtc = opt$.isUtc === void 0 ? false : opt$.isUtc;
152 this.millisecondsSinceEpoch = millisecondsSinceEpoch; 152 this.millisecondsSinceEpoch = millisecondsSinceEpoch;
153 this.isUtc = isUtc; 153 this.isUtc = isUtc;
154 if (millisecondsSinceEpoch.abs() > _MAX_MILLISECONDS_SINCE_EPOCH) { 154 if (dart.notNull(millisecondsSinceEpoch.abs()) > dart.notNull(_MAX_MILLISE CONDS_SINCE_EPOCH)) {
155 throw new ArgumentError(millisecondsSinceEpoch); 155 throw new ArgumentError(millisecondsSinceEpoch);
156 } 156 }
157 if (isUtc === null) 157 if (isUtc === null)
158 throw new ArgumentError(isUtc); 158 throw new ArgumentError(isUtc);
159 } 159 }
160 ['=='](other) { 160 ['=='](other) {
161 if (!dart.notNull(dart.is(other, DateTime))) 161 if (!dart.notNull(dart.is(other, DateTime)))
162 return false; 162 return false;
163 return dart.notNull(this.millisecondsSinceEpoch === dart.dload(other, 'mil lisecondsSinceEpoch')) && dart.notNull(this.isUtc === dart.dload(other, 'isUtc') ); 163 return this.millisecondsSinceEpoch === dart.dload(other, 'millisecondsSinc eEpoch') && this.isUtc === dart.dload(other, 'isUtc');
164 } 164 }
165 isBefore(other) { 165 isBefore(other) {
166 return this.millisecondsSinceEpoch < other.millisecondsSinceEpoch; 166 return dart.notNull(this.millisecondsSinceEpoch) < dart.notNull(other.mill isecondsSinceEpoch);
167 } 167 }
168 isAfter(other) { 168 isAfter(other) {
169 return this.millisecondsSinceEpoch > other.millisecondsSinceEpoch; 169 return dart.notNull(this.millisecondsSinceEpoch) > dart.notNull(other.mill isecondsSinceEpoch);
170 } 170 }
171 isAtSameMomentAs(other) { 171 isAtSameMomentAs(other) {
172 return this.millisecondsSinceEpoch === other.millisecondsSinceEpoch; 172 return this.millisecondsSinceEpoch === other.millisecondsSinceEpoch;
173 } 173 }
174 compareTo(other) { 174 compareTo(other) {
175 return this.millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch) ; 175 return this.millisecondsSinceEpoch.compareTo(other.millisecondsSinceEpoch) ;
176 } 176 }
177 get hashCode() { 177 get hashCode() {
178 return this.millisecondsSinceEpoch; 178 return this.millisecondsSinceEpoch;
179 } 179 }
180 toLocal() { 180 toLocal() {
181 if (this.isUtc) { 181 if (this.isUtc) {
182 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false}); 182 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpo ch, {isUtc: false});
183 } 183 }
184 return this; 184 return this;
185 } 185 }
186 toUtc() { 186 toUtc() {
187 if (this.isUtc) 187 if (this.isUtc)
188 return this; 188 return this;
189 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch , {isUtc: true}); 189 return new DateTime.fromMillisecondsSinceEpoch(this.millisecondsSinceEpoch , {isUtc: true});
190 } 190 }
191 static [_fourDigits](n) { 191 static [_fourDigits](n) {
192 let absN = n.abs(); 192 let absN = n.abs();
193 let sign = n < 0 ? "-" : ""; 193 let sign = dart.notNull(n) < 0 ? "-" : "";
194 if (absN >= 1000) 194 if (dart.notNull(absN) >= 1000)
195 return `${n}`; 195 return `${n}`;
196 if (absN >= 100) 196 if (dart.notNull(absN) >= 100)
197 return `${sign}0${absN}`; 197 return `${sign}0${absN}`;
198 if (absN >= 10) 198 if (dart.notNull(absN) >= 10)
199 return `${sign}00${absN}`; 199 return `${sign}00${absN}`;
200 return `${sign}000${absN}`; 200 return `${sign}000${absN}`;
201 } 201 }
202 static [_sixDigits](n) { 202 static [_sixDigits](n) {
203 dart.assert(dart.notNull(n < -9999) || dart.notNull(n > 9999)); 203 dart.assert(dart.notNull(n) < -9999 || dart.notNull(n) > 9999);
204 let absN = n.abs(); 204 let absN = n.abs();
205 let sign = n < 0 ? "-" : "+"; 205 let sign = dart.notNull(n) < 0 ? "-" : "+";
206 if (absN >= 100000) 206 if (dart.notNull(absN) >= 100000)
207 return `${sign}${absN}`; 207 return `${sign}${absN}`;
208 return `${sign}0${absN}`; 208 return `${sign}0${absN}`;
209 } 209 }
210 static [_threeDigits](n) { 210 static [_threeDigits](n) {
211 if (n >= 100) 211 if (dart.notNull(n) >= 100)
212 return `${n}`; 212 return `${n}`;
213 if (n >= 10) 213 if (dart.notNull(n) >= 10)
214 return `0${n}`; 214 return `0${n}`;
215 return `00${n}`; 215 return `00${n}`;
216 } 216 }
217 static [_twoDigits](n) { 217 static [_twoDigits](n) {
218 if (n >= 10) 218 if (dart.notNull(n) >= 10)
219 return `${n}`; 219 return `${n}`;
220 return `0${n}`; 220 return `0${n}`;
221 } 221 }
222 toString() { 222 toString() {
223 let y = _fourDigits(this.year); 223 let y = _fourDigits(this.year);
224 let m = _twoDigits(this.month); 224 let m = _twoDigits(this.month);
225 let d = _twoDigits(this.day); 225 let d = _twoDigits(this.day);
226 let h = _twoDigits(this.hour); 226 let h = _twoDigits(this.hour);
227 let min = _twoDigits(this.minute); 227 let min = _twoDigits(this.minute);
228 let sec = _twoDigits(this.second); 228 let sec = _twoDigits(this.second);
229 let ms = _threeDigits(this.millisecond); 229 let ms = _threeDigits(this.millisecond);
230 if (this.isUtc) { 230 if (this.isUtc) {
231 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}Z`; 231 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}Z`;
232 } else { 232 } else {
233 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}`; 233 return `${y}-${m}-${d} ${h}:${min}:${sec}.${ms}`;
234 } 234 }
235 } 235 }
236 toIso8601String() { 236 toIso8601String() {
237 let y = dart.notNull(this.year >= -9999) && dart.notNull(this.year <= 9999 ) ? _fourDigits(this.year) : _sixDigits(this.year); 237 let y = dart.notNull(this.year) >= -9999 && dart.notNull(this.year) <= 999 9 ? _fourDigits(this.year) : _sixDigits(this.year);
238 let m = _twoDigits(this.month); 238 let m = _twoDigits(this.month);
239 let d = _twoDigits(this.day); 239 let d = _twoDigits(this.day);
240 let h = _twoDigits(this.hour); 240 let h = _twoDigits(this.hour);
241 let min = _twoDigits(this.minute); 241 let min = _twoDigits(this.minute);
242 let sec = _twoDigits(this.second); 242 let sec = _twoDigits(this.second);
243 let ms = _threeDigits(this.millisecond); 243 let ms = _threeDigits(this.millisecond);
244 if (this.isUtc) { 244 if (this.isUtc) {
245 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}Z`; 245 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}Z`;
246 } else { 246 } else {
247 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}`; 247 return `${y}-${m}-${d}T${h}:${min}:${sec}.${ms}`;
248 } 248 }
249 } 249 }
250 add(duration) { 250 add(duration) {
251 let ms = this.millisecondsSinceEpoch; 251 let ms = this.millisecondsSinceEpoch;
252 return new DateTime.fromMillisecondsSinceEpoch(ms + duration.inMillisecond s, {isUtc: this.isUtc}); 252 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) + dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc});
253 } 253 }
254 subtract(duration) { 254 subtract(duration) {
255 let ms = this.millisecondsSinceEpoch; 255 let ms = this.millisecondsSinceEpoch;
256 return new DateTime.fromMillisecondsSinceEpoch(ms - duration.inMillisecond s, {isUtc: this.isUtc}); 256 return new DateTime.fromMillisecondsSinceEpoch(dart.notNull(ms) - dart.not Null(duration.inMilliseconds), {isUtc: this.isUtc});
257 } 257 }
258 difference(other) { 258 difference(other) {
259 let ms = this.millisecondsSinceEpoch; 259 let ms = this.millisecondsSinceEpoch;
260 let otherMs = other.millisecondsSinceEpoch; 260 let otherMs = other.millisecondsSinceEpoch;
261 return new Duration({milliseconds: ms - otherMs}); 261 return new Duration({milliseconds: dart.notNull(ms) - dart.notNull(otherMs )});
262 } 262 }
263 DateTime$_internal(year, month, day, hour, minute, second, millisecond, isUt c) { 263 DateTime$_internal(year, month, day, hour, minute, second, millisecond, isUt c) {
264 this.isUtc = dart.as(typeof isUtc == boolean ? isUtc : dart.throw_(new Arg umentError(isUtc)), bool); 264 this.isUtc = dart.as(typeof isUtc == boolean ? isUtc : dart.throw_(new Arg umentError(isUtc)), bool);
265 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int); 265 this.millisecondsSinceEpoch = dart.as(_js_helper.checkInt(_js_helper.Primi tives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecon d, isUtc)), int);
266 } 266 }
267 DateTime$_now() { 267 DateTime$_now() {
268 this.isUtc = false; 268 this.isUtc = false;
269 this.millisecondsSinceEpoch = dart.notNull(_js_helper.Primitives.dateNow() ); 269 this.millisecondsSinceEpoch = _js_helper.Primitives.dateNow();
270 } 270 }
271 static [_brokenDownDateToMillisecondsSinceEpoch](year, month, day, hour, min ute, second, millisecond, isUtc) { 271 static [_brokenDownDateToMillisecondsSinceEpoch](year, month, day, hour, min ute, second, millisecond, isUtc) {
272 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int); 272 return dart.as(_js_helper.Primitives.valueFromDecomposedDate(year, month, day, hour, minute, second, millisecond, isUtc), int);
273 } 273 }
274 get timeZoneName() { 274 get timeZoneName() {
275 if (this.isUtc) 275 if (this.isUtc)
276 return "UTC"; 276 return "UTC";
277 return _js_helper.Primitives.getTimeZoneName(this); 277 return _js_helper.Primitives.getTimeZoneName(this);
278 } 278 }
279 get timeZoneOffset() { 279 get timeZoneOffset() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 DateTime._MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; 335 DateTime._MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
336 class double extends num { 336 class double extends num {
337 static parse(source, onError) { 337 static parse(source, onError) {
338 if (onError === void 0) 338 if (onError === void 0)
339 onError = null; 339 onError = null;
340 return _js_helper.Primitives.parseDouble(source, onError); 340 return _js_helper.Primitives.parseDouble(source, onError);
341 } 341 }
342 } 342 }
343 double.NAN = 0.0 / 0.0; 343 double.NAN = 0.0 / 0.0;
344 double.INFINITY = 1.0 / 0.0; 344 double.INFINITY = 1.0 / 0.0;
345 double.NEGATIVE_INFINITY = -INFINITY; 345 double.NEGATIVE_INFINITY = -dart.notNull(INFINITY);
346 double.MIN_POSITIVE = 5e-324; 346 double.MIN_POSITIVE = 5e-324;
347 double.MAX_FINITE = 1.7976931348623157e+308; 347 double.MAX_FINITE = 1.7976931348623157e+308;
348 let _duration = Symbol('_duration'); 348 let _duration = Symbol('_duration');
349 class Duration extends dart.Object { 349 class Duration extends dart.Object {
350 Duration(opt$) { 350 Duration(opt$) {
351 let days = opt$.days === void 0 ? 0 : opt$.days; 351 let days = opt$.days === void 0 ? 0 : opt$.days;
352 let hours = opt$.hours === void 0 ? 0 : opt$.hours; 352 let hours = opt$.hours === void 0 ? 0 : opt$.hours;
353 let minutes = opt$.minutes === void 0 ? 0 : opt$.minutes; 353 let minutes = opt$.minutes === void 0 ? 0 : opt$.minutes;
354 let seconds = opt$.seconds === void 0 ? 0 : opt$.seconds; 354 let seconds = opt$.seconds === void 0 ? 0 : opt$.seconds;
355 let milliseconds = opt$.milliseconds === void 0 ? 0 : opt$.milliseconds; 355 let milliseconds = opt$.milliseconds === void 0 ? 0 : opt$.milliseconds;
356 let microseconds = opt$.microseconds === void 0 ? 0 : opt$.microseconds; 356 let microseconds = opt$.microseconds === void 0 ? 0 : opt$.microseconds;
357 this.Duration$_microseconds(days * MICROSECONDS_PER_DAY + hours * MICROSEC ONDS_PER_HOUR + minutes * MICROSECONDS_PER_MINUTE + seconds * MICROSECONDS_PER_S ECOND + milliseconds * MICROSECONDS_PER_MILLISECOND + microseconds); 357 this.Duration$_microseconds(dart.notNull(days) * dart.notNull(MICROSECONDS _PER_DAY) + dart.notNull(hours) * dart.notNull(MICROSECONDS_PER_HOUR) + dart.not Null(minutes) * dart.notNull(MICROSECONDS_PER_MINUTE) + dart.notNull(seconds) * dart.notNull(MICROSECONDS_PER_SECOND) + dart.notNull(milliseconds) * dart.notNul l(MICROSECONDS_PER_MILLISECOND) + dart.notNull(microseconds));
358 } 358 }
359 Duration$_microseconds($_duration) { 359 Duration$_microseconds($_duration) {
360 this[_duration] = $_duration; 360 this[_duration] = $_duration;
361 } 361 }
362 ['+'](other) { 362 ['+'](other) {
363 return new Duration._microseconds(this[_duration] + other[_duration]); 363 return new Duration._microseconds(dart.notNull(this[_duration]) + dart.not Null(other[_duration]));
364 } 364 }
365 ['-'](other) { 365 ['-'](other) {
366 return new Duration._microseconds(this[_duration] - other[_duration]); 366 return new Duration._microseconds(dart.notNull(this[_duration]) - dart.not Null(other[_duration]));
367 } 367 }
368 ['*'](factor) { 368 ['*'](factor) {
369 return new Duration._microseconds((this[_duration] * dart.notNull(factor)) .round()); 369 return new Duration._microseconds((dart.notNull(this[_duration]) * dart.no tNull(factor)).round());
370 } 370 }
371 ['~/'](quotient) { 371 ['~/'](quotient) {
372 if (quotient === 0) 372 if (quotient === 0)
373 throw new IntegerDivisionByZeroException(); 373 throw new IntegerDivisionByZeroException();
374 return new Duration._microseconds((this[_duration] / quotient).truncate()) ; 374 return new Duration._microseconds((dart.notNull(this[_duration]) / dart.no tNull(quotient)).truncate());
375 } 375 }
376 ['<'](other) { 376 ['<'](other) {
377 return this[_duration] < other[_duration]; 377 return dart.notNull(this[_duration]) < dart.notNull(other[_duration]);
378 } 378 }
379 ['>'](other) { 379 ['>'](other) {
380 return this[_duration] > other[_duration]; 380 return dart.notNull(this[_duration]) > dart.notNull(other[_duration]);
381 } 381 }
382 ['<='](other) { 382 ['<='](other) {
383 return this[_duration] <= other[_duration]; 383 return dart.notNull(this[_duration]) <= dart.notNull(other[_duration]);
384 } 384 }
385 ['>='](other) { 385 ['>='](other) {
386 return this[_duration] >= other[_duration]; 386 return dart.notNull(this[_duration]) >= dart.notNull(other[_duration]);
387 } 387 }
388 get inDays() { 388 get inDays() {
389 return (this[_duration] / Duration.MICROSECONDS_PER_DAY).truncate(); 389 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_DAY)).truncate();
390 } 390 }
391 get inHours() { 391 get inHours() {
392 return (this[_duration] / Duration.MICROSECONDS_PER_HOUR).truncate(); 392 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_HOUR)).truncate();
393 } 393 }
394 get inMinutes() { 394 get inMinutes() {
395 return (this[_duration] / Duration.MICROSECONDS_PER_MINUTE).truncate(); 395 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_MINUTE)).truncate();
396 } 396 }
397 get inSeconds() { 397 get inSeconds() {
398 return (this[_duration] / Duration.MICROSECONDS_PER_SECOND).truncate(); 398 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_SECOND)).truncate();
399 } 399 }
400 get inMilliseconds() { 400 get inMilliseconds() {
401 return (this[_duration] / Duration.MICROSECONDS_PER_MILLISECOND).truncate( ); 401 return (dart.notNull(this[_duration]) / dart.notNull(Duration.MICROSECONDS _PER_MILLISECOND)).truncate();
402 } 402 }
403 get inMicroseconds() { 403 get inMicroseconds() {
404 return this[_duration]; 404 return this[_duration];
405 } 405 }
406 ['=='](other) { 406 ['=='](other) {
407 if (!dart.is(other, Duration)) 407 if (!dart.is(other, Duration))
408 return false; 408 return false;
409 return this[_duration] === dart.dload(other, '_duration'); 409 return this[_duration] === dart.dload(other, '_duration');
410 } 410 }
411 get hashCode() { 411 get hashCode() {
412 return this[_duration].hashCode; 412 return this[_duration].hashCode;
413 } 413 }
414 compareTo(other) { 414 compareTo(other) {
415 return this[_duration].compareTo(other[_duration]); 415 return this[_duration].compareTo(other[_duration]);
416 } 416 }
417 toString() { 417 toString() {
418 // Function sixDigits: (int) → String 418 // Function sixDigits: (int) → String
419 function sixDigits(n) { 419 function sixDigits(n) {
420 if (n >= 100000) 420 if (dart.notNull(n) >= 100000)
421 return `${n}`; 421 return `${n}`;
422 if (n >= 10000) 422 if (dart.notNull(n) >= 10000)
423 return `0${n}`; 423 return `0${n}`;
424 if (n >= 1000) 424 if (dart.notNull(n) >= 1000)
425 return `00${n}`; 425 return `00${n}`;
426 if (n >= 100) 426 if (dart.notNull(n) >= 100)
427 return `000${n}`; 427 return `000${n}`;
428 if (n >= 10) 428 if (dart.notNull(n) >= 10)
429 return `0000${n}`; 429 return `0000${n}`;
430 return `00000${n}`; 430 return `00000${n}`;
431 } 431 }
432 // Function twoDigits: (int) → String 432 // Function twoDigits: (int) → String
433 function twoDigits(n) { 433 function twoDigits(n) {
434 if (n >= 10) 434 if (dart.notNull(n) >= 10)
435 return `${n}`; 435 return `${n}`;
436 return `0${n}`; 436 return `0${n}`;
437 } 437 }
438 if (this.inMicroseconds < 0) { 438 if (dart.notNull(this.inMicroseconds) < 0) {
439 return `-${dart.throw_("Unimplemented PrefixExpression: -this")}`; 439 return `-${dart.throw_("Unimplemented PrefixExpression: -this")}`;
440 } 440 }
441 let twoDigitMinutes = twoDigits(dart.notNull(this.inMinutes.remainder(MINU TES_PER_HOUR))); 441 let twoDigitMinutes = twoDigits(this.inMinutes.remainder(MINUTES_PER_HOUR) );
442 let twoDigitSeconds = twoDigits(dart.notNull(this.inSeconds.remainder(SECO NDS_PER_MINUTE))); 442 let twoDigitSeconds = twoDigits(this.inSeconds.remainder(SECONDS_PER_MINUT E));
443 let sixDigitUs = sixDigits(dart.notNull(this.inMicroseconds.remainder(MICR OSECONDS_PER_SECOND))); 443 let sixDigitUs = sixDigits(this.inMicroseconds.remainder(MICROSECONDS_PER_ SECOND));
444 return `${this.inHours}:${twoDigitMinutes}:${twoDigitSeconds}.${sixDigitUs }`; 444 return `${this.inHours}:${twoDigitMinutes}:${twoDigitSeconds}.${sixDigitUs }`;
445 } 445 }
446 get isNegative() { 446 get isNegative() {
447 return this[_duration] < 0; 447 return dart.notNull(this[_duration]) < 0;
448 } 448 }
449 abs() { 449 abs() {
450 return new Duration._microseconds(this[_duration].abs()); 450 return new Duration._microseconds(this[_duration].abs());
451 } 451 }
452 ['-']() { 452 ['-']() {
453 return new Duration._microseconds(-this[_duration]); 453 return new Duration._microseconds(-dart.notNull(this[_duration]));
454 } 454 }
455 } 455 }
456 dart.defineNamedConstructor(Duration, '_microseconds'); 456 dart.defineNamedConstructor(Duration, '_microseconds');
457 Duration.MICROSECONDS_PER_MILLISECOND = 1000; 457 Duration.MICROSECONDS_PER_MILLISECOND = 1000;
458 Duration.MILLISECONDS_PER_SECOND = 1000; 458 Duration.MILLISECONDS_PER_SECOND = 1000;
459 Duration.SECONDS_PER_MINUTE = 60; 459 Duration.SECONDS_PER_MINUTE = 60;
460 Duration.MINUTES_PER_HOUR = 60; 460 Duration.MINUTES_PER_HOUR = 60;
461 Duration.HOURS_PER_DAY = 24; 461 Duration.HOURS_PER_DAY = 24;
462 Duration.MICROSECONDS_PER_SECOND = MICROSECONDS_PER_MILLISECOND * MILLISECONDS _PER_SECOND; 462 Duration.MICROSECONDS_PER_SECOND = dart.notNull(MICROSECONDS_PER_MILLISECOND) * dart.notNull(MILLISECONDS_PER_SECOND);
463 Duration.MICROSECONDS_PER_MINUTE = MICROSECONDS_PER_SECOND * SECONDS_PER_MINUT E; 463 Duration.MICROSECONDS_PER_MINUTE = dart.notNull(MICROSECONDS_PER_SECOND) * dar t.notNull(SECONDS_PER_MINUTE);
464 Duration.MICROSECONDS_PER_HOUR = MICROSECONDS_PER_MINUTE * MINUTES_PER_HOUR; 464 Duration.MICROSECONDS_PER_HOUR = dart.notNull(MICROSECONDS_PER_MINUTE) * dart. notNull(MINUTES_PER_HOUR);
465 Duration.MICROSECONDS_PER_DAY = MICROSECONDS_PER_HOUR * HOURS_PER_DAY; 465 Duration.MICROSECONDS_PER_DAY = dart.notNull(MICROSECONDS_PER_HOUR) * dart.not Null(HOURS_PER_DAY);
466 Duration.MILLISECONDS_PER_MINUTE = MILLISECONDS_PER_SECOND * SECONDS_PER_MINUT E; 466 Duration.MILLISECONDS_PER_MINUTE = dart.notNull(MILLISECONDS_PER_SECOND) * dar t.notNull(SECONDS_PER_MINUTE);
467 Duration.MILLISECONDS_PER_HOUR = MILLISECONDS_PER_MINUTE * MINUTES_PER_HOUR; 467 Duration.MILLISECONDS_PER_HOUR = dart.notNull(MILLISECONDS_PER_MINUTE) * dart. notNull(MINUTES_PER_HOUR);
468 Duration.MILLISECONDS_PER_DAY = MILLISECONDS_PER_HOUR * HOURS_PER_DAY; 468 Duration.MILLISECONDS_PER_DAY = dart.notNull(MILLISECONDS_PER_HOUR) * dart.not Null(HOURS_PER_DAY);
469 Duration.SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR; 469 Duration.SECONDS_PER_HOUR = dart.notNull(SECONDS_PER_MINUTE) * dart.notNull(MI NUTES_PER_HOUR);
470 Duration.SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY; 470 Duration.SECONDS_PER_DAY = dart.notNull(SECONDS_PER_HOUR) * dart.notNull(HOURS _PER_DAY);
471 Duration.MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY; 471 Duration.MINUTES_PER_DAY = dart.notNull(MINUTES_PER_HOUR) * dart.notNull(HOURS _PER_DAY);
472 Duration.ZERO = new Duration({seconds: 0}); 472 Duration.ZERO = new Duration({seconds: 0});
473 let _stringToSafeString = Symbol('_stringToSafeString'); 473 let _stringToSafeString = Symbol('_stringToSafeString');
474 let _objectToString = Symbol('_objectToString'); 474 let _objectToString = Symbol('_objectToString');
475 class Error extends dart.Object { 475 class Error extends dart.Object {
476 Error() { 476 Error() {
477 } 477 }
478 static safeToString(object) { 478 static safeToString(object) {
479 if (dart.notNull(dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == boolean)) || dart.notNull(null === object)) { 479 if (dart.notNull(dart.is(object, num)) || dart.notNull(typeof object == bo olean) || dart.notNull(null === object)) {
480 return object.toString(); 480 return object.toString();
481 } 481 }
482 if (typeof object == string) { 482 if (typeof object == string) {
483 return _stringToSafeString(object); 483 return _stringToSafeString(object);
484 } 484 }
485 return _objectToString(object); 485 return _objectToString(object);
486 } 486 }
487 static [_stringToSafeString](string) { 487 static [_stringToSafeString](string) {
488 return _js_helper.jsonEncodeNative(string); 488 return _js_helper.jsonEncodeNative(string);
489 } 489 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 super.ArgumentError$value(invalidValue, name, message !== null ? message : "Invalid value"); 574 super.ArgumentError$value(invalidValue, name, message !== null ? message : "Invalid value");
575 } 575 }
576 RangeError$index(index, indexable, name, message, length) { 576 RangeError$index(index, indexable, name, message, length) {
577 return new IndexError(index, indexable, name, message, length); 577 return new IndexError(index, indexable, name, message, length);
578 } 578 }
579 static checkValueInInterval(value, minValue, maxValue, name, message) { 579 static checkValueInInterval(value, minValue, maxValue, name, message) {
580 if (name === void 0) 580 if (name === void 0)
581 name = null; 581 name = null;
582 if (message === void 0) 582 if (message === void 0)
583 message = null; 583 message = null;
584 if (dart.notNull(value < minValue) || dart.notNull(value > maxValue)) { 584 if (dart.notNull(value) < dart.notNull(minValue) || dart.notNull(value) > dart.notNull(maxValue)) {
585 throw new RangeError.range(value, minValue, maxValue, name, message); 585 throw new RangeError.range(value, minValue, maxValue, name, message);
586 } 586 }
587 } 587 }
588 static checkValidIndex(index, indexable, name, length, message) { 588 static checkValidIndex(index, indexable, name, length, message) {
589 if (name === void 0) 589 if (name === void 0)
590 name = null; 590 name = null;
591 if (length === void 0) 591 if (length === void 0)
592 length = null; 592 length = null;
593 if (message === void 0) 593 if (message === void 0)
594 message = null; 594 message = null;
595 if (length === null) 595 if (length === null)
596 length = dart.as(dart.dload(indexable, 'length'), int); 596 length = dart.as(dart.dload(indexable, 'length'), int);
597 if (dart.notNull(index < 0) || dart.notNull(index >= length)) { 597 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(length) ) {
598 if (name === null) 598 if (name === null)
599 name = "index"; 599 name = "index";
600 throw new RangeError.index(index, indexable, name, message, length); 600 throw new RangeError.index(index, indexable, name, message, length);
601 } 601 }
602 } 602 }
603 static checkValidRange(start, end, length, startName, endName, message) { 603 static checkValidRange(start, end, length, startName, endName, message) {
604 if (startName === void 0) 604 if (startName === void 0)
605 startName = null; 605 startName = null;
606 if (endName === void 0) 606 if (endName === void 0)
607 endName = null; 607 endName = null;
608 if (message === void 0) 608 if (message === void 0)
609 message = null; 609 message = null;
610 if (dart.notNull(start < 0) || dart.notNull(start > length)) { 610 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length)) {
611 if (startName === null) 611 if (startName === null)
612 startName = "start"; 612 startName = "start";
613 throw new RangeError.range(start, 0, length, startName, message); 613 throw new RangeError.range(start, 0, length, startName, message);
614 } 614 }
615 if (dart.notNull(end !== null) && dart.notNull(dart.notNull(end < start) | | dart.notNull(end > length))) { 615 if (end !== null && (dart.notNull(end) < dart.notNull(start) || dart.notNu ll(end) > dart.notNull(length))) {
616 if (endName === null) 616 if (endName === null)
617 endName = "end"; 617 endName = "end";
618 throw new RangeError.range(end, start, length, endName, message); 618 throw new RangeError.range(end, start, length, endName, message);
619 } 619 }
620 } 620 }
621 static checkNotNegative(value, name, message) { 621 static checkNotNegative(value, name, message) {
622 if (name === void 0) 622 if (name === void 0)
623 name = null; 623 name = null;
624 if (message === void 0) 624 if (message === void 0)
625 message = null; 625 message = null;
626 if (value < 0) 626 if (dart.notNull(value) < 0)
627 throw new RangeError.range(value, 0, dart.as(null, int), name, message); 627 throw new RangeError.range(value, 0, null, name, message);
628 } 628 }
629 toString() { 629 toString() {
630 if (!dart.notNull(this[_hasValue])) 630 if (!dart.notNull(this[_hasValue]))
631 return `RangeError: ${this.message}`; 631 return `RangeError: ${this.message}`;
632 let value = Error.safeToString(this.invalidValue); 632 let value = Error.safeToString(this.invalidValue);
633 let explanation = ""; 633 let explanation = "";
634 if (this.start === null) { 634 if (this.start === null) {
635 if (this.end !== null) { 635 if (this.end !== null) {
636 explanation = `: Not less than or equal to ${this.end}`; 636 explanation = `: Not less than or equal to ${this.end}`;
637 } 637 }
(...skipping 21 matching lines...) Expand all
659 if (length === void 0) 659 if (length === void 0)
660 length = null; 660 length = null;
661 this.indexable = indexable; 661 this.indexable = indexable;
662 this.length = dart.as(length !== null ? length : dart.dload(indexable, 'le ngth'), int); 662 this.length = dart.as(length !== null ? length : dart.dload(indexable, 'le ngth'), int);
663 super.ArgumentError$value(invalidValue, name, message !== null ? message : "Index out of range"); 663 super.ArgumentError$value(invalidValue, name, message !== null ? message : "Index out of range");
664 } 664 }
665 get start() { 665 get start() {
666 return 0; 666 return 0;
667 } 667 }
668 get end() { 668 get end() {
669 return this.length - 1; 669 return dart.notNull(this.length) - 1;
670 } 670 }
671 toString() { 671 toString() {
672 dart.assert(this[_hasValue]); 672 dart.assert(this[_hasValue]);
673 let target = Error.safeToString(this.indexable); 673 let target = Error.safeToString(this.indexable);
674 let explanation = `index should be less than ${this.length}`; 674 let explanation = `index should be less than ${this.length}`;
675 if (dart.dbinary(this.invalidValue, '<', 0)) { 675 if (dart.dbinary(this.invalidValue, '<', 0)) {
676 explanation = "index must not be negative"; 676 explanation = "index must not be negative";
677 } 677 }
678 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e xplanation}`; 678 return `RangeError: ${this.message} (${target}[${this.invalidValue}]): ${e xplanation}`;
679 } 679 }
(...skipping 26 matching lines...) Expand all
706 this[_memberName] = memberName; 706 this[_memberName] = memberName;
707 this[_arguments] = positionalArguments; 707 this[_arguments] = positionalArguments;
708 this[_namedArguments] = namedArguments; 708 this[_namedArguments] = namedArguments;
709 this[_existingArgumentNames] = existingArgumentNames; 709 this[_existingArgumentNames] = existingArgumentNames;
710 super.Error(); 710 super.Error();
711 } 711 }
712 toString() { 712 toString() {
713 let sb = new StringBuffer(); 713 let sb = new StringBuffer();
714 let i = 0; 714 let i = 0;
715 if (this[_arguments] !== null) { 715 if (this[_arguments] !== null) {
716 for (; i < this[_arguments].length; i++) { 716 for (; dart.notNull(i) < dart.notNull(this[_arguments].length); dart.not Null(i)++) {
717 if (i > 0) { 717 if (dart.notNull(i) > 0) {
718 sb.write(", "); 718 sb.write(", ");
719 } 719 }
720 sb.write(Error.safeToString(this[_arguments].get(i))); 720 sb.write(Error.safeToString(this[_arguments].get(i)));
721 } 721 }
722 } 722 }
723 if (this[_namedArguments] !== null) { 723 if (this[_namedArguments] !== null) {
724 this[_namedArguments].forEach(((key, value) => { 724 this[_namedArguments].forEach(((key, value) => {
725 if (i > 0) { 725 if (dart.notNull(i) > 0) {
726 sb.write(", "); 726 sb.write(", ");
727 } 727 }
728 sb.write(_symbolToString(key)); 728 sb.write(_symbolToString(key));
729 sb.write(": "); 729 sb.write(": ");
730 sb.write(Error.safeToString(value)); 730 sb.write(Error.safeToString(value));
731 i++; 731 dart.notNull(i)++;
732 }).bind(this)); 732 }).bind(this));
733 } 733 }
734 if (this[_existingArgumentNames] === null) { 734 if (this[_existingArgumentNames] === null) {
735 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`; 735 return `NoSuchMethodError : method not found: '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_receiver])}\n` + `Arguments: [${sb}]`;
736 } else { 736 } else {
737 let actualParameters = sb.toString(); 737 let actualParameters = sb.toString();
738 sb = new StringBuffer(); 738 sb = new StringBuffer();
739 for (let i = 0; i < this[_existingArgumentNames].length; i++) { 739 for (let i = 0; dart.notNull(i) < dart.notNull(this[_existingArgumentNam es].length); dart.notNull(i)++) {
740 if (i > 0) { 740 if (dart.notNull(i) > 0) {
741 sb.write(", "); 741 sb.write(", ");
742 } 742 }
743 sb.write(this[_existingArgumentNames].get(i)); 743 sb.write(this[_existingArgumentNames].get(i));
744 } 744 }
745 let formalParameters = sb.toString(); 745 let formalParameters = sb.toString();
746 return "NoSuchMethodError: incorrect number of arguments passed to " + ` method named '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_r eceiver])}\n` + `Tried calling: ${this[_memberName]}(${actualParameters})\n` + ` Found: ${this[_memberName]}(${formalParameters})`; 746 return "NoSuchMethodError: incorrect number of arguments passed to " + ` method named '${this[_memberName]}'\n` + `Receiver: ${Error.safeToString(this[_r eceiver])}\n` + `Tried calling: ${this[_memberName]}(${actualParameters})\n` + ` Found: ${this[_memberName]}(${formalParameters})`;
747 } 747 }
748 } 748 }
749 } 749 }
750 class UnsupportedError extends Error { 750 class UnsupportedError extends Error {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 if (dart.notNull(this.message !== null) && dart.notNull(!dart.equals("", t his.message))) { 857 if (dart.notNull(this.message !== null) && dart.notNull(!dart.equals("", t his.message))) {
858 report = `${report}: ${this.message}`; 858 report = `${report}: ${this.message}`;
859 } 859 }
860 let offset = this.offset; 860 let offset = this.offset;
861 if (!(typeof this.source == string)) { 861 if (!(typeof this.source == string)) {
862 if (offset !== -1) { 862 if (offset !== -1) {
863 report = ` (at offset ${offset})`; 863 report = ` (at offset ${offset})`;
864 } 864 }
865 return report; 865 return report;
866 } 866 }
867 if (dart.notNull(offset !== -1) && dart.notNull(dart.notNull(offset < 0) | | dart.notNull(offset['>'](dart.dload(this.source, 'length'))))) { 867 if (offset !== -1 && (dart.notNull(offset) < 0 || offset['>'](dart.dload(t his.source, 'length')))) {
868 offset = -1; 868 offset = -1;
869 } 869 }
870 if (offset === -1) { 870 if (offset === -1) {
871 let source = dart.as(this.source, String); 871 let source = dart.as(this.source, String);
872 if (source.length > 78) { 872 if (dart.notNull(source.length) > 78) {
873 source = String['+'](source.substring(0, 75), "..."); 873 source = String['+'](source.substring(0, 75), "...");
874 } 874 }
875 return `${report}\n${source}`; 875 return `${report}\n${source}`;
876 } 876 }
877 let lineNum = 1; 877 let lineNum = 1;
878 let lineStart = 0; 878 let lineStart = 0;
879 let lastWasCR = null; 879 let lastWasCR = null;
880 for (let i = 0; i < offset; i++) { 880 for (let i = 0; dart.notNull(i) < dart.notNull(offset); dart.notNull(i)++) {
881 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 881 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
882 if (char === 10) { 882 if (char === 10) {
883 if (dart.notNull(lineStart !== i) || dart.notNull(!dart.notNull(lastWa sCR))) { 883 if (lineStart !== i || !dart.notNull(lastWasCR)) {
884 lineNum++; 884 dart.notNull(lineNum)++;
885 } 885 }
886 lineStart = i + 1; 886 lineStart = dart.notNull(i) + 1;
887 lastWasCR = false; 887 lastWasCR = false;
888 } else if (char === 13) { 888 } else if (char === 13) {
889 lineNum++; 889 dart.notNull(lineNum)++;
890 lineStart = i + 1; 890 lineStart = dart.notNull(i) + 1;
891 lastWasCR = true; 891 lastWasCR = true;
892 } 892 }
893 } 893 }
894 if (lineNum > 1) { 894 if (dart.notNull(lineNum) > 1) {
895 report = ` (at line ${lineNum}, character ${offset - lineStart + 1})\n`; 895 report = ` (at line ${lineNum}, character ${dart.notNull(offset) - dart. notNull(lineStart) + 1})\n`;
896 } else { 896 } else {
897 report = ` (at character ${offset + 1})\n`; 897 report = ` (at character ${dart.notNull(offset) + 1})\n`;
898 } 898 }
899 let lineEnd = dart.as(dart.dload(this.source, 'length'), int); 899 let lineEnd = dart.as(dart.dload(this.source, 'length'), int);
900 for (let i = offset; i['<'](dart.dload(this.source, 'length')); i++) { 900 for (let i = offset; i['<'](dart.dload(this.source, 'length')); dart.notNu ll(i)++) {
901 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int); 901 let char = dart.as(dart.dinvoke(this.source, 'codeUnitAt', i), int);
902 if (dart.notNull(char === 10) || dart.notNull(char === 13)) { 902 if (char === 10 || char === 13) {
903 lineEnd = i; 903 lineEnd = i;
904 break; 904 break;
905 } 905 }
906 } 906 }
907 let length = lineEnd - lineStart; 907 let length = dart.notNull(lineEnd) - dart.notNull(lineStart);
908 let start = lineStart; 908 let start = lineStart;
909 let end = lineEnd; 909 let end = lineEnd;
910 let prefix = ""; 910 let prefix = "";
911 let postfix = ""; 911 let postfix = "";
912 if (length > 78) { 912 if (dart.notNull(length) > 78) {
913 let index = offset - lineStart; 913 let index = dart.notNull(offset) - dart.notNull(lineStart);
914 if (index < 75) { 914 if (dart.notNull(index) < 75) {
915 end = start + 75; 915 end = dart.notNull(start) + 75;
916 postfix = "..."; 916 postfix = "...";
917 } else if (end - offset < 75) { 917 } else if (dart.notNull(end) - dart.notNull(offset) < 75) {
918 start = end - 75; 918 start = dart.notNull(end) - 75;
919 prefix = "..."; 919 prefix = "...";
920 } else { 920 } else {
921 start = offset - 36; 921 start = dart.notNull(offset) - 36;
922 end = offset + 36; 922 end = dart.notNull(offset) + 36;
923 prefix = postfix = "..."; 923 prefix = postfix = "...";
924 } 924 }
925 } 925 }
926 let slice = dart.as(dart.dinvoke(this.source, 'substring', start, end), St ring); 926 let slice = dart.as(dart.dinvoke(this.source, 'substring', start, end), St ring);
927 let markOffset = offset - start + prefix.length; 927 let markOffset = dart.notNull(offset) - dart.notNull(start) + dart.notNull (prefix.length);
928 return `${report}${prefix}${slice}${postfix}\n${String['*'](" ", markOffse t)}^\n`; 928 return `${report}${prefix}${slice}${postfix}\n${String['*'](" ", markOffse t)}^\n`;
929 } 929 }
930 } 930 }
931 class IntegerDivisionByZeroException extends dart.Object { 931 class IntegerDivisionByZeroException extends dart.Object {
932 IntegerDivisionByZeroException() { 932 IntegerDivisionByZeroException() {
933 } 933 }
934 toString() { 934 toString() {
935 return "IntegerDivisionByZeroException"; 935 return "IntegerDivisionByZeroException";
936 } 936 }
937 } 937 }
(...skipping 16 matching lines...) Expand all
954 let values = _js_helper.Primitives.getProperty(object, _EXPANDO_PROPERTY _NAME); 954 let values = _js_helper.Primitives.getProperty(object, _EXPANDO_PROPERTY _NAME);
955 if (values === null) { 955 if (values === null) {
956 values = new Object(); 956 values = new Object();
957 _js_helper.Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, valu es); 957 _js_helper.Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, valu es);
958 } 958 }
959 _js_helper.Primitives.setProperty(values, this[_getKey](), value); 959 _js_helper.Primitives.setProperty(values, this[_getKey](), value);
960 } 960 }
961 [_getKey]() { 961 [_getKey]() {
962 let key = dart.as(_js_helper.Primitives.getProperty(this, _KEY_PROPERTY_ NAME), String); 962 let key = dart.as(_js_helper.Primitives.getProperty(this, _KEY_PROPERTY_ NAME), String);
963 if (key === null) { 963 if (key === null) {
964 key = `expando$key$${_keyCount++}`; 964 key = `expando$key$${dart.notNull(_keyCount)++}`;
965 _js_helper.Primitives.setProperty(this, _KEY_PROPERTY_NAME, key); 965 _js_helper.Primitives.setProperty(this, _KEY_PROPERTY_NAME, key);
966 } 966 }
967 return key; 967 return key;
968 } 968 }
969 } 969 }
970 Expando._KEY_PROPERTY_NAME = 'expando$key'; 970 Expando._KEY_PROPERTY_NAME = 'expando$key';
971 Expando._EXPANDO_PROPERTY_NAME = 'expando$values'; 971 Expando._EXPANDO_PROPERTY_NAME = 'expando$values';
972 Expando._keyCount = 0; 972 Expando._keyCount = 0;
973 return Expando; 973 return Expando;
974 }); 974 });
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 return dart.notNull(this.isGetter) || dart.notNull(this.isSetter); 1013 return dart.notNull(this.isGetter) || dart.notNull(this.isSetter);
1014 } 1014 }
1015 } 1015 }
1016 let Iterable$ = dart.generic(function(E) { 1016 let Iterable$ = dart.generic(function(E) {
1017 class Iterable extends dart.Object { 1017 class Iterable extends dart.Object {
1018 Iterable() { 1018 Iterable() {
1019 } 1019 }
1020 Iterable$generate(count, generator) { 1020 Iterable$generate(count, generator) {
1021 if (generator === void 0) 1021 if (generator === void 0)
1022 generator = null; 1022 generator = null;
1023 if (count <= 0) 1023 if (dart.notNull(count) <= 0)
1024 return new _internal.EmptyIterable(); 1024 return new _internal.EmptyIterable();
1025 return new _GeneratorIterable(count, generator); 1025 return new _GeneratorIterable(count, generator);
1026 } 1026 }
1027 join(separator) { 1027 join(separator) {
1028 if (separator === void 0) 1028 if (separator === void 0)
1029 separator = ""; 1029 separator = "";
1030 let buffer = new StringBuffer(); 1030 let buffer = new StringBuffer();
1031 buffer.writeAll(this, separator); 1031 buffer.writeAll(this, separator);
1032 return buffer.toString(); 1032 return buffer.toString();
1033 } 1033 }
(...skipping 26 matching lines...) Expand all
1060 _GeneratorIterable$slice($_start, $_end, $_generator) { 1060 _GeneratorIterable$slice($_start, $_end, $_generator) {
1061 this[_start] = $_start; 1061 this[_start] = $_start;
1062 this[_end] = $_end; 1062 this[_end] = $_end;
1063 this[_generator] = $_generator; 1063 this[_generator] = $_generator;
1064 super.IterableBase(); 1064 super.IterableBase();
1065 } 1065 }
1066 get iterator() { 1066 get iterator() {
1067 return new _GeneratorIterator(this[_start], this[_end], this[_generator] ); 1067 return new _GeneratorIterator(this[_start], this[_end], this[_generator] );
1068 } 1068 }
1069 get length() { 1069 get length() {
1070 return this[_end] - this[_start]; 1070 return dart.notNull(this[_end]) - dart.notNull(this[_start]);
1071 } 1071 }
1072 skip(count) { 1072 skip(count) {
1073 RangeError.checkNotNegative(count, "count"); 1073 RangeError.checkNotNegative(count, "count");
1074 if (count === 0) 1074 if (count === 0)
1075 return this; 1075 return this;
1076 let newStart = this[_start] + count; 1076 let newStart = dart.notNull(this[_start]) + dart.notNull(count);
1077 if (newStart >= this[_end]) 1077 if (dart.notNull(newStart) >= dart.notNull(this[_end]))
1078 return new _internal.EmptyIterable(); 1078 return new _internal.EmptyIterable();
1079 return new _GeneratorIterable.slice(newStart, this[_end], this[_generato r]); 1079 return new _GeneratorIterable.slice(newStart, this[_end], this[_generato r]);
1080 } 1080 }
1081 take(count) { 1081 take(count) {
1082 RangeError.checkNotNegative(count, "count"); 1082 RangeError.checkNotNegative(count, "count");
1083 if (count === 0) 1083 if (count === 0)
1084 return new _internal.EmptyIterable(); 1084 return new _internal.EmptyIterable();
1085 let newEnd = this[_start] + count; 1085 let newEnd = dart.notNull(this[_start]) + dart.notNull(count);
1086 if (newEnd >= this[_end]) 1086 if (dart.notNull(newEnd) >= dart.notNull(this[_end]))
1087 return this; 1087 return this;
1088 return new _GeneratorIterable.slice(this[_start], newEnd, this[_generato r]); 1088 return new _GeneratorIterable.slice(this[_start], newEnd, this[_generato r]);
1089 } 1089 }
1090 static [_id](n) { 1090 static [_id](n) {
1091 return n; 1091 return n;
1092 } 1092 }
1093 } 1093 }
1094 dart.defineNamedConstructor(_GeneratorIterable, 'slice'); 1094 dart.defineNamedConstructor(_GeneratorIterable, 'slice');
1095 return _GeneratorIterable; 1095 return _GeneratorIterable;
1096 }); 1096 });
1097 let _GeneratorIterable = _GeneratorIterable$(dynamic); 1097 let _GeneratorIterable = _GeneratorIterable$(dynamic);
1098 let _index = Symbol('_index'); 1098 let _index = Symbol('_index');
1099 let _current = Symbol('_current'); 1099 let _current = Symbol('_current');
1100 let _GeneratorIterator$ = dart.generic(function(E) { 1100 let _GeneratorIterator$ = dart.generic(function(E) {
1101 class _GeneratorIterator extends dart.Object { 1101 class _GeneratorIterator extends dart.Object {
1102 _GeneratorIterator($_index, $_end, $_generator) { 1102 _GeneratorIterator($_index, $_end, $_generator) {
1103 this[_index] = $_index; 1103 this[_index] = $_index;
1104 this[_end] = $_end; 1104 this[_end] = $_end;
1105 this[_generator] = $_generator; 1105 this[_generator] = $_generator;
1106 this[_current] = dart.as(null, E); 1106 this[_current] = null;
1107 } 1107 }
1108 moveNext() { 1108 moveNext() {
1109 if (this[_index] < this[_end]) { 1109 if (dart.notNull(this[_index]) < dart.notNull(this[_end])) {
1110 this[_current] = this[_generator](this[_index]); 1110 this[_current] = this[_generator](this[_index]);
1111 this[_index]++; 1111 dart.notNull(this[_index])++;
1112 return true; 1112 return true;
1113 } else { 1113 } else {
1114 this[_current] = dart.as(null, E); 1114 this[_current] = null;
1115 return false; 1115 return false;
1116 } 1116 }
1117 } 1117 }
1118 get current() { 1118 get current() {
1119 return this[_current]; 1119 return this[_current];
1120 } 1120 }
1121 } 1121 }
1122 return _GeneratorIterator; 1122 return _GeneratorIterator;
1123 }); 1123 });
1124 let _GeneratorIterator = _GeneratorIterator$(dynamic); 1124 let _GeneratorIterator = _GeneratorIterator$(dynamic);
(...skipping 14 matching lines...) Expand all
1139 List(length) { 1139 List(length) {
1140 if (length === void 0) 1140 if (length === void 0)
1141 length = new _ListConstructorSentinel(); 1141 length = new _ListConstructorSentinel();
1142 if (length === new _ListConstructorSentinel()) { 1142 if (length === new _ListConstructorSentinel()) {
1143 return new _interceptors.JSArray.emptyGrowable(); 1143 return new _interceptors.JSArray.emptyGrowable();
1144 } 1144 }
1145 return new _interceptors.JSArray.fixed(length); 1145 return new _interceptors.JSArray.fixed(length);
1146 } 1146 }
1147 List$filled(length, fill) { 1147 List$filled(length, fill) {
1148 let result = new _interceptors.JSArray.fixed(length); 1148 let result = new _interceptors.JSArray.fixed(length);
1149 if (dart.notNull(length !== 0) && dart.notNull(fill !== null)) { 1149 if (length !== 0 && dart.notNull(fill !== null)) {
1150 for (let i = 0; i < result.length; i++) { 1150 for (let i = 0; dart.notNull(i) < dart.notNull(result.length); dart.no tNull(i)++) {
1151 result.set(i, fill); 1151 result.set(i, fill);
1152 } 1152 }
1153 } 1153 }
1154 return dart.as(result, List$(E)); 1154 return dart.as(result, List$(E));
1155 } 1155 }
1156 List$from(elements, opt$) { 1156 List$from(elements, opt$) {
1157 let growable = opt$.growable === void 0 ? true : opt$.growable; 1157 let growable = opt$.growable === void 0 ? true : opt$.growable;
1158 let list = new List(); 1158 let list = new List();
1159 for (let e of elements) { 1159 for (let e of elements) {
1160 list.add(e); 1160 list.add(e);
1161 } 1161 }
1162 if (growable) 1162 if (growable)
1163 return list; 1163 return list;
1164 return dart.as(_internal.makeListFixedLength(list), List$(E)); 1164 return dart.as(_internal.makeListFixedLength(list), List$(E));
1165 } 1165 }
1166 List$generate(length, generator, opt$) { 1166 List$generate(length, generator, opt$) {
1167 let growable = opt$.growable === void 0 ? true : opt$.growable; 1167 let growable = opt$.growable === void 0 ? true : opt$.growable;
1168 let result = null; 1168 let result = null;
1169 if (growable) { 1169 if (growable) {
1170 result = ((_) => { 1170 result = ((_) => {
1171 _.length = length; 1171 _.length = length;
1172 return _; 1172 return _;
1173 }).bind(this)(new List.from([])); 1173 }).bind(this)(new List.from([]));
1174 } else { 1174 } else {
1175 result = new List(length); 1175 result = new List(length);
1176 } 1176 }
1177 for (let i = 0; i < length; i++) { 1177 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i)+ +) {
1178 result.set(i, generator(i)); 1178 result.set(i, generator(i));
1179 } 1179 }
1180 return result; 1180 return result;
1181 } 1181 }
1182 } 1182 }
1183 dart.defineNamedConstructor(List, 'filled'); 1183 dart.defineNamedConstructor(List, 'filled');
1184 dart.defineNamedConstructor(List, 'from'); 1184 dart.defineNamedConstructor(List, 'from');
1185 dart.defineNamedConstructor(List, 'generate'); 1185 dart.defineNamedConstructor(List, 'generate');
1186 return List; 1186 return List;
1187 }); 1187 });
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 this[_start] = null; 1324 this[_start] = null;
1325 this[_stop] = null; 1325 this[_stop] = null;
1326 _initTicker(); 1326 _initTicker();
1327 } 1327 }
1328 start() { 1328 start() {
1329 if (this.isRunning) 1329 if (this.isRunning)
1330 return; 1330 return;
1331 if (this[_start] === null) { 1331 if (this[_start] === null) {
1332 this[_start] = _now(); 1332 this[_start] = _now();
1333 } else { 1333 } else {
1334 this[_start] = _now() - dart.notNull(dart.notNull(this[_stop]) - dart.no tNull(this[_start])); 1334 this[_start] = dart.notNull(_now()) - (dart.notNull(this[_stop]) - dart. notNull(this[_start]));
1335 this[_stop] = null; 1335 this[_stop] = null;
1336 } 1336 }
1337 } 1337 }
1338 stop() { 1338 stop() {
1339 if (!dart.notNull(this.isRunning)) 1339 if (!dart.notNull(this.isRunning))
1340 return; 1340 return;
1341 this[_stop] = _now(); 1341 this[_stop] = _now();
1342 } 1342 }
1343 reset() { 1343 reset() {
1344 if (this[_start] === null) 1344 if (this[_start] === null)
1345 return; 1345 return;
1346 this[_start] = _now(); 1346 this[_start] = _now();
1347 if (this[_stop] !== null) { 1347 if (this[_stop] !== null) {
1348 this[_stop] = this[_start]; 1348 this[_stop] = this[_start];
1349 } 1349 }
1350 } 1350 }
1351 get elapsedTicks() { 1351 get elapsedTicks() {
1352 if (this[_start] === null) { 1352 if (this[_start] === null) {
1353 return 0; 1353 return 0;
1354 } 1354 }
1355 return dart.notNull(this[_stop] === null ? _now() - dart.notNull(this[_sta rt]) : dart.notNull(this[_stop]) - dart.notNull(this[_start])); 1355 return this[_stop] === null ? dart.notNull(_now()) - dart.notNull(this[_st art]) : dart.notNull(this[_stop]) - dart.notNull(this[_start]);
1356 } 1356 }
1357 get elapsed() { 1357 get elapsed() {
1358 return new Duration({microseconds: this.elapsedMicroseconds}); 1358 return new Duration({microseconds: this.elapsedMicroseconds});
1359 } 1359 }
1360 get elapsedMicroseconds() { 1360 get elapsedMicroseconds() {
1361 return (this.elapsedTicks * 1000000 / this.frequency).truncate(); 1361 return (dart.notNull(this.elapsedTicks) * 1000000 / dart.notNull(this.freq uency)).truncate();
1362 } 1362 }
1363 get elapsedMilliseconds() { 1363 get elapsedMilliseconds() {
1364 return (this.elapsedTicks * 1000 / this.frequency).truncate(); 1364 return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequen cy)).truncate();
1365 } 1365 }
1366 get isRunning() { 1366 get isRunning() {
1367 return dart.notNull(this[_start] !== null) && dart.notNull(this[_stop] === null); 1367 return this[_start] !== null && this[_stop] === null;
1368 } 1368 }
1369 static [_initTicker]() { 1369 static [_initTicker]() {
1370 _js_helper.Primitives.initTicker(); 1370 _js_helper.Primitives.initTicker();
1371 _frequency = _js_helper.Primitives.timerFrequency; 1371 _frequency = _js_helper.Primitives.timerFrequency;
1372 } 1372 }
1373 static [_now]() { 1373 static [_now]() {
1374 return dart.as(dart.dinvoke(_js_helper.Primitives, 'timerTicks'), int); 1374 return dart.as(dart.dinvoke(_js_helper.Primitives, 'timerTicks'), int);
1375 } 1375 }
1376 } 1376 }
1377 Stopwatch._frequency = null; 1377 Stopwatch._frequency = null;
1378 let _stringFromIterable = Symbol('_stringFromIterable'); 1378 let _stringFromIterable = Symbol('_stringFromIterable');
1379 class String extends dart.Object { 1379 class String extends dart.Object {
1380 String$fromCharCodes(charCodes, start, end) { 1380 String$fromCharCodes(charCodes, start, end) {
1381 if (start === void 0) 1381 if (start === void 0)
1382 start = 0; 1382 start = 0;
1383 if (end === void 0) 1383 if (end === void 0)
1384 end = null; 1384 end = null;
1385 if (!dart.is(charCodes, _interceptors.JSArray)) { 1385 if (!dart.is(charCodes, _interceptors.JSArray)) {
1386 return _stringFromIterable(charCodes, start, end); 1386 return _stringFromIterable(charCodes, start, end);
1387 } 1387 }
1388 let list = dart.as(charCodes, List); 1388 let list = dart.as(charCodes, List);
1389 let len = list.length; 1389 let len = list.length;
1390 if (dart.notNull(start < 0) || dart.notNull(start > len)) { 1390 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(len)) {
1391 throw new RangeError.range(start, 0, len); 1391 throw new RangeError.range(start, 0, len);
1392 } 1392 }
1393 if (end === null) { 1393 if (end === null) {
1394 end = len; 1394 end = len;
1395 } else if (dart.notNull(end < start) || dart.notNull(end > len)) { 1395 } else if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.notNull(len)) {
1396 throw new RangeError.range(end, start, len); 1396 throw new RangeError.range(end, start, len);
1397 } 1397 }
1398 if (dart.notNull(start > 0) || dart.notNull(end < len)) { 1398 if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(len)) {
1399 list = list.sublist(start, end); 1399 list = list.sublist(start, end);
1400 } 1400 }
1401 return _js_helper.Primitives.stringFromCharCodes(list); 1401 return _js_helper.Primitives.stringFromCharCodes(list);
1402 } 1402 }
1403 String$fromCharCode(charCode) { 1403 String$fromCharCode(charCode) {
1404 return _js_helper.Primitives.stringFromCharCode(charCode); 1404 return _js_helper.Primitives.stringFromCharCode(charCode);
1405 } 1405 }
1406 String$fromEnvironment(name, opt$) { 1406 String$fromEnvironment(name, opt$) {
1407 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultValue ; 1407 let defaultValue = opt$.defaultValue === void 0 ? null : opt$.defaultValue ;
1408 throw new UnsupportedError('String.fromEnvironment can only be used as a c onst constructor'); 1408 throw new UnsupportedError('String.fromEnvironment can only be used as a c onst constructor');
1409 } 1409 }
1410 static [_stringFromIterable](charCodes, start, end) { 1410 static [_stringFromIterable](charCodes, start, end) {
1411 if (start < 0) 1411 if (dart.notNull(start) < 0)
1412 throw new RangeError.range(start, 0, charCodes.length); 1412 throw new RangeError.range(start, 0, charCodes.length);
1413 if (dart.notNull(end !== null) && dart.notNull(end < start)) { 1413 if (end !== null && dart.notNull(end) < dart.notNull(start)) {
1414 throw new RangeError.range(end, start, charCodes.length); 1414 throw new RangeError.range(end, start, charCodes.length);
1415 } 1415 }
1416 let it = charCodes.iterator; 1416 let it = charCodes.iterator;
1417 for (let i = 0; i < start; i++) { 1417 for (let i = 0; dart.notNull(i) < dart.notNull(start); dart.notNull(i)++) {
1418 if (!dart.notNull(it.moveNext())) { 1418 if (!dart.notNull(it.moveNext())) {
1419 throw new RangeError.range(start, 0, i); 1419 throw new RangeError.range(start, 0, i);
1420 } 1420 }
1421 } 1421 }
1422 let list = new List.from([]); 1422 let list = new List.from([]);
1423 if (end === null) { 1423 if (end === null) {
1424 while (it.moveNext()) 1424 while (it.moveNext())
1425 list.add(it.current); 1425 list.add(it.current);
1426 } else { 1426 } else {
1427 for (let i = start; i < end; i++) { 1427 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i) ++) {
1428 if (!dart.notNull(it.moveNext())) { 1428 if (!dart.notNull(it.moveNext())) {
1429 throw new RangeError.range(end, start, i); 1429 throw new RangeError.range(end, start, i);
1430 } 1430 }
1431 list.add(it.current); 1431 list.add(it.current);
1432 } 1432 }
1433 } 1433 }
1434 return _js_helper.Primitives.stringFromCharCodes(list); 1434 return _js_helper.Primitives.stringFromCharCodes(list);
1435 } 1435 }
1436 } 1436 }
1437 dart.defineNamedConstructor(String, 'fromCharCodes'); 1437 dart.defineNamedConstructor(String, 'fromCharCodes');
1438 dart.defineNamedConstructor(String, 'fromCharCode'); 1438 dart.defineNamedConstructor(String, 'fromCharCode');
1439 dart.defineNamedConstructor(String, 'fromEnvironment'); 1439 dart.defineNamedConstructor(String, 'fromEnvironment');
1440 class Runes extends collection.IterableBase$(int) { 1440 class Runes extends collection.IterableBase$(int) {
1441 Runes(string) { 1441 Runes(string) {
1442 this.string = string; 1442 this.string = string;
1443 super.IterableBase(); 1443 super.IterableBase();
1444 } 1444 }
1445 get iterator() { 1445 get iterator() {
1446 return new RuneIterator(this.string); 1446 return new RuneIterator(this.string);
1447 } 1447 }
1448 get last() { 1448 get last() {
1449 if (this.string.length === 0) { 1449 if (this.string.length === 0) {
1450 throw new StateError('No elements.'); 1450 throw new StateError('No elements.');
1451 } 1451 }
1452 let length = this.string.length; 1452 let length = this.string.length;
1453 let code = this.string.codeUnitAt(length - 1); 1453 let code = this.string.codeUnitAt(dart.notNull(length) - 1);
1454 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string.leng th > 1)) { 1454 if (dart.notNull(_isTrailSurrogate(code)) && dart.notNull(this.string.leng th) > 1) {
1455 let previousCode = this.string.codeUnitAt(length - 2); 1455 let previousCode = this.string.codeUnitAt(dart.notNull(length) - 2);
1456 if (_isLeadSurrogate(previousCode)) { 1456 if (_isLeadSurrogate(previousCode)) {
1457 return _combineSurrogatePair(previousCode, code); 1457 return _combineSurrogatePair(previousCode, code);
1458 } 1458 }
1459 } 1459 }
1460 return code; 1460 return code;
1461 } 1461 }
1462 } 1462 }
1463 // Function _isLeadSurrogate: (int) → bool 1463 // Function _isLeadSurrogate: (int) → bool
1464 function _isLeadSurrogate(code) { 1464 function _isLeadSurrogate(code) {
1465 return (code & 64512) === 55296; 1465 return (dart.notNull(code) & 64512) === 55296;
1466 } 1466 }
1467 // Function _isTrailSurrogate: (int) → bool 1467 // Function _isTrailSurrogate: (int) → bool
1468 function _isTrailSurrogate(code) { 1468 function _isTrailSurrogate(code) {
1469 return (code & 64512) === 56320; 1469 return (dart.notNull(code) & 64512) === 56320;
1470 } 1470 }
1471 // Function _combineSurrogatePair: (int, int) → int 1471 // Function _combineSurrogatePair: (int, int) → int
1472 function _combineSurrogatePair(start, end) { 1472 function _combineSurrogatePair(start, end) {
1473 return 65536 + ((start & 1023) << 10) + (end & 1023); 1473 return 65536 + ((dart.notNull(start) & 1023) << 10) + (dart.notNull(end) & 1 023);
1474 } 1474 }
1475 let _position = Symbol('_position'); 1475 let _position = Symbol('_position');
1476 let _nextPosition = Symbol('_nextPosition'); 1476 let _nextPosition = Symbol('_nextPosition');
1477 let _currentCodePoint = Symbol('_currentCodePoint'); 1477 let _currentCodePoint = Symbol('_currentCodePoint');
1478 let _checkSplitSurrogate = Symbol('_checkSplitSurrogate'); 1478 let _checkSplitSurrogate = Symbol('_checkSplitSurrogate');
1479 class RuneIterator extends dart.Object { 1479 class RuneIterator extends dart.Object {
1480 RuneIterator(string) { 1480 RuneIterator(string) {
1481 this.string = string; 1481 this.string = string;
1482 this[_position] = 0; 1482 this[_position] = 0;
1483 this[_nextPosition] = 0; 1483 this[_nextPosition] = 0;
1484 this[_currentCodePoint] = null; 1484 this[_currentCodePoint] = null;
1485 } 1485 }
1486 RuneIterator$at(string, index) { 1486 RuneIterator$at(string, index) {
1487 this.string = string; 1487 this.string = string;
1488 this[_position] = index; 1488 this[_position] = index;
1489 this[_nextPosition] = index; 1489 this[_nextPosition] = index;
1490 this[_currentCodePoint] = null; 1490 this[_currentCodePoint] = null;
1491 RangeError.checkValueInInterval(index, 0, string.length); 1491 RangeError.checkValueInInterval(index, 0, string.length);
1492 this[_checkSplitSurrogate](index); 1492 this[_checkSplitSurrogate](index);
1493 } 1493 }
1494 [_checkSplitSurrogate](index) { 1494 [_checkSplitSurrogate](index) {
1495 if (dart.notNull(dart.notNull(dart.notNull(index > 0) && dart.notNull(inde x < this.string.length)) && dart.notNull(_isLeadSurrogate(this.string.codeUnitAt (index - 1)))) && dart.notNull(_isTrailSurrogate(this.string.codeUnitAt(index))) ) { 1495 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))) ) {
1496 throw new ArgumentError(`Index inside surrogate pair: ${index}`); 1496 throw new ArgumentError(`Index inside surrogate pair: ${index}`);
1497 } 1497 }
1498 } 1498 }
1499 get rawIndex() { 1499 get rawIndex() {
1500 return dart.as(this[_position] !== this[_nextPosition] ? this[_position] : null, int); 1500 return dart.as(this[_position] !== this[_nextPosition] ? this[_position] : null, int);
1501 } 1501 }
1502 set rawIndex(rawIndex) { 1502 set rawIndex(rawIndex) {
1503 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex"); 1503 RangeError.checkValidIndex(rawIndex, this.string, "rawIndex");
1504 this.reset(rawIndex); 1504 this.reset(rawIndex);
1505 this.moveNext(); 1505 this.moveNext();
1506 } 1506 }
1507 reset(rawIndex) { 1507 reset(rawIndex) {
1508 if (rawIndex === void 0) 1508 if (rawIndex === void 0)
1509 rawIndex = 0; 1509 rawIndex = 0;
1510 RangeError.checkValueInInterval(rawIndex, 0, this.string.length, "rawIndex "); 1510 RangeError.checkValueInInterval(rawIndex, 0, this.string.length, "rawIndex ");
1511 this[_checkSplitSurrogate](rawIndex); 1511 this[_checkSplitSurrogate](rawIndex);
1512 this[_position] = this[_nextPosition] = rawIndex; 1512 this[_position] = this[_nextPosition] = rawIndex;
1513 this[_currentCodePoint] = null; 1513 this[_currentCodePoint] = null;
1514 } 1514 }
1515 get current() { 1515 get current() {
1516 return dart.notNull(this[_currentCodePoint]); 1516 return this[_currentCodePoint];
1517 } 1517 }
1518 get currentSize() { 1518 get currentSize() {
1519 return this[_nextPosition] - this[_position]; 1519 return dart.notNull(this[_nextPosition]) - dart.notNull(this[_position]);
1520 } 1520 }
1521 get currentAsString() { 1521 get currentAsString() {
1522 if (this[_position] === this[_nextPosition]) 1522 if (this[_position] === this[_nextPosition])
1523 return null; 1523 return null;
1524 if (this[_position] + 1 === this[_nextPosition]) 1524 if (dart.notNull(this[_position]) + 1 === this[_nextPosition])
1525 return this.string.get(this[_position]); 1525 return this.string.get(this[_position]);
1526 return this.string.substring(this[_position], this[_nextPosition]); 1526 return this.string.substring(this[_position], this[_nextPosition]);
1527 } 1527 }
1528 moveNext() { 1528 moveNext() {
1529 this[_position] = this[_nextPosition]; 1529 this[_position] = this[_nextPosition];
1530 if (this[_position] === this.string.length) { 1530 if (this[_position] === this.string.length) {
1531 this[_currentCodePoint] = null; 1531 this[_currentCodePoint] = null;
1532 return false; 1532 return false;
1533 } 1533 }
1534 let codeUnit = this.string.codeUnitAt(this[_position]); 1534 let codeUnit = this.string.codeUnitAt(this[_position]);
1535 let nextPosition = this[_position] + 1; 1535 let nextPosition = dart.notNull(this[_position]) + 1;
1536 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition < this.string.length)) { 1536 if (dart.notNull(_isLeadSurrogate(codeUnit)) && dart.notNull(nextPosition) < dart.notNull(this.string.length)) {
1537 let nextCodeUnit = this.string.codeUnitAt(nextPosition); 1537 let nextCodeUnit = this.string.codeUnitAt(nextPosition);
1538 if (_isTrailSurrogate(nextCodeUnit)) { 1538 if (_isTrailSurrogate(nextCodeUnit)) {
1539 this[_nextPosition] = nextPosition + 1; 1539 this[_nextPosition] = dart.notNull(nextPosition) + 1;
1540 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit ); 1540 this[_currentCodePoint] = _combineSurrogatePair(codeUnit, nextCodeUnit );
1541 return true; 1541 return true;
1542 } 1542 }
1543 } 1543 }
1544 this[_nextPosition] = nextPosition; 1544 this[_nextPosition] = nextPosition;
1545 this[_currentCodePoint] = codeUnit; 1545 this[_currentCodePoint] = codeUnit;
1546 return true; 1546 return true;
1547 } 1547 }
1548 movePrevious() { 1548 movePrevious() {
1549 this[_nextPosition] = this[_position]; 1549 this[_nextPosition] = this[_position];
1550 if (this[_position] === 0) { 1550 if (this[_position] === 0) {
1551 this[_currentCodePoint] = null; 1551 this[_currentCodePoint] = null;
1552 return false; 1552 return false;
1553 } 1553 }
1554 let position = this[_position] - 1; 1554 let position = dart.notNull(this[_position]) - 1;
1555 let codeUnit = this.string.codeUnitAt(position); 1555 let codeUnit = this.string.codeUnitAt(position);
1556 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position > 0 )) { 1556 if (dart.notNull(_isTrailSurrogate(codeUnit)) && dart.notNull(position) > 0) {
1557 let prevCodeUnit = this.string.codeUnitAt(position - 1); 1557 let prevCodeUnit = this.string.codeUnitAt(dart.notNull(position) - 1);
1558 if (_isLeadSurrogate(prevCodeUnit)) { 1558 if (_isLeadSurrogate(prevCodeUnit)) {
1559 this[_position] = position - 1; 1559 this[_position] = dart.notNull(position) - 1;
1560 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit ); 1560 this[_currentCodePoint] = _combineSurrogatePair(prevCodeUnit, codeUnit );
1561 return true; 1561 return true;
1562 } 1562 }
1563 } 1563 }
1564 this[_position] = position; 1564 this[_position] = position;
1565 this[_currentCodePoint] = codeUnit; 1565 this[_currentCodePoint] = codeUnit;
1566 return true; 1566 return true;
1567 } 1567 }
1568 } 1568 }
1569 dart.defineNamedConstructor(RuneIterator, 'at'); 1569 dart.defineNamedConstructor(RuneIterator, 'at');
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 this[_writeAuthority](sb); 1688 this[_writeAuthority](sb);
1689 return sb.toString(); 1689 return sb.toString();
1690 } 1690 }
1691 get userInfo() { 1691 get userInfo() {
1692 return this[_userInfo]; 1692 return this[_userInfo];
1693 } 1693 }
1694 get host() { 1694 get host() {
1695 if (this[_host] === null) 1695 if (this[_host] === null)
1696 return ""; 1696 return "";
1697 if (this[_host].startsWith('[')) { 1697 if (this[_host].startsWith('[')) {
1698 return this[_host].substring(1, this[_host].length - 1); 1698 return this[_host].substring(1, dart.notNull(this[_host].length) - 1);
1699 } 1699 }
1700 return this[_host]; 1700 return this[_host];
1701 } 1701 }
1702 get port() { 1702 get port() {
1703 if (this[_port] === null) 1703 if (this[_port] === null)
1704 return _defaultPort(this.scheme); 1704 return _defaultPort(this.scheme);
1705 return dart.notNull(this[_port]); 1705 return this[_port];
1706 } 1706 }
1707 static [_defaultPort](scheme) { 1707 static [_defaultPort](scheme) {
1708 if (dart.equals(scheme, "http")) 1708 if (dart.equals(scheme, "http"))
1709 return 80; 1709 return 80;
1710 if (dart.equals(scheme, "https")) 1710 if (dart.equals(scheme, "https"))
1711 return 443; 1711 return 443;
1712 return 0; 1712 return 0;
1713 } 1713 }
1714 get path() { 1714 get path() {
1715 return this[_path]; 1715 return this[_path];
1716 } 1716 }
1717 get query() { 1717 get query() {
1718 return this[_query] === null ? "" : this[_query]; 1718 return this[_query] === null ? "" : this[_query];
1719 } 1719 }
1720 get fragment() { 1720 get fragment() {
1721 return this[_fragment] === null ? "" : this[_fragment]; 1721 return this[_fragment] === null ? "" : this[_fragment];
1722 } 1722 }
1723 static parse(uri) { 1723 static parse(uri) {
1724 // Function isRegName: (int) → bool 1724 // Function isRegName: (int) → bool
1725 function isRegName(ch) { 1725 function isRegName(ch) {
1726 return dart.notNull(ch < 128) && dart.notNull(!dart.equals(dart.dbinary( dart.dindex(_regNameTable, ch >> 4), '&', 1 << (ch & 15)), 0)); 1726 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary( dart.dindex(_regNameTable, dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
1727 } 1727 }
1728 let EOI = -1; 1728 let EOI = -1;
1729 let scheme = ""; 1729 let scheme = "";
1730 let userinfo = ""; 1730 let userinfo = "";
1731 let host = null; 1731 let host = null;
1732 let port = null; 1732 let port = null;
1733 let path = null; 1733 let path = null;
1734 let query = null; 1734 let query = null;
1735 let fragment = null; 1735 let fragment = null;
1736 let index = 0; 1736 let index = 0;
1737 let pathStart = 0; 1737 let pathStart = 0;
1738 let char = EOI; 1738 let char = EOI;
1739 // Function parseAuth: () → void 1739 // Function parseAuth: () → void
1740 function parseAuth() { 1740 function parseAuth() {
1741 if (index === uri.length) { 1741 if (index === uri.length) {
1742 char = EOI; 1742 char = EOI;
1743 return; 1743 return;
1744 } 1744 }
1745 let authStart = index; 1745 let authStart = index;
1746 let lastColon = -1; 1746 let lastColon = -1;
1747 let lastAt = -1; 1747 let lastAt = -1;
1748 char = uri.codeUnitAt(index); 1748 char = uri.codeUnitAt(index);
1749 while (index < uri.length) { 1749 while (dart.notNull(index) < dart.notNull(uri.length)) {
1750 char = uri.codeUnitAt(index); 1750 char = uri.codeUnitAt(index);
1751 if (dart.notNull(dart.notNull(char === _SLASH) || dart.notNull(char == = _QUESTION)) || dart.notNull(char === _NUMBER_SIGN)) { 1751 if (char === _SLASH || char === _QUESTION || char === _NUMBER_SIGN) {
1752 break; 1752 break;
1753 } 1753 }
1754 if (char === _AT_SIGN) { 1754 if (char === _AT_SIGN) {
1755 lastAt = index; 1755 lastAt = index;
1756 lastColon = -1; 1756 lastColon = -1;
1757 } else if (char === _COLON) { 1757 } else if (char === _COLON) {
1758 lastColon = index; 1758 lastColon = index;
1759 } else if (char === _LEFT_BRACKET) { 1759 } else if (char === _LEFT_BRACKET) {
1760 lastColon = -1; 1760 lastColon = -1;
1761 let endBracket = uri.indexOf(']', index + 1); 1761 let endBracket = uri.indexOf(']', dart.notNull(index) + 1);
1762 if (endBracket === -1) { 1762 if (endBracket === -1) {
1763 index = uri.length; 1763 index = uri.length;
1764 char = EOI; 1764 char = EOI;
1765 break; 1765 break;
1766 } else { 1766 } else {
1767 index = endBracket; 1767 index = endBracket;
1768 } 1768 }
1769 } 1769 }
1770 index++; 1770 dart.notNull(index)++;
1771 char = EOI; 1771 char = EOI;
1772 } 1772 }
1773 let hostStart = authStart; 1773 let hostStart = authStart;
1774 let hostEnd = index; 1774 let hostEnd = index;
1775 if (lastAt >= 0) { 1775 if (dart.notNull(lastAt) >= 0) {
1776 userinfo = _makeUserInfo(uri, authStart, lastAt); 1776 userinfo = _makeUserInfo(uri, authStart, lastAt);
1777 hostStart = lastAt + 1; 1777 hostStart = dart.notNull(lastAt) + 1;
1778 } 1778 }
1779 if (lastColon >= 0) { 1779 if (dart.notNull(lastColon) >= 0) {
1780 let portNumber = null; 1780 let portNumber = null;
1781 if (lastColon + 1 < index) { 1781 if (dart.notNull(lastColon) + 1 < dart.notNull(index)) {
1782 portNumber = 0; 1782 portNumber = 0;
1783 for (let i = lastColon + 1; i < index; i++) { 1783 for (let i = dart.notNull(lastColon) + 1; dart.notNull(i) < dart.not Null(index); dart.notNull(i)++) {
1784 let digit = uri.codeUnitAt(i); 1784 let digit = uri.codeUnitAt(i);
1785 if (dart.notNull(_ZERO > digit) || dart.notNull(_NINE < digit)) { 1785 if (dart.notNull(_ZERO) > dart.notNull(digit) || dart.notNull(_NIN E) < dart.notNull(digit)) {
1786 _fail(uri, i, "Invalid port number"); 1786 _fail(uri, i, "Invalid port number");
1787 } 1787 }
1788 portNumber = portNumber * 10 + (digit - _ZERO); 1788 portNumber = dart.notNull(portNumber) * 10 + (dart.notNull(digit) - dart.notNull(_ZERO));
1789 } 1789 }
1790 } 1790 }
1791 port = _makePort(portNumber, scheme); 1791 port = _makePort(portNumber, scheme);
1792 hostEnd = lastColon; 1792 hostEnd = lastColon;
1793 } 1793 }
1794 host = _makeHost(uri, hostStart, hostEnd, true); 1794 host = _makeHost(uri, hostStart, hostEnd, true);
1795 if (index < uri.length) { 1795 if (dart.notNull(index) < dart.notNull(uri.length)) {
1796 char = uri.codeUnitAt(index); 1796 char = uri.codeUnitAt(index);
1797 } 1797 }
1798 } 1798 }
1799 let NOT_IN_PATH = 0; 1799 let NOT_IN_PATH = 0;
1800 let IN_PATH = 1; 1800 let IN_PATH = 1;
1801 let ALLOW_AUTH = 2; 1801 let ALLOW_AUTH = 2;
1802 let state = NOT_IN_PATH; 1802 let state = NOT_IN_PATH;
1803 let i = index; 1803 let i = index;
1804 while (i < uri.length) { 1804 while (dart.notNull(i) < dart.notNull(uri.length)) {
1805 char = uri.codeUnitAt(i); 1805 char = uri.codeUnitAt(i);
1806 if (dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBER_SI GN)) { 1806 if (char === _QUESTION || char === _NUMBER_SIGN) {
1807 state = NOT_IN_PATH; 1807 state = NOT_IN_PATH;
1808 break; 1808 break;
1809 } 1809 }
1810 if (char === _SLASH) { 1810 if (char === _SLASH) {
1811 state = i === 0 ? ALLOW_AUTH : IN_PATH; 1811 state = i === 0 ? ALLOW_AUTH : IN_PATH;
1812 break; 1812 break;
1813 } 1813 }
1814 if (char === _COLON) { 1814 if (char === _COLON) {
1815 if (i === 0) 1815 if (i === 0)
1816 _fail(uri, 0, "Invalid empty scheme"); 1816 _fail(uri, 0, "Invalid empty scheme");
1817 scheme = _makeScheme(uri, i); 1817 scheme = _makeScheme(uri, i);
1818 i++; 1818 dart.notNull(i)++;
1819 pathStart = i; 1819 pathStart = i;
1820 if (i === uri.length) { 1820 if (i === uri.length) {
1821 char = EOI; 1821 char = EOI;
1822 state = NOT_IN_PATH; 1822 state = NOT_IN_PATH;
1823 } else { 1823 } else {
1824 char = uri.codeUnitAt(i); 1824 char = uri.codeUnitAt(i);
1825 if (dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBE R_SIGN)) { 1825 if (char === _QUESTION || char === _NUMBER_SIGN) {
1826 state = NOT_IN_PATH; 1826 state = NOT_IN_PATH;
1827 } else if (char === _SLASH) { 1827 } else if (char === _SLASH) {
1828 state = ALLOW_AUTH; 1828 state = ALLOW_AUTH;
1829 } else { 1829 } else {
1830 state = IN_PATH; 1830 state = IN_PATH;
1831 } 1831 }
1832 } 1832 }
1833 break; 1833 break;
1834 } 1834 }
1835 i++; 1835 dart.notNull(i)++;
1836 char = EOI; 1836 char = EOI;
1837 } 1837 }
1838 index = i; 1838 index = i;
1839 if (state === ALLOW_AUTH) { 1839 if (state === ALLOW_AUTH) {
1840 dart.assert(char === _SLASH); 1840 dart.assert(char === _SLASH);
1841 index++; 1841 dart.notNull(index)++;
1842 if (index === uri.length) { 1842 if (index === uri.length) {
1843 char = EOI; 1843 char = EOI;
1844 state = NOT_IN_PATH; 1844 state = NOT_IN_PATH;
1845 } else { 1845 } else {
1846 char = uri.codeUnitAt(index); 1846 char = uri.codeUnitAt(index);
1847 if (char === _SLASH) { 1847 if (char === _SLASH) {
1848 index++; 1848 dart.notNull(index)++;
1849 parseAuth(); 1849 parseAuth();
1850 pathStart = index; 1850 pathStart = index;
1851 } 1851 }
1852 if (dart.notNull(dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBER_SIGN)) || dart.notNull(char === EOI)) { 1852 if (char === _QUESTION || char === _NUMBER_SIGN || char === EOI) {
1853 state = NOT_IN_PATH; 1853 state = NOT_IN_PATH;
1854 } else { 1854 } else {
1855 state = IN_PATH; 1855 state = IN_PATH;
1856 } 1856 }
1857 } 1857 }
1858 } 1858 }
1859 dart.assert(dart.notNull(state === IN_PATH) || dart.notNull(state === NOT_ IN_PATH)); 1859 dart.assert(state === IN_PATH || state === NOT_IN_PATH);
1860 if (state === IN_PATH) { 1860 if (state === IN_PATH) {
1861 while (++index < uri.length) { 1861 while (++dart.notNull(index) < dart.notNull(uri.length)) {
1862 char = uri.codeUnitAt(index); 1862 char = uri.codeUnitAt(index);
1863 if (dart.notNull(char === _QUESTION) || dart.notNull(char === _NUMBER_ SIGN)) { 1863 if (char === _QUESTION || char === _NUMBER_SIGN) {
1864 break; 1864 break;
1865 } 1865 }
1866 char = EOI; 1866 char = EOI;
1867 } 1867 }
1868 state = NOT_IN_PATH; 1868 state = NOT_IN_PATH;
1869 } 1869 }
1870 dart.assert(state === NOT_IN_PATH); 1870 dart.assert(state === NOT_IN_PATH);
1871 let isFile = dart.equals(scheme, "file"); 1871 let isFile = dart.equals(scheme, "file");
1872 let ensureLeadingSlash = host !== null; 1872 let ensureLeadingSlash = host !== null;
1873 path = _makePath(uri, pathStart, index, null, ensureLeadingSlash, isFile); 1873 path = _makePath(uri, pathStart, index, null, ensureLeadingSlash, isFile);
1874 if (char === _QUESTION) { 1874 if (char === _QUESTION) {
1875 let numberSignIndex = uri.indexOf('#', index + 1); 1875 let numberSignIndex = uri.indexOf('#', dart.notNull(index) + 1);
1876 if (numberSignIndex < 0) { 1876 if (dart.notNull(numberSignIndex) < 0) {
1877 query = _makeQuery(uri, index + 1, uri.length, null); 1877 query = _makeQuery(uri, dart.notNull(index) + 1, uri.length, null);
1878 } else { 1878 } else {
1879 query = _makeQuery(uri, index + 1, numberSignIndex, null); 1879 query = _makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null );
1880 fragment = _makeFragment(uri, numberSignIndex + 1, uri.length); 1880 fragment = _makeFragment(uri, dart.notNull(numberSignIndex) + 1, uri.l ength);
1881 } 1881 }
1882 } else if (char === _NUMBER_SIGN) { 1882 } else if (char === _NUMBER_SIGN) {
1883 fragment = _makeFragment(uri, index + 1, uri.length); 1883 fragment = _makeFragment(uri, dart.notNull(index) + 1, uri.length);
1884 } 1884 }
1885 return new Uri._internal(scheme, userinfo, host, port, path, query, fragme nt); 1885 return new Uri._internal(scheme, userinfo, host, port, path, query, fragme nt);
1886 } 1886 }
1887 static [_fail](uri, index, message) { 1887 static [_fail](uri, index, message) {
1888 throw new FormatException(message, uri, index); 1888 throw new FormatException(message, uri, index);
1889 } 1889 }
1890 Uri$_internal(scheme, $_userInfo, $_host, $_port, $_path, $_query, $_fragmen t) { 1890 Uri$_internal(scheme, $_userInfo, $_host, $_port, $_path, $_query, $_fragmen t) {
1891 this.scheme = scheme; 1891 this.scheme = scheme;
1892 this[_userInfo] = $_userInfo; 1892 this[_userInfo] = $_userInfo;
1893 this[_host] = $_host; 1893 this[_host] = $_host;
(...skipping 16 matching lines...) Expand all
1910 let fragment = opt$.fragment === void 0 ? null : opt$.fragment; 1910 let fragment = opt$.fragment === void 0 ? null : opt$.fragment;
1911 scheme = _makeScheme(scheme, _stringOrNullLength(scheme)); 1911 scheme = _makeScheme(scheme, _stringOrNullLength(scheme));
1912 userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo)); 1912 userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo));
1913 host = _makeHost(host, 0, _stringOrNullLength(host), false); 1913 host = _makeHost(host, 0, _stringOrNullLength(host), false);
1914 if (dart.equals(query, "")) 1914 if (dart.equals(query, ""))
1915 query = null; 1915 query = null;
1916 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters); 1916 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters);
1917 fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment)); 1917 fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment));
1918 port = _makePort(port, scheme); 1918 port = _makePort(port, scheme);
1919 let isFile = dart.equals(scheme, "file"); 1919 let isFile = dart.equals(scheme, "file");
1920 if (dart.notNull(host === null) && dart.notNull(dart.notNull(dart.notNull( userInfo.isNotEmpty) || dart.notNull(port !== null)) || dart.notNull(isFile))) { 1920 if (dart.notNull(host === null) && (dart.notNull(userInfo.isNotEmpty) || p ort !== null || dart.notNull(isFile))) {
1921 host = ""; 1921 host = "";
1922 } 1922 }
1923 let ensureLeadingSlash = host !== null; 1923 let ensureLeadingSlash = host !== null;
1924 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, ensureL eadingSlash, isFile); 1924 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, ensureL eadingSlash, isFile);
1925 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt); 1925 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt);
1926 } 1926 }
1927 Uri$http(authority, unencodedPath, queryParameters) { 1927 Uri$http(authority, unencodedPath, queryParameters) {
1928 if (queryParameters === void 0) 1928 if (queryParameters === void 0)
1929 queryParameters = null; 1929 queryParameters = null;
1930 return _makeHttpUri("http", authority, unencodedPath, queryParameters); 1930 return _makeHttpUri("http", authority, unencodedPath, queryParameters);
1931 } 1931 }
1932 Uri$https(authority, unencodedPath, queryParameters) { 1932 Uri$https(authority, unencodedPath, queryParameters) {
1933 if (queryParameters === void 0) 1933 if (queryParameters === void 0)
1934 queryParameters = null; 1934 queryParameters = null;
1935 return _makeHttpUri("https", authority, unencodedPath, queryParameters); 1935 return _makeHttpUri("https", authority, unencodedPath, queryParameters);
1936 } 1936 }
1937 static [_makeHttpUri](scheme, authority, unencodedPath, queryParameters) { 1937 static [_makeHttpUri](scheme, authority, unencodedPath, queryParameters) {
1938 let userInfo = ""; 1938 let userInfo = "";
1939 let host = null; 1939 let host = null;
1940 let port = null; 1940 let port = null;
1941 if (dart.notNull(authority !== null) && dart.notNull(authority.isNotEmpty) ) { 1941 if (dart.notNull(authority !== null) && dart.notNull(authority.isNotEmpty) ) {
1942 let hostStart = 0; 1942 let hostStart = 0;
1943 let hasUserInfo = false; 1943 let hasUserInfo = false;
1944 for (let i = 0; i < authority.length; i++) { 1944 for (let i = 0; dart.notNull(i) < dart.notNull(authority.length); dart.n otNull(i)++) {
1945 if (authority.codeUnitAt(i) === _AT_SIGN) { 1945 if (authority.codeUnitAt(i) === _AT_SIGN) {
1946 hasUserInfo = true; 1946 hasUserInfo = true;
1947 userInfo = authority.substring(0, i); 1947 userInfo = authority.substring(0, i);
1948 hostStart = i + 1; 1948 hostStart = dart.notNull(i) + 1;
1949 break; 1949 break;
1950 } 1950 }
1951 } 1951 }
1952 let hostEnd = hostStart; 1952 let hostEnd = hostStart;
1953 if (dart.notNull(hostStart < authority.length) && dart.notNull(authority .codeUnitAt(hostStart) === _LEFT_BRACKET)) { 1953 if (dart.notNull(hostStart) < dart.notNull(authority.length) && authorit y.codeUnitAt(hostStart) === _LEFT_BRACKET) {
1954 for (; hostEnd < authority.length; hostEnd++) { 1954 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); dart.no tNull(hostEnd)++) {
1955 if (authority.codeUnitAt(hostEnd) === _RIGHT_BRACKET) 1955 if (authority.codeUnitAt(hostEnd) === _RIGHT_BRACKET)
1956 break; 1956 break;
1957 } 1957 }
1958 if (hostEnd === authority.length) { 1958 if (hostEnd === authority.length) {
1959 throw new FormatException("Invalid IPv6 host entry.", authority, hos tStart); 1959 throw new FormatException("Invalid IPv6 host entry.", authority, hos tStart);
1960 } 1960 }
1961 parseIPv6Address(authority, hostStart + 1, hostEnd); 1961 parseIPv6Address(authority, dart.notNull(hostStart) + 1, hostEnd);
1962 hostEnd++; 1962 dart.notNull(hostEnd)++;
1963 if (dart.notNull(hostEnd !== authority.length) && dart.notNull(authori ty.codeUnitAt(hostEnd) !== _COLON)) { 1963 if (hostEnd !== authority.length && authority.codeUnitAt(hostEnd) !== _COLON) {
1964 throw new FormatException("Invalid end of authority", authority, hos tEnd); 1964 throw new FormatException("Invalid end of authority", authority, hos tEnd);
1965 } 1965 }
1966 } 1966 }
1967 let hasPort = false; 1967 let hasPort = false;
1968 for (; hostEnd < authority.length; hostEnd++) { 1968 for (; dart.notNull(hostEnd) < dart.notNull(authority.length); dart.notN ull(hostEnd)++) {
1969 if (authority.codeUnitAt(hostEnd) === _COLON) { 1969 if (authority.codeUnitAt(hostEnd) === _COLON) {
1970 let portString = authority.substring(hostEnd + 1); 1970 let portString = authority.substring(dart.notNull(hostEnd) + 1);
1971 if (portString.isNotEmpty) 1971 if (portString.isNotEmpty)
1972 port = int.parse(portString); 1972 port = int.parse(portString);
1973 break; 1973 break;
1974 } 1974 }
1975 } 1975 }
1976 host = authority.substring(hostStart, hostEnd); 1976 host = authority.substring(hostStart, hostEnd);
1977 } 1977 }
1978 return new Uri({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath.split("/"), queryPa rameters: queryParameters}); 1978 return new Uri({scheme: scheme, userInfo: userInfo, host: dart.as(host, St ring), port: dart.as(port, int), pathSegments: unencodedPath.split("/"), queryPa rameters: queryParameters});
1979 } 1979 }
1980 Uri$file(path, opt$) { 1980 Uri$file(path, opt$) {
(...skipping 28 matching lines...) Expand all
2009 if (dart.dinvoke(segment, 'contains', new RegExp('["*/:<>?\\\\|]'))) { 2009 if (dart.dinvoke(segment, 'contains', new RegExp('["*/:<>?\\\\|]'))) {
2010 if (argumentError) { 2010 if (argumentError) {
2011 throw new ArgumentError("Illegal character in path"); 2011 throw new ArgumentError("Illegal character in path");
2012 } else { 2012 } else {
2013 throw new UnsupportedError("Illegal character in path"); 2013 throw new UnsupportedError("Illegal character in path");
2014 } 2014 }
2015 } 2015 }
2016 }); 2016 });
2017 } 2017 }
2018 static [_checkWindowsDriveLetter](charCode, argumentError) { 2018 static [_checkWindowsDriveLetter](charCode, argumentError) {
2019 if (dart.notNull(dart.notNull(_UPPER_CASE_A <= charCode) && dart.notNull(c harCode <= _UPPER_CASE_Z)) || dart.notNull(dart.notNull(_LOWER_CASE_A <= charCod e) && dart.notNull(charCode <= _LOWER_CASE_Z))) { 2019 if (dart.notNull(_UPPER_CASE_A) <= dart.notNull(charCode) && dart.notNull( charCode) <= dart.notNull(_UPPER_CASE_Z) || dart.notNull(_LOWER_CASE_A) <= dart. notNull(charCode) && dart.notNull(charCode) <= dart.notNull(_LOWER_CASE_Z)) {
2020 return; 2020 return;
2021 } 2021 }
2022 if (argumentError) { 2022 if (argumentError) {
2023 throw new ArgumentError(String['+']("Illegal drive letter ", new String. fromCharCode(charCode))); 2023 throw new ArgumentError(String['+']("Illegal drive letter ", new String. fromCharCode(charCode)));
2024 } else { 2024 } else {
2025 throw new UnsupportedError(String['+']("Illegal drive letter ", new Stri ng.fromCharCode(charCode))); 2025 throw new UnsupportedError(String['+']("Illegal drive letter ", new Stri ng.fromCharCode(charCode)));
2026 } 2026 }
2027 } 2027 }
2028 static [_makeFileUri](path) { 2028 static [_makeFileUri](path) {
2029 let sep = "/"; 2029 let sep = "/";
2030 if (path.startsWith(sep)) { 2030 if (path.startsWith(sep)) {
2031 return new Uri({scheme: "file", pathSegments: path.split(sep)}); 2031 return new Uri({scheme: "file", pathSegments: path.split(sep)});
2032 } else { 2032 } else {
2033 return new Uri({pathSegments: path.split(sep)}); 2033 return new Uri({pathSegments: path.split(sep)});
2034 } 2034 }
2035 } 2035 }
2036 static [_makeWindowsFileUrl](path) { 2036 static [_makeWindowsFileUrl](path) {
2037 if (path.startsWith("\\\\?\\")) { 2037 if (path.startsWith("\\\\?\\")) {
2038 if (path.startsWith("\\\\?\\UNC\\")) { 2038 if (path.startsWith("\\\\?\\UNC\\")) {
2039 path = `\\${path.substring(7)}`; 2039 path = `\\${path.substring(7)}`;
2040 } else { 2040 } else {
2041 path = path.substring(4); 2041 path = path.substring(4);
2042 if (dart.notNull(dart.notNull(path.length < 3) || dart.notNull(path.co deUnitAt(1) !== _COLON)) || dart.notNull(path.codeUnitAt(2) !== _BACKSLASH)) { 2042 if (dart.notNull(path.length) < 3 || path.codeUnitAt(1) !== _COLON || path.codeUnitAt(2) !== _BACKSLASH) {
2043 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute"); 2043 throw new ArgumentError("Windows paths with \\\\?\\ prefix must be a bsolute");
2044 } 2044 }
2045 } 2045 }
2046 } else { 2046 } else {
2047 path = path.replaceAll("/", "\\"); 2047 path = path.replaceAll("/", "\\");
2048 } 2048 }
2049 let sep = "\\"; 2049 let sep = "\\";
2050 if (dart.notNull(path.length > 1) && dart.notNull(dart.equals(path.get(1), ":"))) { 2050 if (dart.notNull(path.length) > 1 && dart.notNull(dart.equals(path.get(1), ":"))) {
2051 _checkWindowsDriveLetter(path.codeUnitAt(0), true); 2051 _checkWindowsDriveLetter(path.codeUnitAt(0), true);
2052 if (dart.notNull(path.length === 2) || dart.notNull(path.codeUnitAt(2) ! == _BACKSLASH)) { 2052 if (path.length === 2 || path.codeUnitAt(2) !== _BACKSLASH) {
2053 throw new ArgumentError("Windows paths with drive letter must be absol ute"); 2053 throw new ArgumentError("Windows paths with drive letter must be absol ute");
2054 } 2054 }
2055 let pathSegments = path.split(sep); 2055 let pathSegments = path.split(sep);
2056 _checkWindowsPathReservedCharacters(pathSegments, true, 1); 2056 _checkWindowsPathReservedCharacters(pathSegments, true, 1);
2057 return new Uri({scheme: "file", pathSegments: pathSegments}); 2057 return new Uri({scheme: "file", pathSegments: pathSegments});
2058 } 2058 }
2059 if (dart.notNull(path.length > 0) && dart.notNull(dart.equals(path.get(0), sep))) { 2059 if (dart.notNull(path.length) > 0 && dart.notNull(dart.equals(path.get(0), sep))) {
2060 if (dart.notNull(path.length > 1) && dart.notNull(dart.equals(path.get(1 ), sep))) { 2060 if (dart.notNull(path.length) > 1 && dart.notNull(dart.equals(path.get(1 ), sep))) {
2061 let pathStart = path.indexOf("\\", 2); 2061 let pathStart = path.indexOf("\\", 2);
2062 let hostPart = pathStart === -1 ? path.substring(2) : path.substring(2 , pathStart); 2062 let hostPart = pathStart === -1 ? path.substring(2) : path.substring(2 , pathStart);
2063 let pathPart = pathStart === -1 ? "" : path.substring(pathStart + 1); 2063 let pathPart = pathStart === -1 ? "" : path.substring(dart.notNull(pat hStart) + 1);
2064 let pathSegments = pathPart.split(sep); 2064 let pathSegments = pathPart.split(sep);
2065 _checkWindowsPathReservedCharacters(pathSegments, true); 2065 _checkWindowsPathReservedCharacters(pathSegments, true);
2066 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents}); 2066 return new Uri({scheme: "file", host: hostPart, pathSegments: pathSegm ents});
2067 } else { 2067 } else {
2068 let pathSegments = path.split(sep); 2068 let pathSegments = path.split(sep);
2069 _checkWindowsPathReservedCharacters(pathSegments, true); 2069 _checkWindowsPathReservedCharacters(pathSegments, true);
2070 return new Uri({scheme: "file", pathSegments: pathSegments}); 2070 return new Uri({scheme: "file", pathSegments: pathSegments});
2071 } 2071 }
2072 } else { 2072 } else {
2073 let pathSegments = path.split(sep); 2073 let pathSegments = path.split(sep);
(...skipping 20 matching lines...) Expand all
2094 } 2094 }
2095 let isFile = dart.equals(scheme, "file"); 2095 let isFile = dart.equals(scheme, "file");
2096 if (userInfo !== null) { 2096 if (userInfo !== null) {
2097 userInfo = _makeUserInfo(userInfo, 0, userInfo.length); 2097 userInfo = _makeUserInfo(userInfo, 0, userInfo.length);
2098 } else { 2098 } else {
2099 userInfo = this.userInfo; 2099 userInfo = this.userInfo;
2100 } 2100 }
2101 if (port !== null) { 2101 if (port !== null) {
2102 port = _makePort(port, scheme); 2102 port = _makePort(port, scheme);
2103 } else { 2103 } else {
2104 port = dart.notNull(this[_port]); 2104 port = this[_port];
2105 if (schemeChanged) { 2105 if (schemeChanged) {
2106 port = _makePort(port, scheme); 2106 port = _makePort(port, scheme);
2107 } 2107 }
2108 } 2108 }
2109 if (host !== null) { 2109 if (host !== null) {
2110 host = _makeHost(host, 0, host.length, false); 2110 host = _makeHost(host, 0, host.length, false);
2111 } else if (this.hasAuthority) { 2111 } else if (this.hasAuthority) {
2112 host = this.host; 2112 host = this.host;
2113 } else if (dart.notNull(dart.notNull(userInfo.isNotEmpty) || dart.notNull( port !== null)) || dart.notNull(isFile)) { 2113 } else if (dart.notNull(userInfo.isNotEmpty) || port !== null || dart.notN ull(isFile)) {
2114 host = ""; 2114 host = "";
2115 } 2115 }
2116 let ensureLeadingSlash = host !== null; 2116 let ensureLeadingSlash = host !== null;
2117 if (dart.notNull(path !== null) || dart.notNull(pathSegments !== null)) { 2117 if (dart.notNull(path !== null) || dart.notNull(pathSegments !== null)) {
2118 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, ensur eLeadingSlash, isFile); 2118 path = _makePath(path, 0, _stringOrNullLength(path), pathSegments, ensur eLeadingSlash, isFile);
2119 } else { 2119 } else {
2120 path = this.path; 2120 path = this.path;
2121 if (dart.notNull(dart.notNull(isFile) || dart.notNull(dart.notNull(ensur eLeadingSlash) && dart.notNull(!dart.notNull(path.isEmpty)))) && dart.notNull(!d art.notNull(path.startsWith('/')))) { 2121 if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash) && !dart.n otNull(path.isEmpty)) && !dart.notNull(path.startsWith('/'))) {
2122 path = `/${path}`; 2122 path = `/${path}`;
2123 } 2123 }
2124 } 2124 }
2125 if (dart.notNull(query !== null) || dart.notNull(queryParameters !== null) ) { 2125 if (dart.notNull(query !== null) || dart.notNull(queryParameters !== null) ) {
2126 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters ); 2126 query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters );
2127 } else if (this.hasQuery) { 2127 } else if (this.hasQuery) {
2128 query = this.query; 2128 query = this.query;
2129 } 2129 }
2130 if (fragment !== null) { 2130 if (fragment !== null) {
2131 fragment = _makeFragment(fragment, 0, fragment.length); 2131 fragment = _makeFragment(fragment, 0, fragment.length);
2132 } else if (this.hasFragment) { 2132 } else if (this.hasFragment) {
2133 fragment = this.fragment; 2133 fragment = this.fragment;
2134 } 2134 }
2135 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt); 2135 return new Uri._internal(scheme, userInfo, host, port, path, query, fragme nt);
2136 } 2136 }
2137 get pathSegments() { 2137 get pathSegments() {
2138 if (this[_pathSegments] === null) { 2138 if (this[_pathSegments] === null) {
2139 let pathToSplit = dart.notNull(!dart.notNull(this.path.isEmpty)) && dart .notNull(this.path.codeUnitAt(0) === _SLASH) ? this.path.substring(1) : this.pat h; 2139 let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnit At(0) === _SLASH ? this.path.substring(1) : this.path;
2140 this[_pathSegments] = dart.as(new collection.UnmodifiableListView(dart.e quals(pathToSplit, "") ? /* Unimplemented const */new List.from([]) : pathToSpli t.split("/").map(Uri.decodeComponent).toList({growable: false})), List$(String)) ; 2140 this[_pathSegments] = dart.as(new collection.UnmodifiableListView(dart.e quals(pathToSplit, "") ? /* Unimplemented const */new List.from([]) : pathToSpli t.split("/").map(Uri.decodeComponent).toList({growable: false})), List$(String)) ;
2141 } 2141 }
2142 return this[_pathSegments]; 2142 return this[_pathSegments];
2143 } 2143 }
2144 get queryParameters() { 2144 get queryParameters() {
2145 if (this[_queryParameters] === null) { 2145 if (this[_queryParameters] === null) {
2146 this[_queryParameters] = dart.as(new collection.UnmodifiableMapView(spli tQueryString(this.query)), Map$(String, String)); 2146 this[_queryParameters] = dart.as(new collection.UnmodifiableMapView(spli tQueryString(this.query)), Map$(String, String));
2147 } 2147 }
2148 return this[_queryParameters]; 2148 return this[_queryParameters];
2149 } 2149 }
2150 static [_makePort](port, scheme) { 2150 static [_makePort](port, scheme) {
2151 if (dart.notNull(port !== null) && dart.notNull(port === _defaultPort(sche me))) 2151 if (port !== null && port === _defaultPort(scheme))
2152 return dart.as(null, int); 2152 return null;
2153 return port; 2153 return port;
2154 } 2154 }
2155 static [_makeHost](host, start, end, strictIPv6) { 2155 static [_makeHost](host, start, end, strictIPv6) {
2156 if (host === null) 2156 if (host === null)
2157 return null; 2157 return null;
2158 if (start === end) 2158 if (start === end)
2159 return ""; 2159 return "";
2160 if (host.codeUnitAt(start) === _LEFT_BRACKET) { 2160 if (host.codeUnitAt(start) === _LEFT_BRACKET) {
2161 if (host.codeUnitAt(end - 1) !== _RIGHT_BRACKET) { 2161 if (host.codeUnitAt(dart.notNull(end) - 1) !== _RIGHT_BRACKET) {
2162 _fail(host, start, 'Missing end `]` to match `[` in host'); 2162 _fail(host, start, 'Missing end `]` to match `[` in host');
2163 } 2163 }
2164 parseIPv6Address(host, start + 1, end - 1); 2164 parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
2165 return host.substring(start, end).toLowerCase(); 2165 return host.substring(start, end).toLowerCase();
2166 } 2166 }
2167 if (!dart.notNull(strictIPv6)) { 2167 if (!dart.notNull(strictIPv6)) {
2168 for (let i = start; i < end; i++) { 2168 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i) ++) {
2169 if (host.codeUnitAt(i) === _COLON) { 2169 if (host.codeUnitAt(i) === _COLON) {
2170 parseIPv6Address(host, start, end); 2170 parseIPv6Address(host, start, end);
2171 return `[${host}]`; 2171 return `[${host}]`;
2172 } 2172 }
2173 } 2173 }
2174 } 2174 }
2175 return _normalizeRegName(host, start, end); 2175 return _normalizeRegName(host, start, end);
2176 } 2176 }
2177 static [_isRegNameChar](char) { 2177 static [_isRegNameChar](char) {
2178 return dart.notNull(char < 127) && dart.notNull(!dart.equals(dart.dbinary( dart.dindex(_regNameTable, char >> 4), '&', 1 << (char & 15)), 0)); 2178 return dart.notNull(char) < 127 && dart.notNull(!dart.equals(dart.dbinary( dart.dindex(_regNameTable, dart.notNull(char) >> 4), '&', 1 << (dart.notNull(cha r) & 15)), 0));
2179 } 2179 }
2180 static [_normalizeRegName](host, start, end) { 2180 static [_normalizeRegName](host, start, end) {
2181 let buffer = null; 2181 let buffer = null;
2182 let sectionStart = start; 2182 let sectionStart = start;
2183 let index = start; 2183 let index = start;
2184 let isNormalized = true; 2184 let isNormalized = true;
2185 while (index < end) { 2185 while (dart.notNull(index) < dart.notNull(end)) {
2186 let char = host.codeUnitAt(index); 2186 let char = host.codeUnitAt(index);
2187 if (char === _PERCENT) { 2187 if (char === _PERCENT) {
2188 let replacement = _normalizeEscape(host, index, true); 2188 let replacement = _normalizeEscape(host, index, true);
2189 if (dart.notNull(replacement === null) && dart.notNull(isNormalized)) { 2189 if (dart.notNull(replacement === null) && dart.notNull(isNormalized)) {
2190 index = 3; 2190 index = 3;
2191 continue; 2191 continue;
2192 } 2192 }
2193 if (buffer === null) 2193 if (buffer === null)
2194 buffer = new StringBuffer(); 2194 buffer = new StringBuffer();
2195 let slice = host.substring(sectionStart, index); 2195 let slice = host.substring(sectionStart, index);
2196 if (!dart.notNull(isNormalized)) 2196 if (!dart.notNull(isNormalized))
2197 slice = slice.toLowerCase(); 2197 slice = slice.toLowerCase();
2198 buffer.write(slice); 2198 buffer.write(slice);
2199 let sourceLength = 3; 2199 let sourceLength = 3;
2200 if (replacement === null) { 2200 if (replacement === null) {
2201 replacement = host.substring(index, index + 3); 2201 replacement = host.substring(index, dart.notNull(index) + 3);
2202 } else if (dart.equals(replacement, "%")) { 2202 } else if (dart.equals(replacement, "%")) {
2203 replacement = "%25"; 2203 replacement = "%25";
2204 sourceLength = 1; 2204 sourceLength = 1;
2205 } 2205 }
2206 buffer.write(replacement); 2206 buffer.write(replacement);
2207 index = sourceLength; 2207 index = sourceLength;
2208 sectionStart = index; 2208 sectionStart = index;
2209 isNormalized = true; 2209 isNormalized = true;
2210 } else if (_isRegNameChar(char)) { 2210 } else if (_isRegNameChar(char)) {
2211 if (dart.notNull(dart.notNull(isNormalized) && dart.notNull(_UPPER_CAS E_A <= char)) && dart.notNull(_UPPER_CASE_Z >= char)) { 2211 if (dart.notNull(isNormalized) && dart.notNull(_UPPER_CASE_A) <= dart. notNull(char) && dart.notNull(_UPPER_CASE_Z) >= dart.notNull(char)) {
2212 if (buffer === null) 2212 if (buffer === null)
2213 buffer = new StringBuffer(); 2213 buffer = new StringBuffer();
2214 if (sectionStart < index) { 2214 if (dart.notNull(sectionStart) < dart.notNull(index)) {
2215 buffer.write(host.substring(sectionStart, index)); 2215 buffer.write(host.substring(sectionStart, index));
2216 sectionStart = index; 2216 sectionStart = index;
2217 } 2217 }
2218 isNormalized = false; 2218 isNormalized = false;
2219 } 2219 }
2220 index++; 2220 dart.notNull(index)++;
2221 } else if (_isGeneralDelimiter(char)) { 2221 } else if (_isGeneralDelimiter(char)) {
2222 _fail(host, index, "Invalid character"); 2222 _fail(host, index, "Invalid character");
2223 } else { 2223 } else {
2224 let sourceLength = 1; 2224 let sourceLength = 1;
2225 if (dart.notNull((char & 64512) === 55296) && dart.notNull(index + 1 < end)) { 2225 if ((dart.notNull(char) & 64512) === 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
2226 let tail = host.codeUnitAt(index + 1); 2226 let tail = host.codeUnitAt(dart.notNull(index) + 1);
2227 if ((tail & 64512) === 56320) { 2227 if ((dart.notNull(tail) & 64512) === 56320) {
2228 char = 65536 | (char & 1023) << 10 | tail & 1023; 2228 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNull(ta il) & 1023;
2229 sourceLength = 2; 2229 sourceLength = 2;
2230 } 2230 }
2231 } 2231 }
2232 if (buffer === null) 2232 if (buffer === null)
2233 buffer = new StringBuffer(); 2233 buffer = new StringBuffer();
2234 let slice = host.substring(sectionStart, index); 2234 let slice = host.substring(sectionStart, index);
2235 if (!dart.notNull(isNormalized)) 2235 if (!dart.notNull(isNormalized))
2236 slice = slice.toLowerCase(); 2236 slice = slice.toLowerCase();
2237 buffer.write(slice); 2237 buffer.write(slice);
2238 buffer.write(_escapeChar(char)); 2238 buffer.write(_escapeChar(char));
2239 index = sourceLength; 2239 index = sourceLength;
2240 sectionStart = index; 2240 sectionStart = index;
2241 } 2241 }
2242 } 2242 }
2243 if (buffer === null) 2243 if (buffer === null)
2244 return host.substring(start, end); 2244 return host.substring(start, end);
2245 if (sectionStart < end) { 2245 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2246 let slice = host.substring(sectionStart, end); 2246 let slice = host.substring(sectionStart, end);
2247 if (!dart.notNull(isNormalized)) 2247 if (!dart.notNull(isNormalized))
2248 slice = slice.toLowerCase(); 2248 slice = slice.toLowerCase();
2249 buffer.write(slice); 2249 buffer.write(slice);
2250 } 2250 }
2251 return buffer.toString(); 2251 return buffer.toString();
2252 } 2252 }
2253 static [_makeScheme](scheme, end) { 2253 static [_makeScheme](scheme, end) {
2254 if (end === 0) 2254 if (end === 0)
2255 return ""; 2255 return "";
2256 let firstCodeUnit = scheme.codeUnitAt(0); 2256 let firstCodeUnit = scheme.codeUnitAt(0);
2257 if (!dart.notNull(_isAlphabeticCharacter(firstCodeUnit))) { 2257 if (!dart.notNull(_isAlphabeticCharacter(firstCodeUnit))) {
2258 _fail(scheme, 0, "Scheme not starting with alphabetic character"); 2258 _fail(scheme, 0, "Scheme not starting with alphabetic character");
2259 } 2259 }
2260 let allLowercase = firstCodeUnit >= _LOWER_CASE_A; 2260 let allLowercase = dart.notNull(firstCodeUnit) >= dart.notNull(_LOWER_CASE _A);
2261 for (let i = 0; i < end; i++) { 2261 for (let i = 0; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++) {
2262 let codeUnit = scheme.codeUnitAt(i); 2262 let codeUnit = scheme.codeUnitAt(i);
2263 if (!dart.notNull(_isSchemeCharacter(codeUnit))) { 2263 if (!dart.notNull(_isSchemeCharacter(codeUnit))) {
2264 _fail(scheme, i, "Illegal scheme character"); 2264 _fail(scheme, i, "Illegal scheme character");
2265 } 2265 }
2266 if (dart.notNull(codeUnit < _LOWER_CASE_A) || dart.notNull(codeUnit > _L OWER_CASE_Z)) { 2266 if (dart.notNull(codeUnit) < dart.notNull(_LOWER_CASE_A) || dart.notNull (codeUnit) > dart.notNull(_LOWER_CASE_Z)) {
2267 allLowercase = false; 2267 allLowercase = false;
2268 } 2268 }
2269 } 2269 }
2270 scheme = scheme.substring(0, end); 2270 scheme = scheme.substring(0, end);
2271 if (!dart.notNull(allLowercase)) 2271 if (!dart.notNull(allLowercase))
2272 scheme = scheme.toLowerCase(); 2272 scheme = scheme.toLowerCase();
2273 return scheme; 2273 return scheme;
2274 } 2274 }
2275 static [_makeUserInfo](userInfo, start, end) { 2275 static [_makeUserInfo](userInfo, start, end) {
2276 if (userInfo === null) 2276 if (userInfo === null)
2277 return ""; 2277 return "";
2278 return _normalize(userInfo, start, end, dart.as(_userinfoTable, List$(int) )); 2278 return _normalize(userInfo, start, end, dart.as(_userinfoTable, List$(int) ));
2279 } 2279 }
2280 static [_makePath](path, start, end, pathSegments, ensureLeadingSlash, isFil e) { 2280 static [_makePath](path, start, end, pathSegments, ensureLeadingSlash, isFil e) {
2281 if (dart.notNull(path === null) && dart.notNull(pathSegments === null)) 2281 if (dart.notNull(path === null) && dart.notNull(pathSegments === null))
2282 return isFile ? "/" : ""; 2282 return isFile ? "/" : "";
2283 if (dart.notNull(path !== null) && dart.notNull(pathSegments !== null)) { 2283 if (dart.notNull(path !== null) && dart.notNull(pathSegments !== null)) {
2284 throw new ArgumentError('Both path and pathSegments specified'); 2284 throw new ArgumentError('Both path and pathSegments specified');
2285 } 2285 }
2286 let result = null; 2286 let result = null;
2287 if (path !== null) { 2287 if (path !== null) {
2288 result = _normalize(path, start, end, dart.as(_pathCharOrSlashTable, Lis t$(int))); 2288 result = _normalize(path, start, end, dart.as(_pathCharOrSlashTable, Lis t$(int)));
2289 } else { 2289 } else {
2290 result = pathSegments.map((s) => _uriEncode(dart.as(_pathCharTable, List $(int)), dart.as(s, String))).join("/"); 2290 result = pathSegments.map((s) => _uriEncode(dart.as(_pathCharTable, List $(int)), dart.as(s, String))).join("/");
2291 } 2291 }
2292 if (dart.dload(result, 'isEmpty')) { 2292 if (dart.dload(result, 'isEmpty')) {
2293 if (isFile) 2293 if (isFile)
2294 return "/"; 2294 return "/";
2295 } else if (dart.notNull(dart.notNull(isFile) || dart.notNull(ensureLeading Slash)) && dart.notNull(!dart.equals(dart.dinvoke(result, 'codeUnitAt', 0), _SLA SH))) { 2295 } else if ((dart.notNull(isFile) || dart.notNull(ensureLeadingSlash)) && d art.notNull(!dart.equals(dart.dinvoke(result, 'codeUnitAt', 0), _SLASH))) {
2296 return `/${result}`; 2296 return `/${result}`;
2297 } 2297 }
2298 return dart.as(result, String); 2298 return dart.as(result, String);
2299 } 2299 }
2300 static [_makeQuery](query, start, end, queryParameters) { 2300 static [_makeQuery](query, start, end, queryParameters) {
2301 if (dart.notNull(query === null) && dart.notNull(queryParameters === null) ) 2301 if (dart.notNull(query === null) && dart.notNull(queryParameters === null) )
2302 return null; 2302 return null;
2303 if (dart.notNull(query !== null) && dart.notNull(queryParameters !== null) ) { 2303 if (dart.notNull(query !== null) && dart.notNull(queryParameters !== null) ) {
2304 throw new ArgumentError('Both query and queryParameters specified'); 2304 throw new ArgumentError('Both query and queryParameters specified');
2305 } 2305 }
(...skipping 16 matching lines...) Expand all
2322 } 2322 }
2323 static [_makeFragment](fragment, start, end) { 2323 static [_makeFragment](fragment, start, end) {
2324 if (fragment === null) 2324 if (fragment === null)
2325 return null; 2325 return null;
2326 return _normalize(fragment, start, end, dart.as(_queryCharTable, List$(int ))); 2326 return _normalize(fragment, start, end, dart.as(_queryCharTable, List$(int )));
2327 } 2327 }
2328 static [_stringOrNullLength](s) { 2328 static [_stringOrNullLength](s) {
2329 return s === null ? 0 : s.length; 2329 return s === null ? 0 : s.length;
2330 } 2330 }
2331 static [_isHexDigit](char) { 2331 static [_isHexDigit](char) {
2332 if (_NINE >= char) 2332 if (dart.notNull(_NINE) >= dart.notNull(char))
2333 return _ZERO <= char; 2333 return dart.notNull(_ZERO) <= dart.notNull(char);
2334 char = 32; 2334 char = 32;
2335 return dart.notNull(_LOWER_CASE_A <= char) && dart.notNull(_LOWER_CASE_F > = char); 2335 return dart.notNull(_LOWER_CASE_A) <= dart.notNull(char) && dart.notNull(_ LOWER_CASE_F) >= dart.notNull(char);
2336 } 2336 }
2337 static [_hexValue](char) { 2337 static [_hexValue](char) {
2338 dart.assert(_isHexDigit(char)); 2338 dart.assert(_isHexDigit(char));
2339 if (_NINE >= char) 2339 if (dart.notNull(_NINE) >= dart.notNull(char))
2340 return char - _ZERO; 2340 return dart.notNull(char) - dart.notNull(_ZERO);
2341 char = 32; 2341 char = 32;
2342 return char - (_LOWER_CASE_A - 10); 2342 return dart.notNull(char) - (dart.notNull(_LOWER_CASE_A) - 10);
2343 } 2343 }
2344 static [_normalizeEscape](source, index, lowerCase) { 2344 static [_normalizeEscape](source, index, lowerCase) {
2345 dart.assert(source.codeUnitAt(index) === _PERCENT); 2345 dart.assert(source.codeUnitAt(index) === _PERCENT);
2346 if (index + 2 >= source.length) { 2346 if (dart.notNull(index) + 2 >= dart.notNull(source.length)) {
2347 return "%"; 2347 return "%";
2348 } 2348 }
2349 let firstDigit = source.codeUnitAt(index + 1); 2349 let firstDigit = source.codeUnitAt(dart.notNull(index) + 1);
2350 let secondDigit = source.codeUnitAt(index + 2); 2350 let secondDigit = source.codeUnitAt(dart.notNull(index) + 2);
2351 if (dart.notNull(!dart.notNull(_isHexDigit(firstDigit))) || dart.notNull(! dart.notNull(_isHexDigit(secondDigit)))) { 2351 if (!dart.notNull(_isHexDigit(firstDigit)) || !dart.notNull(_isHexDigit(se condDigit))) {
2352 return "%"; 2352 return "%";
2353 } 2353 }
2354 let value = _hexValue(firstDigit) * 16 + _hexValue(secondDigit); 2354 let value = dart.notNull(_hexValue(firstDigit)) * 16 + dart.notNull(_hexVa lue(secondDigit));
2355 if (_isUnreservedChar(value)) { 2355 if (_isUnreservedChar(value)) {
2356 if (dart.notNull(dart.notNull(lowerCase) && dart.notNull(_UPPER_CASE_A < = value)) && dart.notNull(_UPPER_CASE_Z >= value)) { 2356 if (dart.notNull(lowerCase) && dart.notNull(_UPPER_CASE_A) <= dart.notNu ll(value) && dart.notNull(_UPPER_CASE_Z) >= dart.notNull(value)) {
2357 value = 32; 2357 value = 32;
2358 } 2358 }
2359 return new String.fromCharCode(value); 2359 return new String.fromCharCode(value);
2360 } 2360 }
2361 if (dart.notNull(firstDigit >= _LOWER_CASE_A) || dart.notNull(secondDigit >= _LOWER_CASE_A)) { 2361 if (dart.notNull(firstDigit) >= dart.notNull(_LOWER_CASE_A) || dart.notNul l(secondDigit) >= dart.notNull(_LOWER_CASE_A)) {
2362 return source.substring(index, index + 3).toUpperCase(); 2362 return source.substring(index, dart.notNull(index) + 3).toUpperCase();
2363 } 2363 }
2364 return null; 2364 return null;
2365 } 2365 }
2366 static [_isUnreservedChar](ch) { 2366 static [_isUnreservedChar](ch) {
2367 return dart.notNull(ch < 127) && dart.notNull(!dart.equals(dart.dbinary(da rt.dindex(_unreservedTable, ch >> 4), '&', 1 << (ch & 15)), 0)); 2367 return dart.notNull(ch) < 127 && dart.notNull(!dart.equals(dart.dbinary(da rt.dindex(_unreservedTable, dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
2368 } 2368 }
2369 static [_escapeChar](char) { 2369 static [_escapeChar](char) {
2370 dart.assert(dart.dbinary(char, '<=', 1114111)); 2370 dart.assert(dart.dbinary(char, '<=', 1114111));
2371 let hexDigits = "0123456789ABCDEF"; 2371 let hexDigits = "0123456789ABCDEF";
2372 let codeUnits = null; 2372 let codeUnits = null;
2373 if (dart.dbinary(char, '<', 128)) { 2373 if (dart.dbinary(char, '<', 128)) {
2374 codeUnits = new List(3); 2374 codeUnits = new List(3);
2375 codeUnits.set(0, _PERCENT); 2375 codeUnits.set(0, _PERCENT);
2376 codeUnits.set(1, hexDigits.codeUnitAt(dart.as(dart.dbinary(char, '>>', 4 ), int))); 2376 codeUnits.set(1, hexDigits.codeUnitAt(dart.as(dart.dbinary(char, '>>', 4 ), int)));
2377 codeUnits.set(2, hexDigits.codeUnitAt(dart.as(dart.dbinary(char, '&', 15 ), int))); 2377 codeUnits.set(2, hexDigits.codeUnitAt(dart.as(dart.dbinary(char, '&', 15 ), int)));
2378 } else { 2378 } else {
2379 let flag = 192; 2379 let flag = 192;
2380 let encodedBytes = 2; 2380 let encodedBytes = 2;
2381 if (dart.dbinary(char, '>', 2047)) { 2381 if (dart.dbinary(char, '>', 2047)) {
2382 flag = 224; 2382 flag = 224;
2383 encodedBytes = 3; 2383 encodedBytes = 3;
2384 if (dart.dbinary(char, '>', 65535)) { 2384 if (dart.dbinary(char, '>', 65535)) {
2385 encodedBytes = 4; 2385 encodedBytes = 4;
2386 flag = 240; 2386 flag = 240;
2387 } 2387 }
2388 } 2388 }
2389 codeUnits = new List(3 * encodedBytes); 2389 codeUnits = new List(3 * dart.notNull(encodedBytes));
2390 let index = 0; 2390 let index = 0;
2391 while (--encodedBytes >= 0) { 2391 while (--dart.notNull(encodedBytes) >= 0) {
2392 let byte = dart.as(dart.dbinary(dart.dbinary(dart.dbinary(char, '>>', 6 * encodedBytes), '&', 63), '|', flag), int); 2392 let byte = dart.as(dart.dbinary(dart.dbinary(dart.dbinary(char, '>>', 6 * dart.notNull(encodedBytes)), '&', 63), '|', flag), int);
2393 codeUnits.set(index, _PERCENT); 2393 codeUnits.set(index, _PERCENT);
2394 codeUnits.set(index + 1, hexDigits.codeUnitAt(byte >> 4)); 2394 codeUnits.set(dart.notNull(index) + 1, hexDigits.codeUnitAt(dart.notNu ll(byte) >> 4));
2395 codeUnits.set(index + 2, hexDigits.codeUnitAt(byte & 15)); 2395 codeUnits.set(dart.notNull(index) + 2, hexDigits.codeUnitAt(dart.notNu ll(byte) & 15));
2396 index = 3; 2396 index = 3;
2397 flag = 128; 2397 flag = 128;
2398 } 2398 }
2399 } 2399 }
2400 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int))); 2400 return new String.fromCharCodes(dart.as(codeUnits, Iterable$(int)));
2401 } 2401 }
2402 static [_normalize](component, start, end, charTable) { 2402 static [_normalize](component, start, end, charTable) {
2403 let buffer = null; 2403 let buffer = null;
2404 let sectionStart = start; 2404 let sectionStart = start;
2405 let index = start; 2405 let index = start;
2406 while (index < end) { 2406 while (dart.notNull(index) < dart.notNull(end)) {
2407 let char = component.codeUnitAt(index); 2407 let char = component.codeUnitAt(index);
2408 if (dart.notNull(char < 127) && dart.notNull((charTable.get(char >> 4) & 1 << (char & 15)) !== 0)) { 2408 if (dart.notNull(char) < 127 && (dart.notNull(charTable.get(dart.notNull (char) >> 4)) & 1 << (dart.notNull(char) & 15)) !== 0) {
2409 index++; 2409 dart.notNull(index)++;
2410 } else { 2410 } else {
2411 let replacement = null; 2411 let replacement = null;
2412 let sourceLength = null; 2412 let sourceLength = null;
2413 if (char === _PERCENT) { 2413 if (char === _PERCENT) {
2414 replacement = _normalizeEscape(component, index, false); 2414 replacement = _normalizeEscape(component, index, false);
2415 if (replacement === null) { 2415 if (replacement === null) {
2416 index = 3; 2416 index = 3;
2417 continue; 2417 continue;
2418 } 2418 }
2419 if (dart.equals("%", replacement)) { 2419 if (dart.equals("%", replacement)) {
2420 replacement = "%25"; 2420 replacement = "%25";
2421 sourceLength = 1; 2421 sourceLength = 1;
2422 } else { 2422 } else {
2423 sourceLength = 3; 2423 sourceLength = 3;
2424 } 2424 }
2425 } else if (_isGeneralDelimiter(char)) { 2425 } else if (_isGeneralDelimiter(char)) {
2426 _fail(component, index, "Invalid character"); 2426 _fail(component, index, "Invalid character");
2427 } else { 2427 } else {
2428 sourceLength = 1; 2428 sourceLength = 1;
2429 if ((char & 64512) === 55296) { 2429 if ((dart.notNull(char) & 64512) === 55296) {
2430 if (index + 1 < end) { 2430 if (dart.notNull(index) + 1 < dart.notNull(end)) {
2431 let tail = component.codeUnitAt(index + 1); 2431 let tail = component.codeUnitAt(dart.notNull(index) + 1);
2432 if ((tail & 64512) === 56320) { 2432 if ((dart.notNull(tail) & 64512) === 56320) {
2433 sourceLength = 2; 2433 sourceLength = 2;
2434 char = 65536 | (char & 1023) << 10 | tail & 1023; 2434 char = 65536 | (dart.notNull(char) & 1023) << 10 | dart.notNul l(tail) & 1023;
2435 } 2435 }
2436 } 2436 }
2437 } 2437 }
2438 replacement = _escapeChar(char); 2438 replacement = _escapeChar(char);
2439 } 2439 }
2440 if (buffer === null) 2440 if (buffer === null)
2441 buffer = new StringBuffer(); 2441 buffer = new StringBuffer();
2442 buffer.write(component.substring(sectionStart, index)); 2442 buffer.write(component.substring(sectionStart, index));
2443 buffer.write(replacement); 2443 buffer.write(replacement);
2444 index = sourceLength; 2444 index = sourceLength;
2445 sectionStart = index; 2445 sectionStart = index;
2446 } 2446 }
2447 } 2447 }
2448 if (buffer === null) { 2448 if (buffer === null) {
2449 return component.substring(start, end); 2449 return component.substring(start, end);
2450 } 2450 }
2451 if (sectionStart < end) { 2451 if (dart.notNull(sectionStart) < dart.notNull(end)) {
2452 buffer.write(component.substring(sectionStart, end)); 2452 buffer.write(component.substring(sectionStart, end));
2453 } 2453 }
2454 return buffer.toString(); 2454 return buffer.toString();
2455 } 2455 }
2456 static [_isSchemeCharacter](ch) { 2456 static [_isSchemeCharacter](ch) {
2457 return dart.notNull(ch < 128) && dart.notNull(!dart.equals(dart.dbinary(da rt.dindex(_schemeTable, ch >> 4), '&', 1 << (ch & 15)), 0)); 2457 return dart.notNull(ch) < 128 && dart.notNull(!dart.equals(dart.dbinary(da rt.dindex(_schemeTable, dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15 )), 0));
2458 } 2458 }
2459 static [_isGeneralDelimiter](ch) { 2459 static [_isGeneralDelimiter](ch) {
2460 return dart.notNull(ch <= _RIGHT_BRACKET) && dart.notNull(!dart.equals(dar t.dbinary(dart.dindex(_genDelimitersTable, ch >> 4), '&', 1 << (ch & 15)), 0)); 2460 return dart.notNull(ch) <= dart.notNull(_RIGHT_BRACKET) && dart.notNull(!d art.equals(dart.dbinary(dart.dindex(_genDelimitersTable, dart.notNull(ch) >> 4), '&', 1 << (dart.notNull(ch) & 15)), 0));
2461 } 2461 }
2462 get isAbsolute() { 2462 get isAbsolute() {
2463 return dart.notNull(!dart.equals(this.scheme, "")) && dart.notNull(dart.eq uals(this.fragment, "")); 2463 return dart.notNull(!dart.equals(this.scheme, "")) && dart.notNull(dart.eq uals(this.fragment, ""));
2464 } 2464 }
2465 [_merge](base, reference) { 2465 [_merge](base, reference) {
2466 if (base.isEmpty) 2466 if (base.isEmpty)
2467 return `/${reference}`; 2467 return `/${reference}`;
2468 let backCount = 0; 2468 let backCount = 0;
2469 let refStart = 0; 2469 let refStart = 0;
2470 while (reference.startsWith("../", refStart)) { 2470 while (reference.startsWith("../", refStart)) {
2471 refStart = 3; 2471 refStart = 3;
2472 backCount++; 2472 dart.notNull(backCount)++;
2473 } 2473 }
2474 let baseEnd = base.lastIndexOf('/'); 2474 let baseEnd = base.lastIndexOf('/');
2475 while (dart.notNull(baseEnd > 0) && dart.notNull(backCount > 0)) { 2475 while (dart.notNull(baseEnd) > 0 && dart.notNull(backCount) > 0) {
2476 let newEnd = base.lastIndexOf('/', baseEnd - 1); 2476 let newEnd = base.lastIndexOf('/', dart.notNull(baseEnd) - 1);
2477 if (newEnd < 0) { 2477 if (dart.notNull(newEnd) < 0) {
2478 break; 2478 break;
2479 } 2479 }
2480 let delta = baseEnd - newEnd; 2480 let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
2481 if (dart.notNull(dart.notNull(dart.notNull(delta === 2) || dart.notNull( delta === 3)) && dart.notNull(base.codeUnitAt(newEnd + 1) === _DOT)) && dart.not Null(dart.notNull(delta === 2) || dart.notNull(base.codeUnitAt(newEnd + 2) === _ DOT))) { 2481 if ((delta === 2 || delta === 3) && base.codeUnitAt(dart.notNull(newEnd) + 1) === _DOT && (delta === 2 || base.codeUnitAt(dart.notNull(newEnd) + 2) === _DOT)) {
2482 break; 2482 break;
2483 } 2483 }
2484 baseEnd = newEnd; 2484 baseEnd = newEnd;
2485 backCount--; 2485 dart.notNull(backCount)--;
2486 } 2486 }
2487 return String['+'](base.substring(0, baseEnd + 1), reference.substring(ref Start - 3 * backCount)); 2487 return String['+'](base.substring(0, dart.notNull(baseEnd) + 1), reference .substring(dart.notNull(refStart) - 3 * dart.notNull(backCount)));
2488 } 2488 }
2489 [_hasDotSegments](path) { 2489 [_hasDotSegments](path) {
2490 if (dart.notNull(path.length > 0) && dart.notNull(path.codeUnitAt(0) === _ DOT)) 2490 if (dart.notNull(path.length) > 0 && path.codeUnitAt(0) === _DOT)
2491 return true; 2491 return true;
2492 let index = path.indexOf("/."); 2492 let index = path.indexOf("/.");
2493 return index !== -1; 2493 return index !== -1;
2494 } 2494 }
2495 [_removeDotSegments](path) { 2495 [_removeDotSegments](path) {
2496 if (!dart.notNull(this[_hasDotSegments](path))) 2496 if (!dart.notNull(this[_hasDotSegments](path)))
2497 return path; 2497 return path;
2498 let output = dart.as(new List.from([]), List$(String)); 2498 let output = dart.as(new List.from([]), List$(String));
2499 let appendSlash = false; 2499 let appendSlash = false;
2500 for (let segment of path.split("/")) { 2500 for (let segment of path.split("/")) {
2501 appendSlash = false; 2501 appendSlash = false;
2502 if (dart.equals(segment, "..")) { 2502 if (dart.equals(segment, "..")) {
2503 if (dart.notNull(!dart.notNull(output.isEmpty)) && dart.notNull(dart.n otNull(output.length !== 1) || dart.notNull(!dart.equals(output.get(0), "")))) 2503 if (!dart.notNull(output.isEmpty) && (output.length !== 1 || dart.notN ull(!dart.equals(output.get(0), ""))))
2504 output.removeLast(); 2504 output.removeLast();
2505 appendSlash = true; 2505 appendSlash = true;
2506 } else if (dart.equals(".", segment)) { 2506 } else if (dart.equals(".", segment)) {
2507 appendSlash = true; 2507 appendSlash = true;
2508 } else { 2508 } else {
2509 output.add(segment); 2509 output.add(segment);
2510 } 2510 }
2511 } 2511 }
2512 if (appendSlash) 2512 if (appendSlash)
2513 output.add(""); 2513 output.add("");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 if (reference.path.startsWith("/")) { 2555 if (reference.path.startsWith("/")) {
2556 targetPath = this[_removeDotSegments](reference.path); 2556 targetPath = this[_removeDotSegments](reference.path);
2557 } else { 2557 } else {
2558 targetPath = this[_removeDotSegments](this[_merge](this[_path], re ference.path)); 2558 targetPath = this[_removeDotSegments](this[_merge](this[_path], re ference.path));
2559 } 2559 }
2560 if (reference.hasQuery) 2560 if (reference.hasQuery)
2561 targetQuery = reference.query; 2561 targetQuery = reference.query;
2562 } 2562 }
2563 targetUserInfo = this[_userInfo]; 2563 targetUserInfo = this[_userInfo];
2564 targetHost = this[_host]; 2564 targetHost = this[_host];
2565 targetPort = dart.notNull(this[_port]); 2565 targetPort = this[_port];
2566 } 2566 }
2567 } 2567 }
2568 let fragment = dart.as(reference.hasFragment ? reference.fragment : null, String); 2568 let fragment = dart.as(reference.hasFragment ? reference.fragment : null, String);
2569 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP ort, targetPath, targetQuery, fragment); 2569 return new Uri._internal(targetScheme, targetUserInfo, targetHost, targetP ort, targetPath, targetQuery, fragment);
2570 } 2570 }
2571 get hasAuthority() { 2571 get hasAuthority() {
2572 return this[_host] !== null; 2572 return this[_host] !== null;
2573 } 2573 }
2574 get hasPort() { 2574 get hasPort() {
2575 return this[_port] !== null; 2575 return this[_port] !== null;
2576 } 2576 }
2577 get hasQuery() { 2577 get hasQuery() {
2578 return this[_query] !== null; 2578 return this[_query] !== null;
2579 } 2579 }
2580 get hasFragment() { 2580 get hasFragment() {
2581 return this[_fragment] !== null; 2581 return this[_fragment] !== null;
2582 } 2582 }
2583 get origin() { 2583 get origin() {
2584 if (dart.notNull(dart.notNull(dart.equals(this.scheme, "")) || dart.notNul l(this[_host] === null)) || dart.notNull(dart.equals(this[_host], ""))) { 2584 if (dart.notNull(dart.equals(this.scheme, "")) || dart.notNull(this[_host] === null) || dart.notNull(dart.equals(this[_host], ""))) {
2585 throw new StateError(`Cannot use origin without a scheme: ${this}`); 2585 throw new StateError(`Cannot use origin without a scheme: ${this}`);
2586 } 2586 }
2587 if (dart.notNull(!dart.equals(this.scheme, "http")) && dart.notNull(!dart. equals(this.scheme, "https"))) { 2587 if (dart.notNull(!dart.equals(this.scheme, "http")) && dart.notNull(!dart. equals(this.scheme, "https"))) {
2588 throw new StateError(`Origin is only applicable schemes http and https: ${this}`); 2588 throw new StateError(`Origin is only applicable schemes http and https: ${this}`);
2589 } 2589 }
2590 if (this[_port] === null) 2590 if (this[_port] === null)
2591 return `${this.scheme}://${this[_host]}`; 2591 return `${this.scheme}://${this[_host]}`;
2592 return `${this.scheme}://${this[_host]}:${this[_port]}`; 2592 return `${this.scheme}://${this[_host]}:${this[_port]}`;
2593 } 2593 }
2594 toFilePath(opt$) { 2594 toFilePath(opt$) {
(...skipping 18 matching lines...) Expand all
2613 _checkNonWindowsPathReservedCharacters(this.pathSegments, false); 2613 _checkNonWindowsPathReservedCharacters(this.pathSegments, false);
2614 let result = new StringBuffer(); 2614 let result = new StringBuffer();
2615 if (this[_isPathAbsolute]) 2615 if (this[_isPathAbsolute])
2616 result.write("/"); 2616 result.write("/");
2617 result.writeAll(this.pathSegments, "/"); 2617 result.writeAll(this.pathSegments, "/");
2618 return result.toString(); 2618 return result.toString();
2619 } 2619 }
2620 [_toWindowsFilePath]() { 2620 [_toWindowsFilePath]() {
2621 let hasDriveLetter = false; 2621 let hasDriveLetter = false;
2622 let segments = this.pathSegments; 2622 let segments = this.pathSegments;
2623 if (dart.notNull(dart.notNull(segments.length > 0) && dart.notNull(segment s.get(0).length === 2)) && dart.notNull(segments.get(0).codeUnitAt(1) === _COLON )) { 2623 if (dart.notNull(segments.length) > 0 && segments.get(0).length === 2 && s egments.get(0).codeUnitAt(1) === _COLON) {
2624 _checkWindowsDriveLetter(segments.get(0).codeUnitAt(0), false); 2624 _checkWindowsDriveLetter(segments.get(0).codeUnitAt(0), false);
2625 _checkWindowsPathReservedCharacters(segments, false, 1); 2625 _checkWindowsPathReservedCharacters(segments, false, 1);
2626 hasDriveLetter = true; 2626 hasDriveLetter = true;
2627 } else { 2627 } else {
2628 _checkWindowsPathReservedCharacters(segments, false); 2628 _checkWindowsPathReservedCharacters(segments, false);
2629 } 2629 }
2630 let result = new StringBuffer(); 2630 let result = new StringBuffer();
2631 if (dart.notNull(this[_isPathAbsolute]) && dart.notNull(!dart.notNull(hasD riveLetter))) 2631 if (dart.notNull(this[_isPathAbsolute]) && !dart.notNull(hasDriveLetter))
2632 result.write("\\"); 2632 result.write("\\");
2633 if (!dart.equals(this.host, "")) { 2633 if (!dart.equals(this.host, "")) {
2634 result.write("\\"); 2634 result.write("\\");
2635 result.write(this.host); 2635 result.write(this.host);
2636 result.write("\\"); 2636 result.write("\\");
2637 } 2637 }
2638 result.writeAll(segments, "\\"); 2638 result.writeAll(segments, "\\");
2639 if (dart.notNull(hasDriveLetter) && dart.notNull(segments.length === 1)) 2639 if (dart.notNull(hasDriveLetter) && segments.length === 1)
2640 result.write("\\"); 2640 result.write("\\");
2641 return result.toString(); 2641 return result.toString();
2642 } 2642 }
2643 get [_isPathAbsolute]() { 2643 get [_isPathAbsolute]() {
2644 if (dart.notNull(this.path === null) || dart.notNull(this.path.isEmpty)) 2644 if (dart.notNull(this.path === null) || dart.notNull(this.path.isEmpty))
2645 return false; 2645 return false;
2646 return this.path.startsWith('/'); 2646 return this.path.startsWith('/');
2647 } 2647 }
2648 [_writeAuthority](ss) { 2648 [_writeAuthority](ss) {
2649 if (this[_userInfo].isNotEmpty) { 2649 if (this[_userInfo].isNotEmpty) {
2650 ss.write(this[_userInfo]); 2650 ss.write(this[_userInfo]);
2651 ss.write("@"); 2651 ss.write("@");
2652 } 2652 }
2653 if (this[_host] !== null) 2653 if (this[_host] !== null)
2654 ss.write(this[_host]); 2654 ss.write(this[_host]);
2655 if (this[_port] !== null) { 2655 if (this[_port] !== null) {
2656 ss.write(":"); 2656 ss.write(":");
2657 ss.write(this[_port]); 2657 ss.write(this[_port]);
2658 } 2658 }
2659 } 2659 }
2660 toString() { 2660 toString() {
2661 let sb = new StringBuffer(); 2661 let sb = new StringBuffer();
2662 _addIfNonEmpty(sb, this.scheme, this.scheme, ':'); 2662 _addIfNonEmpty(sb, this.scheme, this.scheme, ':');
2663 if (dart.notNull(dart.notNull(this.hasAuthority) || dart.notNull(this.path .startsWith("//"))) || dart.notNull(dart.equals(this.scheme, "file"))) { 2663 if (dart.notNull(this.hasAuthority) || dart.notNull(this.path.startsWith(" //")) || dart.notNull(dart.equals(this.scheme, "file"))) {
2664 sb.write("//"); 2664 sb.write("//");
2665 this[_writeAuthority](sb); 2665 this[_writeAuthority](sb);
2666 } 2666 }
2667 sb.write(this.path); 2667 sb.write(this.path);
2668 if (this[_query] !== null) { 2668 if (this[_query] !== null) {
2669 sb.write("?"); 2669 sb.write("?");
2670 sb.write(this[_query]); 2670 sb.write(this[_query]);
2671 } 2671 }
2672 if (this[_fragment] !== null) { 2672 if (this[_fragment] !== null) {
2673 sb.write("#"); 2673 sb.write("#");
2674 sb.write(this[_fragment]); 2674 sb.write(this[_fragment]);
2675 } 2675 }
2676 return sb.toString(); 2676 return sb.toString();
2677 } 2677 }
2678 ['=='](other) { 2678 ['=='](other) {
2679 if (!dart.is(other, Uri)) 2679 if (!dart.is(other, Uri))
2680 return false; 2680 return false;
2681 let uri = dart.as(other, Uri); 2681 let uri = dart.as(other, Uri);
2682 return dart.notNull(dart.notNull(dart.notNull(dart.notNull(dart.notNull(da rt.notNull(dart.notNull(dart.notNull(dart.notNull(dart.equals(this.scheme, uri.s cheme)) && dart.notNull(this.hasAuthority === uri.hasAuthority)) && dart.notNull (dart.equals(this.userInfo, uri.userInfo))) && dart.notNull(dart.equals(this.hos t, uri.host))) && dart.notNull(this.port === uri.port)) && dart.notNull(dart.equ als(this.path, uri.path))) && dart.notNull(this.hasQuery === uri.hasQuery)) && d art.notNull(dart.equals(this.query, uri.query))) && dart.notNull(this.hasFragmen t === uri.hasFragment)) && dart.notNull(dart.equals(this.fragment, uri.fragment) ); 2682 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));
2683 } 2683 }
2684 get hashCode() { 2684 get hashCode() {
2685 // Function combine: (dynamic, dynamic) → int 2685 // Function combine: (dynamic, dynamic) → int
2686 function combine(part, current) { 2686 function combine(part, current) {
2687 return dart.as(dart.dbinary(dart.dbinary(dart.dbinary(current, '*', 31), '+', dart.dload(part, 'hashCode')), '&', 1073741823), int); 2687 return dart.as(dart.dbinary(dart.dbinary(dart.dbinary(current, '*', 31), '+', dart.dload(part, 'hashCode')), '&', 1073741823), int);
2688 } 2688 }
2689 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) ))))); 2689 return combine(this.scheme, combine(this.userInfo, combine(this.host, comb ine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)) )))));
2690 } 2690 }
2691 static [_addIfNonEmpty](sb, test, first, second) { 2691 static [_addIfNonEmpty](sb, test, first, second) {
2692 if (!dart.equals("", test)) { 2692 if (!dart.equals("", test)) {
(...skipping 24 matching lines...) Expand all
2717 static splitQueryString(query, opt$) { 2717 static splitQueryString(query, opt$) {
2718 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding; 2718 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2719 return dart.as(query.split("&").fold(dart.map(), (map, element) => { 2719 return dart.as(query.split("&").fold(dart.map(), (map, element) => {
2720 let index = dart.as(dart.dinvoke(element, 'indexOf', "="), int); 2720 let index = dart.as(dart.dinvoke(element, 'indexOf', "="), int);
2721 if (index === -1) { 2721 if (index === -1) {
2722 if (!dart.equals(element, "")) { 2722 if (!dart.equals(element, "")) {
2723 dart.dsetindex(map, decodeQueryComponent(dart.as(element, String), { encoding: encoding}), ""); 2723 dart.dsetindex(map, decodeQueryComponent(dart.as(element, String), { encoding: encoding}), "");
2724 } 2724 }
2725 } else if (index !== 0) { 2725 } else if (index !== 0) {
2726 let key = dart.dinvoke(element, 'substring', 0, index); 2726 let key = dart.dinvoke(element, 'substring', 0, index);
2727 let value = dart.dinvoke(element, 'substring', index + 1); 2727 let value = dart.dinvoke(element, 'substring', dart.notNull(index) + 1 );
2728 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), decodeQueryComponent(dart.as(value, String), {encoding: enco ding})); 2728 dart.dsetindex(map, Uri.decodeQueryComponent(dart.as(key, String), {en coding: encoding}), decodeQueryComponent(dart.as(value, String), {encoding: enco ding}));
2729 } 2729 }
2730 return map; 2730 return map;
2731 }), Map$(String, String)); 2731 }), Map$(String, String));
2732 } 2732 }
2733 static parseIPv4Address(host) { 2733 static parseIPv4Address(host) {
2734 // Function error: (String) → void 2734 // Function error: (String) → void
2735 function error(msg) { 2735 function error(msg) {
2736 throw new FormatException(`Illegal IPv4 address, ${msg}`); 2736 throw new FormatException(`Illegal IPv4 address, ${msg}`);
2737 } 2737 }
2738 let bytes = host.split('.'); 2738 let bytes = host.split('.');
2739 if (bytes.length !== 4) { 2739 if (bytes.length !== 4) {
2740 error('IPv4 address should contain exactly 4 parts'); 2740 error('IPv4 address should contain exactly 4 parts');
2741 } 2741 }
2742 return dart.as(bytes.map((byteString) => { 2742 return dart.as(bytes.map((byteString) => {
2743 let byte = int.parse(dart.as(byteString, String)); 2743 let byte = int.parse(dart.as(byteString, String));
2744 if (dart.notNull(byte < 0) || dart.notNull(byte > 255)) { 2744 if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
2745 error('each part must be in the range of `0..255`'); 2745 error('each part must be in the range of `0..255`');
2746 } 2746 }
2747 return byte; 2747 return byte;
2748 }).toList(), List$(int)); 2748 }).toList(), List$(int));
2749 } 2749 }
2750 static parseIPv6Address(host, start, end) { 2750 static parseIPv6Address(host, start, end) {
2751 if (start === void 0) 2751 if (start === void 0)
2752 start = 0; 2752 start = 0;
2753 if (end === void 0) 2753 if (end === void 0)
2754 end = null; 2754 end = null;
2755 if (end === null) 2755 if (end === null)
2756 end = host.length; 2756 end = host.length;
2757 // Function error: (String, [dynamic]) → void 2757 // Function error: (String, [dynamic]) → void
2758 function error(msg, position) { 2758 function error(msg, position) {
2759 if (position === void 0) 2759 if (position === void 0)
2760 position = null; 2760 position = null;
2761 throw new FormatException(`Illegal IPv6 address, ${msg}`, host, dart.as( position, int)); 2761 throw new FormatException(`Illegal IPv6 address, ${msg}`, host, dart.as( position, int));
2762 } 2762 }
2763 // Function parseHex: (int, int) → int 2763 // Function parseHex: (int, int) → int
2764 function parseHex(start, end) { 2764 function parseHex(start, end) {
2765 if (end - start > 4) { 2765 if (dart.notNull(end) - dart.notNull(start) > 4) {
2766 error('an IPv6 part can only contain a maximum of 4 hex digits', start ); 2766 error('an IPv6 part can only contain a maximum of 4 hex digits', start );
2767 } 2767 }
2768 let value = int.parse(host.substring(start, end), {radix: 16}); 2768 let value = int.parse(host.substring(start, end), {radix: 16});
2769 if (dart.notNull(value < 0) || dart.notNull(value > (1 << 16) - 1)) { 2769 if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
2770 error('each part must be in the range of `0x0..0xFFFF`', start); 2770 error('each part must be in the range of `0x0..0xFFFF`', start);
2771 } 2771 }
2772 return value; 2772 return value;
2773 } 2773 }
2774 if (host.length < 2) 2774 if (dart.notNull(host.length) < 2)
2775 error('address is too short'); 2775 error('address is too short');
2776 let parts = dart.as(new List.from([]), List$(int)); 2776 let parts = dart.as(new List.from([]), List$(int));
2777 let wildcardSeen = false; 2777 let wildcardSeen = false;
2778 let partStart = start; 2778 let partStart = start;
2779 for (let i = start; i < end; i++) { 2779 for (let i = start; dart.notNull(i) < dart.notNull(end); dart.notNull(i)++ ) {
2780 if (host.codeUnitAt(i) === _COLON) { 2780 if (host.codeUnitAt(i) === _COLON) {
2781 if (i === start) { 2781 if (i === start) {
2782 i++; 2782 dart.notNull(i)++;
2783 if (host.codeUnitAt(i) !== _COLON) { 2783 if (host.codeUnitAt(i) !== _COLON) {
2784 error('invalid start colon.', i); 2784 error('invalid start colon.', i);
2785 } 2785 }
2786 partStart = i; 2786 partStart = i;
2787 } 2787 }
2788 if (i === partStart) { 2788 if (i === partStart) {
2789 if (wildcardSeen) { 2789 if (wildcardSeen) {
2790 error('only one wildcard `::` is allowed', i); 2790 error('only one wildcard `::` is allowed', i);
2791 } 2791 }
2792 wildcardSeen = true; 2792 wildcardSeen = true;
2793 parts.add(-1); 2793 parts.add(-1);
2794 } else { 2794 } else {
2795 parts.add(parseHex(partStart, i)); 2795 parts.add(parseHex(partStart, i));
2796 } 2796 }
2797 partStart = i + 1; 2797 partStart = dart.notNull(i) + 1;
2798 } 2798 }
2799 } 2799 }
2800 if (parts.length === 0) 2800 if (parts.length === 0)
2801 error('too few parts'); 2801 error('too few parts');
2802 let atEnd = partStart === end; 2802 let atEnd = partStart === end;
2803 let isLastWildcard = parts.last === -1; 2803 let isLastWildcard = parts.last === -1;
2804 if (dart.notNull(atEnd) && dart.notNull(!dart.notNull(isLastWildcard))) { 2804 if (dart.notNull(atEnd) && !dart.notNull(isLastWildcard)) {
2805 error('expected a part after last `:`', end); 2805 error('expected a part after last `:`', end);
2806 } 2806 }
2807 if (!dart.notNull(atEnd)) { 2807 if (!dart.notNull(atEnd)) {
2808 try { 2808 try {
2809 parts.add(parseHex(partStart, end)); 2809 parts.add(parseHex(partStart, end));
2810 } catch (e) { 2810 } catch (e) {
2811 try { 2811 try {
2812 let last = parseIPv4Address(host.substring(partStart, end)); 2812 let last = parseIPv4Address(host.substring(partStart, end));
2813 parts.add(last.get(0) << 8 | last.get(1)); 2813 parts.add(dart.notNull(last.get(0)) << 8 | dart.notNull(last.get(1)) );
2814 parts.add(last.get(2) << 8 | last.get(3)); 2814 parts.add(dart.notNull(last.get(2)) << 8 | dart.notNull(last.get(3)) );
2815 } catch (e) { 2815 } catch (e) {
2816 error('invalid end of IPv6 address.', partStart); 2816 error('invalid end of IPv6 address.', partStart);
2817 } 2817 }
2818 2818
2819 } 2819 }
2820 2820
2821 } 2821 }
2822 if (wildcardSeen) { 2822 if (wildcardSeen) {
2823 if (parts.length > 7) { 2823 if (dart.notNull(parts.length) > 7) {
2824 error('an address with a wildcard must have less than 7 parts'); 2824 error('an address with a wildcard must have less than 7 parts');
2825 } 2825 }
2826 } else if (parts.length !== 8) { 2826 } else if (parts.length !== 8) {
2827 error('an address without a wildcard must contain exactly 8 parts'); 2827 error('an address without a wildcard must contain exactly 8 parts');
2828 } 2828 }
2829 let bytes = new List(16); 2829 let bytes = new List(16);
2830 for (let i = 0, index = 0; i < parts.length; i++) { 2830 for (let i = 0, index = 0; dart.notNull(i) < dart.notNull(parts.length); d art.notNull(i)++) {
2831 let value = parts.get(i); 2831 let value = parts.get(i);
2832 if (value === -1) { 2832 if (value === -1) {
2833 let wildCardLength = 9 - parts.length; 2833 let wildCardLength = 9 - dart.notNull(parts.length);
2834 for (let j = 0; j < wildCardLength; j++) { 2834 for (let j = 0; dart.notNull(j) < dart.notNull(wildCardLength); dart.n otNull(j)++) {
2835 bytes.set(index, 0); 2835 bytes.set(index, 0);
2836 bytes.set(index + 1, 0); 2836 bytes.set(dart.notNull(index) + 1, 0);
2837 index = 2; 2837 index = 2;
2838 } 2838 }
2839 } else { 2839 } else {
2840 bytes.set(index, value >> 8); 2840 bytes.set(index, dart.notNull(value) >> 8);
2841 bytes.set(index + 1, value & 255); 2841 bytes.set(dart.notNull(index) + 1, dart.notNull(value) & 255);
2842 index = 2; 2842 index = 2;
2843 } 2843 }
2844 } 2844 }
2845 return dart.as(bytes, List$(int)); 2845 return dart.as(bytes, List$(int));
2846 } 2846 }
2847 static [_uriEncode](canonicalTable, text, opt$) { 2847 static [_uriEncode](canonicalTable, text, opt$) {
2848 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding; 2848 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2849 let spaceToPlus = opt$.spaceToPlus === void 0 ? false : opt$.spaceToPlus; 2849 let spaceToPlus = opt$.spaceToPlus === void 0 ? false : opt$.spaceToPlus;
2850 // Function byteToHex: (dynamic, dynamic) → dynamic 2850 // Function byteToHex: (dynamic, dynamic) → dynamic
2851 function byteToHex(byte, buffer) { 2851 function byteToHex(byte, buffer) {
2852 let hex = '0123456789ABCDEF'; 2852 let hex = '0123456789ABCDEF';
2853 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '>>', 4), int))); 2853 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '>>', 4), int)));
2854 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '&', 15), int))); 2854 dart.dinvoke(buffer, 'writeCharCode', hex.codeUnitAt(dart.as(dart.dbinar y(byte, '&', 15), int)));
2855 } 2855 }
2856 let result = new StringBuffer(); 2856 let result = new StringBuffer();
2857 let bytes = encoding.encode(text); 2857 let bytes = encoding.encode(text);
2858 for (let i = 0; i < bytes.length; i++) { 2858 for (let i = 0; dart.notNull(i) < dart.notNull(bytes.length); dart.notNull (i)++) {
2859 let byte = bytes.get(i); 2859 let byte = bytes.get(i);
2860 if (dart.notNull(byte < 128) && dart.notNull((canonicalTable.get(byte >> 4) & 1 << (byte & 15)) !== 0)) { 2860 if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable.get(dart.no tNull(byte) >> 4)) & 1 << (dart.notNull(byte) & 15)) !== 0) {
2861 result.writeCharCode(byte); 2861 result.writeCharCode(byte);
2862 } else if (dart.notNull(spaceToPlus) && dart.notNull(byte === _SPACE)) { 2862 } else if (dart.notNull(spaceToPlus) && byte === _SPACE) {
2863 result.writeCharCode(_PLUS); 2863 result.writeCharCode(_PLUS);
2864 } else { 2864 } else {
2865 result.writeCharCode(_PERCENT); 2865 result.writeCharCode(_PERCENT);
2866 byteToHex(byte, result); 2866 byteToHex(byte, result);
2867 } 2867 }
2868 } 2868 }
2869 return result.toString(); 2869 return result.toString();
2870 } 2870 }
2871 static [_hexCharPairToByte](s, pos) { 2871 static [_hexCharPairToByte](s, pos) {
2872 let byte = 0; 2872 let byte = 0;
2873 for (let i = 0; i < 2; i++) { 2873 for (let i = 0; dart.notNull(i) < 2; dart.notNull(i)++) {
2874 let charCode = s.codeUnitAt(pos + i); 2874 let charCode = s.codeUnitAt(dart.notNull(pos) + dart.notNull(i));
2875 if (dart.notNull(48 <= charCode) && dart.notNull(charCode <= 57)) { 2875 if (48 <= dart.notNull(charCode) && dart.notNull(charCode) <= 57) {
2876 byte = byte * 16 + charCode - 48; 2876 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 48;
2877 } else { 2877 } else {
2878 charCode = 32; 2878 charCode = 32;
2879 if (dart.notNull(97 <= charCode) && dart.notNull(charCode <= 102)) { 2879 if (97 <= dart.notNull(charCode) && dart.notNull(charCode) <= 102) {
2880 byte = byte * 16 + charCode - 87; 2880 byte = dart.notNull(byte) * 16 + dart.notNull(charCode) - 87;
2881 } else { 2881 } else {
2882 throw new ArgumentError("Invalid URL encoding"); 2882 throw new ArgumentError("Invalid URL encoding");
2883 } 2883 }
2884 } 2884 }
2885 } 2885 }
2886 return byte; 2886 return byte;
2887 } 2887 }
2888 static [_uriDecode](text, opt$) { 2888 static [_uriDecode](text, opt$) {
2889 let plusToSpace = opt$.plusToSpace === void 0 ? false : opt$.plusToSpace; 2889 let plusToSpace = opt$.plusToSpace === void 0 ? false : opt$.plusToSpace;
2890 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding; 2890 let encoding = opt$.encoding === void 0 ? convert.UTF8 : opt$.encoding;
2891 let simple = true; 2891 let simple = true;
2892 for (let i = 0; dart.notNull(i < text.length) && dart.notNull(simple); i++ ) { 2892 for (let i = 0; dart.notNull(i) < dart.notNull(text.length) && dart.notNul l(simple); dart.notNull(i)++) {
2893 let codeUnit = text.codeUnitAt(i); 2893 let codeUnit = text.codeUnitAt(i);
2894 simple = dart.notNull(codeUnit !== _PERCENT) && dart.notNull(codeUnit != = _PLUS); 2894 simple = codeUnit !== _PERCENT && codeUnit !== _PLUS;
2895 } 2895 }
2896 let bytes = null; 2896 let bytes = null;
2897 if (simple) { 2897 if (simple) {
2898 if (dart.notNull(dart.equals(encoding, convert.UTF8)) || dart.notNull(da rt.equals(encoding, convert.LATIN1))) { 2898 if (dart.notNull(dart.equals(encoding, convert.UTF8)) || dart.notNull(da rt.equals(encoding, convert.LATIN1))) {
2899 return text; 2899 return text;
2900 } else { 2900 } else {
2901 bytes = text.codeUnits; 2901 bytes = text.codeUnits;
2902 } 2902 }
2903 } else { 2903 } else {
2904 bytes = dart.as(new List(), List$(int)); 2904 bytes = dart.as(new List(), List$(int));
2905 for (let i = 0; i < text.length; i++) { 2905 for (let i = 0; dart.notNull(i) < dart.notNull(text.length); dart.notNul l(i)++) {
2906 let codeUnit = text.codeUnitAt(i); 2906 let codeUnit = text.codeUnitAt(i);
2907 if (codeUnit > 127) { 2907 if (dart.notNull(codeUnit) > 127) {
2908 throw new ArgumentError("Illegal percent encoding in URI"); 2908 throw new ArgumentError("Illegal percent encoding in URI");
2909 } 2909 }
2910 if (codeUnit === _PERCENT) { 2910 if (codeUnit === _PERCENT) {
2911 if (i + 3 > text.length) { 2911 if (dart.notNull(i) + 3 > dart.notNull(text.length)) {
2912 throw new ArgumentError('Truncated URI'); 2912 throw new ArgumentError('Truncated URI');
2913 } 2913 }
2914 bytes.add(_hexCharPairToByte(text, i + 1)); 2914 bytes.add(_hexCharPairToByte(text, dart.notNull(i) + 1));
2915 i = 2; 2915 i = 2;
2916 } else if (dart.notNull(plusToSpace) && dart.notNull(codeUnit === _PLU S)) { 2916 } else if (dart.notNull(plusToSpace) && codeUnit === _PLUS) {
2917 bytes.add(_SPACE); 2917 bytes.add(_SPACE);
2918 } else { 2918 } else {
2919 bytes.add(codeUnit); 2919 bytes.add(codeUnit);
2920 } 2920 }
2921 } 2921 }
2922 } 2922 }
2923 return encoding.decode(bytes); 2923 return encoding.decode(bytes);
2924 } 2924 }
2925 static [_isAlphabeticCharacter](codeUnit) { 2925 static [_isAlphabeticCharacter](codeUnit) {
2926 return dart.notNull(dart.notNull(codeUnit >= _LOWER_CASE_A) && dart.notNul l(codeUnit <= _LOWER_CASE_Z)) || dart.notNull(dart.notNull(codeUnit >= _UPPER_CA SE_A) && dart.notNull(codeUnit <= _UPPER_CASE_Z)); 2926 return dart.notNull(codeUnit) >= dart.notNull(_LOWER_CASE_A) && dart.notNu ll(codeUnit) <= dart.notNull(_LOWER_CASE_Z) || dart.notNull(codeUnit) >= dart.no tNull(_UPPER_CASE_A) && dart.notNull(codeUnit) <= dart.notNull(_UPPER_CASE_Z);
2927 } 2927 }
2928 } 2928 }
2929 dart.defineNamedConstructor(Uri, '_internal'); 2929 dart.defineNamedConstructor(Uri, '_internal');
2930 dart.defineNamedConstructor(Uri, 'http'); 2930 dart.defineNamedConstructor(Uri, 'http');
2931 dart.defineNamedConstructor(Uri, 'https'); 2931 dart.defineNamedConstructor(Uri, 'https');
2932 dart.defineNamedConstructor(Uri, 'file'); 2932 dart.defineNamedConstructor(Uri, 'file');
2933 Uri._SPACE = 32; 2933 Uri._SPACE = 32;
2934 Uri._DOUBLE_QUOTE = 34; 2934 Uri._DOUBLE_QUOTE = 34;
2935 Uri._NUMBER_SIGN = 35; 2935 Uri._NUMBER_SIGN = 35;
2936 Uri._PERCENT = 37; 2936 Uri._PERCENT = 37;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 exports.Stopwatch = Stopwatch; 3031 exports.Stopwatch = Stopwatch;
3032 exports.String = String; 3032 exports.String = String;
3033 exports.Runes = Runes; 3033 exports.Runes = Runes;
3034 exports.RuneIterator = RuneIterator; 3034 exports.RuneIterator = RuneIterator;
3035 exports.StringBuffer = StringBuffer; 3035 exports.StringBuffer = StringBuffer;
3036 exports.StringSink = StringSink; 3036 exports.StringSink = StringSink;
3037 exports.Symbol = Symbol; 3037 exports.Symbol = Symbol;
3038 exports.Type = Type; 3038 exports.Type = Type;
3039 exports.Uri = Uri; 3039 exports.Uri = Uri;
3040 })(core || (core = {})); 3040 })(core || (core = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698