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

Side by Side Diff: runtime/lib/growable_array.dart

Issue 8602004: Fix code generation issue with new factory syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class GrowableObjectArray<T> implements List<T> { 5 class GrowableObjectArray<T> implements List<T> {
6 ObjectArray<T> backingArray; 6 ObjectArray<T> backingArray;
7 7
8 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) { 8 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {
9 Arrays.copy(src, srcStart, this, dstStart, count); 9 Arrays.copy(src, srcStart, this, dstStart, count);
10 } 10 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 GrowableObjectArray._usingArray(List<T> array) { 90 GrowableObjectArray._usingArray(List<T> array) {
91 backingArray = array; 91 backingArray = array;
92 _length = array.length; 92 _length = array.length;
93 if (_length == 0) { 93 if (_length == 0) {
94 grow(4); 94 grow(4);
95 } 95 }
96 } 96 }
97 97
98 factory GrowableObjectArray.from(Collection<T> other) { 98 factory GrowableObjectArray<T>.from(Collection<T> other) {
99 List result = new GrowableObjectArray(); 99 List<T> result = new GrowableObjectArray<T>();
100 result.addAll(other); 100 result.addAll(other);
101 return result; 101 return result;
102 } 102 }
103 103
104 int get length() { 104 int get length() {
105 return _length; 105 return _length;
106 } 106 }
107 107
108 void set length(int new_length) { 108 void set length(int new_length) {
109 if (new_length >= backingArray.length) { 109 if (new_length >= backingArray.length) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (!hasNext()) { 240 if (!hasNext()) {
241 throw const NoMoreElementsException(); 241 throw const NoMoreElementsException();
242 } 242 }
243 return _array[_pos++]; 243 return _array[_pos++];
244 } 244 }
245 245
246 final GrowableObjectArray<T> _array; 246 final GrowableObjectArray<T> _array;
247 int _pos; 247 int _pos;
248 } 248 }
249 249
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698