OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library('dart:_interceptors'); | 5 #library('dart:_interceptors'); |
6 | 6 |
7 #import('dart:coreimpl'); | 7 #import('dart:coreimpl'); |
8 | 8 |
9 add$1(var receiver, var value) { | 9 add$1(var receiver, var value) { |
10 if (isJsArray(receiver)) { | 10 if (isJsArray(receiver)) { |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 501 } |
502 | 502 |
503 concat(receiver, other) { | 503 concat(receiver, other) { |
504 if (receiver is !String) return UNINTERCEPTED(receiver.concat(other)); | 504 if (receiver is !String) return UNINTERCEPTED(receiver.concat(other)); |
505 | 505 |
506 if (other is !String) throw new ArgumentError(other); | 506 if (other is !String) throw new ArgumentError(other); |
507 return JS('String', r'# + #', receiver, other); | 507 return JS('String', r'# + #', receiver, other); |
508 } | 508 } |
509 | 509 |
510 contains$1(receiver, other) { | 510 contains$1(receiver, other) { |
511 if (receiver is !String) { | 511 if (receiver is String) { |
512 return UNINTERCEPTED(receiver.contains(other)); | 512 return contains$2(receiver, other, 0); |
| 513 } else if (isJsArray(receiver)) { |
| 514 for (int i = 0; i < receiver.length; i++) { |
| 515 if (other == receiver[i]) return true; |
| 516 } |
| 517 return false; |
513 } | 518 } |
514 return contains$2(receiver, other, 0); | 519 return UNINTERCEPTED(receiver.contains(other)); |
515 } | 520 } |
516 | 521 |
517 contains$2(receiver, other, startIndex) { | 522 contains$2(receiver, other, startIndex) { |
518 if (receiver is !String) { | 523 if (receiver is !String) { |
519 return UNINTERCEPTED(receiver.contains(other, startIndex)); | 524 return UNINTERCEPTED(receiver.contains(other, startIndex)); |
520 } | 525 } |
521 checkNull(other); | 526 checkNull(other); |
522 return stringContainsUnchecked(receiver, other, startIndex); | 527 return stringContainsUnchecked(receiver, other, startIndex); |
523 } | 528 } |
524 | 529 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } else { | 674 } else { |
670 return UNINTERCEPTED(receiver.runtimeType); | 675 return UNINTERCEPTED(receiver.runtimeType); |
671 } | 676 } |
672 } | 677 } |
673 | 678 |
674 // TODO(lrn): These getters should be generated automatically for all | 679 // TODO(lrn): These getters should be generated automatically for all |
675 // intercepted methods. | 680 // intercepted methods. |
676 get$toString(receiver) => () => toString(receiver); | 681 get$toString(receiver) => () => toString(receiver); |
677 | 682 |
678 get$hashCode(receiver) => () => hashCode(receiver); | 683 get$hashCode(receiver) => () => hashCode(receiver); |
OLD | NEW |