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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 Function makeElementRenamer(rename, generateUniqueName) => (element) { | 136 Function makeElementRenamer(rename, generateUniqueName) => (element) { |
137 assert(Elements.isStaticOrTopLevel(element) | 137 assert(Elements.isStaticOrTopLevel(element) |
138 || element is TypeVariableElement); | 138 || element is TypeVariableElement); |
139 // TODO(smok): We may want to reuse class static field and method names. | 139 // TODO(smok): We may want to reuse class static field and method names. |
140 String originalName = element.name.slowToString(); | 140 String originalName = element.name.slowToString(); |
141 LibraryElement library = element.getLibrary(); | 141 LibraryElement library = element.getLibrary(); |
142 if (identical(element.getLibrary(), compiler.coreLibrary)) { | 142 if (identical(element.getLibrary(), compiler.coreLibrary)) { |
143 return originalName; | 143 return originalName; |
144 } | 144 } |
145 if (library.isPlatformLibrary) { | 145 if (library.isPlatformLibrary && !library.isInternalLibrary) { |
146 assert(element.isTopLevel()); | 146 assert(element.isTopLevel()); |
147 final prefix = | 147 final prefix = |
148 imports.putIfAbsent(library, () => generateUniqueName('p')); | 148 imports.putIfAbsent(library, () => generateUniqueName('p')); |
149 return '$prefix.$originalName'; | 149 return '$prefix.$originalName'; |
150 } | 150 } |
151 | 151 |
152 return rename(library, originalName); | 152 return rename(library, originalName); |
153 }; | 153 }; |
154 | 154 |
155 Function makeRenamer(generateUniqueName) => | 155 Function makeRenamer(generateUniqueName) => |
(...skipping 193 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 |