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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. Created 7 years, 10 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_backend; 5 part of dart_backend;
6 6
7 Function get _compareNodes => 7 Function get _compareNodes =>
8 compareBy((n) => n.getBeginToken().charOffset); 8 compareBy((n) => n.getBeginToken().charOffset);
9 9
10 typedef String _Renamer(Renamable renamable); 10 typedef String _Renamer(Renamable renamable);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // the same identifier. So the top-used local variables in all functions 184 // the same identifier. So the top-used local variables in all functions
185 // will be renamed first and will all share the same new identifier. 185 // will be renamed first and will all share the same new identifier.
186 List<Set<Node>> allSortedLocals = new List<Set<Node>>(); 186 List<Set<Node>> allSortedLocals = new List<Set<Node>>();
187 for (var functionScope in placeholderCollector.functionScopes.values) { 187 for (var functionScope in placeholderCollector.functionScopes.values) {
188 // Add current sorted local identifiers to the whole sorted list 188 // Add current sorted local identifiers to the whole sorted list
189 // of all local identifiers for all functions. 189 // of all local identifiers for all functions.
190 List<LocalPlaceholder> currentSortedPlaceholders = 190 List<LocalPlaceholder> currentSortedPlaceholders =
191 sorted(functionScope.localPlaceholders, 191 sorted(functionScope.localPlaceholders,
192 compareBy((LocalPlaceholder ph) => -ph.nodes.length)); 192 compareBy((LocalPlaceholder ph) => -ph.nodes.length));
193 List<Set<Node>> currentSortedNodes = 193 List<Set<Node>> currentSortedNodes =
194 currentSortedPlaceholders.mappedBy((ph) => ph.nodes).toList(); 194 currentSortedPlaceholders.map((ph) => ph.nodes).toList();
195 // Make room in all sorted locals list for new stuff. 195 // Make room in all sorted locals list for new stuff.
196 while (currentSortedNodes.length > allSortedLocals.length) { 196 while (currentSortedNodes.length > allSortedLocals.length) {
197 allSortedLocals.add(new Set<Node>()); 197 allSortedLocals.add(new Set<Node>());
198 } 198 }
199 for (int i = 0; i < currentSortedNodes.length; i++) { 199 for (int i = 0; i < currentSortedNodes.length; i++) {
200 allSortedLocals[i].addAll(currentSortedNodes[i]); 200 allSortedLocals[i].addAll(currentSortedNodes[i]);
201 } 201 }
202 } 202 }
203 203
204 // Rename elements, members and locals together based on their usage count, 204 // Rename elements, members and locals together based on their usage count,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 index ~/= firstCharAlphabet.length; 350 index ~/= firstCharAlphabet.length;
351 int length = otherCharsAlphabet.length; 351 int length = otherCharsAlphabet.length;
352 while (index >= length) { 352 while (index >= length) {
353 resultBuilder.add(otherCharsAlphabet[index % length]); 353 resultBuilder.add(otherCharsAlphabet[index % length]);
354 index ~/= length; 354 index ~/= length;
355 } 355 }
356 resultBuilder.add(otherCharsAlphabet[index]); 356 resultBuilder.add(otherCharsAlphabet[index]);
357 return resultBuilder.toString(); 357 return resultBuilder.toString();
358 } 358 }
359 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698