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

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

Issue 1233553005: Fixes #254 - Better stacktrace support (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: format fix Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/_operations.js ('k') | lib/runtime/dart/_internal.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/_interceptors', null, /* Imports */[ 1 dart_library.library('dart/_interceptors', null, /* Imports */[
2 "dart_runtime/dart", 2 "dart_runtime/dart",
3 'dart/core', 3 'dart/core',
4 'dart/_internal', 4 'dart/_internal',
5 'dart/collection', 5 'dart/collection',
6 'dart/math' 6 'dart/math'
7 ], /* Lazy imports */[ 7 ], /* Lazy imports */[
8 'dart/_js_helper' 8 'dart/_js_helper'
9 ], function(exports, dart, core, _internal, collection, math, _js_helper) { 9 ], function(exports, dart, core, _internal, collection, math, _js_helper) {
10 'use strict'; 10 'use strict';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 static markGrowable(allocation) { 80 static markGrowable(allocation) {
81 return JSArray$().typed(allocation); 81 return JSArray$().typed(allocation);
82 } 82 }
83 static markFixedList(list) { 83 static markFixedList(list) {
84 list.fixed$length = Array; 84 list.fixed$length = Array;
85 return list; 85 return list;
86 } 86 }
87 [dartx.checkGrowable](reason) { 87 [dartx.checkGrowable](reason) {
88 if (this.fixed$length) { 88 if (this.fixed$length) {
89 throw new core.UnsupportedError(dart.as(reason, core.String)); 89 dart.throw(new core.UnsupportedError(dart.as(reason, core.String)));
90 } 90 }
91 } 91 }
92 [dartx.add](value) { 92 [dartx.add](value) {
93 dart.as(value, E); 93 dart.as(value, E);
94 this[dartx.checkGrowable]('add'); 94 this[dartx.checkGrowable]('add');
95 this.push(value); 95 this.push(value);
96 } 96 }
97 [dartx.removeAt](index) { 97 [dartx.removeAt](index) {
98 if (!(typeof index == 'number')) 98 if (!(typeof index == 'number'))
99 throw new core.ArgumentError(index); 99 dart.throw(new core.ArgumentError(index));
100 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[ dartx.length])) { 100 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this[ dartx.length])) {
101 throw new core.RangeError.value(index); 101 dart.throw(new core.RangeError.value(index));
102 } 102 }
103 this[dartx.checkGrowable]('removeAt'); 103 this[dartx.checkGrowable]('removeAt');
104 return this.splice(index, 1)[0]; 104 return this.splice(index, 1)[0];
105 } 105 }
106 [dartx.insert](index, value) { 106 [dartx.insert](index, value) {
107 dart.as(value, E); 107 dart.as(value, E);
108 if (!(typeof index == 'number')) 108 if (!(typeof index == 'number'))
109 throw new core.ArgumentError(index); 109 dart.throw(new core.ArgumentError(index));
110 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[d artx.length])) { 110 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[d artx.length])) {
111 throw new core.RangeError.value(index); 111 dart.throw(new core.RangeError.value(index));
112 } 112 }
113 this[dartx.checkGrowable]('insert'); 113 this[dartx.checkGrowable]('insert');
114 this.splice(index, 0, value); 114 this.splice(index, 0, value);
115 } 115 }
116 [dartx.insertAll](index, iterable) { 116 [dartx.insertAll](index, iterable) {
117 dart.as(iterable, core.Iterable$(E)); 117 dart.as(iterable, core.Iterable$(E));
118 this[dartx.checkGrowable]('insertAll'); 118 this[dartx.checkGrowable]('insertAll');
119 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); 119 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable);
120 } 120 }
121 [dartx.setAll](index, iterable) { 121 [dartx.setAll](index, iterable) {
122 dart.as(iterable, core.Iterable$(E)); 122 dart.as(iterable, core.Iterable$(E));
123 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); 123 _internal.IterableMixinWorkaround.setAllList(this, index, iterable);
124 } 124 }
125 [dartx.removeLast]() { 125 [dartx.removeLast]() {
126 this[dartx.checkGrowable]('removeLast'); 126 this[dartx.checkGrowable]('removeLast');
127 if (this[dartx.length] == 0) 127 if (this[dartx.length] == 0)
128 throw new core.RangeError.value(-1); 128 dart.throw(new core.RangeError.value(-1));
129 return dart.as(this.pop(), E); 129 return dart.as(this.pop(), E);
130 } 130 }
131 [dartx.remove](element) { 131 [dartx.remove](element) {
132 this[dartx.checkGrowable]('remove'); 132 this[dartx.checkGrowable]('remove');
133 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { 133 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) {
134 if (dart.equals(this[dartx.get](i), element)) { 134 if (dart.equals(this[dartx.get](i), element)) {
135 this.splice(i, 1); 135 this.splice(i, 1);
136 return true; 136 return true;
137 } 137 }
138 } 138 }
(...skipping 23 matching lines...) Expand all
162 } 162 }
163 [dartx.clear]() { 163 [dartx.clear]() {
164 this[dartx.length] = 0; 164 this[dartx.length] = 0;
165 } 165 }
166 [dartx.forEach](f) { 166 [dartx.forEach](f) {
167 dart.as(f, dart.functionType(dart.void, [E])); 167 dart.as(f, dart.functionType(dart.void, [E]));
168 let length = this[dartx.length]; 168 let length = this[dartx.length];
169 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 169 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
170 f(dart.as(this[i], E)); 170 f(dart.as(this[i], E));
171 if (length != this[dartx.length]) { 171 if (length != this[dartx.length]) {
172 throw new core.ConcurrentModificationError(this); 172 dart.throw(new core.ConcurrentModificationError(this));
173 } 173 }
174 } 174 }
175 } 175 }
176 [dartx.map](f) { 176 [dartx.map](f) {
177 dart.as(f, dart.functionType(dart.dynamic, [E])); 177 dart.as(f, dart.functionType(dart.dynamic, [E]));
178 return _internal.IterableMixinWorkaround.mapList(this, f); 178 return _internal.IterableMixinWorkaround.mapList(this, f);
179 } 179 }
180 [dartx.join](separator) { 180 [dartx.join](separator) {
181 if (separator === void 0) 181 if (separator === void 0)
182 separator = ""; 182 separator = "";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 return dart.as(_internal.IterableMixinWorkaround.singleWhere(this, test) , E); 225 return dart.as(_internal.IterableMixinWorkaround.singleWhere(this, test) , E);
226 } 226 }
227 [dartx.elementAt](index) { 227 [dartx.elementAt](index) {
228 return this[dartx.get](index); 228 return this[dartx.get](index);
229 } 229 }
230 [dartx.sublist](start, end) { 230 [dartx.sublist](start, end) {
231 if (end === void 0) 231 if (end === void 0)
232 end = null; 232 end = null;
233 _js_helper.checkNull(start); 233 _js_helper.checkNull(start);
234 if (!(typeof start == 'number')) 234 if (!(typeof start == 'number'))
235 throw new core.ArgumentError(start); 235 dart.throw(new core.ArgumentError(start));
236 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[d artx.length])) { 236 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[d artx.length])) {
237 throw new core.RangeError.range(start, 0, this[dartx.length]); 237 dart.throw(new core.RangeError.range(start, 0, this[dartx.length]));
238 } 238 }
239 if (end == null) { 239 if (end == null) {
240 end = this[dartx.length]; 240 end = this[dartx.length];
241 } else { 241 } else {
242 if (!(typeof end == 'number')) 242 if (!(typeof end == 'number'))
243 throw new core.ArgumentError(end); 243 dart.throw(new core.ArgumentError(end));
244 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar t.notNull(this[dartx.length])) { 244 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar t.notNull(this[dartx.length])) {
245 throw new core.RangeError.range(end, start, this[dartx.length]); 245 dart.throw(new core.RangeError.range(end, start, this[dartx.length]) );
246 } 246 }
247 } 247 }
248 if (start == end) 248 if (start == end)
249 return dart.list([], E); 249 return dart.list([], E);
250 return JSArray$(E).typed(this.slice(start, end)); 250 return JSArray$(E).typed(this.slice(start, end));
251 } 251 }
252 [dartx.getRange](start, end) { 252 [dartx.getRange](start, end) {
253 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this, start, end); 253 return new (_internal.IterableMixinWorkaround$(E))().getRangeList(this, start, end);
254 } 254 }
255 get [dartx.first]() { 255 get [dartx.first]() {
256 if (dart.notNull(this[dartx.length]) > 0) 256 if (dart.notNull(this[dartx.length]) > 0)
257 return this[dartx.get](0); 257 return this[dartx.get](0);
258 throw new core.StateError("No elements"); 258 dart.throw(new core.StateError("No elements"));
259 } 259 }
260 get [dartx.last]() { 260 get [dartx.last]() {
261 if (dart.notNull(this[dartx.length]) > 0) 261 if (dart.notNull(this[dartx.length]) > 0)
262 return this[dartx.get](dart.notNull(this[dartx.length]) - 1); 262 return this[dartx.get](dart.notNull(this[dartx.length]) - 1);
263 throw new core.StateError("No elements"); 263 dart.throw(new core.StateError("No elements"));
264 } 264 }
265 get [dartx.single]() { 265 get [dartx.single]() {
266 if (this[dartx.length] == 1) 266 if (this[dartx.length] == 1)
267 return this[dartx.get](0); 267 return this[dartx.get](0);
268 if (this[dartx.length] == 0) 268 if (this[dartx.length] == 0)
269 throw new core.StateError("No elements"); 269 dart.throw(new core.StateError("No elements"));
270 throw new core.StateError("More than one element"); 270 dart.throw(new core.StateError("More than one element"));
271 } 271 }
272 [dartx.removeRange](start, end) { 272 [dartx.removeRange](start, end) {
273 this[dartx.checkGrowable]('removeRange'); 273 this[dartx.checkGrowable]('removeRange');
274 let receiverLength = this[dartx.length]; 274 let receiverLength = this[dartx.length];
275 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv erLength)) { 275 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv erLength)) {
276 throw new core.RangeError.range(start, 0, receiverLength); 276 dart.throw(new core.RangeError.range(start, 0, receiverLength));
277 } 277 }
278 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart. notNull(receiverLength)) { 278 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart. notNull(receiverLength)) {
279 throw new core.RangeError.range(end, start, receiverLength); 279 dart.throw(new core.RangeError.range(end, start, receiverLength));
280 } 280 }
281 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength ) - dart.notNull(end)); 281 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength ) - dart.notNull(end));
282 this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) - dart.notNull(start)); 282 this[dartx.length] = dart.notNull(receiverLength) - (dart.notNull(end) - dart.notNull(start));
283 } 283 }
284 [dartx.setRange](start, end, iterable, skipCount) { 284 [dartx.setRange](start, end, iterable, skipCount) {
285 dart.as(iterable, core.Iterable$(E)); 285 dart.as(iterable, core.Iterable$(E));
286 if (skipCount === void 0) 286 if (skipCount === void 0)
287 skipCount = 0; 287 skipCount = 0;
288 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl e, skipCount); 288 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl e, skipCount);
289 } 289 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 return new (_internal.ListIterator$(E))(this); 359 return new (_internal.ListIterator$(E))(this);
360 } 360 }
361 get hashCode() { 361 get hashCode() {
362 return _js_helper.Primitives.objectHashCode(this); 362 return _js_helper.Primitives.objectHashCode(this);
363 } 363 }
364 get [dartx.length]() { 364 get [dartx.length]() {
365 return dart.as(this.length, core.int); 365 return dart.as(this.length, core.int);
366 } 366 }
367 set [dartx.length](newLength) { 367 set [dartx.length](newLength) {
368 if (!(typeof newLength == 'number')) 368 if (!(typeof newLength == 'number'))
369 throw new core.ArgumentError(newLength); 369 dart.throw(new core.ArgumentError(newLength));
370 if (dart.notNull(newLength) < 0) 370 if (dart.notNull(newLength) < 0)
371 throw new core.RangeError.value(newLength); 371 dart.throw(new core.RangeError.value(newLength));
372 this[dartx.checkGrowable]('set length'); 372 this[dartx.checkGrowable]('set length');
373 this.length = newLength; 373 this.length = newLength;
374 } 374 }
375 [dartx.get](index) { 375 [dartx.get](index) {
376 if (!(typeof index == 'number')) 376 if (!(typeof index == 'number'))
377 throw new core.ArgumentError(index); 377 dart.throw(new core.ArgumentError(index));
378 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN ull(index) < 0) 378 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN ull(index) < 0)
379 throw new core.RangeError.value(index); 379 dart.throw(new core.RangeError.value(index));
380 return dart.as(this[index], E); 380 return dart.as(this[index], E);
381 } 381 }
382 [dartx.set](index, value) { 382 [dartx.set](index, value) {
383 dart.as(value, E); 383 dart.as(value, E);
384 if (!(typeof index == 'number')) 384 if (!(typeof index == 'number'))
385 throw new core.ArgumentError(index); 385 dart.throw(new core.ArgumentError(index));
386 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN ull(index) < 0) 386 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notN ull(index) < 0)
387 throw new core.RangeError.value(index); 387 dart.throw(new core.RangeError.value(index));
388 this[index] = value; 388 this[index] = value;
389 } 389 }
390 [dartx.asMap]() { 390 [dartx.asMap]() {
391 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this); 391 return new (_internal.IterableMixinWorkaround$(E))().asMapList(this);
392 } 392 }
393 } 393 }
394 dart.setBaseClass(JSArray, dart.global.Array); 394 dart.setBaseClass(JSArray, dart.global.Array);
395 JSArray[dart.implements] = () => [core.List$(E), JSIndexable]; 395 JSArray[dart.implements] = () => [core.List$(E), JSIndexable];
396 dart.setSignature(JSArray, { 396 dart.setSignature(JSArray, {
397 constructors: () => ({ 397 constructors: () => ({
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 '<=', 532 '<=',
533 '>=', 533 '>=',
534 'runtimeType' 534 'runtimeType'
535 ]); 535 ]);
536 class JSNumber extends Interceptor { 536 class JSNumber extends Interceptor {
537 JSNumber() { 537 JSNumber() {
538 super.Interceptor(); 538 super.Interceptor();
539 } 539 }
540 [dartx.compareTo](b) { 540 [dartx.compareTo](b) {
541 if (!dart.is(b, core.num)) 541 if (!dart.is(b, core.num))
542 throw new core.ArgumentError(b); 542 dart.throw(new core.ArgumentError(b));
543 if (dart.notNull(this[dartx['<']](b))) { 543 if (dart.notNull(this[dartx['<']](b))) {
544 return -1; 544 return -1;
545 } else if (dart.notNull(this[dartx['>']](b))) { 545 } else if (dart.notNull(this[dartx['>']](b))) {
546 return 1; 546 return 1;
547 } else if (dart.equals(this, b)) { 547 } else if (dart.equals(this, b)) {
548 if (dart.equals(this, 0)) { 548 if (dart.equals(this, 0)) {
549 let bIsNegative = b[dartx.isNegative]; 549 let bIsNegative = b[dartx.isNegative];
550 if (this[dartx.isNegative] == bIsNegative) 550 if (this[dartx.isNegative] == bIsNegative)
551 return 0; 551 return 0;
552 if (dart.notNull(this[dartx.isNegative])) 552 if (dart.notNull(this[dartx.isNegative]))
(...skipping 18 matching lines...) Expand all
571 } 571 }
572 get [dartx.isInfinite]() { 572 get [dartx.isInfinite]() {
573 return this == Infinity || this == -Infinity; 573 return this == Infinity || this == -Infinity;
574 } 574 }
575 get [dartx.isFinite]() { 575 get [dartx.isFinite]() {
576 return isFinite(this); 576 return isFinite(this);
577 } 577 }
578 [dartx.remainder](b) { 578 [dartx.remainder](b) {
579 _js_helper.checkNull(b); 579 _js_helper.checkNull(b);
580 if (!dart.is(b, core.num)) 580 if (!dart.is(b, core.num))
581 throw new core.ArgumentError(b); 581 dart.throw(new core.ArgumentError(b));
582 return this % b; 582 return this % b;
583 } 583 }
584 [dartx.abs]() { 584 [dartx.abs]() {
585 return Math.abs(this); 585 return Math.abs(this);
586 } 586 }
587 get [dartx.sign]() { 587 get [dartx.sign]() {
588 return dart.notNull(this[dartx['>']](0)) ? 1 : dart.notNull(this[dartx['<' ]](0)) ? -1 : this; 588 return dart.notNull(this[dartx['>']](0)) ? 1 : dart.notNull(this[dartx['<' ]](0)) ? -1 : this;
589 } 589 }
590 [dartx.toInt]() { 590 [dartx.toInt]() {
591 if (dart.notNull(this[dartx['>=']](JSNumber._MIN_INT32)) && dart.notNull(t his[dartx['<=']](JSNumber._MAX_INT32))) { 591 if (dart.notNull(this[dartx['>=']](JSNumber._MIN_INT32)) && dart.notNull(t his[dartx['<=']](JSNumber._MAX_INT32))) {
592 return this | 0; 592 return this | 0;
593 } 593 }
594 if (isFinite(this)) { 594 if (isFinite(this)) {
595 return this[dartx.truncateToDouble]() + 0; 595 return this[dartx.truncateToDouble]() + 0;
596 } 596 }
597 throw new core.UnsupportedError('' + this); 597 dart.throw(new core.UnsupportedError('' + this));
598 } 598 }
599 [dartx.truncate]() { 599 [dartx.truncate]() {
600 return this[dartx.toInt](); 600 return this[dartx.toInt]();
601 } 601 }
602 [dartx.ceil]() { 602 [dartx.ceil]() {
603 return this[dartx.ceilToDouble]()[dartx.toInt](); 603 return this[dartx.ceilToDouble]()[dartx.toInt]();
604 } 604 }
605 [dartx.floor]() { 605 [dartx.floor]() {
606 return this[dartx.floorToDouble]()[dartx.toInt](); 606 return this[dartx.floorToDouble]()[dartx.toInt]();
607 } 607 }
(...skipping 11 matching lines...) Expand all
619 return -Math.round(-this); 619 return -Math.round(-this);
620 } else { 620 } else {
621 return Math.round(this); 621 return Math.round(this);
622 } 622 }
623 } 623 }
624 [dartx.truncateToDouble]() { 624 [dartx.truncateToDouble]() {
625 return dart.notNull(this[dartx['<']](0)) ? this[dartx.ceilToDouble]() : th is[dartx.floorToDouble](); 625 return dart.notNull(this[dartx['<']](0)) ? this[dartx.ceilToDouble]() : th is[dartx.floorToDouble]();
626 } 626 }
627 [dartx.clamp](lowerLimit, upperLimit) { 627 [dartx.clamp](lowerLimit, upperLimit) {
628 if (!dart.is(lowerLimit, core.num)) 628 if (!dart.is(lowerLimit, core.num))
629 throw new core.ArgumentError(lowerLimit); 629 dart.throw(new core.ArgumentError(lowerLimit));
630 if (!dart.is(upperLimit, core.num)) 630 if (!dart.is(upperLimit, core.num))
631 throw new core.ArgumentError(upperLimit); 631 dart.throw(new core.ArgumentError(upperLimit));
632 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) { 632 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) {
633 throw new core.ArgumentError(lowerLimit); 633 dart.throw(new core.ArgumentError(lowerLimit));
634 } 634 }
635 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0) 635 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0)
636 return lowerLimit; 636 return lowerLimit;
637 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0) 637 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0)
638 return upperLimit; 638 return upperLimit;
639 return this; 639 return this;
640 } 640 }
641 [dartx.toDouble]() { 641 [dartx.toDouble]() {
642 return this; 642 return this;
643 } 643 }
644 [dartx.toStringAsFixed](fractionDigits) { 644 [dartx.toStringAsFixed](fractionDigits) {
645 _js_helper.checkInt(fractionDigits); 645 _js_helper.checkInt(fractionDigits);
646 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20) { 646 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20) {
647 throw new core.RangeError(fractionDigits); 647 dart.throw(new core.RangeError(fractionDigits));
648 } 648 }
649 let result = this.toFixed(fractionDigits); 649 let result = this.toFixed(fractionDigits);
650 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) 650 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative]))
651 return `-${result}`; 651 return `-${result}`;
652 return result; 652 return result;
653 } 653 }
654 [dartx.toStringAsExponential](fractionDigits) { 654 [dartx.toStringAsExponential](fractionDigits) {
655 if (fractionDigits === void 0) 655 if (fractionDigits === void 0)
656 fractionDigits = null; 656 fractionDigits = null;
657 let result = null; 657 let result = null;
658 if (fractionDigits != null) { 658 if (fractionDigits != null) {
659 _js_helper.checkInt(fractionDigits); 659 _js_helper.checkInt(fractionDigits);
660 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2 0) { 660 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2 0) {
661 throw new core.RangeError(fractionDigits); 661 dart.throw(new core.RangeError(fractionDigits));
662 } 662 }
663 result = this.toExponential(fractionDigits); 663 result = this.toExponential(fractionDigits);
664 } else { 664 } else {
665 result = this.toExponential(); 665 result = this.toExponential();
666 } 666 }
667 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) 667 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative]))
668 return `-${result}`; 668 return `-${result}`;
669 return result; 669 return result;
670 } 670 }
671 [dartx.toStringAsPrecision](precision) { 671 [dartx.toStringAsPrecision](precision) {
672 _js_helper.checkInt(precision); 672 _js_helper.checkInt(precision);
673 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { 673 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) {
674 throw new core.RangeError(precision); 674 dart.throw(new core.RangeError(precision));
675 } 675 }
676 let result = this.toPrecision(precision); 676 let result = this.toPrecision(precision);
677 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) 677 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative]))
678 return `-${result}`; 678 return `-${result}`;
679 return result; 679 return result;
680 } 680 }
681 [dartx.toRadixString](radix) { 681 [dartx.toRadixString](radix) {
682 _js_helper.checkInt(radix); 682 _js_helper.checkInt(radix);
683 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) 683 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36)
684 throw new core.RangeError(radix); 684 dart.throw(new core.RangeError(radix));
685 let result = this.toString(radix); 685 let result = this.toString(radix);
686 let rightParenCode = 41; 686 let rightParenCode = 41;
687 if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != ri ghtParenCode) { 687 if (result[dartx.codeUnitAt](dart.notNull(result[dartx.length]) - 1) != ri ghtParenCode) {
688 return result; 688 return result;
689 } 689 }
690 return JSNumber._handleIEtoString(result); 690 return JSNumber._handleIEtoString(result);
691 } 691 }
692 static _handleIEtoString(result) { 692 static _handleIEtoString(result) {
693 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); 693 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result);
694 if (match == null) { 694 if (match == null) {
695 throw new core.UnsupportedError(`Unexpected toString result: ${result}`) ; 695 dart.throw(new core.UnsupportedError(`Unexpected toString result: ${resu lt}`));
696 } 696 }
697 result = dart.dindex(match, 1); 697 result = dart.dindex(match, 1);
698 let exponent = +dart.dindex(match, 3); 698 let exponent = +dart.dindex(match, 3);
699 if (dart.dindex(match, 2) != null) { 699 if (dart.dindex(match, 2) != null) {
700 result = result + dart.dindex(match, 2); 700 result = result + dart.dindex(match, 2);
701 exponent = dart.notNull(exponent) - dart.dindex(match, 2).length; 701 exponent = dart.notNull(exponent) - dart.dindex(match, 2).length;
702 } 702 }
703 return dart.notNull(result) + "0"[dartx['*']](exponent); 703 return dart.notNull(result) + "0"[dartx['*']](exponent);
704 } 704 }
705 toString() { 705 toString() {
706 if (dart.equals(this, 0) && 1 / this < 0) { 706 if (dart.equals(this, 0) && 1 / this < 0) {
707 return '-0.0'; 707 return '-0.0';
708 } else { 708 } else {
709 return "" + this; 709 return "" + this;
710 } 710 }
711 } 711 }
712 get hashCode() { 712 get hashCode() {
713 return this & 0x1FFFFFFF; 713 return this & 0x1FFFFFFF;
714 } 714 }
715 [dartx['unary-']]() { 715 [dartx['unary-']]() {
716 return -this; 716 return -this;
717 } 717 }
718 [dartx['+']](other) { 718 [dartx['+']](other) {
719 if (!dart.is(other, core.num)) 719 if (!dart.is(other, core.num))
720 throw new core.ArgumentError(other); 720 dart.throw(new core.ArgumentError(other));
721 return this + other; 721 return this + other;
722 } 722 }
723 [dartx['-']](other) { 723 [dartx['-']](other) {
724 if (!dart.is(other, core.num)) 724 if (!dart.is(other, core.num))
725 throw new core.ArgumentError(other); 725 dart.throw(new core.ArgumentError(other));
726 return this - other; 726 return this - other;
727 } 727 }
728 [dartx['/']](other) { 728 [dartx['/']](other) {
729 if (!dart.is(other, core.num)) 729 if (!dart.is(other, core.num))
730 throw new core.ArgumentError(other); 730 dart.throw(new core.ArgumentError(other));
731 return this / other; 731 return this / other;
732 } 732 }
733 [dartx['*']](other) { 733 [dartx['*']](other) {
734 if (!dart.is(other, core.num)) 734 if (!dart.is(other, core.num))
735 throw new core.ArgumentError(other); 735 dart.throw(new core.ArgumentError(other));
736 return this * other; 736 return this * other;
737 } 737 }
738 [dartx['%']](other) { 738 [dartx['%']](other) {
739 if (!dart.is(other, core.num)) 739 if (!dart.is(other, core.num))
740 throw new core.ArgumentError(other); 740 dart.throw(new core.ArgumentError(other));
741 let result = this % other; 741 let result = this % other;
742 if (result == 0) 742 if (result == 0)
743 return 0; 743 return 0;
744 if (dart.notNull(result) > 0) 744 if (dart.notNull(result) > 0)
745 return result; 745 return result;
746 if (other < 0) { 746 if (other < 0) {
747 return dart.notNull(result) - other; 747 return dart.notNull(result) - other;
748 } else { 748 } else {
749 return dart.notNull(result) + other; 749 return dart.notNull(result) + other;
750 } 750 }
751 } 751 }
752 [_isInt32](value) { 752 [_isInt32](value) {
753 return (value | 0) === value; 753 return (value | 0) === value;
754 } 754 }
755 [dartx['~/']](other) { 755 [dartx['~/']](other) {
756 if (false) 756 if (false)
757 this[_tdivFast](other); 757 this[_tdivFast](other);
758 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe r)) && 0 != other && -1 != other) { 758 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe r)) && 0 != other && -1 != other) {
759 return this / other | 0; 759 return this / other | 0;
760 } else { 760 } else {
761 return this[_tdivSlow](other); 761 return this[_tdivSlow](other);
762 } 762 }
763 } 763 }
764 [_tdivFast](other) { 764 [_tdivFast](other) {
765 return dart.notNull(this[_isInt32](this)) ? this / other | 0 : (this / oth er)[dartx.toInt](); 765 return dart.notNull(this[_isInt32](this)) ? this / other | 0 : (this / oth er)[dartx.toInt]();
766 } 766 }
767 [_tdivSlow](other) { 767 [_tdivSlow](other) {
768 if (!dart.is(other, core.num)) 768 if (!dart.is(other, core.num))
769 throw new core.ArgumentError(other); 769 dart.throw(new core.ArgumentError(other));
770 return (this / other)[dartx.toInt](); 770 return (this / other)[dartx.toInt]();
771 } 771 }
772 [dartx['<<']](other) { 772 [dartx['<<']](other) {
773 if (!dart.is(other, core.num)) 773 if (!dart.is(other, core.num))
774 throw new core.ArgumentError(other); 774 dart.throw(new core.ArgumentError(other));
775 if (other < 0) 775 if (other < 0)
776 throw new core.ArgumentError(other); 776 dart.throw(new core.ArgumentError(other));
777 return this[_shlPositive](other); 777 return this[_shlPositive](other);
778 } 778 }
779 [_shlPositive](other) { 779 [_shlPositive](other) {
780 return other > 31 ? 0 : dart.as(this << other >>> 0, core.num); 780 return other > 31 ? 0 : dart.as(this << other >>> 0, core.num);
781 } 781 }
782 [dartx['>>']](other) { 782 [dartx['>>']](other) {
783 if (false) 783 if (false)
784 this[_shrReceiverPositive](other); 784 this[_shrReceiverPositive](other);
785 if (!dart.is(other, core.num)) 785 if (!dart.is(other, core.num))
786 throw new core.ArgumentError(other); 786 dart.throw(new core.ArgumentError(other));
787 if (other < 0) 787 if (other < 0)
788 throw new core.ArgumentError(other); 788 dart.throw(new core.ArgumentError(other));
789 return this[_shrOtherPositive](other); 789 return this[_shrOtherPositive](other);
790 } 790 }
791 [_shrOtherPositive](other) { 791 [_shrOtherPositive](other) {
792 return this > 0 ? this[_shrBothPositive](other) : dart.as(this >> (dart.no tNull(other) > 31 ? 31 : other) >>> 0, core.num); 792 return this > 0 ? this[_shrBothPositive](other) : dart.as(this >> (dart.no tNull(other) > 31 ? 31 : other) >>> 0, core.num);
793 } 793 }
794 [_shrReceiverPositive](other) { 794 [_shrReceiverPositive](other) {
795 if (other < 0) 795 if (other < 0)
796 throw new core.ArgumentError(other); 796 dart.throw(new core.ArgumentError(other));
797 return this[_shrBothPositive](other); 797 return this[_shrBothPositive](other);
798 } 798 }
799 [_shrBothPositive](other) { 799 [_shrBothPositive](other) {
800 return other > 31 ? 0 : dart.as(this >>> other, core.num); 800 return other > 31 ? 0 : dart.as(this >>> other, core.num);
801 } 801 }
802 [dartx['&']](other) { 802 [dartx['&']](other) {
803 if (!dart.is(other, core.num)) 803 if (!dart.is(other, core.num))
804 throw new core.ArgumentError(other); 804 dart.throw(new core.ArgumentError(other));
805 return dart.as((this & other) >>> 0, core.num); 805 return dart.as((this & other) >>> 0, core.num);
806 } 806 }
807 [dartx['|']](other) { 807 [dartx['|']](other) {
808 if (!dart.is(other, core.num)) 808 if (!dart.is(other, core.num))
809 throw new core.ArgumentError(other); 809 dart.throw(new core.ArgumentError(other));
810 return dart.as((this | other) >>> 0, core.num); 810 return dart.as((this | other) >>> 0, core.num);
811 } 811 }
812 [dartx['^']](other) { 812 [dartx['^']](other) {
813 if (!dart.is(other, core.num)) 813 if (!dart.is(other, core.num))
814 throw new core.ArgumentError(other); 814 dart.throw(new core.ArgumentError(other));
815 return dart.as((this ^ other) >>> 0, core.num); 815 return dart.as((this ^ other) >>> 0, core.num);
816 } 816 }
817 [dartx['<']](other) { 817 [dartx['<']](other) {
818 if (!dart.is(other, core.num)) 818 if (!dart.is(other, core.num))
819 throw new core.ArgumentError(other); 819 dart.throw(new core.ArgumentError(other));
820 return this < other; 820 return this < other;
821 } 821 }
822 [dartx['>']](other) { 822 [dartx['>']](other) {
823 if (!dart.is(other, core.num)) 823 if (!dart.is(other, core.num))
824 throw new core.ArgumentError(other); 824 dart.throw(new core.ArgumentError(other));
825 return this > other; 825 return this > other;
826 } 826 }
827 [dartx['<=']](other) { 827 [dartx['<=']](other) {
828 if (!dart.is(other, core.num)) 828 if (!dart.is(other, core.num))
829 throw new core.ArgumentError(other); 829 dart.throw(new core.ArgumentError(other));
830 return this <= other; 830 return this <= other;
831 } 831 }
832 [dartx['>=']](other) { 832 [dartx['>=']](other) {
833 if (!dart.is(other, core.num)) 833 if (!dart.is(other, core.num))
834 throw new core.ArgumentError(other); 834 dart.throw(new core.ArgumentError(other));
835 return this >= other; 835 return this >= other;
836 } 836 }
837 get runtimeType() { 837 get runtimeType() {
838 return core.num; 838 return core.num;
839 } 839 }
840 } 840 }
841 JSNumber[dart.implements] = () => [core.num]; 841 JSNumber[dart.implements] = () => [core.num];
842 dart.setSignature(JSNumber, { 842 dart.setSignature(JSNumber, {
843 constructors: () => ({JSNumber: [JSNumber, []]}), 843 constructors: () => ({JSNumber: [JSNumber, []]}),
844 methods: () => ({ 844 methods: () => ({
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 'runtimeType', 1031 'runtimeType',
1032 'length', 1032 'length',
1033 'get' 1033 'get'
1034 ]); 1034 ]);
1035 class JSString extends Interceptor { 1035 class JSString extends Interceptor {
1036 JSString() { 1036 JSString() {
1037 super.Interceptor(); 1037 super.Interceptor();
1038 } 1038 }
1039 [dartx.codeUnitAt](index) { 1039 [dartx.codeUnitAt](index) {
1040 if (!(typeof index == 'number')) 1040 if (!(typeof index == 'number'))
1041 throw new core.ArgumentError(index); 1041 dart.throw(new core.ArgumentError(index));
1042 if (dart.notNull(index) < 0) 1042 if (dart.notNull(index) < 0)
1043 throw new core.RangeError.value(index); 1043 dart.throw(new core.RangeError.value(index));
1044 if (dart.notNull(index) >= dart.notNull(this[dartx.length])) 1044 if (dart.notNull(index) >= dart.notNull(this[dartx.length]))
1045 throw new core.RangeError.value(index); 1045 dart.throw(new core.RangeError.value(index));
1046 return dart.as(this.charCodeAt(index), core.int); 1046 return dart.as(this.charCodeAt(index), core.int);
1047 } 1047 }
1048 [dartx.allMatches](string, start) { 1048 [dartx.allMatches](string, start) {
1049 if (start === void 0) 1049 if (start === void 0)
1050 start = 0; 1050 start = 0;
1051 _js_helper.checkString(string); 1051 _js_helper.checkString(string);
1052 _js_helper.checkInt(start); 1052 _js_helper.checkInt(start);
1053 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[d artx.length])) { 1053 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string[d artx.length])) {
1054 throw new core.RangeError.range(start, 0, string[dartx.length]); 1054 dart.throw(new core.RangeError.range(start, 0, string[dartx.length]));
1055 } 1055 }
1056 return _js_helper.allMatchesInStringUnchecked(this, string, start); 1056 return _js_helper.allMatchesInStringUnchecked(this, string, start);
1057 } 1057 }
1058 [dartx.matchAsPrefix](string, start) { 1058 [dartx.matchAsPrefix](string, start) {
1059 if (start === void 0) 1059 if (start === void 0)
1060 start = 0; 1060 start = 0;
1061 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) { 1061 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d artx.length])) {
1062 throw new core.RangeError.range(start, 0, string[dartx.length]); 1062 dart.throw(new core.RangeError.range(start, 0, string[dartx.length]));
1063 } 1063 }
1064 if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull( string[dartx.length])) 1064 if (dart.notNull(start) + dart.notNull(this[dartx.length]) > dart.notNull( string[dartx.length]))
1065 return null; 1065 return null;
1066 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da rt.notNull(i) + 1) { 1066 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da rt.notNull(i) + 1) {
1067 if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != t his[dartx.codeUnitAt](i)) { 1067 if (string[dartx.codeUnitAt](dart.notNull(start) + dart.notNull(i)) != t his[dartx.codeUnitAt](i)) {
1068 return null; 1068 return null;
1069 } 1069 }
1070 } 1070 }
1071 return new _js_helper.StringMatch(start, string, this); 1071 return new _js_helper.StringMatch(start, string, this);
1072 } 1072 }
1073 [dartx['+']](other) { 1073 [dartx['+']](other) {
1074 if (!(typeof other == 'string')) 1074 if (!(typeof other == 'string'))
1075 throw new core.ArgumentError(other); 1075 dart.throw(new core.ArgumentError(other));
1076 return this + other; 1076 return this + other;
1077 } 1077 }
1078 [dartx.endsWith](other) { 1078 [dartx.endsWith](other) {
1079 _js_helper.checkString(other); 1079 _js_helper.checkString(other);
1080 let otherLength = other[dartx.length]; 1080 let otherLength = other[dartx.length];
1081 if (dart.notNull(otherLength) > dart.notNull(this[dartx.length])) 1081 if (dart.notNull(otherLength) > dart.notNull(this[dartx.length]))
1082 return false; 1082 return false;
1083 return other == this[dartx.substring](dart.notNull(this[dartx.length]) - d art.notNull(otherLength)); 1083 return other == this[dartx.substring](dart.notNull(this[dartx.length]) - d art.notNull(otherLength));
1084 } 1084 }
1085 [dartx.replaceAll](from, to) { 1085 [dartx.replaceAll](from, to) {
1086 _js_helper.checkString(to); 1086 _js_helper.checkString(to);
1087 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core. String); 1087 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core. String);
1088 } 1088 }
1089 [dartx.replaceAllMapped](from, convert) { 1089 [dartx.replaceAllMapped](from, convert) {
1090 return this[dartx.splitMapJoin](from, {onMatch: convert}); 1090 return this[dartx.splitMapJoin](from, {onMatch: convert});
1091 } 1091 }
1092 [dartx.splitMapJoin](from, opts) { 1092 [dartx.splitMapJoin](from, opts) {
1093 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null; 1093 let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null;
1094 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null; 1094 let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null;
1095 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc h, onNonMatch), core.String); 1095 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc h, onNonMatch), core.String);
1096 } 1096 }
1097 [dartx.replaceFirst](from, to, startIndex) { 1097 [dartx.replaceFirst](from, to, startIndex) {
1098 if (startIndex === void 0) 1098 if (startIndex === void 0)
1099 startIndex = 0; 1099 startIndex = 0;
1100 _js_helper.checkString(to); 1100 _js_helper.checkString(to);
1101 _js_helper.checkInt(startIndex); 1101 _js_helper.checkInt(startIndex);
1102 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul l(this[dartx.length])) { 1102 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul l(this[dartx.length])) {
1103 throw new core.RangeError.range(startIndex, 0, this[dartx.length]); 1103 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length])) ;
1104 } 1104 }
1105 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star tIndex), core.String); 1105 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star tIndex), core.String);
1106 } 1106 }
1107 [dartx.split](pattern) { 1107 [dartx.split](pattern) {
1108 _js_helper.checkNull(pattern); 1108 _js_helper.checkNull(pattern);
1109 if (typeof pattern == 'string') { 1109 if (typeof pattern == 'string') {
1110 return dart.as(this.split(pattern), core.List$(core.String)); 1110 return dart.as(this.split(pattern), core.List$(core.String));
1111 } else if (dart.is(pattern, _js_helper.JSSyntaxRegExp) && _js_helper.regEx pCaptureCount(pattern) == 0) { 1111 } else if (dart.is(pattern, _js_helper.JSSyntaxRegExp) && _js_helper.regEx pCaptureCount(pattern) == 0) {
1112 let re = _js_helper.regExpGetNative(pattern); 1112 let re = _js_helper.regExpGetNative(pattern);
1113 return dart.as(this.split(re), core.List$(core.String)); 1113 return dart.as(this.split(re), core.List$(core.String));
(...skipping 19 matching lines...) Expand all
1133 if (dart.notNull(start) < dart.notNull(this[dartx.length]) || dart.notNull (length) > 0) { 1133 if (dart.notNull(start) < dart.notNull(this[dartx.length]) || dart.notNull (length) > 0) {
1134 result[dartx.add](this[dartx.substring](start)); 1134 result[dartx.add](this[dartx.substring](start));
1135 } 1135 }
1136 return result; 1136 return result;
1137 } 1137 }
1138 [dartx.startsWith](pattern, index) { 1138 [dartx.startsWith](pattern, index) {
1139 if (index === void 0) 1139 if (index === void 0)
1140 index = 0; 1140 index = 0;
1141 _js_helper.checkInt(index); 1141 _js_helper.checkInt(index);
1142 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dar tx.length])) { 1142 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this[dar tx.length])) {
1143 throw new core.RangeError.range(index, 0, this[dartx.length]); 1143 dart.throw(new core.RangeError.range(index, 0, this[dartx.length]));
1144 } 1144 }
1145 if (typeof pattern == 'string') { 1145 if (typeof pattern == 'string') {
1146 let other = pattern; 1146 let other = pattern;
1147 let otherLength = other[dartx.length]; 1147 let otherLength = other[dartx.length];
1148 let endIndex = dart.notNull(index) + dart.notNull(otherLength); 1148 let endIndex = dart.notNull(index) + dart.notNull(otherLength);
1149 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) 1149 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length]))
1150 return false; 1150 return false;
1151 return other == this.substring(index, endIndex); 1151 return other == this.substring(index, endIndex);
1152 } 1152 }
1153 return pattern[dartx.matchAsPrefix](this, index) != null; 1153 return pattern[dartx.matchAsPrefix](this, index) != null;
1154 } 1154 }
1155 [dartx.substring](startIndex, endIndex) { 1155 [dartx.substring](startIndex, endIndex) {
1156 if (endIndex === void 0) 1156 if (endIndex === void 0)
1157 endIndex = null; 1157 endIndex = null;
1158 _js_helper.checkInt(startIndex); 1158 _js_helper.checkInt(startIndex);
1159 if (endIndex == null) 1159 if (endIndex == null)
1160 endIndex = this[dartx.length]; 1160 endIndex = this[dartx.length];
1161 _js_helper.checkInt(endIndex); 1161 _js_helper.checkInt(endIndex);
1162 if (dart.notNull(startIndex) < 0) 1162 if (dart.notNull(startIndex) < 0)
1163 throw new core.RangeError.value(startIndex); 1163 dart.throw(new core.RangeError.value(startIndex));
1164 if (dart.notNull(startIndex) > dart.notNull(endIndex)) 1164 if (dart.notNull(startIndex) > dart.notNull(endIndex))
1165 throw new core.RangeError.value(startIndex); 1165 dart.throw(new core.RangeError.value(startIndex));
1166 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length])) 1166 if (dart.notNull(endIndex) > dart.notNull(this[dartx.length]))
1167 throw new core.RangeError.value(endIndex); 1167 dart.throw(new core.RangeError.value(endIndex));
1168 return this.substring(startIndex, endIndex); 1168 return this.substring(startIndex, endIndex);
1169 } 1169 }
1170 [dartx.toLowerCase]() { 1170 [dartx.toLowerCase]() {
1171 return this.toLowerCase(); 1171 return this.toLowerCase();
1172 } 1172 }
1173 [dartx.toUpperCase]() { 1173 [dartx.toUpperCase]() {
1174 return this.toUpperCase(); 1174 return this.toUpperCase();
1175 } 1175 }
1176 static _isWhitespace(codeUnit) { 1176 static _isWhitespace(codeUnit) {
1177 if (dart.notNull(codeUnit) < 256) { 1177 if (dart.notNull(codeUnit) < 256) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 if (endIndex == 0) 1311 if (endIndex == 0)
1312 return ""; 1312 return "";
1313 return result.substring(0, endIndex); 1313 return result.substring(0, endIndex);
1314 } 1314 }
1315 [dartx['*']](times) { 1315 [dartx['*']](times) {
1316 if (0 >= dart.notNull(times)) 1316 if (0 >= dart.notNull(times))
1317 return ''; 1317 return '';
1318 if (times == 1 || this[dartx.length] == 0) 1318 if (times == 1 || this[dartx.length] == 0)
1319 return this; 1319 return this;
1320 if (!dart.equals(times, times >>> 0)) { 1320 if (!dart.equals(times, times >>> 0)) {
1321 throw dart.const(new core.OutOfMemoryError()); 1321 dart.throw(dart.const(new core.OutOfMemoryError()));
1322 } 1322 }
1323 let result = ''; 1323 let result = '';
1324 let s = this; 1324 let s = this;
1325 while (true) { 1325 while (true) {
1326 if ((dart.notNull(times) & 1) == 1) 1326 if ((dart.notNull(times) & 1) == 1)
1327 result = s[dartx['+']](result); 1327 result = s[dartx['+']](result);
1328 times = dart.as(times >>> 1, core.int); 1328 times = dart.as(times >>> 1, core.int);
1329 if (times == 0) 1329 if (times == 0)
1330 break; 1330 break;
1331 s = s[dartx['+']](s); 1331 s = s[dartx['+']](s);
(...skipping 20 matching lines...) Expand all
1352 return new _CodeUnits(this); 1352 return new _CodeUnits(this);
1353 } 1353 }
1354 get [dartx.runes]() { 1354 get [dartx.runes]() {
1355 return new core.Runes(this); 1355 return new core.Runes(this);
1356 } 1356 }
1357 [dartx.indexOf](pattern, start) { 1357 [dartx.indexOf](pattern, start) {
1358 if (start === void 0) 1358 if (start === void 0)
1359 start = 0; 1359 start = 0;
1360 _js_helper.checkNull(pattern); 1360 _js_helper.checkNull(pattern);
1361 if (!(typeof start == 'number')) 1361 if (!(typeof start == 'number'))
1362 throw new core.ArgumentError(start); 1362 dart.throw(new core.ArgumentError(start));
1363 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dar tx.length])) { 1363 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this[dar tx.length])) {
1364 throw new core.RangeError.range(start, 0, this[dartx.length]); 1364 dart.throw(new core.RangeError.range(start, 0, this[dartx.length]));
1365 } 1365 }
1366 if (typeof pattern == 'string') { 1366 if (typeof pattern == 'string') {
1367 return this.indexOf(pattern, start); 1367 return this.indexOf(pattern, start);
1368 } 1368 }
1369 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { 1369 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) {
1370 let re = pattern; 1370 let re = pattern;
1371 let match = _js_helper.firstMatchAfter(re, this, start); 1371 let match = _js_helper.firstMatchAfter(re, this, start);
1372 return match == null ? -1 : match.start; 1372 return match == null ? -1 : match.start;
1373 } 1373 }
1374 for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) { 1374 for (let i = start; dart.notNull(i) <= dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) {
1375 if (pattern[dartx.matchAsPrefix](this, i) != null) 1375 if (pattern[dartx.matchAsPrefix](this, i) != null)
1376 return i; 1376 return i;
1377 } 1377 }
1378 return -1; 1378 return -1;
1379 } 1379 }
1380 [dartx.lastIndexOf](pattern, start) { 1380 [dartx.lastIndexOf](pattern, start) {
1381 if (start === void 0) 1381 if (start === void 0)
1382 start = null; 1382 start = null;
1383 _js_helper.checkNull(pattern); 1383 _js_helper.checkNull(pattern);
1384 if (start == null) { 1384 if (start == null) {
1385 start = this[dartx.length]; 1385 start = this[dartx.length];
1386 } else if (!(typeof start == 'number')) { 1386 } else if (!(typeof start == 'number')) {
1387 throw new core.ArgumentError(start); 1387 dart.throw(new core.ArgumentError(start));
1388 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t his[dartx.length])) { 1388 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t his[dartx.length])) {
1389 throw new core.RangeError.range(start, 0, this[dartx.length]); 1389 dart.throw(new core.RangeError.range(start, 0, this[dartx.length]));
1390 } 1390 }
1391 if (typeof pattern == 'string') { 1391 if (typeof pattern == 'string') {
1392 let other = pattern; 1392 let other = pattern;
1393 if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNu ll(this[dartx.length])) { 1393 if (dart.notNull(start) + dart.notNull(other[dartx.length]) > dart.notNu ll(this[dartx.length])) {
1394 start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.le ngth]); 1394 start = dart.notNull(this[dartx.length]) - dart.notNull(other[dartx.le ngth]);
1395 } 1395 }
1396 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start) , core.int); 1396 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start) , core.int);
1397 } 1397 }
1398 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { 1398 for (let i = start; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
1399 if (pattern[dartx.matchAsPrefix](this, i) != null) 1399 if (pattern[dartx.matchAsPrefix](this, i) != null)
1400 return i; 1400 return i;
1401 } 1401 }
1402 return -1; 1402 return -1;
1403 } 1403 }
1404 [dartx.contains](other, startIndex) { 1404 [dartx.contains](other, startIndex) {
1405 if (startIndex === void 0) 1405 if (startIndex === void 0)
1406 startIndex = 0; 1406 startIndex = 0;
1407 _js_helper.checkNull(other); 1407 _js_helper.checkNull(other);
1408 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul l(this[dartx.length])) { 1408 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul l(this[dartx.length])) {
1409 throw new core.RangeError.range(startIndex, 0, this[dartx.length]); 1409 dart.throw(new core.RangeError.range(startIndex, 0, this[dartx.length])) ;
1410 } 1410 }
1411 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex) , core.bool); 1411 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex) , core.bool);
1412 } 1412 }
1413 get [dartx.isEmpty]() { 1413 get [dartx.isEmpty]() {
1414 return this[dartx.length] == 0; 1414 return this[dartx.length] == 0;
1415 } 1415 }
1416 get [dartx.isNotEmpty]() { 1416 get [dartx.isNotEmpty]() {
1417 return !dart.notNull(this[dartx.isEmpty]); 1417 return !dart.notNull(this[dartx.isEmpty]);
1418 } 1418 }
1419 [dartx.compareTo](other) { 1419 [dartx.compareTo](other) {
1420 if (!(typeof other == 'string')) 1420 if (!(typeof other == 'string'))
1421 throw new core.ArgumentError(other); 1421 dart.throw(new core.ArgumentError(other));
1422 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; 1422 return dart.equals(this, other) ? 0 : this < other ? -1 : 1;
1423 } 1423 }
1424 toString() { 1424 toString() {
1425 return this; 1425 return this;
1426 } 1426 }
1427 get hashCode() { 1427 get hashCode() {
1428 let hash = 0; 1428 let hash = 0;
1429 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da rt.notNull(i) + 1) { 1429 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = da rt.notNull(i) + 1) {
1430 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i); 1430 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i);
1431 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) < < 10); 1431 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) < < 10);
1432 hash = hash ^ hash >> 6; 1432 hash = hash ^ hash >> 6;
1433 } 1433 }
1434 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3); 1434 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
1435 hash = hash ^ hash >> 11; 1435 hash = hash ^ hash >> 11;
1436 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5); 1436 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
1437 } 1437 }
1438 get runtimeType() { 1438 get runtimeType() {
1439 return core.String; 1439 return core.String;
1440 } 1440 }
1441 get [dartx.length]() { 1441 get [dartx.length]() {
1442 return this.length; 1442 return this.length;
1443 } 1443 }
1444 [dartx.get](index) { 1444 [dartx.get](index) {
1445 if (!(typeof index == 'number')) 1445 if (!(typeof index == 'number'))
1446 throw new core.ArgumentError(index); 1446 dart.throw(new core.ArgumentError(index));
1447 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNul l(index) < 0) 1447 if (dart.notNull(index) >= dart.notNull(this[dartx.length]) || dart.notNul l(index) < 0)
1448 throw new core.RangeError.value(index); 1448 dart.throw(new core.RangeError.value(index));
1449 return this[index]; 1449 return this[index];
1450 } 1450 }
1451 } 1451 }
1452 JSString[dart.implements] = () => [core.String, JSIndexable]; 1452 JSString[dart.implements] = () => [core.String, JSIndexable];
1453 dart.setSignature(JSString, { 1453 dart.setSignature(JSString, {
1454 constructors: () => ({JSString: [JSString, []]}), 1454 constructors: () => ({JSString: [JSString, []]}),
1455 methods: () => ({ 1455 methods: () => ({
1456 [dartx.codeUnitAt]: [core.int, [core.int]], 1456 [dartx.codeUnitAt]: [core.int, [core.int]],
1457 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int] ], 1457 [dartx.allMatches]: [core.Iterable$(core.Match), [core.String], [core.int] ],
1458 [dartx.matchAsPrefix]: [core.Match, [core.String], [core.int]], 1458 [dartx.matchAsPrefix]: [core.Match, [core.String], [core.int]],
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 exports.JSString = JSString; 1591 exports.JSString = JSString;
1592 exports.getInterceptor = getInterceptor; 1592 exports.getInterceptor = getInterceptor;
1593 exports.JSBool = JSBool; 1593 exports.JSBool = JSBool;
1594 exports.JSIndexable = JSIndexable; 1594 exports.JSIndexable = JSIndexable;
1595 exports.JSMutableIndexable = JSMutableIndexable; 1595 exports.JSMutableIndexable = JSMutableIndexable;
1596 exports.JSObject = JSObject; 1596 exports.JSObject = JSObject;
1597 exports.JavaScriptObject = JavaScriptObject; 1597 exports.JavaScriptObject = JavaScriptObject;
1598 exports.PlainJavaScriptObject = PlainJavaScriptObject; 1598 exports.PlainJavaScriptObject = PlainJavaScriptObject;
1599 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; 1599 exports.UnknownJavaScriptObject = UnknownJavaScriptObject;
1600 }); 1600 });
OLDNEW
« no previous file with comments | « lib/runtime/_operations.js ('k') | lib/runtime/dart/_internal.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698