| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 String renameType(DartType type, Function renameElement) { | 89 String renameType(DartType type, Function renameElement) { |
| 90 if (type.isDynamic) return 'dynamic'; | 90 if (type.isDynamic) return 'dynamic'; |
| 91 // TODO(smok): Do not rename type if it is in platform library or | 91 // TODO(smok): Do not rename type if it is in platform library or |
| 92 // js-helpers. | 92 // js-helpers. |
| 93 StringBuffer result = new StringBuffer(renameElement(type.element)); | 93 StringBuffer result = new StringBuffer(renameElement(type.element)); |
| 94 if (type is GenericType && !type.treatAsRaw) { | 94 if (type is GenericType && !type.treatAsRaw) { |
| 95 result.write('<'); | 95 result.write('<'); |
| 96 Link<DartType> argumentsLink = type.typeArguments; | 96 List<DartType> arguments = type.typeArguments; |
| 97 result.write(renameType(argumentsLink.head, renameElement)); | 97 result.write(renameType(arguments.first, renameElement)); |
| 98 for (Link<DartType> link = argumentsLink.tail; !link.isEmpty; | 98 for (int index = 1; index < arguments.length; index++) { |
| 99 link = link.tail) { | |
| 100 result.write(','); | 99 result.write(','); |
| 101 result.write(renameType(link.head, renameElement)); | 100 result.write(renameType(arguments[index], renameElement)); |
| 102 } | 101 } |
| 103 result.write('>'); | 102 result.write('>'); |
| 104 } | 103 } |
| 105 return result.toString(); | 104 return result.toString(); |
| 106 } | 105 } |
| 107 | 106 |
| 108 String renameConstructor(Element element, ConstructorPlaceholder placeholder, | 107 String renameConstructor(Element element, ConstructorPlaceholder placeholder, |
| 109 Function renameString, Function renameElement) { | 108 Function renameString, Function renameElement) { |
| 110 assert(element.isConstructor); | 109 assert(element.isConstructor); |
| 111 StringBuffer result = new StringBuffer(); | 110 StringBuffer result = new StringBuffer(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 MinifyingGenerator(); | 354 MinifyingGenerator(); |
| 356 | 355 |
| 357 String generate(bool isForbidden(String name)) { | 356 String generate(bool isForbidden(String name)) { |
| 358 String result; | 357 String result; |
| 359 do { | 358 do { |
| 360 result = generateMiniId(index++); | 359 result = generateMiniId(index++); |
| 361 } while (isForbidden(result)); | 360 } while (isForbidden(result)); |
| 362 return result; | 361 return result; |
| 363 } | 362 } |
| 364 } | 363 } |
| OLD | NEW |