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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_string.dart

Issue 11348316: Move the handling of operator[] into the new interceptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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
Index: sdk/lib/_internal/compiler/implementation/lib/js_string.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/lib/js_string.dart (revision 15907)
+++ sdk/lib/_internal/compiler/implementation/lib/js_string.dart (working copy)
@@ -163,4 +163,10 @@
Type get runtimeType => String;
int get length => JS('int', r'#.length', this);
+
+ String operator [](int index) {
+ if (index is !int) throw new ArgumentError(index);
+ if (index >= length || index < 0) throw new RangeError.value(index);
+ return JS('String', '#[#]', this, index);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698