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

Side by Side Diff: sdk/lib/isolate/mangler.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months 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 part of dart.isolate; 5 part of dart.isolate;
6 6
7 class _IsolateEncoder { 7 class _IsolateEncoder {
8 final manglingToken; 8 final manglingToken;
9 // TODO(floitsch): switch to identity set. 9 // TODO(floitsch): switch to identity set.
10 final Map _encoded = new Map(); 10 final Map _encoded = new Map();
(...skipping 26 matching lines...) Expand all
37 _visiting[data] = data; 37 _visiting[data] = data;
38 38
39 var result; 39 var result;
40 40
41 if (data is List) { 41 if (data is List) {
42 bool hasBeenDuplicated = false; 42 bool hasBeenDuplicated = false;
43 result = data; 43 result = data;
44 for (int i = 0; i < data.length; i++) { 44 for (int i = 0; i < data.length; i++) {
45 var mangled = encode(data[i]); 45 var mangled = encode(data[i]);
46 if (mangled != data[i] && !hasBeenDuplicated) { 46 if (mangled != data[i] && !hasBeenDuplicated) {
47 result = new List.fixedLength(data.length); 47 result = new List(data.length);
48 for (int j = 0; j < i; j++) { 48 for (int j = 0; j < i; j++) {
49 result[j] = data[j]; 49 result[j] = data[j];
50 } 50 }
51 hasBeenDuplicated = true; 51 hasBeenDuplicated = true;
52 } 52 }
53 if (hasBeenDuplicated) { 53 if (hasBeenDuplicated) {
54 result[i] = mangled; 54 result[i] = mangled;
55 } 55 }
56 } 56 }
57 result = _escapeIfNecessary(result); 57 result = _escapeIfNecessary(result);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 _extractMangled(wrappedMangled) { 262 _extractMangled(wrappedMangled) {
263 assert(_isMangled(wrappedMangled)); 263 assert(_isMangled(wrappedMangled));
264 return wrappedMangled[2]; 264 return wrappedMangled[2];
265 } 265 }
266 _extractEscaped(data) { 266 _extractEscaped(data) {
267 assert(_isEscaped(data)); 267 assert(_isEscaped(data));
268 return data[2]; 268 return data[2];
269 } 269 }
270 } 270 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698