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:
Alexander Udalov
2014-09-18 14:27:17 +04:00
parent 4cb9fbc026
commit 806d79caba
@@ -142,8 +142,9 @@ public class CodegenBinding {
@NotNull ScriptDescriptor scriptDescriptor,
@NotNull Type asmType
) {
String simpleName = asmType.getInternalName().substring(asmType.getInternalName().lastIndexOf('/') + 1);
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);
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);