public ErrorClassDescriptor(@Nullable String name) { super( getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"), Modality.OPEN, Collections.<JetType>emptyList(), SourceElement.NO_SOURCE); ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true, SourceElement.NO_SOURCE); errorConstructor.initialize( Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(), Visibilities.INTERNAL); JetScope memberScope = createErrorScope(getName().asString()); errorConstructor.setReturnType( new ErrorTypeImpl( TypeConstructorImpl.createForClass( this, Annotations.EMPTY, false, getName().asString(), Collections.<TypeParameterDescriptorImpl>emptyList(), Collections.singleton(KotlinBuiltIns.getInstance().getAnyType())), memberScope)); initialize( memberScope, Collections.<ConstructorDescriptor>singleton(errorConstructor), errorConstructor); }
public static ConstructorDescriptor createErrorConstructor( int typeParameterCount, List<JetType> positionedValueParameterTypes) { ConstructorDescriptorImpl r = new ConstructorDescriptorImpl( ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), false); r.initialize( Collections.<TypeParameterDescriptor>emptyList(), // TODO Collections.<ValueParameterDescriptor>emptyList(), // TODO Visibilities.INTERNAL); r.setReturnType(createErrorType("<ERROR RETURN TYPE>")); return r; }
public void createTypeConstructor() { assert typeConstructor == null : typeConstructor; this.typeConstructor = TypeConstructorImpl.createForClass( this, Annotations.EMPTY, // TODO : pass annotations from the class? !getModality().isOverridable(), getName().asString(), typeParameters, supertypes); for (FunctionDescriptor functionDescriptor : getConstructors()) { ((ConstructorDescriptorImpl) functionDescriptor).setReturnType(getDefaultType()); } scopeForMemberResolution.setImplicitReceiver(getThisAsReceiverParameter()); }
public void setPrimaryConstructor(@NotNull ConstructorDescriptor constructorDescriptor) { assert primaryConstructor == null : "Primary constructor assigned twice " + this; primaryConstructor = constructorDescriptor; constructors.add(constructorDescriptor); ((ConstructorDescriptorImpl) constructorDescriptor) .setReturnType( new DelegatingType() { @Override protected JetType getDelegate() { return getDefaultType(); } }); if (constructorDescriptor.isPrimary()) { setUpScopeForInitializers(constructorDescriptor); } }