@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); }
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; }
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; }
static boolean containsAnnotation( DeclarationDescriptor descriptor, FqName annotationClassFqName) { return descriptor.getOriginal().getAnnotations().findAnnotation(annotationClassFqName) != null; }