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

Unified 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: Use generator for html. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/core/collection.dart » ('j') | lib/core/sequences.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/lib/interceptors.dart
diff --git a/lib/compiler/implementation/lib/interceptors.dart b/lib/compiler/implementation/lib/interceptors.dart
index 0c67b2224821e432ef2fffbc718309f3a75b46ab..2234648d5750b4d5ff768d4c87f2acaeedd2b0f7 100644
--- a/lib/compiler/implementation/lib/interceptors.dart
+++ b/lib/compiler/implementation/lib/interceptors.dart
@@ -516,10 +516,15 @@ concat(receiver, other) {
}
contains$1(receiver, other) {
- if (receiver is !String) {
- return UNINTERCEPTED(receiver.contains(other));
+ if (receiver is String) {
+ return contains$2(receiver, other, 0);
+ } else if (isJsArray(receiver)) {
+ for (int i = 0; i < receiver.length; i++) {
+ if (other == receiver[i]) return true;
+ }
+ return false;
}
- return contains$2(receiver, other, 0);
+ return UNINTERCEPTED(receiver.contains(other));
}
contains$2(receiver, other, startIndex) {
« no previous file with comments | « no previous file | lib/core/collection.dart » ('j') | lib/core/sequences.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698