| 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 abstract class Renamable implements Comparable { | 10 abstract class Renamable implements Comparable { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 String _renameConstructor(ConstructorPlaceholder placeholder) { | 129 String _renameConstructor(ConstructorPlaceholder placeholder) { |
| 130 String name = placeholder.element.name; | 130 String name = placeholder.element.name; |
| 131 if (name == '') return ""; | 131 if (name == '') return ""; |
| 132 String result = _renameGlobal(placeholder.element); | 132 String result = _renameGlobal(placeholder.element); |
| 133 return result; | 133 return result; |
| 134 } | 134 } |
| 135 | 135 |
| 136 String _renameGlobal(Entity entity) { | 136 String _renameGlobal(Entity entity) { |
| 137 assert(entity is! Element || | 137 assert(entity is! Element || |
| 138 Elements.isErroneous(entity) || | 138 Elements.isMalformed(entity) || |
| 139 Elements.isStaticOrTopLevel(entity) || | 139 Elements.isStaticOrTopLevel(entity) || |
| 140 entity is TypeVariableElement); | 140 entity is TypeVariableElement); |
| 141 // TODO(smok): We may want to reuse class static field and method names. | 141 // TODO(smok): We may want to reuse class static field and method names. |
| 142 if (entity is Element) { | 142 if (entity is Element) { |
| 143 LibraryElement library = entity.library; | 143 LibraryElement library = entity.library; |
| 144 if (reexportingLibraries.containsKey(entity)) { | 144 if (reexportingLibraries.containsKey(entity)) { |
| 145 library = reexportingLibraries[entity]; | 145 library = reexportingLibraries[entity]; |
| 146 } | 146 } |
| 147 if (library.isPlatformLibrary) { | 147 if (library.isPlatformLibrary) { |
| 148 // TODO(johnniwinther): Handle prefixes for dart:core. | 148 // TODO(johnniwinther): Handle prefixes for dart:core. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 MinifyingGenerator(); | 366 MinifyingGenerator(); |
| 367 | 367 |
| 368 String generate(String originalName, bool isForbidden(String name)) { | 368 String generate(String originalName, bool isForbidden(String name)) { |
| 369 String result; | 369 String result; |
| 370 do { | 370 do { |
| 371 result = generateMiniId(index++); | 371 result = generateMiniId(index++); |
| 372 } while (isForbidden(result)); | 372 } while (isForbidden(result)); |
| 373 return result; | 373 return result; |
| 374 } | 374 } |
| 375 } | 375 } |
| OLD | NEW |