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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/lib/isolate_patch.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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Patch file for the dart:isolate library. 5 // Patch file for the dart:isolate library.
6 6
7 import 'dart:uri'; 7 import 'dart:uri';
8 8
9 /** 9 /**
10 * Called by the compiler to support switching 10 * Called by the compiler to support switching
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 1104
1105 visitPrimitive(x) => x; 1105 visitPrimitive(x) => x;
1106 1106
1107 List visitList(List list) { 1107 List visitList(List list) {
1108 List copy = _visited[list]; 1108 List copy = _visited[list];
1109 if (copy != null) return copy; 1109 if (copy != null) return copy;
1110 1110
1111 int len = list.length; 1111 int len = list.length;
1112 1112
1113 // TODO(floitsch): we loose the generic type of the List. 1113 // TODO(floitsch): we loose the generic type of the List.
1114 copy = new List(len); 1114 copy = new List.fixedLength(len);
1115 _visited[list] = copy; 1115 _visited[list] = copy;
1116 for (int i = 0; i < len; i++) { 1116 for (int i = 0; i < len; i++) {
1117 copy[i] = _dispatch(list[i]); 1117 copy[i] = _dispatch(list[i]);
1118 } 1118 }
1119 return copy; 1119 return copy;
1120 } 1120 }
1121 1121
1122 Map visitMap(Map map) { 1122 Map visitMap(Map map) {
1123 Map copy = _visited[map]; 1123 Map copy = _visited[map];
1124 if (copy != null) return copy; 1124 if (copy != null) return copy;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 int id = _nextFreeRefId++; 1158 int id = _nextFreeRefId++;
1159 _visited[map] = id; 1159 _visited[map] = id;
1160 var keys = _serializeList(map.keys); 1160 var keys = _serializeList(map.keys);
1161 var values = _serializeList(map.values); 1161 var values = _serializeList(map.values);
1162 // TODO(floitsch): we are losing the generic type. 1162 // TODO(floitsch): we are losing the generic type.
1163 return ['map', id, keys, values]; 1163 return ['map', id, keys, values];
1164 } 1164 }
1165 1165
1166 _serializeList(List list) { 1166 _serializeList(List list) {
1167 int len = list.length; 1167 int len = list.length;
1168 var result = new List(len); 1168 var result = new List.fixedLength(len);
1169 for (int i = 0; i < len; i++) { 1169 for (int i = 0; i < len; i++) {
1170 result[i] = _dispatch(list[i]); 1170 result[i] = _dispatch(list[i]);
1171 } 1171 }
1172 return result; 1172 return result;
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 /** Deserializes arrays created with [_Serializer]. */ 1176 /** Deserializes arrays created with [_Serializer]. */
1177 class _Deserializer { 1177 class _Deserializer {
1178 Map<int, dynamic> _deserialized; 1178 Map<int, dynamic> _deserialized;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 _window.clearTimeout(_handle); 1284 _window.clearTimeout(_handle);
1285 } else { 1285 } else {
1286 _window.clearInterval(_handle); 1286 _window.clearInterval(_handle);
1287 } 1287 }
1288 } 1288 }
1289 } 1289 }
1290 1290
1291 Timer _timerFactory(int millis, void callback(Timer timer), bool repeating) => 1291 Timer _timerFactory(int millis, void callback(Timer timer), bool repeating) =>
1292 repeating ? new _Timer.repeating(millis, callback) 1292 repeating ? new _Timer.repeating(millis, callback)
1293 : new _Timer(millis, callback); 1293 : new _Timer(millis, callback);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698