Support static class scope in frontend, JVM codegen and IDE
This commit is contained in:
+10
-9
@@ -77,21 +77,22 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
super.visitParameter(parameter);
|
||||
}
|
||||
|
||||
private void highlightProperty(@NotNull PsiElement elementToHighlight,
|
||||
private void highlightProperty(
|
||||
@NotNull PsiElement elementToHighlight,
|
||||
@NotNull PropertyDescriptor descriptor,
|
||||
boolean withBackingField) {
|
||||
boolean inPackage = DescriptorUtils.isTopLevelDeclaration(descriptor);
|
||||
JetPsiChecker.highlightName(holder, elementToHighlight,
|
||||
inPackage ? JetHighlightingColors.PACKAGE_PROPERTY : JetHighlightingColors.INSTANCE_PROPERTY
|
||||
boolean withBackingField
|
||||
) {
|
||||
boolean isStatic = DescriptorUtils.isStaticDeclaration(descriptor);
|
||||
JetPsiChecker.highlightName(
|
||||
holder, elementToHighlight,
|
||||
isStatic ? JetHighlightingColors.PACKAGE_PROPERTY : JetHighlightingColors.INSTANCE_PROPERTY
|
||||
);
|
||||
if (descriptor.getReceiverParameter() != null) {
|
||||
JetPsiChecker.highlightName(holder, elementToHighlight, JetHighlightingColors.EXTENSION_PROPERTY);
|
||||
}
|
||||
if (withBackingField) {
|
||||
holder.createInfoAnnotation(
|
||||
elementToHighlight,
|
||||
"This property has a backing field")
|
||||
.setTextAttributes(JetHighlightingColors.PROPERTY_WITH_BACKING_FIELD);
|
||||
holder.createInfoAnnotation(elementToHighlight, "This property has a backing field")
|
||||
.setTextAttributes(JetHighlightingColors.PROPERTY_WITH_BACKING_FIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,9 @@ public val DeclarationDescriptor.importableFqNameSafe: FqName
|
||||
get() = DescriptorUtils.getFqNameSafe(getImportableDescriptor())
|
||||
|
||||
public fun DeclarationDescriptor.canBeReferencedViaImport(): Boolean {
|
||||
if (this is PackageViewDescriptor || DescriptorUtils.isTopLevelDeclaration(this)) {
|
||||
if (this is PackageViewDescriptor ||
|
||||
DescriptorUtils.isTopLevelDeclaration(this) ||
|
||||
(this is CallableDescriptor && DescriptorUtils.isStaticDeclaration(this))) {
|
||||
return true
|
||||
}
|
||||
val parent = getContainingDeclaration()!!
|
||||
|
||||
Reference in New Issue
Block a user