OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void renamePlaceholders( | 64 void renamePlaceholders( |
65 Compiler compiler, | 65 Compiler compiler, |
66 PlaceholderCollector placeholderCollector, | 66 PlaceholderCollector placeholderCollector, |
67 Map<Node, String> renames, | 67 Map<Node, String> renames, |
68 Map<LibraryElement, String> imports, | 68 Map<LibraryElement, String> imports, |
69 Set<String> fixedMemberNames, | 69 Set<String> fixedMemberNames, |
70 bool cutDeclarationTypes) { | 70 bool cutDeclarationTypes) { |
71 final Map<LibraryElement, Map<String, String>> renamed | 71 final Map<LibraryElement, Map<String, String>> renamed |
72 = new Map<LibraryElement, Map<String, String>>(); | 72 = new Map<LibraryElement, Map<String, String>>(); |
73 | 73 |
74 renameNodes(Collection<Node> nodes, renamer) { | 74 renameNodes(Iterable<Node> nodes, renamer) { |
75 for (Node node in sorted(nodes, _compareNodes)) { | 75 for (Node node in sorted(nodes, _compareNodes)) { |
76 renames[node] = renamer(node); | 76 renames[node] = renamer(node); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 sortedForEach(Map<Element, dynamic> map, f) { | 80 sortedForEach(Map<Element, dynamic> map, f) { |
81 for (Element element in sortElements(map.keys)) { | 81 for (Element element in sortElements(map.keys)) { |
82 f(element, map[element]); | 82 f(element, map[element]); |
83 } | 83 } |
84 } | 84 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.write(otherCharsAlphabet[index % length]); | 353 resultBuilder.write(otherCharsAlphabet[index % length]); |
354 index ~/= length; | 354 index ~/= length; |
355 } | 355 } |
356 resultBuilder.write(otherCharsAlphabet[index]); | 356 resultBuilder.write(otherCharsAlphabet[index]); |
357 return resultBuilder.toString(); | 357 return resultBuilder.toString(); |
358 } | 358 } |
359 } | 359 } |
OLD | NEW |