public static void registerClassNameForScript(
      BindingTrace bindingTrace,
      @NotNull ScriptDescriptor scriptDescriptor,
      @NotNull JvmClassName className) {
    bindingTrace.record(SCRIPT_NAMES, className);

    ClassDescriptorImpl classDescriptor =
        new ClassDescriptorImpl(
            scriptDescriptor,
            Collections.<AnnotationDescriptor>emptyList(),
            Modality.FINAL,
            Name.special("<script-" + className + ">"));
    classDescriptor.initialize(
        false,
        Collections.<TypeParameterDescriptor>emptyList(),
        Collections.singletonList(KotlinBuiltIns.getInstance().getAnyType()),
        JetScope.EMPTY,
        Collections.<ConstructorDescriptor>emptySet(),
        null,
        false);

    recordClosure(bindingTrace, null, classDescriptor, null, className, false);

    assert PsiCodegenPredictor.checkPredictedClassNameForFun(
        bindingTrace.getBindingContext(), scriptDescriptor, classDescriptor);
    bindingTrace.record(CLASS_FOR_SCRIPT, scriptDescriptor, classDescriptor);
  }
Beispiel #2
0
 static {
   ERROR_CLASS.initialize(
       true,
       Collections.<TypeParameterDescriptor>emptyList(),
       Collections.<JetType>emptyList(),
       createErrorScope("ERROR_CLASS"),
       ERROR_CONSTRUCTOR_GROUP,
       ERROR_CONSTRUCTOR,
       false);
 }
Beispiel #3
0
 public static boolean isError(@NotNull TypeConstructor typeConstructor) {
   return typeConstructor == ERROR_CLASS.getTypeConstructor();
 }