Stubs - Extract interface for JetElement and JetExpression (Stub psi element should extend StubBasedPsiElementBase but JetElement extended ASTWrapperPsiElement)
This commit is contained in:
@@ -24,6 +24,7 @@ import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetElementImpl;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
@@ -49,7 +50,7 @@ public class JetNodeType extends IElementType {
|
||||
|
||||
try {
|
||||
if (myPsiFactory == null) {
|
||||
return new JetElement(node);
|
||||
return new JetElementImpl(node);
|
||||
}
|
||||
return myPsiFactory.newInstance(node);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -22,20 +22,19 @@ import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowInstructionsGenerator;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.LocalDeclarationInstruction;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.Pseudocode;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowInstructionsGenerator;
|
||||
import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodeImpl;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.constants.BooleanValue;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstantResolver;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetAnnotatedExpression extends JetExpression {
|
||||
public class JetAnnotatedExpression extends JetExpressionImpl {
|
||||
public JetAnnotatedExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class JetAnnotatedExpression extends JetExpression {
|
||||
|
||||
@Nullable
|
||||
public JetExpression getBaseExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
public List<JetAnnotation> getAttributeAnnotations() {
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetAnnotation extends JetElement {
|
||||
public class JetAnnotation extends JetElementImpl {
|
||||
public JetAnnotation(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetAnnotationEntry extends JetElement implements JetCallElement {
|
||||
public class JetAnnotationEntry extends JetElementImpl implements JetCallElement {
|
||||
public JetAnnotationEntry(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class JetArrayAccessExpression extends JetReferenceExpression {
|
||||
|
||||
@NotNull
|
||||
public JetExpression getArrayExpression() {
|
||||
JetExpression baseExpression = findChildByClass(JetExpression.class);
|
||||
JetExpression baseExpression = findChildByClass(JetExpressionImpl.class);
|
||||
assert baseExpression != null;
|
||||
return baseExpression;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetBinaryExpression extends JetExpression implements JetOperationExpression {
|
||||
public class JetBinaryExpression extends JetExpressionImpl implements JetOperationExpression {
|
||||
public JetBinaryExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class JetBinaryExpression extends JetExpression implements JetOperationEx
|
||||
|
||||
@NotNull
|
||||
public JetExpression getLeft() {
|
||||
JetExpression left = findChildByClass(JetExpression.class);
|
||||
JetExpression left = findChildByClass(JetExpressionImpl.class);
|
||||
assert left != null;
|
||||
return left;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class JetBinaryExpression extends JetExpression implements JetOperationEx
|
||||
ASTNode node = getOperationReference().getNode().getTreeNext();
|
||||
while (node != null) {
|
||||
PsiElement psi = node.getPsi();
|
||||
if (psi instanceof JetExpression) {
|
||||
if (psi instanceof JetExpressionImpl) {
|
||||
return (JetExpression) psi;
|
||||
}
|
||||
node = node.getTreeNext();
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetBinaryExpressionWithTypeRHS extends JetExpression {
|
||||
public class JetBinaryExpressionWithTypeRHS extends JetExpressionImpl {
|
||||
public JetBinaryExpressionWithTypeRHS(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class JetBinaryExpressionWithTypeRHS extends JetExpression {
|
||||
|
||||
@NotNull
|
||||
public JetExpression getLeft() {
|
||||
JetExpression left = findChildByClass(JetExpression.class);
|
||||
JetExpression left = findChildByClass(JetExpressionImpl.class);
|
||||
assert left != null;
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetBlockExpression extends JetExpression implements JetStatementExpression, PsiModifiableCodeBlock {
|
||||
public class JetBlockExpression extends JetExpressionImpl implements JetStatementExpression, PsiModifiableCodeBlock {
|
||||
public JetBlockExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetCallExpression extends JetExpression implements JetCallElement {
|
||||
public class JetCallExpression extends JetExpressionImpl implements JetCallElement {
|
||||
public JetCallExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class JetCallExpression extends JetExpression implements JetCallElement {
|
||||
@Override
|
||||
@Nullable
|
||||
public JetExpression getCalleeExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetCatchClause extends JetElement {
|
||||
public class JetCatchClause extends JetElementImpl {
|
||||
public JetCatchClause(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -57,6 +57,6 @@ public class JetCatchClause extends JetElement {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getCatchBody() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ public class JetClass extends JetTypeParameterListOwner
|
||||
public JetClass(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
// TODO (stubs)
|
||||
// public JetClass(final PsiJetClassStub stub) {
|
||||
// this.stub = stub;
|
||||
// }
|
||||
|
||||
//public JetClass(@NotNull final PsiJetClassStub stub) {
|
||||
// this.stub = stub;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public List<JetDeclaration> getDeclarations() {
|
||||
@@ -237,4 +237,9 @@ public class JetClass extends JetTypeParameterListOwner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public ItemPresentation getPresentation() {
|
||||
// return ItemPresentationProviders.getItemPresentation(this);
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetClassBody extends JetElement implements JetDeclarationContainer {
|
||||
public class JetClassBody extends JetElementImpl implements JetDeclarationContainer {
|
||||
public JetClassBody(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class JetClassInitializer extends JetDeclaration implements JetStatementE
|
||||
|
||||
@NotNull
|
||||
public JetExpression getBody() {
|
||||
JetExpression body = findChildByClass(JetExpression.class);
|
||||
JetExpression body = findChildByClass(JetExpressionImpl.class);
|
||||
assert body != null;
|
||||
return body;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetConstantExpression extends JetExpression {
|
||||
public class JetConstantExpression extends JetExpressionImpl {
|
||||
public JetConstantExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetConstructorCalleeExpression extends JetExpression {
|
||||
public class JetConstructorCalleeExpression extends JetExpressionImpl {
|
||||
public JetConstructorCalleeExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetContainerNode extends JetElement {
|
||||
public class JetContainerNode extends JetElementImpl {
|
||||
public JetContainerNode(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lexer.JetToken;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public abstract class JetDeclaration extends JetExpression implements JetModifierListOwner {
|
||||
public abstract class JetDeclaration extends JetExpressionImpl implements JetModifierListOwner {
|
||||
public JetDeclaration(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class JetDecomposerPattern extends JetPattern {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getDecomposerExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetDelegationSpecifier extends JetElement{
|
||||
public class JetDelegationSpecifier extends JetElementImpl {
|
||||
public JetDelegationSpecifier(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetDelegationSpecifierList extends JetElement {
|
||||
public class JetDelegationSpecifierList extends JetElementImpl {
|
||||
public JetDelegationSpecifierList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,6 +40,6 @@ public class JetDelegatorByExpressionSpecifier extends JetDelegationSpecifier {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getDelegateExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +1,15 @@
|
||||
/*
|
||||
* 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.extapi.psi.ASTWrapperPsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.NavigatablePsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author Nikolay Krasko
|
||||
*/
|
||||
public class JetElement extends ASTWrapperPsiElement {
|
||||
public JetElement(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
public interface JetElement extends NavigatablePsiElement {
|
||||
<D> void acceptChildren(@NotNull JetTreeVisitor<D> visitor, D data);
|
||||
|
||||
/**
|
||||
* Comes along with @Nullable to indicate null is only possible if parsing error present
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface IfNotParsed {}
|
||||
void accept(@NotNull JetVisitorVoid visitor);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getNode().getElementType().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JetVisitorVoid) {
|
||||
accept((JetVisitorVoid) visitor);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
public <D> void acceptChildren(@NotNull JetTreeVisitor<D> visitor, D data) {
|
||||
PsiElement child = getFirstChild();
|
||||
while (child != null) {
|
||||
if (child instanceof JetElement) {
|
||||
((JetElement) child).accept(visitor, data);
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(@NotNull JetVisitorVoid visitor) {
|
||||
visitor.visitJetElement(this);
|
||||
}
|
||||
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitJetElement(this, data);
|
||||
}
|
||||
<R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.extapi.psi.ASTWrapperPsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetElementImpl extends ASTWrapperPsiElement implements JetElement {
|
||||
public JetElementImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Comes along with @Nullable to indicate null is only possible if parsing error present
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface IfNotParsed {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getNode().getElementType().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JetVisitorVoid) {
|
||||
accept((JetVisitorVoid) visitor);
|
||||
}
|
||||
else {
|
||||
visitor.visitElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <D> void acceptChildren(@NotNull JetTreeVisitor<D> visitor, D data) {
|
||||
PsiElement child = getFirstChild();
|
||||
while (child != null) {
|
||||
if (child instanceof JetElementImpl) {
|
||||
((JetElement) child).accept(visitor, data);
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull JetVisitorVoid visitor) {
|
||||
visitor.visitJetElement(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitJetElement(this, data);
|
||||
}
|
||||
}
|
||||
@@ -16,32 +16,16 @@
|
||||
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.NavigatablePsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetNodeType;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
* @author Nikolay Krasko
|
||||
*/
|
||||
public abstract class JetExpression extends JetElement {
|
||||
public JetExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
public interface JetExpression extends NavigatablePsiElement, JetElement {
|
||||
@Override
|
||||
void accept(@NotNull JetVisitorVoid visitor);
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull JetVisitorVoid visitor) {
|
||||
visitor.visitExpression(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitExpression(this, data);
|
||||
}
|
||||
|
||||
protected JetExpression findExpressionUnder(JetNodeType type) {
|
||||
JetContainerNode containerNode = (JetContainerNode) findChildByType(type);
|
||||
if (containerNode == null) return null;
|
||||
|
||||
return containerNode.findChildByClass(JetExpression.class);
|
||||
}
|
||||
<R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.jet.JetNodeType;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
abstract class JetExpressionImpl extends JetElementImpl implements JetExpression {
|
||||
public JetExpressionImpl(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull JetVisitorVoid visitor) {
|
||||
visitor.visitExpression(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitExpression(this, data);
|
||||
}
|
||||
|
||||
protected JetExpression findExpressionUnder(JetNodeType type) {
|
||||
JetContainerNode containerNode = (JetContainerNode) findChildByType(type);
|
||||
if (containerNode == null) return null;
|
||||
|
||||
return containerNode.findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class JetExpressionPattern extends JetPattern {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetFinallySection extends JetElement {
|
||||
public class JetFinallySection extends JetElementImpl {
|
||||
public JetFinallySection(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ abstract public class JetFunction extends JetTypeParameterListOwner
|
||||
@Override
|
||||
@Nullable
|
||||
public JetExpression getBodyExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetFunctionLiteralExpression extends JetExpression implements JetDeclarationWithBody {
|
||||
public class JetFunctionLiteralExpression extends JetExpressionImpl implements JetDeclarationWithBody {
|
||||
public JetFunctionLiteralExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
* @author Evgeny Gerashchenko
|
||||
* @since 2/8/12
|
||||
*/
|
||||
public class JetIdeTemplateExpression extends JetExpression {
|
||||
public class JetIdeTemplateExpression extends JetExpressionImpl {
|
||||
public JetIdeTemplateExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetIfExpression extends JetExpression {
|
||||
public class JetIfExpression extends JetExpressionImpl {
|
||||
public JetIfExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetImportDirective extends JetElement {
|
||||
public class JetImportDirective extends JetElementImpl {
|
||||
public JetImportDirective(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class JetImportDirective extends JetElement {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getImportedReference() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetInitializerList extends JetElement {
|
||||
public class JetInitializerList extends JetElementImpl {
|
||||
public JetInitializerList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetIsExpression extends JetExpression {
|
||||
public class JetIsExpression extends JetExpressionImpl {
|
||||
public JetIsExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class JetIsExpression extends JetExpression {
|
||||
|
||||
@NotNull
|
||||
public JetExpression getLeftHandSide() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
|
||||
@@ -20,12 +20,11 @@ import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetLabelQualifiedExpression extends JetExpression {
|
||||
public class JetLabelQualifiedExpression extends JetExpressionImpl {
|
||||
|
||||
public JetLabelQualifiedExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
@@ -40,7 +39,7 @@ public class JetLabelQualifiedExpression extends JetExpression {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getLabeledExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public abstract class JetLoopExpression extends JetExpression implements JetStatementExpression {
|
||||
public abstract class JetLoopExpression extends JetExpressionImpl implements JetStatementExpression {
|
||||
public JetLoopExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetModifierList extends JetElement {
|
||||
public class JetModifierList extends JetElementImpl {
|
||||
public JetModifierList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetNamespaceBody extends JetElement implements JetDeclarationContainer {
|
||||
public class JetNamespaceBody extends JetElementImpl implements JetDeclarationContainer {
|
||||
public JetNamespaceBody(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetObjectLiteralExpression extends JetExpression {
|
||||
public class JetObjectLiteralExpression extends JetExpressionImpl {
|
||||
public JetObjectLiteralExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class JetParameter extends JetNamedDeclaration {
|
||||
ASTNode child = getNode().getFirstChildNode();
|
||||
while (child != null) {
|
||||
if (child.getElementType() == JetTokens.EQ) passedEQ = true;
|
||||
if (passedEQ && child.getPsi() instanceof JetExpression) {
|
||||
if (passedEQ && child.getPsi() instanceof JetExpressionImpl) {
|
||||
return (JetExpression) child.getPsi();
|
||||
}
|
||||
child = child.getTreeNext();
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetParameterList extends JetElement {
|
||||
public class JetParameterList extends JetElementImpl {
|
||||
public JetParameterList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetParenthesizedExpression extends JetExpression {
|
||||
public class JetParenthesizedExpression extends JetExpressionImpl {
|
||||
public JetParenthesizedExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -40,6 +40,6 @@ public class JetParenthesizedExpression extends JetExpression {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetPattern extends JetElement {
|
||||
public class JetPattern extends JetElementImpl {
|
||||
public JetPattern(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class JetPostfixExpression extends JetUnaryExpression {
|
||||
|
||||
@NotNull
|
||||
public JetExpression getBaseExpression() {
|
||||
JetExpression answer = findChildByClass(JetExpression.class);
|
||||
JetExpression answer = findChildByClass(JetExpressionImpl.class);
|
||||
assert answer != null;
|
||||
return answer;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class JetPrefixExpression extends JetUnaryExpression {
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getBaseExpression() {
|
||||
PsiElement expression = getOperationReference().getNextSibling();
|
||||
while (expression != null && !(expression instanceof JetExpression)) {
|
||||
while (expression != null && !(expression instanceof JetExpressionImpl)) {
|
||||
expression = expression.getNextSibling();
|
||||
}
|
||||
return (JetExpression) expression;
|
||||
|
||||
@@ -130,7 +130,7 @@ public class JetProperty extends JetTypeParameterListOwner implements JetModifie
|
||||
@Nullable
|
||||
public JetExpression getInitializer() {
|
||||
PsiElement eq = findChildByType(EQ);
|
||||
return PsiTreeUtil.getNextSiblingOfType(eq, JetExpression.class);
|
||||
return PsiTreeUtil.getNextSiblingOfType(eq, JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -74,7 +74,7 @@ public class JetPropertyAccessor extends JetDeclaration implements JetDeclaratio
|
||||
@Nullable
|
||||
@Override
|
||||
public JetExpression getBodyExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -191,7 +191,7 @@ public class JetPsiUtil {
|
||||
return firstPart.child(functionName);
|
||||
}
|
||||
|
||||
@Nullable @JetElement.IfNotParsed
|
||||
@Nullable @JetElementImpl.IfNotParsed
|
||||
public static ImportPath getImportPath(JetImportDirective importDirective) {
|
||||
final JetExpression importedReference = importDirective.getImportedReference();
|
||||
if (importedReference == null) {
|
||||
|
||||
@@ -26,14 +26,14 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public abstract class JetQualifiedExpression extends JetExpression {
|
||||
public abstract class JetQualifiedExpression extends JetExpressionImpl {
|
||||
public JetQualifiedExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetExpression getReceiverExpression() {
|
||||
JetExpression left = findChildByClass(JetExpression.class);
|
||||
JetExpression left = findChildByClass(JetExpressionImpl.class);
|
||||
assert left != null;
|
||||
return left;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public abstract class JetQualifiedExpression extends JetExpression {
|
||||
ASTNode node = getOperationTokenNode();
|
||||
while (node != null) {
|
||||
PsiElement psi = node.getPsi();
|
||||
if (psi instanceof JetExpression) {
|
||||
if (psi instanceof JetExpressionImpl) {
|
||||
return (JetExpression) psi;
|
||||
}
|
||||
node = node.getTreeNext();
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public abstract class JetReferenceExpression extends JetExpression {
|
||||
public abstract class JetReferenceExpression extends JetExpressionImpl {
|
||||
public JetReferenceExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ public class JetReturnExpression extends JetLabelQualifiedExpression implements
|
||||
|
||||
@Nullable
|
||||
public JetExpression getReturnedExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetRootNamespaceExpression extends JetExpression {
|
||||
public class JetRootNamespaceExpression extends JetExpressionImpl {
|
||||
public JetRootNamespaceExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class JetSecondaryConstructor extends JetDeclaration implements JetDeclar
|
||||
|
||||
@Override
|
||||
public JetExpression getBodyExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,10 +22,10 @@ package org.jetbrains.jet.lang.psi;
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is an interface to show that {@link JetExpression} is not
|
||||
* This is an interface to show that {@link JetExpressionImpl} is not
|
||||
* actually an expression (in meaning that this expression can be placed after "val x = ").
|
||||
* This is possibly redundant interface, all inheritors of this interface should be refactored that they are not
|
||||
* {@link JetExpression}, after such refactoring, this interface can be removed.
|
||||
* {@link JetExpressionImpl}, after such refactoring, this interface can be removed.
|
||||
*/
|
||||
public interface JetStatementExpression {
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public abstract class JetStringTemplateEntry extends JetElement {
|
||||
public abstract class JetStringTemplateEntry extends JetElementImpl {
|
||||
public JetStringTemplateEntry(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetExpression getExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetStringTemplateExpression extends JetExpression {
|
||||
public class JetStringTemplateExpression extends JetExpressionImpl {
|
||||
public JetStringTemplateExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetThrowExpression extends JetExpression {
|
||||
public class JetThrowExpression extends JetExpressionImpl {
|
||||
public JetThrowExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -40,6 +40,6 @@ public class JetThrowExpression extends JetExpression {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getThrownExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetTryExpression extends JetExpression {
|
||||
public class JetTryExpression extends JetExpressionImpl {
|
||||
public JetTryExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetTupleExpression extends JetExpression {
|
||||
public class JetTupleExpression extends JetExpressionImpl {
|
||||
public JetTupleExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetTuplePatternEntry extends JetElement {
|
||||
public class JetTuplePatternEntry extends JetElementImpl {
|
||||
public JetTuplePatternEntry(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetTypeArgumentList extends JetElement {
|
||||
public class JetTypeArgumentList extends JetElementImpl {
|
||||
public JetTypeArgumentList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetTypeConstraint extends JetElement {
|
||||
public class JetTypeConstraint extends JetElementImpl {
|
||||
public JetTypeConstraint(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetTypeConstraintList extends JetElement {
|
||||
public class JetTypeConstraintList extends JetElementImpl {
|
||||
public JetTypeConstraintList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public abstract class JetTypeElement extends JetElement {
|
||||
public abstract class JetTypeElement extends JetElementImpl {
|
||||
public JetTypeElement(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetTypeParameterList extends JetElement {
|
||||
public class JetTypeParameterList extends JetElementImpl {
|
||||
public JetTypeParameterList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetTypeProjection extends JetElement implements JetModifierListOwner {
|
||||
public class JetTypeProjection extends JetElementImpl implements JetModifierListOwner {
|
||||
public JetTypeProjection(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*
|
||||
* @author max
|
||||
*/
|
||||
public class JetTypeReference extends JetElement {
|
||||
public class JetTypeReference extends JetElementImpl {
|
||||
public JetTypeReference(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public abstract class JetUnaryExpression extends JetExpression implements JetOperationExpression {
|
||||
public abstract class JetUnaryExpression extends JetExpressionImpl implements JetOperationExpression {
|
||||
public JetUnaryExpression(ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetValueArgument extends JetElement implements ValueArgument {
|
||||
public class JetValueArgument extends JetElementImpl implements ValueArgument {
|
||||
public JetValueArgument(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class JetValueArgument extends JetElement implements ValueArgument {
|
||||
@Override
|
||||
@Nullable @IfNotParsed
|
||||
public JetExpression getArgumentExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetValueArgumentList extends JetElement {
|
||||
public class JetValueArgumentList extends JetElementImpl {
|
||||
public JetValueArgumentList(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.JetNodeTypes;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetValueArgumentName extends JetElement {
|
||||
public class JetValueArgumentName extends JetElementImpl {
|
||||
public JetValueArgumentName(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public abstract class JetWhenCondition extends JetElement {
|
||||
public abstract class JetWhenCondition extends JetElementImpl {
|
||||
public JetWhenCondition(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class JetWhenConditionInRange extends JetWhenCondition {
|
||||
ASTNode node = getOperationReference().getNode().getTreeNext();
|
||||
while (node != null) {
|
||||
PsiElement psi = node.getPsi();
|
||||
if (psi instanceof JetExpression) {
|
||||
if (psi instanceof JetExpressionImpl) {
|
||||
return (JetExpression) psi;
|
||||
}
|
||||
node = node.getTreeNext();
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetWhenEntry extends JetElement {
|
||||
public class JetWhenEntry extends JetElementImpl {
|
||||
public JetWhenEntry(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class JetWhenEntry extends JetElement {
|
||||
|
||||
@Nullable
|
||||
public JetExpression getExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetWhenExpression extends JetExpression {
|
||||
public class JetWhenExpression extends JetExpressionImpl {
|
||||
public JetWhenExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class JetWhenExpression extends JetExpression {
|
||||
|
||||
@Nullable
|
||||
public JetExpression getSubjectExpression() {
|
||||
return findChildByClass(JetExpression.class);
|
||||
return findChildByClass(JetExpressionImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface ValueArgument {
|
||||
@Nullable
|
||||
@JetElement.IfNotParsed
|
||||
@JetElementImpl.IfNotParsed
|
||||
JetExpression getArgumentExpression();
|
||||
|
||||
@Nullable
|
||||
|
||||
+2
-2
@@ -51,8 +51,8 @@ public class JetClassElementType extends JetStubElementType<PsiJetClassStub, Jet
|
||||
|
||||
@Override
|
||||
public JetClass createPsi(@NotNull PsiJetClassStub stub) {
|
||||
// return getPsiFactory(stub).createClass(stub);
|
||||
return null;
|
||||
//return getPsiFactory(stub).createClass(stub);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetElementImpl;
|
||||
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
||||
|
||||
import java.io.File;
|
||||
@@ -102,7 +103,7 @@ public class JetParsingTest extends ParsingTestCase {
|
||||
Object result = method.invoke(elem);
|
||||
if (result == null) {
|
||||
for (Annotation annotation : method.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JetElement.IfNotParsed) {
|
||||
if (annotation instanceof JetElementImpl.IfNotParsed) {
|
||||
assertNotNull(
|
||||
"Incomplete operation in parsed OK test, method " + methodName +
|
||||
" in " + declaringClass.getSimpleName() + " returns null. Element text: \n" + elem.getText(),
|
||||
|
||||
+2
@@ -36,10 +36,12 @@ import java.util.List;
|
||||
* Originally from IDEA platform: StatementGroupSelectioner
|
||||
*/
|
||||
public class JetStatementGroupSelectioner extends BasicSelectioner {
|
||||
@Override
|
||||
public boolean canSelect(PsiElement e) {
|
||||
return e instanceof JetExpression || e instanceof JetWhenEntry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
|
||||
List<TextRange> result = new ArrayList<TextRange>();
|
||||
|
||||
|
||||
@@ -155,8 +155,9 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
|
||||
if (!callFound) {
|
||||
|
||||
JetExpression parentExpression = (elementAtOffset instanceof JetExpression) ? (JetExpression) elementAtOffset
|
||||
: PsiTreeUtil.getParentOfType(elementAtOffset, JetExpression.class);
|
||||
JetExpression parentExpression = (elementAtOffset instanceof JetExpression) ?
|
||||
(JetExpression) elementAtOffset :
|
||||
PsiTreeUtil.getParentOfType(elementAtOffset, JetExpression.class);
|
||||
if (parentExpression != null) {
|
||||
JetType type = bindingContext.get(EXPRESSION_TYPE, parentExpression);
|
||||
String text = parentExpression + "|" + parentExpression.getText() + "| : " + type;
|
||||
@@ -173,7 +174,7 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private <D> PsiElement findData(BindingContext bindingContext, PsiElement currentElement, ReadOnlySlice<PsiElement, D> slice) {
|
||||
private static <D> PsiElement findData(BindingContext bindingContext, PsiElement currentElement, ReadOnlySlice<PsiElement, D> slice) {
|
||||
while (currentElement != null && !(currentElement instanceof PsiFile)) {
|
||||
if (currentElement instanceof JetElement) {
|
||||
JetElement atOffset = (JetElement) currentElement;
|
||||
@@ -188,7 +189,9 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String renderDebugInfo(PsiElement currentElement, @Nullable ResolutionDebugInfo.Data debugInfo, @Nullable ResolvedCall<? extends CallableDescriptor> call) {
|
||||
private static String renderDebugInfo(PsiElement currentElement,
|
||||
@Nullable ResolutionDebugInfo.Data debugInfo,
|
||||
@Nullable ResolvedCall<? extends CallableDescriptor> call) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if (debugInfo != null) {
|
||||
@@ -208,11 +211,13 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
else {
|
||||
result.append("Resolved call is null\n");
|
||||
}
|
||||
result.append(currentElement + ": " + currentElement.getText());
|
||||
result.append(currentElement).append(": ").append(currentElement.getText());
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private void renderResolutionLogForCall(Data debugInfo, ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall, StringBuilder result) {
|
||||
private static void renderResolutionLogForCall(Data debugInfo,
|
||||
ResolvedCallWithTrace<? extends CallableDescriptor> resolvedCall,
|
||||
StringBuilder result) {
|
||||
result.append("Trying to call ").append(resolvedCall.getCandidateDescriptor()).append("\n");
|
||||
StringBuilder errors = debugInfo.getByKey(ERRORS, resolvedCall);
|
||||
if (errors != null) {
|
||||
@@ -232,7 +237,7 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
result.append(BAR);
|
||||
}
|
||||
|
||||
private <K> void renderMap(Map<K, BoundsOwner> map, StringBuilder builder) {
|
||||
private static <K> void renderMap(Map<K, BoundsOwner> map, StringBuilder builder) {
|
||||
if (map == null) return;
|
||||
|
||||
for (Map.Entry<K, BoundsOwner> entry : map.entrySet()) {
|
||||
@@ -248,7 +253,7 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private String renderCall(StringBuilder builder, ResolvedCall<? extends CallableDescriptor> resolvedCall) {
|
||||
private static String renderCall(StringBuilder builder, ResolvedCall<? extends CallableDescriptor> resolvedCall) {
|
||||
|
||||
CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
|
||||
ReceiverDescriptor receiverArgument = resolvedCall.getReceiverArgument();
|
||||
@@ -283,7 +288,7 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private void renderValueArguments(Map<ValueParameterDescriptor, ResolvedValueArgument> valueArguments, StringBuilder builder) {
|
||||
private static void renderValueArguments(Map<ValueParameterDescriptor, ResolvedValueArgument> valueArguments, StringBuilder builder) {
|
||||
ResolvedValueArgument[] args = new ResolvedValueArgument[valueArguments.size()];
|
||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : valueArguments.entrySet()) {
|
||||
ValueParameterDescriptor key = entry.getKey();
|
||||
@@ -302,7 +307,7 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
builder.append(")");
|
||||
}
|
||||
|
||||
private void renderTypeArguments(Map<TypeParameterDescriptor, JetType> typeArguments, StringBuilder builder) {
|
||||
private static void renderTypeArguments(Map<TypeParameterDescriptor, JetType> typeArguments, StringBuilder builder) {
|
||||
JetType[] args = new JetType[typeArguments.size()];
|
||||
for (Map.Entry<TypeParameterDescriptor, JetType> entry : typeArguments.entrySet()) {
|
||||
TypeParameterDescriptor key = entry.getKey();
|
||||
@@ -320,7 +325,7 @@ public class ResolveToolwindow extends JPanel implements Disposable {
|
||||
builder.append(">");
|
||||
}
|
||||
|
||||
private void renderReceiver(ReceiverDescriptor receiverArgument, ReceiverDescriptor thisObject, StringBuilder builder) {
|
||||
private static void renderReceiver(ReceiverDescriptor receiverArgument, ReceiverDescriptor thisObject, StringBuilder builder) {
|
||||
if (receiverArgument.exists()) {
|
||||
builder.append("/").append(receiverArgument);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.quickfix;
|
||||
|
||||
import com.intellij.extapi.psi.ASTDelegatePsiElement;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -25,7 +26,6 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetFunction;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
@@ -79,7 +79,7 @@ public class RemoveFunctionBodyFix extends JetIntentionAction<JetFunction> {
|
||||
element.replace(function);
|
||||
}
|
||||
|
||||
private static boolean removePossiblyEquationSign(@NotNull JetElement element, @Nullable PsiElement possiblyEq) {
|
||||
private static boolean removePossiblyEquationSign(@NotNull ASTDelegatePsiElement element, @Nullable PsiElement possiblyEq) {
|
||||
if (possiblyEq instanceof LeafPsiElement && ((LeafPsiElement)possiblyEq).getElementType() == JetTokens.EQ) {
|
||||
QuickFixUtil.removePossiblyWhiteSpace(element, possiblyEq.getNextSibling());
|
||||
element.deleteChildInternal(possiblyEq.getNode());
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.quickfix;
|
||||
|
||||
import com.intellij.extapi.psi.ASTDelegatePsiElement;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -26,7 +27,6 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetModifierList;
|
||||
import org.jetbrains.jet.lang.psi.JetModifierListOwner;
|
||||
import org.jetbrains.jet.lexer.JetKeywordToken;
|
||||
@@ -70,9 +70,9 @@ public class RemoveModifierFix extends JetIntentionAction<JetModifierListOwner>
|
||||
removeModifierFromList(modifierList, modifier);
|
||||
if (modifierList.getFirstChild() == null) {
|
||||
PsiElement whiteSpace = modifierList.getNextSibling();
|
||||
assert element instanceof JetElement;
|
||||
((JetElement) element).deleteChildInternal(modifierList.getNode());
|
||||
QuickFixUtil.removePossiblyWhiteSpace((JetElement) element, whiteSpace);
|
||||
assert element instanceof ASTDelegatePsiElement;
|
||||
((ASTDelegatePsiElement) element).deleteChildInternal(modifierList.getNode());
|
||||
QuickFixUtil.removePossiblyWhiteSpace((ASTDelegatePsiElement) element, whiteSpace);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user