Fix a bug which caused class object's visibility to be ignored
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.jet.lang.psi;
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.JetNodeTypes;
|
import org.jetbrains.jet.JetNodeTypes;
|
||||||
@@ -33,9 +34,19 @@ abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclar
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetModifierList getModifierList() {
|
public JetModifierList getModifierList() {
|
||||||
|
PsiElement parent = getParent();
|
||||||
|
if (isClassObject(parent)) {
|
||||||
|
assert parent instanceof JetDeclaration;
|
||||||
|
return ((JetDeclaration)parent).getModifierList();
|
||||||
|
}
|
||||||
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isClassObject(@NotNull PsiElement parent) {
|
||||||
|
return parent.getNode().getElementType().equals(JetNodeTypes.CLASS_OBJECT);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasModifier(JetToken modifier) {
|
public boolean hasModifier(JetToken modifier) {
|
||||||
JetModifierList modifierList = getModifierList();
|
JetModifierList modifierList = getModifierList();
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
A.d
|
||||||
|
A.<!INVISIBLE_MEMBER!>f<!>
|
||||||
|
B.<!INVISIBLE_MEMBER!>c<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
class A() {
|
||||||
|
public class object {
|
||||||
|
val d = 3
|
||||||
|
private object f {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B() {
|
||||||
|
private class object {
|
||||||
|
val c = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user