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

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

Issue 11434041: Sort constructors while renaming. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | tests/compiler/dart2js/dart_backend_test.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 // 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // members to constructors. 278 // members to constructors.
279 usedMemberIdentifiers.addAll(usedTopLevelOrMemberIdentifiers); 279 usedMemberIdentifiers.addAll(usedTopLevelOrMemberIdentifiers);
280 placeholderCollector.memberPlaceholders.forEach((identifier, nodes) { 280 placeholderCollector.memberPlaceholders.forEach((identifier, nodes) {
281 String newIdentifier = conservativeGenerator( 281 String newIdentifier = conservativeGenerator(
282 identifier, usedMemberIdentifiers.contains); 282 identifier, usedMemberIdentifiers.contains);
283 renameNodes(nodes, (_) => newIdentifier); 283 renameNodes(nodes, (_) => newIdentifier);
284 }); 284 });
285 } 285 }
286 286
287 // Rename constructors. 287 // Rename constructors.
288 placeholderCollector.constructorPlaceholders.forEach( 288 sortedForEach(placeholderCollector.constructorPlaceholders,
289 (Element constructor, List<ConstructorPlaceholder> placeholders) { 289 (Element constructor, List<ConstructorPlaceholder> placeholders) {
290 for (ConstructorPlaceholder ph in placeholders) { 290 for (ConstructorPlaceholder ph in placeholders) {
291 renames[ph.node] = 291 renames[ph.node] =
292 renameConstructor(constructor, ph, rename, renameElement); 292 renameConstructor(constructor, ph, rename, renameElement);
293 } 293 }
294 }); 294 });
295 sortedForEach(placeholderCollector.privateNodes, (library, nodes) { 295 sortedForEach(placeholderCollector.privateNodes, (library, nodes) {
296 renameNodes(nodes, (node) => rename(library, node.source.slowToString())); 296 renameNodes(nodes, (node) => rename(library, node.source.slowToString()));
297 }); 297 });
298 renameNodes(placeholderCollector.unresolvedNodes, 298 renameNodes(placeholderCollector.unresolvedNodes,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 index ~/= firstCharAlphabet.length; 349 index ~/= firstCharAlphabet.length;
350 int length = otherCharsAlphabet.length; 350 int length = otherCharsAlphabet.length;
351 while (index >= length) { 351 while (index >= length) {
352 resultBuilder.add(otherCharsAlphabet[index % length]); 352 resultBuilder.add(otherCharsAlphabet[index % length]);
353 index ~/= length; 353 index ~/= length;
354 } 354 }
355 resultBuilder.add(otherCharsAlphabet[index]); 355 resultBuilder.add(otherCharsAlphabet[index]);
356 return resultBuilder.toString(); 356 return resultBuilder.toString();
357 } 357 }
358 } 358 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/dart_backend_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698