From 70f3da109d8bfdd65ccc7a520e6484248dcad6e2 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Wed, 5 Sep 2012 12:49:51 +0400 Subject: [PATCH] Removing obsolete PSI classes, error message and CF-handling #KT-2359 In Progress --- .../jet/lang/cfg/JetControlFlowProcessor.java | 62 ++----------------- .../jetbrains/jet/lang/cfg/WhenChecker.java | 4 +- .../jet/lang/diagnostics/Errors.java | 2 - .../rendering/DefaultErrorMessages.java | 2 - .../jet/lang/psi/JetBindingPattern.java | 51 --------------- .../jet/lang/psi/JetDecomposerPattern.java | 51 --------------- .../jet/lang/psi/JetExpressionPattern.java | 45 -------------- .../jet/lang/psi/JetIsExpression.java | 4 +- .../jetbrains/jet/lang/psi/JetPattern.java | 29 --------- .../jetbrains/jet/lang/psi/JetPsiUtil.java | 19 ------ .../jet/lang/psi/JetTuplePattern.java | 47 -------------- .../jet/lang/psi/JetTuplePatternEntry.java | 47 -------------- .../jet/lang/psi/JetTypePattern.java | 45 -------------- .../jetbrains/jet/lang/psi/JetVisitor.java | 28 --------- .../jet/lang/psi/JetVisitorVoid.java | 28 --------- .../lang/psi/JetWhenConditionIsPattern.java | 5 +- .../psi/JetWhenConditionWithExpression.java | 4 +- .../jet/lang/psi/JetWildcardPattern.java | 39 ------------ 18 files changed, 12 insertions(+), 500 deletions(-) delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBindingPattern.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDecomposerPattern.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionPattern.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPattern.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePattern.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePatternEntry.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypePattern.java delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWildcardPattern.java diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index b3d499f97bd..9658a0f774b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -26,7 +26,6 @@ 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.PseudocodeImpl; -import org.jetbrains.jet.lang.diagnostics.AbstractDiagnosticFactory; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContextUtils; @@ -109,18 +108,12 @@ public class JetControlFlowProcessor { @Override public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) { - JetPattern pattern = condition.getPattern(); - if (pattern != null) { - pattern.accept(patternVisitor); - } + // TODO: types in CF? } @Override public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) { - JetExpressionPattern pattern = condition.getPattern(); - if (pattern != null) { - pattern.accept(patternVisitor); - } + value(condition.getExpression(), inCondition); } @Override @@ -129,50 +122,6 @@ public class JetControlFlowProcessor { } }; private final JetVisitorVoid patternVisitor = new JetVisitorVoid() { - @Override - public void visitTypePattern(JetTypePattern typePattern) { - // TODO - } - - @Override - public void visitWildcardPattern(JetWildcardPattern pattern) { - // TODO - } - - @Override - public void visitExpressionPattern(JetExpressionPattern pattern) { - value(pattern.getExpression(), inCondition); - } - - @Override - public void visitTuplePattern(JetTuplePattern pattern) { - List entries = pattern.getEntries(); - for (JetTuplePatternEntry entry : entries) { - JetPattern entryPattern = entry.getPattern(); - if (entryPattern != null) { - entryPattern.accept(this); - } - } - } - - @Override - public void visitDecomposerPattern(JetDecomposerPattern pattern) { - value(pattern.getDecomposerExpression(), inCondition); - JetTuplePattern argumentList = pattern.getArgumentList(); - if (argumentList != null) { - argumentList.accept(this); - } - } - - @Override - public void visitBindingPattern(JetBindingPattern pattern) { - JetProperty variableDeclaration = pattern.getVariableDeclaration(); - builder.write(pattern, variableDeclaration); - JetWhenCondition condition = pattern.getCondition(); - if (condition != null) { - condition.accept(conditionVisitor); - } - } @Override public void visitJetElement(JetElement element) { @@ -807,10 +756,7 @@ public class JetControlFlowProcessor { @Override public void visitIsExpression(final JetIsExpression expression) { value(expression.getLeftHandSide(), inCondition); - JetPattern pattern = expression.getPattern(); - if (pattern != null) { - pattern.accept(patternVisitor); - } + // no CF for types // TODO : builder.read(expression.getPattern()); builder.read(expression); } @@ -837,7 +783,7 @@ public class JetControlFlowProcessor { trace.report(ELSE_MISPLACED_IN_WHEN.on(whenEntry)); } } - boolean isIrrefutable = JetPsiUtil.isIrrefutable(whenEntry); + boolean isIrrefutable = whenEntry.isElse(); if (isIrrefutable) { hasElseOrIrrefutableBranch = true; } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/WhenChecker.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/WhenChecker.java index 42fcd8e59fb..5356ae2e235 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/WhenChecker.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/WhenChecker.java @@ -70,9 +70,7 @@ public class WhenChecker { for (JetWhenEntry whenEntry : whenExpression.getEntries()) { for (JetWhenCondition condition : whenEntry.getConditions()) { if (condition instanceof JetWhenConditionWithExpression) { - JetExpressionPattern pattern = ((JetWhenConditionWithExpression) condition).getPattern(); - if (pattern == null) continue; - JetExpression patternExpression = pattern.getExpression(); + JetExpression patternExpression = ((JetWhenConditionWithExpression) condition).getExpression(); JetType type = trace.get(BindingContext.EXPRESSION_TYPE, patternExpression); if (type == null) continue; if (type.getConstructor().getDeclarationDescriptor() == enumEntry) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 8272ea262e2..942a63419b3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -276,8 +276,6 @@ public interface Errors { DiagnosticFactory2 TYPE_MISMATCH_IN_FOR_LOOP = DiagnosticFactory2.create(ERROR); DiagnosticFactory1 TYPE_MISMATCH_IN_CONDITION = DiagnosticFactory1.create(ERROR); - DiagnosticFactory2 TYPE_MISMATCH_IN_TUPLE_PATTERN = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 TYPE_MISMATCH_IN_BINDING_PATTERN = DiagnosticFactory2.create(ERROR); DiagnosticFactory2 INCOMPATIBLE_TYPES = DiagnosticFactory2.create(ERROR); SimpleDiagnosticFactory EXPECTED_CONDITION = SimpleDiagnosticFactory.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java index e198eb19fc0..26feb3d0f6b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java @@ -312,8 +312,6 @@ public class DefaultErrorMessages { MAP.put(TYPE_MISMATCH_IN_FOR_LOOP, "The loop iterates over values of type {0} but the parameter is declared to be {1}", RENDER_TYPE, RENDER_TYPE); MAP.put(TYPE_MISMATCH_IN_CONDITION, "Condition must be of type jet.Boolean, but is of type {0}", RENDER_TYPE); - MAP.put(TYPE_MISMATCH_IN_TUPLE_PATTERN, "Type mismatch: subject is of type {0} but the pattern is a {1}-tuple", RENDER_TYPE, TO_STRING); - MAP.put(TYPE_MISMATCH_IN_BINDING_PATTERN, "{0} is not a supertype of {1}. Use ''is'' to match against {0}", RENDER_TYPE, RENDER_TYPE); MAP.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE); MAP.put(EXPECTED_CONDITION, "Expected condition of jet.Boolean type"); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBindingPattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBindingPattern.java deleted file mode 100644 index 3ad6d74b442..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetBindingPattern.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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; - -/** - * @author abreslav - */ -public class JetBindingPattern extends JetPattern { - public JetBindingPattern(@NotNull ASTNode node) { - super(node); - } - - @NotNull - public JetProperty getVariableDeclaration() { - return (JetProperty) findChildByType(JetNodeTypes.PROPERTY); - } - - @Nullable - public JetWhenCondition getCondition() { - return findChildByClass(JetWhenCondition.class); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitBindingPattern(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitBindingPattern(this, data); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDecomposerPattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDecomposerPattern.java deleted file mode 100644 index 2be142dc39e..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetDecomposerPattern.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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; - -/** - * @author abreslav - */ -public class JetDecomposerPattern extends JetPattern { - public JetDecomposerPattern(@NotNull ASTNode node) { - super(node); - } - - @Nullable @IfNotParsed - public JetExpression getDecomposerExpression() { - return findChildByClass(JetExpression.class); - } - - @Nullable - public JetTuplePattern getArgumentList() { - return (JetTuplePattern) findChildByType(JetNodeTypes.DECOMPOSER_ARGUMENT_LIST); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitDecomposerPattern(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitDecomposerPattern(this, data); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionPattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionPattern.java deleted file mode 100644 index 9b9be36d2de..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionPattern.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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; - -/** - * @author abreslav - */ -public class JetExpressionPattern extends JetPattern { - public JetExpressionPattern(@NotNull ASTNode node) { - super(node); - } - - @Nullable @IfNotParsed - public JetExpression getExpression() { - return findChildByClass(JetExpression.class); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitExpressionPattern(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitExpressionPattern(this, data); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetIsExpression.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetIsExpression.java index 14887ecdf6d..8c04e038050 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetIsExpression.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetIsExpression.java @@ -46,8 +46,8 @@ public class JetIsExpression extends JetExpressionImpl { } @Nullable @IfNotParsed - public JetPattern getPattern() { - return findChildByClass(JetPattern.class); + public JetTypeReference getTypeRef() { + return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE); } @NotNull diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPattern.java deleted file mode 100644 index 8625d490467..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPattern.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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; - -/** - * @author abreslav - */ -public class JetPattern extends JetElementImpl { - public JetPattern(@NotNull ASTNode node) { - super(node); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java index 693a0aa184c..9d450eb28f1 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java @@ -200,25 +200,6 @@ public class JetPsiUtil { return new ImportPath(text.replaceAll(" ", "") + (importDirective.isAllUnder() ? ".*" : "")); } - public static boolean isIrrefutable(JetWhenEntry entry) { - if (entry.isElse()) return true; - for (JetWhenCondition condition : entry.getConditions()) { - if (condition instanceof JetWhenConditionIsPattern) { - JetPattern pattern = ((JetWhenConditionIsPattern) condition).getPattern(); - if (pattern instanceof JetWildcardPattern) { - return true; - } - if (pattern instanceof JetBindingPattern) { - JetBindingPattern bindingPattern = (JetBindingPattern) pattern; - if (bindingPattern.getVariableDeclaration().getTypeRef() == null && bindingPattern.getCondition() == null) { - return true; - } - } - } - } - return false; - } - @Nullable public static T getDirectParentOfTypeForBlock(@NotNull JetBlockExpression block, @NotNull Class aClass) { T parent = PsiTreeUtil.getParentOfType(block, aClass); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePattern.java deleted file mode 100644 index c2cdb56ad8e..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePattern.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.JetNodeTypes; - -import java.util.List; - -/** - * @author abreslav - */ -public class JetTuplePattern extends JetPattern { - public JetTuplePattern(@NotNull ASTNode node) { - super(node); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitTuplePattern(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitTuplePattern(this, data); - } - - @NotNull - public List getEntries() { - return findChildrenByType(JetNodeTypes.TUPLE_PATTERN_ENTRY); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePatternEntry.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePatternEntry.java deleted file mode 100644 index 0d8a2f3c4f2..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTuplePatternEntry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.lexer.JetTokens; - -/** - * @author abreslav - */ -public class JetTuplePatternEntry extends JetElementImpl { - public JetTuplePatternEntry(@NotNull ASTNode node) { - super(node); - } - - @Nullable - public ASTNode getNameLabelNode() { - return getNode().findChildByType(JetTokens.IDENTIFIER); - } - - @Nullable - public String getNameLabel() { - ASTNode nameLabelNode = getNameLabelNode(); - return nameLabelNode == null ? null : nameLabelNode.getText(); - } - - @Nullable @IfNotParsed - public JetPattern getPattern() { - return findChildByClass(JetPattern.class); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypePattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypePattern.java deleted file mode 100644 index 5bc80f5ec67..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTypePattern.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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; - -/** - * @author abreslav - */ -public class JetTypePattern extends JetPattern { - public JetTypePattern(@NotNull ASTNode node) { - super(node); - } - - @Nullable @IfNotParsed - public JetTypeReference getTypeReference() { - return findChildByClass(JetTypeReference.class); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitTypePattern(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitTypePattern(this, data); - } -} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java index c69e0061b7d..9a3e8a026df 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitor.java @@ -388,30 +388,6 @@ public class JetVisitor extends PsiElementVisitor { return visitJetElement(condition, data); } - public R visitTypePattern(JetTypePattern pattern, D data) { - return visitPattern(pattern, data); - } - - public R visitWildcardPattern(JetWildcardPattern pattern, D data) { - return visitPattern(pattern, data); - } - - public R visitExpressionPattern(JetExpressionPattern pattern, D data) { - return visitPattern(pattern, data); - } - - public R visitTuplePattern(JetTuplePattern pattern, D data) { - return visitPattern(pattern, data); - } - - private R visitPattern(JetPattern pattern, D data) { - return visitJetElement(pattern, data); - } - - public R visitDecomposerPattern(JetDecomposerPattern pattern, D data) { - return visitPattern(pattern, data); - } - public R visitObjectDeclaration(JetObjectDeclaration declaration, D data) { return visitNamedDeclaration(declaration, data); } @@ -420,10 +396,6 @@ public class JetVisitor extends PsiElementVisitor { return visitNamedDeclaration(declarationName, data); } - public R visitBindingPattern(JetBindingPattern pattern, D data) { - return visitPattern(pattern, data); - } - public R visitStringTemplateEntry(JetStringTemplateEntry entry, D data) { return visitJetElement(entry, data); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java index 3aab76cfcd7..b1aafd75e77 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetVisitorVoid.java @@ -377,30 +377,6 @@ public class JetVisitorVoid extends PsiElementVisitor { visitJetElement(condition); } - public void visitTypePattern(JetTypePattern pattern) { - visitPattern(pattern); - } - - public void visitWildcardPattern(JetWildcardPattern pattern) { - visitPattern(pattern); - } - - public void visitExpressionPattern(JetExpressionPattern pattern) { - visitPattern(pattern); - } - - public void visitTuplePattern(JetTuplePattern pattern) { - visitPattern(pattern); - } - - private void visitPattern(JetPattern pattern) { - visitJetElement(pattern); - } - - public void visitDecomposerPattern(JetDecomposerPattern pattern) { - visitPattern(pattern); - } - public void visitObjectDeclaration(JetObjectDeclaration declaration) { visitNamedDeclaration(declaration); } @@ -409,10 +385,6 @@ public class JetVisitorVoid extends PsiElementVisitor { visitNamedDeclaration(declaration); } - public void visitBindingPattern(JetBindingPattern pattern) { - visitPattern(pattern); - } - public void visitStringTemplateEntry(JetStringTemplateEntry entry) { visitJetElement(entry); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionIsPattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionIsPattern.java index 2ca42dfe117..a097c26ce99 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionIsPattern.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionIsPattern.java @@ -19,6 +19,7 @@ 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.JetTokens; /** @@ -34,8 +35,8 @@ public class JetWhenConditionIsPattern extends JetWhenCondition { } @Nullable @IfNotParsed - public JetPattern getPattern() { - return findChildByClass(JetPattern.class); + public JetTypeReference getTypeRef() { + return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionWithExpression.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionWithExpression.java index a85de4b1618..7cb86ac6b7c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionWithExpression.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWhenConditionWithExpression.java @@ -30,8 +30,8 @@ public class JetWhenConditionWithExpression extends JetWhenCondition { @Nullable @IfNotParsed - public JetExpressionPattern getPattern() { - return findChildByClass(JetExpressionPattern.class); + public JetExpression getExpression() { + return findChildByClass(JetExpression.class); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWildcardPattern.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWildcardPattern.java deleted file mode 100644 index 152cd7814cd..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetWildcardPattern.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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; - -/** - * @author abreslav - */ -public class JetWildcardPattern extends JetPattern { - public JetWildcardPattern(@NotNull ASTNode node) { - super(node); - } - - @Override - public void accept(@NotNull JetVisitorVoid visitor) { - visitor.visitWildcardPattern(this); - } - - @Override - public R accept(@NotNull JetVisitor visitor, D data) { - return visitor.visitWildcardPattern(this, data); - } -}