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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
85 | 85 |
86 String renameType(DartType type, Function renameElement) { | 86 String renameType(DartType type, Function renameElement) { |
87 // TODO(smok): Do not rename type if it is in platform library or | 87 // TODO(smok): Do not rename type if it is in platform library or |
88 // js-helpers. | 88 // js-helpers. |
89 StringBuffer result = new StringBuffer(renameElement(type.element)); | 89 StringBuffer result = new StringBuffer(renameElement(type.element)); |
90 if (type is InterfaceType) { | 90 if (type is InterfaceType) { |
91 if (!type.typeArguments.isEmpty) { | 91 if (!type.isRaw) { |
92 result.add('<'); | 92 result.add('<'); |
93 Link<DartType> argumentsLink = type.typeArguments; | 93 Link<DartType> argumentsLink = type.typeArguments; |
94 result.add(renameType(argumentsLink.head, renameElement)); | 94 result.add(renameType(argumentsLink.head, renameElement)); |
95 for (Link<DartType> link = argumentsLink.tail; !link.isEmpty; | 95 for (Link<DartType> link = argumentsLink.tail; !link.isEmpty; |
96 link = link.tail) { | 96 link = link.tail) { |
97 result.add(','); | 97 result.add(','); |
98 result.add(renameType(link.head, renameElement)); | 98 result.add(renameType(link.head, renameElement)); |
99 } | 99 } |
100 result.add('>'); | 100 result.add('>'); |
101 } | 101 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |