Better fix for class object's visibility problem
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
@@ -31,23 +30,12 @@ abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclar
|
||||
super(node);
|
||||
}
|
||||
|
||||
//TODO: code duplication with JetDeclarationStub
|
||||
@Override
|
||||
@Nullable
|
||||
public JetModifierList getModifierList() {
|
||||
PsiElement parent = getParent();
|
||||
if (isClassObject(parent)) {
|
||||
assert parent instanceof JetDeclaration;
|
||||
return ((JetDeclaration)parent).getModifierList();
|
||||
}
|
||||
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
|
||||
private static boolean isClassObject(@NotNull PsiElement parent) {
|
||||
return parent.getNode().getElementType().equals(JetNodeTypes.CLASS_OBJECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasModifier(JetToken modifier) {
|
||||
JetModifierList modifierList = getModifierList();
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,23 +36,12 @@ abstract class JetDeclarationStub<T extends StubElement> extends JetElementImplS
|
||||
super(node);
|
||||
}
|
||||
|
||||
//TODO: code duplication with JetDeclarationImpl
|
||||
@Override
|
||||
@Nullable
|
||||
public JetModifierList getModifierList() {
|
||||
PsiElement parent = getParent();
|
||||
if (isClassObject(parent)) {
|
||||
assert parent instanceof JetDeclaration;
|
||||
return ((JetDeclaration)parent).getModifierList();
|
||||
}
|
||||
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
|
||||
private static boolean isClassObject(@NotNull PsiElement parent) {
|
||||
return parent.getNode().getElementType().equals(JetNodeTypes.CLASS_OBJECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasModifier(JetToken modifier) {
|
||||
JetModifierList modifierList = getModifierList();
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetObjectStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lexer.JetToken;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -86,11 +87,34 @@ public class JetObjectDeclaration extends JetNamedDeclarationStub<PsiJetObjectSt
|
||||
return nameAsDeclaration == null ? null : nameAsDeclaration.setName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetObjectDeclarationName getNameAsDeclaration() {
|
||||
return (JetObjectDeclarationName) findChildByType(JetNodeTypes.OBJECT_DECLARATION_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetModifierList getModifierList() {
|
||||
PsiElement parent = getParent();
|
||||
if (isClassObject(parent)) {
|
||||
assert parent instanceof JetDeclaration;
|
||||
return ((JetDeclaration)parent).getModifierList();
|
||||
}
|
||||
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
|
||||
private static boolean isClassObject(@NotNull PsiElement parent) {
|
||||
return parent.getNode().getElementType().equals(JetNodeTypes.CLASS_OBJECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasModifier(JetToken modifier) {
|
||||
JetModifierList modifierList = getModifierList();
|
||||
return modifierList != null && modifierList.hasModifier(modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetDelegationSpecifierList getDelegationSpecifierList() {
|
||||
|
||||
Reference in New Issue
Block a user