30
30
import org .jetbrains .jet .lang .types .lang .KotlinBuiltIns ;
31
31
32
32
import java .util .Collections ;
33
- import java .util .HashSet ;
34
33
import java .util .List ;
35
34
36
35
// SCRIPT: Script declaration descriptor
@@ -48,7 +47,7 @@ public class ScriptDescriptorImpl extends DeclarationDescriptorNonRootImpl imple
48
47
KotlinBuiltIns .getInstance ().getAnyType (),
49
48
new ScriptReceiver (this ));
50
49
51
- private final ClassDescriptorImpl classDescriptor ;
50
+ private final MutableClassDescriptor classDescriptor ;
52
51
53
52
private final WritableScopeImpl classScope ;
54
53
private WritableScope scopeForBodyResolution ;
@@ -62,11 +61,16 @@ public ScriptDescriptorImpl(
62
61
super (containingDeclaration , Annotations .EMPTY , NAME );
63
62
this .priority = priority ;
64
63
65
- classDescriptor = new ClassDescriptorImpl (containingDeclaration , className , Modality .FINAL ,
66
- Collections .singleton (KotlinBuiltIns .getInstance ().getAnyType ()));
67
- classScope = new WritableScopeImpl (scriptScope , containingDeclaration , RedeclarationHandler .DO_NOTHING , "script members" );
64
+ classDescriptor = new MutableClassDescriptor (containingDeclaration , scriptScope , ClassKind .CLASS , false , className );
65
+ classDescriptor .addSupertype (KotlinBuiltIns .getInstance ().getAnyType ());
66
+ classDescriptor .setModality (Modality .FINAL );
67
+ classDescriptor .setVisibility (Visibilities .PUBLIC );
68
+ classDescriptor .setTypeParameterDescriptors (Collections .<TypeParameterDescriptor >emptyList ());
69
+
70
+ classScope = new WritableScopeImpl (JetScope .EMPTY , classDescriptor , RedeclarationHandler .DO_NOTHING , "script members" );
68
71
classScope .changeLockLevel (WritableScope .LockLevel .BOTH );
69
- classDescriptor .initialize (classScope , new HashSet <ConstructorDescriptor >(), null );
72
+ classDescriptor .setScopeForMemberLookup (classScope );
73
+ classDescriptor .createTypeConstructor ();
70
74
}
71
75
72
76
public void initialize (
0 commit comments