Esempio n. 1
0
 @Nullable
 protected JsExpression getAliasForDescriptor(
     @NotNull DeclarationDescriptor descriptor, boolean fromChild) {
   JsExpression alias =
       aliasesForDescriptors == null ? null : aliasesForDescriptors.get(descriptor.getOriginal());
   return alias != null || parent == null ? alias : parent.getAliasForDescriptor(descriptor, true);
 }
Esempio n. 2
0
 private static boolean isSameClass(
     @NotNull KotlinType type, @NotNull DeclarationDescriptor other) {
   DeclarationDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
   if (descriptor != null) {
     DeclarationDescriptor originalDescriptor = descriptor.getOriginal();
     if (originalDescriptor instanceof ClassifierDescriptor
         && other instanceof ClassifierDescriptor
         && ((ClassifierDescriptor) other)
             .getTypeConstructor()
             .equals(((ClassifierDescriptor) originalDescriptor).getTypeConstructor())) {
       return true;
     }
   }
   return false;
 }
Esempio n. 3
0
  private static boolean containsAnnotation(
      DeclarationDescriptor descriptor, FqName annotationClassFqName) {
    DeclarationDescriptor original = descriptor.getOriginal();
    Annotations annotations = original.getAnnotations();

    if (annotations.findAnnotation(annotationClassFqName) != null) return true;

    AnnotationUseSiteTarget associatedUseSiteTarget =
        AnnotationUseSiteTarget.Companion.getAssociatedUseSiteTarget(descriptor);
    if (associatedUseSiteTarget != null) {
      if (Annotations.Companion.findUseSiteTargetedAnnotation(
              annotations, associatedUseSiteTarget, annotationClassFqName)
          != null) {
        return true;
      }
    }

    return false;
  }
Esempio n. 4
0
 static boolean containsAnnotation(
     DeclarationDescriptor descriptor, FqName annotationClassFqName) {
   return descriptor.getOriginal().getAnnotations().findAnnotation(annotationClassFqName) != null;
 }