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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 Function makeElementRenamer(rename, generateUniqueName) => (element) { | 136 Function makeElementRenamer(rename, generateUniqueName) => (element) { |
137 assert(Elements.isErroneousElement(element) || | 137 assert(Elements.isErroneousElement(element) || |
138 Elements.isStaticOrTopLevel(element) || | 138 Elements.isStaticOrTopLevel(element) || |
139 element is TypeVariableElement); | 139 element is TypeVariableElement); |
140 // TODO(smok): We may want to reuse class static field and method names. | 140 // TODO(smok): We may want to reuse class static field and method names. |
141 String originalName = element.name.slowToString(); | 141 String originalName = element.name.slowToString(); |
142 LibraryElement library = element.getLibrary(); | 142 LibraryElement library = element.getLibrary(); |
143 if (identical(element.getLibrary(), compiler.coreLibrary)) { | 143 if (identical(element.getLibrary(), compiler.coreLibrary)) { |
144 return originalName; | 144 return originalName; |
145 } | 145 } |
146 if (library.isPlatformLibrary) { | 146 if (library.isPlatformLibrary && !library.isInternalLibrary) { |
147 assert(element.isTopLevel()); | 147 assert(element.isTopLevel()); |
148 final prefix = | 148 final prefix = |
149 imports.putIfAbsent(library, () => generateUniqueName('p')); | 149 imports.putIfAbsent(library, () => generateUniqueName('p')); |
150 return '$prefix.$originalName'; | 150 return '$prefix.$originalName'; |
151 } | 151 } |
152 | 152 |
153 return rename(library, originalName); | 153 return rename(library, originalName); |
154 }; | 154 }; |
155 | 155 |
156 Function makeRenamer(generateUniqueName) => | 156 Function makeRenamer(generateUniqueName) => |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 index ~/= firstCharAlphabet.length; | 350 index ~/= firstCharAlphabet.length; |
351 int length = otherCharsAlphabet.length; | 351 int length = otherCharsAlphabet.length; |
352 while (index >= length) { | 352 while (index >= length) { |
353 resultBuilder.add(otherCharsAlphabet[index % length]); | 353 resultBuilder.add(otherCharsAlphabet[index % length]); |
354 index ~/= length; | 354 index ~/= length; |
355 } | 355 } |
356 resultBuilder.add(otherCharsAlphabet[index]); | 356 resultBuilder.add(otherCharsAlphabet[index]); |
357 return resultBuilder.toString(); | 357 return resultBuilder.toString(); |
358 } | 358 } |
359 } | 359 } |
OLD | NEW |