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

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

Issue 8948001: Updates dartc to recognize 'default' keyword on interface and updated factory method syntax (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Got rid of some problems. Created 9 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 unified diff | Download patch | Annotate | Revision Log
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 ListFactory { 5 class ListFactory<E> {
6 factory List<E>.from(Iterable<E> other) { 6 factory List.from(Iterable<E> other) {
7 List<E> list = new List<E>(); 7 List<E> list = new List<E>();
8 for (final e in other) { 8 for (final e in other) {
9 list.add(e); 9 list.add(e);
10 } 10 }
11 return list; 11 return list;
12 } 12 }
13 13
14 factory List<E>([int length = null]) { 14 factory List([int length = null]) {
15 bool isFixed = true; 15 bool isFixed = true;
16 if (length === null) { 16 if (length === null) {
17 length = 0; 17 length = 0;
18 isFixed = false; 18 isFixed = false;
19 } else if (length < 0) { 19 } else if (length < 0) {
20 throw new IllegalArgumentException("negative length $length"); 20 throw new IllegalArgumentException("negative length $length");
21 } 21 }
22 // TODO(floitsch): make list creation more efficient. Currently we allocate 22 // TODO(floitsch): make list creation more efficient. Currently we allocate
23 // a new TypeToken at every allocation. Either we can optimize them away, 23 // a new TypeToken at every allocation. Either we can optimize them away,
24 // or we need to find other ways to pass type-information from Dart to JS. 24 // or we need to find other ways to pass type-information from Dart to JS.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 260
261 static List _newList(int len) native { 261 static List _newList(int len) native {
262 return new List(len); 262 return new List(len);
263 } 263 }
264 264
265 static void _throwIndexOutOfRangeException(int index) native { 265 static void _throwIndexOutOfRangeException(int index) native {
266 throw new IndexOutOfRangeException(index); 266 throw new IndexOutOfRangeException(index);
267 } 267 }
268 } 268 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698