Stubs - Extract interface for JetDeclaration
This commit is contained in:
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
*/
|
*/
|
||||||
public class JetClassInitializer extends JetDeclaration implements JetStatementExpression {
|
public class JetClassInitializer extends JetDeclarationImpl implements JetStatementExpression {
|
||||||
public JetClassInitializer(@NotNull ASTNode node) {
|
public JetClassInitializer(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
|||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
*/
|
*/
|
||||||
public class JetClassObject extends JetDeclaration implements JetStatementExpression {
|
public class JetClassObject extends JetDeclarationImpl implements JetStatementExpression {
|
||||||
public JetClassObject(@NotNull ASTNode node) {
|
public JetClassObject(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,29 +16,17 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.psi;
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.JetNodeTypes;
|
|
||||||
import org.jetbrains.jet.lexer.JetToken;
|
import org.jetbrains.jet.lexer.JetToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author max
|
* @author Nikolay Krasko
|
||||||
*/
|
*/
|
||||||
public abstract class JetDeclaration extends JetExpressionImpl implements JetModifierListOwner {
|
public interface JetDeclaration extends JetExpression, JetModifierListOwner {
|
||||||
public JetDeclaration(@NotNull ASTNode node) {
|
|
||||||
super(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetModifierList getModifierList() {
|
JetModifierList getModifierList();
|
||||||
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasModifier(JetToken modifier) {
|
boolean hasModifier(JetToken modifier);
|
||||||
JetModifierList modifierList = getModifierList();
|
|
||||||
return modifierList != null && modifierList.hasModifier(modifier);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.JetNodeTypes;
|
||||||
|
import org.jetbrains.jet.lexer.JetToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
abstract class JetDeclarationImpl extends JetExpressionImpl implements JetDeclaration {
|
||||||
|
public JetDeclarationImpl(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public JetModifierList getModifierList() {
|
||||||
|
return (JetModifierList) findChildByType(JetNodeTypes.MODIFIER_LIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasModifier(JetToken modifier) {
|
||||||
|
JetModifierList modifierList = getModifierList();
|
||||||
|
return modifierList != null && modifierList.hasModifier(modifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ public final class JetModifiableBlockHelper {
|
|||||||
* Tested in OutOfBlockModificationTest
|
* Tested in OutOfBlockModificationTest
|
||||||
*/
|
*/
|
||||||
public static boolean shouldChangeModificationCount(PsiElement place) {
|
public static boolean shouldChangeModificationCount(PsiElement place) {
|
||||||
JetDeclaration declaration = PsiTreeUtil.getParentOfType(place, JetDeclaration.class, true);
|
JetDeclaration declaration = PsiTreeUtil.getParentOfType(place, JetDeclarationImpl.class, true);
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
if (declaration instanceof JetNamedFunction) {
|
if (declaration instanceof JetNamedFunction) {
|
||||||
JetNamedFunction function = (JetNamedFunction) declaration;
|
JetNamedFunction function = (JetNamedFunction) declaration;
|
||||||
@@ -61,7 +61,7 @@ public final class JetModifiableBlockHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean takePartInDeclarationTypeInference(PsiElement place) {
|
private static boolean takePartInDeclarationTypeInference(PsiElement place) {
|
||||||
JetDeclaration declaration = PsiTreeUtil.getParentOfType(place, JetDeclaration.class, true);
|
JetDeclaration declaration = PsiTreeUtil.getParentOfType(place, JetDeclarationImpl.class, true);
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
if (declaration instanceof JetNamedFunction) {
|
if (declaration instanceof JetNamedFunction) {
|
||||||
JetNamedFunction function = (JetNamedFunction) declaration;
|
JetNamedFunction function = (JetNamedFunction) declaration;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
|||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
*/
|
*/
|
||||||
public abstract class JetNamedDeclaration extends JetDeclaration implements PsiNameIdentifierOwner, JetStatementExpression, JetNamed {
|
public abstract class JetNamedDeclaration extends JetDeclarationImpl implements PsiNameIdentifierOwner, JetStatementExpression, JetNamed {
|
||||||
public JetNamedDeclaration(@NotNull ASTNode node) {
|
public JetNamedDeclaration(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
*/
|
*/
|
||||||
public class JetPropertyAccessor extends JetDeclaration implements JetDeclarationWithBody, JetModifierListOwner {
|
public class JetPropertyAccessor extends JetDeclarationImpl implements JetDeclarationWithBody, JetModifierListOwner {
|
||||||
public JetPropertyAccessor(@NotNull ASTNode node) {
|
public JetPropertyAccessor(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author Stepan Koltsov
|
* @author Stepan Koltsov
|
||||||
*/
|
*/
|
||||||
public class JetScript extends JetDeclaration {
|
public class JetScript extends JetDeclarationImpl {
|
||||||
|
|
||||||
public JetScript(@NotNull ASTNode node) {
|
public JetScript(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
*/
|
*/
|
||||||
public class JetSecondaryConstructor extends JetDeclaration implements JetDeclarationWithBody, JetStatementExpression {
|
public class JetSecondaryConstructor extends JetDeclarationImpl implements JetDeclarationWithBody, JetStatementExpression {
|
||||||
public JetSecondaryConstructor(@NotNull ASTNode node) {
|
public JetSecondaryConstructor(@NotNull ASTNode node) {
|
||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user