Extracted method.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -286,4 +288,10 @@ public class CodegenUtil {
|
||||
|
||||
return ((ImplementationBodyCodegen) classBodyCodegen.getParentCodegen());
|
||||
}
|
||||
|
||||
static int getPathHashCode(@NotNull PsiFile file) {
|
||||
// Conversion to system-dependent name seems to be unnecessary, but it's hard to check now:
|
||||
// it was introduced when fixing KT-2839, which appeared again (KT-3639).
|
||||
return FileUtil.toSystemDependentName(file.getVirtualFile().getPath()).hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,12 +273,9 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
private static String getMultiFileNamespaceInternalName(@NotNull String namespaceInternalName, @NotNull PsiFile file) {
|
||||
String fileName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(file.getName()));
|
||||
|
||||
// Conversion to system-dependent name seems to be unnecessary, but it's hard to check now:
|
||||
// it was introduced when fixing KT-2839, which appeared again (KT-3639).
|
||||
String pathHashCode = Integer.toHexString(FileUtil.toSystemDependentName(file.getVirtualFile().getPath()).hashCode());
|
||||
|
||||
// path hashCode to prevent same name / different path collision
|
||||
return namespaceInternalName + "$src$" + replaceSpecialSymbols(fileName) + "$" + pathHashCode;
|
||||
return namespaceInternalName + "$src$" + replaceSpecialSymbols(fileName) + "$" + Integer.toHexString(
|
||||
CodegenUtil.getPathHashCode(file));
|
||||
}
|
||||
|
||||
private static String replaceSpecialSymbols(@NotNull String str) {
|
||||
|
||||
Reference in New Issue
Block a user