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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload. Adapt code for List.fixedLength. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/crypto/sha256.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:isolate'; 4 import 'dart:isolate';
5 import 'dart:json' as json; 5 import 'dart:json' as json;
6 import 'dart:svg' as svg; 6 import 'dart:svg' as svg;
7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
8 // for details. All rights reserved. Use of this source code is governed by a 8 // for details. All rights reserved. Use of this source code is governed by a
9 // BSD-style license that can be found in the LICENSE file. 9 // BSD-style license that can be found in the LICENSE file.
10 10
(...skipping 24932 matching lines...) Expand 10 before | Expand all | Expand 10 after
24943 24943
24944 visitPrimitive(x) => x; 24944 visitPrimitive(x) => x;
24945 24945
24946 List visitList(List list) { 24946 List visitList(List list) {
24947 List copy = _visited[list]; 24947 List copy = _visited[list];
24948 if (copy != null) return copy; 24948 if (copy != null) return copy;
24949 24949
24950 int len = list.length; 24950 int len = list.length;
24951 24951
24952 // TODO(floitsch): we loose the generic type of the List. 24952 // TODO(floitsch): we loose the generic type of the List.
24953 copy = new List(len); 24953 copy = new List.fixedLength(len);
24954 _visited[list] = copy; 24954 _visited[list] = copy;
24955 for (int i = 0; i < len; i++) { 24955 for (int i = 0; i < len; i++) {
24956 copy[i] = _dispatch(list[i]); 24956 copy[i] = _dispatch(list[i]);
24957 } 24957 }
24958 return copy; 24958 return copy;
24959 } 24959 }
24960 24960
24961 Map visitMap(Map map) { 24961 Map visitMap(Map map) {
24962 Map copy = _visited[map]; 24962 Map copy = _visited[map];
24963 if (copy != null) return copy; 24963 if (copy != null) return copy;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
24997 int id = _nextFreeRefId++; 24997 int id = _nextFreeRefId++;
24998 _visited[map] = id; 24998 _visited[map] = id;
24999 var keys = _serializeList(map.keys); 24999 var keys = _serializeList(map.keys);
25000 var values = _serializeList(map.values); 25000 var values = _serializeList(map.values);
25001 // TODO(floitsch): we are losing the generic type. 25001 // TODO(floitsch): we are losing the generic type.
25002 return ['map', id, keys, values]; 25002 return ['map', id, keys, values];
25003 } 25003 }
25004 25004
25005 _serializeList(List list) { 25005 _serializeList(List list) {
25006 int len = list.length; 25006 int len = list.length;
25007 var result = new List(len); 25007 var result = new List.fixedLength(len);
25008 for (int i = 0; i < len; i++) { 25008 for (int i = 0; i < len; i++) {
25009 result[i] = _dispatch(list[i]); 25009 result[i] = _dispatch(list[i]);
25010 } 25010 }
25011 return result; 25011 return result;
25012 } 25012 }
25013 } 25013 }
25014 25014
25015 /** Deserializes arrays created with [_Serializer]. */ 25015 /** Deserializes arrays created with [_Serializer]. */
25016 class _Deserializer { 25016 class _Deserializer {
25017 Map<int, dynamic> _deserialized; 25017 Map<int, dynamic> _deserialized;
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
26176 if (length < 0) throw new ArgumentError('length'); 26176 if (length < 0) throw new ArgumentError('length');
26177 if (start < 0) throw new RangeError.value(start); 26177 if (start < 0) throw new RangeError.value(start);
26178 int end = start + length; 26178 int end = start + length;
26179 if (end > a.length) throw new RangeError.value(end); 26179 if (end > a.length) throw new RangeError.value(end);
26180 for (int i = start; i < end; i++) { 26180 for (int i = start; i < end; i++) {
26181 accumulator.add(a[i]); 26181 accumulator.add(a[i]);
26182 } 26182 }
26183 return accumulator; 26183 return accumulator;
26184 } 26184 }
26185 } 26185 }
OLDNEW
« no previous file with comments | « sdk/lib/crypto/sha256.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698