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

Unified Diff: frog/lib/corelib_impl.dart

Issue 8725007: Lots of stuff hooking up markdown to dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implement removeRange() on List in frog. Created 9 years, 1 month 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 | utils/dartdoc/README.txt » ('j') | utils/dartdoc/README.txt » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/lib/corelib_impl.dart
diff --git a/frog/lib/corelib_impl.dart b/frog/lib/corelib_impl.dart
index 4cee364e97e1f427dd7e6b8a0eae949f8011d04a..9a25e1a1162b13824e8b3c98bffcbf51070d4528 100644
--- a/frog/lib/corelib_impl.dart
+++ b/frog/lib/corelib_impl.dart
@@ -68,8 +68,17 @@ class ListFactory<E> implements List<E> native "Array" {
"return this.slice(start, start + length);";
void setRange(int start, int length, List<E> from, [int startFrom]) native;
- void removeRange(int start, int length) native;
- void insertRange(int start, int length, [E initialValue]) native;
+ void removeRange(int start, int length) native "this.splice(start, length);";
+
+ void insertRange(int start, int length, [E initialValue]) native
+ """
+ // Splice in the values with a minimum of array allocations.
+ var args = new Array(length + 2);
+ args[0] = start;
+ args[1] = 0;
+ for (var i = 0; i < length; i++) args[i + 2] = initialValue;
nweiz 2011/11/28 22:50:45 Are single-line loops supported by the styleguide?
Jennifer Messerly 2011/11/28 23:08:13 you should be able to surround this with an if:
Bob Nystrom 2011/11/29 02:44:08 Oops, you're right. Fixed.
+ this.splice.apply(this, args);
+ """;
// Collection<E> members:
void forEach(void f(E element)) native;
« no previous file with comments | « no previous file | utils/dartdoc/README.txt » ('j') | utils/dartdoc/README.txt » ('J')

Powered by Google App Engine
This is Rietveld 408576698