TEST_MODULE_NAME extraction
This commit is contained in:
@@ -479,7 +479,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
@NotNull GenerationState state,
|
||||
@NotNull ClassBuilder classBuilder
|
||||
) {
|
||||
classBuilder.newField(NO_ORIGIN, ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.KOTLIN_MODULE_FIELD_NAME,
|
||||
classBuilder.newField(NO_ORIGIN, ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.MODULE_NAME_FIELD,
|
||||
AsmTypes.JAVA_STRING_TYPE.getDescriptor(), null, state.getModuleName());
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class LazyResolveTestUtil {
|
||||
@NotNull List<JetFile> sourceFiles,
|
||||
@NotNull KotlinCoreEnvironment environment
|
||||
) {
|
||||
ModuleContext moduleContext = TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(project, "test");
|
||||
ModuleContext moduleContext = TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(project, JvmResolveUtil.TEST_MODULE_NAME);
|
||||
|
||||
TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegrationNoIncremental(
|
||||
moduleContext, sourceFiles, trace, TopDownAnalysisMode.TopLevelDeclarations,
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class JvmAbi {
|
||||
|
||||
public static final String KOTLIN_CLASS_FIELD_NAME = "$kotlinClass";
|
||||
public static final String KOTLIN_PACKAGE_FIELD_NAME = "$kotlinPackage";
|
||||
public static final String KOTLIN_MODULE_FIELD_NAME = "$moduleName";
|
||||
public static final String MODULE_NAME_FIELD = "$moduleName";
|
||||
public static final ClassId REFLECTION_FACTORY_IMPL = ClassId.topLevel(new FqName("kotlin.reflect.jvm.internal.ReflectionFactoryImpl"));
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -98,7 +98,7 @@ public val Class<*>.kotlinPackage: KPackage?
|
||||
get() = if (getSimpleName().endsWith("Package") &&
|
||||
getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) {
|
||||
try {
|
||||
val field = this.getField(JvmAbi.KOTLIN_MODULE_FIELD_NAME)
|
||||
val field = this.getField(JvmAbi.MODULE_NAME_FIELD)
|
||||
if (field != null) {
|
||||
KPackageImpl(this, field.get(null) as String)
|
||||
}
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.BindingTraceContext
|
||||
import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
||||
|
||||
@@ -48,7 +49,7 @@ public class DecompiledTextConsistencyTest : TextConsistencyBaseTest() {
|
||||
|
||||
override fun getModuleDescriptor(): ModuleDescriptor =
|
||||
TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegrationWithCustomContext(
|
||||
TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(project, "test"),
|
||||
TopDownAnalyzerFacadeForJVM.createContextWithSealedModule(project, JvmResolveUtil.TEST_MODULE_NAME),
|
||||
listOf(), BindingTraceContext(), null, null,
|
||||
IDEPackagePartProvider(GlobalSearchScope.allScope(project))
|
||||
).moduleDescriptor
|
||||
|
||||
Reference in New Issue
Block a user