Minor, strip package name from class for script
This is done to be able to construct a FqName of this class. Currently it's not possible because the name contains '/' and FqName validation fails. This name is only used for debugging and even the ClassDescriptor is used only as a key in binding context to store the internal name of the script class
This commit is contained in:
@@ -142,8 +142,9 @@ public class CodegenBinding {
|
|||||||
@NotNull ScriptDescriptor scriptDescriptor,
|
@NotNull ScriptDescriptor scriptDescriptor,
|
||||||
@NotNull Type asmType
|
@NotNull Type asmType
|
||||||
) {
|
) {
|
||||||
|
String simpleName = asmType.getInternalName().substring(asmType.getInternalName().lastIndexOf('/') + 1);
|
||||||
ClassDescriptorImpl classDescriptor =
|
ClassDescriptorImpl classDescriptor =
|
||||||
new ClassDescriptorImpl(scriptDescriptor, Name.special("<script-" + asmType.getInternalName() + ">"), Modality.FINAL,
|
new ClassDescriptorImpl(scriptDescriptor, Name.special("<script-" + simpleName + ">"), Modality.FINAL,
|
||||||
Collections.singleton(KotlinBuiltIns.getInstance().getAnyType()), SourceElement.NO_SOURCE);
|
Collections.singleton(KotlinBuiltIns.getInstance().getAnyType()), SourceElement.NO_SOURCE);
|
||||||
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);
|
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user