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

Side by Side Diff: lib/compiler/implementation/lib/interceptors.dart

Issue 11169004: Add "contains" method to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/core/collection.dart » ('j') | lib/core/collection.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « no previous file | lib/core/collection.dart » ('j') | lib/core/collection.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698