예제 #1
0
    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);
    }
예제 #2
0
 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;
 }