Chromium Code Reviews| 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 Comparator get _compareNodes => | 7 Comparator 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 sortedForEach(Map<Element, dynamic> map, f) { | 81 sortedForEach(Map<Element, dynamic> map, f) { |
| 82 for (Element element in sortElements(map.keys)) { | 82 for (Element element in sortElements(map.keys)) { |
| 83 f(element, map[element]); | 83 f(element, map[element]); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 String renameType(DartType type, Function renameElement) { | 87 String renameType(DartType type, Function renameElement) { |
| 88 // TODO(smok): Do not rename type if it is in platform library or | 88 // TODO(smok): Do not rename type if it is in platform library or |
| 89 // js-helpers. | 89 // js-helpers. |
| 90 StringBuffer result = new StringBuffer(renameElement(type.element)); | 90 StringBuffer result = new StringBuffer(renameElement(type.element)); |
| 91 if (type is InterfaceType) { | 91 if (type is GenericType) { |
|
karlklose
2013/12/20 07:43:20
Merge the two if-s.
Johnni Winther
2013/12/20 10:14:37
Done.
| |
| 92 InterfaceType interfaceType = type; | 92 if (!type.treatAsRaw) { |
| 93 if (!interfaceType.treatAsRaw) { | |
| 94 result.write('<'); | 93 result.write('<'); |
| 95 Link<DartType> argumentsLink = interfaceType.typeArguments; | 94 Link<DartType> argumentsLink = type.typeArguments; |
| 96 result.write(renameType(argumentsLink.head, renameElement)); | 95 result.write(renameType(argumentsLink.head, renameElement)); |
| 97 for (Link<DartType> link = argumentsLink.tail; !link.isEmpty; | 96 for (Link<DartType> link = argumentsLink.tail; !link.isEmpty; |
| 98 link = link.tail) { | 97 link = link.tail) { |
| 99 result.write(','); | 98 result.write(','); |
| 100 result.write(renameType(link.head, renameElement)); | 99 result.write(renameType(link.head, renameElement)); |
| 101 } | 100 } |
| 102 result.write('>'); | 101 result.write('>'); |
| 103 } | 102 } |
| 104 } | 103 } |
| 105 return result.toString(); | 104 return result.toString(); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 MinifyingGenerator(); | 349 MinifyingGenerator(); |
| 351 | 350 |
| 352 String generate(bool isForbidden(String name)) { | 351 String generate(bool isForbidden(String name)) { |
| 353 String result; | 352 String result; |
| 354 do { | 353 do { |
| 355 result = generateMiniId(index++); | 354 result = generateMiniId(index++); |
| 356 } while (isForbidden(result)); | 355 } while (isForbidden(result)); |
| 357 return result; | 356 return result; |
| 358 } | 357 } |
| 359 } | 358 } |
| OLD | NEW |