Cleanup (warnings; typos; formatting)

GitOrigin-RevId: 3fb847e148f85a383718b403b7dbca2816b92a70
This commit is contained in:
Roman Shevchenko
2019-07-03 01:13:10 +03:00
committed by intellij-monorepo-bot
parent 10b2be555b
commit 03a0ff7035
8 changed files with 94 additions and 268 deletions
@@ -638,11 +638,8 @@ public class DuplicateBranchesInSwitchInspection extends LocalInspectionTool {
private final boolean myIsSimpleExit;
private final boolean myCanFallThrough;
Branch(@NotNull PsiSwitchLabelStatement[] labels, @NotNull List<PsiStatement> statementList,
boolean hasImplicitBreak, @NotNull String[] commentTexts) {
super(labels,
statementsWithoutTrailingBreak(statementList),
commentTexts);
Branch(@NotNull PsiSwitchLabelStatement[] labels, @NotNull List<PsiStatement> statementList, boolean hasImplicitBreak, @NotNull String[] comments) {
super(labels, statementsWithoutTrailingBreak(statementList), comments);
int lastIndex = statementList.size() - 1;
PsiStatement lastStatement = statementList.get(lastIndex);
@@ -677,9 +674,7 @@ public class DuplicateBranchesInSwitchInspection extends LocalInspectionTool {
return new DeleteRedundantBranchFix();
}
/**
* switch labels with comments and spaces
*/
// 'switch' labels with comments and spaces
@NotNull
List<PsiElement> getBranchPrefix() {
List<PsiElement> result = new ArrayList<>();
@@ -785,10 +780,7 @@ public class DuplicateBranchesInSwitchInspection extends LocalInspectionTool {
private final boolean myIsSimpleExit;
Rule(@NotNull PsiSwitchLabeledRuleStatement rule, @NotNull PsiStatement body, @NotNull String[] commentTexts) {
super(new PsiSwitchLabeledRuleStatement[]{rule},
new PsiStatement[]{body},
commentTexts);
super(new PsiSwitchLabeledRuleStatement[]{rule}, new PsiStatement[]{body}, commentTexts);
myIsSimpleExit = body instanceof PsiExpressionStatement || body instanceof PsiThrowStatement;
}
@@ -27,7 +27,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
private final ControlFlowPolicy myPolicy;
private ControlFlowImpl myCurrentFlow;
private final Stack<PsiParameter> myCatchParameters = new Stack<>();// stack of PsiParameter for catch
private final Stack<PsiParameter> myCatchParameters = new Stack<>();// stack of PsiParameter for 'catch'
private final Stack<PsiElement> myCatchBlocks = new Stack<>();
private final Stack<FinallyBlockSubroutine> myFinallyBlocks = new Stack<>();
@@ -239,7 +239,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
for (int i = myUnhandledExceptionCatchBlocks.size() - 1; i >= 0; i--) {
ProgressManager.checkCanceled();
PsiElement block = myUnhandledExceptionCatchBlocks.get(i);
// cannot jump to outer catch blocks (belonging to outer try stmt) if current try{} has finally block
// cannot jump to outer catch blocks (belonging to outer try stmt) if current try{} has 'finally' block
if (block == null) {
if (!myFinallyBlocks.isEmpty()) {
break;
@@ -255,7 +255,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
}
// generate jump to the top finally block
// generate a jump to the top 'finally' block
if (!myFinallyBlocks.isEmpty()) {
final PsiElement finallyBlock = myFinallyBlocks.peek().getElement();
ConditionalThrowToInstruction throwToInstruction = new ConditionalThrowToInstruction(-2);
@@ -852,8 +852,8 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
@Override
public void visitSwitchLabeledRuleStatement(PsiSwitchLabeledRuleStatement statement) {
startElement(statement);
PsiExpressionList caseValues = statement.getCaseValues();
PsiExpressionList caseValues = statement.getCaseValues();
if (caseValues != null) {
for (PsiExpression caseValue : caseValues.getExpressions()) {
ProgressManager.checkCanceled();
@@ -983,7 +983,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
/**
* find offsets of catch(es) corresponding to this throw statement
* Find offsets of catch(es) corresponding to this throw statement
* myCatchParameters and myCatchBlocks arrays should be sorted in ascending scope order (from outermost to innermost)
*
* @return list of targets or list of single null element if no appropriate targets found
@@ -1066,7 +1066,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
if (description != null) {
description.accept(this);
}
// if description is evaluated, the assert statement cannot complete normally
// if description is evaluated, the 'assert' statement cannot complete normally
// though non-necessarily AssertionError will be thrown (description may throw something, or AssertionError ctor, etc.)
PsiClassType exceptionClass = JavaPsiFacade.getElementFactory(statement.getProject()).createTypeByFQClassName(
CommonClassNames.JAVA_LANG_THROWABLE, statement.getResolveScope());
@@ -1217,7 +1217,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
// unchecked exception throwing completion
myCurrentFlow.addInstruction(new ReturnInstruction(procStart - 1, throwExceptionCompletion));
// checked exception throwing completion. need to dispatch to the correct catch clause
// checked exception throwing completion; need to dispatch to the correct catch clause
final List<PsiElement> unhandledExceptionCatchBlocks = finallyBlockToUnhandledExceptions.remove(finallyBlock);
for (int i = 0; unhandledExceptionCatchBlocks != null && i < unhandledExceptionCatchBlocks.size(); i++) {
ProgressManager.checkCanceled();
@@ -1476,18 +1476,16 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
switch (shortcut) {
case NO_SHORTCUT:
assert lOperand != null;
myCurrentFlow.addInstruction(new ConditionalGoToInstruction(0, role, lOperand));
addElementOffsetLater(gotoElement, gotoIsAtStart);
break;
break;
case STOP_EXPRESSION:
if (lOperand != null) {
myCurrentFlow.addInstruction(new GoToInstruction(0, role));
addElementOffsetLater(gotoElement, gotoIsAtStart);
rValue = null;
}
myCurrentFlow.addInstruction(new GoToInstruction(0, role));
addElementOffsetLater(gotoElement, gotoIsAtStart);
rValue = null;
break;
case SKIP_CURRENT_OPERAND:
break;
}
@@ -4,7 +4,7 @@ package com.intellij.psi.impl.source;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
@@ -67,7 +67,7 @@ public class PsiLabelReference implements PsiReference {
@NotNull
@Override
public String[] getVariants() {
return ArrayUtilRt.toStringArray(PsiImplUtil.findAllEnclosingLabels(myStatement));
return ArrayUtil.toStringArray(PsiImplUtil.findAllEnclosingLabels(myStatement));
}
@Override
@@ -37,17 +37,12 @@ import javax.swing.*;
import static com.intellij.util.ObjectUtils.tryCast;
public class UnnecessaryLocalVariableInspection extends BaseInspection {
/**
* @noinspection PublicField, WeakerAccess
*/
public boolean m_ignoreImmediatelyReturnedVariables;
/**
* @deprecated unused, left for compatibility
* @noinspection PublicField
*/
/** @deprecated unused, left for compatibility */
@Deprecated
public boolean m_ignoreAnnotatedVariables;
@SuppressWarnings("WeakerAccess")
public boolean m_ignoreAnnotatedVariablesNew = true;
@Override
@@ -9,7 +9,6 @@ import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
import com.intellij.util.ArrayUtilRt;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
@@ -35,14 +34,9 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas
protected BaseInspection[] getInspections() {
final BaseInspection inspection = getInspection();
if (inspection != null) {
return new BaseInspection[] {inspection};
}
return new BaseInspection[0];
return inspection != null ? new BaseInspection[]{inspection} : new BaseInspection[0];
}
@SuppressWarnings("LanguageMismatch")
@NonNls
@Language("JAVA")
protected String[] getEnvironmentClasses() {
return ArrayUtilRt.EMPTY_STRING_ARRAY;
@@ -69,7 +63,7 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas
myFixture.filterAvailableIntentions(quickfixName));
}
protected void assertQuickfixNotAvailable(String quickfixName, @Language("JAVA") @NotNull @NonNls String text) {
protected void assertQuickfixNotAvailable(String quickfixName, @Language("JAVA") @NotNull String text) {
text = text.replace("/**/", "<caret>");
myFixture.configureByText(JavaFileType.INSTANCE, text);
assertEmpty("Quickfix \'" + quickfixName + "\' is available but should not",
@@ -89,35 +83,34 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas
protected void doTest(final String testName, final String hint) {
myFixture.configureByFile(getRelativePath() + "/" + testName + ".java");
final IntentionAction action = myFixture.getAvailableIntention(hint);
assertNotNull(action);
IntentionAction action = myFixture.findSingleIntention(hint);
myFixture.launchAction(action);
myFixture.checkResultByFile(getRelativePath() + "/" + testName + ".after.java");
}
protected void doExpressionTest(
@NotNull String hint,
@Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {static {System.out.print(", suffix = ");}}") @NotNull @NonNls String before,
@Language(value = "JAVA", prefix = "class $X$ {static {System.out.print(", suffix = ");}}") @NotNull @NonNls String after) {
@Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {static {System.out.print(", suffix = ");}}") @NotNull String before,
@Language(value = "JAVA", prefix = "class $X$ {static {System.out.print(", suffix = ");}}") @NotNull String after
) {
doTest(hint, "class $X$ {static {System.out.print(" + before + ");}}", "class $X$ {static {System.out.print(" + after + ");}}");
}
protected void doMemberTest(
@NotNull String hint,
@Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {", suffix = "}") @NotNull @NonNls String before,
@Language(value = "JAVA", prefix = "class $X$ {", suffix = "}") @NotNull @NonNls String after) {
@Language(value = "JAVA", prefix = "/** @noinspection ALL*/class $X$ {", suffix = "}") @NotNull String before,
@Language(value = "JAVA", prefix = "class $X$ {", suffix = "}") @NotNull String after
) {
doTest(hint, "class $X$ {" + before + "}", "class $X$ {" + after + "}");
}
protected void doTest(@NotNull String hint,
@Language("JAVA") @NotNull @NonNls String before,
@Language("JAVA") @NotNull @NonNls String after) {
protected void doTest(@NotNull String hint, @Language("JAVA") @NotNull String before, @Language("JAVA") @NotNull String after) {
doTest(hint, before, after, "aaa.java");
}
protected void doTest(@NotNull String hint,
@Language("JAVA") @NotNull @NonNls String before,
@Language("JAVA") @NotNull @NonNls String after,
@Language("JAVA") @NotNull String before,
@Language("JAVA") @NotNull String after,
@NotNull String fileName) {
before = before.replace("/**/", "<caret>");
myFixture.configureByText(fileName, before);
@@ -131,5 +124,4 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas
assertNotNull(myRelativePath);
return myRelativePath;
}
}
}
@@ -6,8 +6,10 @@ import org.jetbrains.uast.*
import org.jetbrains.uast.values.UUndeterminedValue
import org.jetbrains.uast.visitor.UastTypedVisitor
internal class DepthLimitingEvaluatorVisitor(val depthLimit: kotlin.Int,
delegator: (org.jetbrains.uast.evaluation.DepthLimitingEvaluatorVisitor) -> org.jetbrains.uast.visitor.UastTypedVisitor<org.jetbrains.uast.evaluation.UEvaluationState, org.jetbrains.uast.evaluation.UEvaluationInfo>) : UastTypedVisitor<UEvaluationState, UEvaluationInfo> {
internal class DepthLimitingEvaluatorVisitor(
private val depthLimit: Int,
delegator: (DepthLimitingEvaluatorVisitor) -> UastTypedVisitor<UEvaluationState, UEvaluationInfo>
) : UastTypedVisitor<UEvaluationState, UEvaluationInfo> {
private val delegate = delegator(this)
@@ -128,8 +128,7 @@ class TreeBasedEvaluator(
data: UEvaluationState
): UEvaluationInfo {
storeState(node, data)
val resolvedElement = node.resolveToUElement()
return when (resolvedElement) {
return when (val resolvedElement = node.resolveToUElement()) {
is UEnumConstant -> UEnumEntryValueConstant(resolvedElement, node)
is UField -> if (resolvedElement.hasModifierProperty(PsiModifier.FINAL)) {
data[resolvedElement].ifUndetermined {
@@ -17,12 +17,9 @@ interface UastVisitor {
fun visitField(node: UField): Boolean = visitVariable(node)
fun visitLocalVariable(node: ULocalVariable): Boolean = visitVariable(node)
fun visitEnumConstant(node: UEnumConstant): Boolean = visitField(node)
fun visitAnnotation(node: UAnnotation): Boolean = visitElement(node)
// Expressions
fun visitExpression(node: UExpression): Boolean = visitElement(node)
fun visitLabeledExpression(node: ULabeledExpression): Boolean = visitExpression(node)
fun visitDeclarationsExpression(node: UDeclarationsExpression): Boolean = visitExpression(node)
fun visitBlockExpression(node: UBlockExpression): Boolean = visitExpression(node)
@@ -52,8 +49,7 @@ interface UastVisitor {
fun visitSuperExpression(node: USuperExpression): Boolean = visitExpression(node)
fun visitReturnExpression(node: UReturnExpression): Boolean = visitExpression(node)
fun visitBreakExpression(node: UBreakExpression): Boolean = visitExpression(node)
@JvmDefault
fun visitYieldExpression(node: UYieldExpression): Boolean = visitExpression(node)
@JvmDefault fun visitYieldExpression(node: UYieldExpression): Boolean = visitExpression(node)
fun visitContinueExpression(node: UContinueExpression): Boolean = visitExpression(node)
fun visitThrowExpression(node: UThrowExpression): Boolean = visitExpression(node)
fun visitArrayAccessExpression(node: UArrayAccessExpression): Boolean = visitExpression(node)
@@ -64,209 +60,59 @@ interface UastVisitor {
// After
fun afterVisitElement(node: UElement) {}
fun afterVisitFile(node: UFile) {
afterVisitElement(node)
}
fun afterVisitImportStatement(node: UImportStatement) {
afterVisitElement(node)
}
fun afterVisitDeclaration(node: UDeclaration) {
afterVisitElement(node)
}
fun afterVisitClass(node: UClass) {
afterVisitDeclaration(node)
}
fun afterVisitInitializer(node: UClassInitializer) {
afterVisitDeclaration(node)
}
fun afterVisitMethod(node: UMethod) {
afterVisitDeclaration(node)
}
fun afterVisitVariable(node: UVariable) {
afterVisitElement(node)
}
fun afterVisitParameter(node: UParameter) {
afterVisitVariable(node)
}
fun afterVisitField(node: UField) {
afterVisitVariable(node)
}
fun afterVisitLocalVariable(node: ULocalVariable) {
afterVisitVariable(node)
}
fun afterVisitEnumConstant(node: UEnumConstant) {
afterVisitField(node)
}
fun afterVisitAnnotation(node: UAnnotation) {
afterVisitElement(node)
}
fun afterVisitElement(node: UElement) { }
fun afterVisitFile(node: UFile) = afterVisitElement(node)
fun afterVisitImportStatement(node: UImportStatement) = afterVisitElement(node)
fun afterVisitDeclaration(node: UDeclaration) = afterVisitElement(node)
fun afterVisitClass(node: UClass) = afterVisitDeclaration(node)
fun afterVisitInitializer(node: UClassInitializer) = afterVisitDeclaration(node)
fun afterVisitMethod(node: UMethod) = afterVisitDeclaration(node)
fun afterVisitVariable(node: UVariable) = afterVisitElement(node)
fun afterVisitParameter(node: UParameter) = afterVisitVariable(node)
fun afterVisitField(node: UField) = afterVisitVariable(node)
fun afterVisitLocalVariable(node: ULocalVariable) = afterVisitVariable(node)
fun afterVisitEnumConstant(node: UEnumConstant) = afterVisitField(node)
fun afterVisitAnnotation(node: UAnnotation) = afterVisitElement(node)
// Expressions
fun afterVisitExpression(node: UExpression) {
afterVisitElement(node)
}
fun afterVisitLabeledExpression(node: ULabeledExpression) {
afterVisitExpression(node)
}
fun afterVisitDeclarationsExpression(node: UDeclarationsExpression) {
afterVisitExpression(node)
}
fun afterVisitBlockExpression(node: UBlockExpression) {
afterVisitExpression(node)
}
fun afterVisitQualifiedReferenceExpression(node: UQualifiedReferenceExpression) {
afterVisitExpression(node)
}
fun afterVisitSimpleNameReferenceExpression(node: USimpleNameReferenceExpression) {
afterVisitExpression(node)
}
fun afterVisitTypeReferenceExpression(node: UTypeReferenceExpression) {
afterVisitExpression(node)
}
fun afterVisitCallExpression(node: UCallExpression) {
afterVisitExpression(node)
}
fun afterVisitBinaryExpression(node: UBinaryExpression) {
afterVisitExpression(node)
}
fun afterVisitBinaryExpressionWithType(node: UBinaryExpressionWithType) {
afterVisitExpression(node)
}
fun afterVisitParenthesizedExpression(node: UParenthesizedExpression) {
afterVisitExpression(node)
}
fun afterVisitUnaryExpression(node: UUnaryExpression) {
afterVisitExpression(node)
}
fun afterVisitPrefixExpression(node: UPrefixExpression) {
afterVisitExpression(node)
}
fun afterVisitPostfixExpression(node: UPostfixExpression) {
afterVisitExpression(node)
}
fun afterVisitExpressionList(node: UExpressionList) {
afterVisitExpression(node)
}
fun afterVisitIfExpression(node: UIfExpression) {
afterVisitExpression(node)
}
fun afterVisitSwitchExpression(node: USwitchExpression) {
afterVisitExpression(node)
}
fun afterVisitSwitchClauseExpression(node: USwitchClauseExpression) {
afterVisitExpression(node)
}
fun afterVisitWhileExpression(node: UWhileExpression) {
afterVisitExpression(node)
}
fun afterVisitDoWhileExpression(node: UDoWhileExpression) {
afterVisitExpression(node)
}
fun afterVisitForExpression(node: UForExpression) {
afterVisitExpression(node)
}
fun afterVisitForEachExpression(node: UForEachExpression) {
afterVisitExpression(node)
}
fun afterVisitTryExpression(node: UTryExpression) {
afterVisitExpression(node)
}
fun afterVisitCatchClause(node: UCatchClause) {
afterVisitElement(node)
}
fun afterVisitLiteralExpression(node: ULiteralExpression) {
afterVisitExpression(node)
}
fun afterVisitThisExpression(node: UThisExpression) {
afterVisitExpression(node)
}
fun afterVisitSuperExpression(node: USuperExpression) {
afterVisitExpression(node)
}
fun afterVisitReturnExpression(node: UReturnExpression) {
afterVisitExpression(node)
}
fun afterVisitBreakExpression(node: UBreakExpression) {
afterVisitExpression(node)
}
@JvmDefault
fun afterVisitYieldExpression(node: UYieldExpression) {
afterVisitExpression(node)
}
fun afterVisitContinueExpression(node: UContinueExpression) {
afterVisitExpression(node)
}
fun afterVisitThrowExpression(node: UThrowExpression) {
afterVisitExpression(node)
}
fun afterVisitArrayAccessExpression(node: UArrayAccessExpression) {
afterVisitExpression(node)
}
fun afterVisitCallableReferenceExpression(node: UCallableReferenceExpression) {
afterVisitExpression(node)
}
fun afterVisitClassLiteralExpression(node: UClassLiteralExpression) {
afterVisitExpression(node)
}
fun afterVisitLambdaExpression(node: ULambdaExpression) {
afterVisitExpression(node)
}
fun afterVisitObjectLiteralExpression(node: UObjectLiteralExpression) {
afterVisitExpression(node)
}
fun afterVisitPolyadicExpression(node: UPolyadicExpression) {
afterVisitExpression(node)
}
fun afterVisitExpression(node: UExpression) = afterVisitElement(node)
fun afterVisitLabeledExpression(node: ULabeledExpression) = afterVisitExpression(node)
fun afterVisitDeclarationsExpression(node: UDeclarationsExpression) = afterVisitExpression(node)
fun afterVisitBlockExpression(node: UBlockExpression) = afterVisitExpression(node)
fun afterVisitQualifiedReferenceExpression(node: UQualifiedReferenceExpression) = afterVisitExpression(node)
fun afterVisitSimpleNameReferenceExpression(node: USimpleNameReferenceExpression) = afterVisitExpression(node)
fun afterVisitTypeReferenceExpression(node: UTypeReferenceExpression) = afterVisitExpression(node)
fun afterVisitCallExpression(node: UCallExpression) = afterVisitExpression(node)
fun afterVisitBinaryExpression(node: UBinaryExpression) = afterVisitExpression(node)
fun afterVisitBinaryExpressionWithType(node: UBinaryExpressionWithType) = afterVisitExpression(node)
fun afterVisitParenthesizedExpression(node: UParenthesizedExpression) = afterVisitExpression(node)
fun afterVisitUnaryExpression(node: UUnaryExpression) = afterVisitExpression(node)
fun afterVisitPrefixExpression(node: UPrefixExpression) = afterVisitExpression(node)
fun afterVisitPostfixExpression(node: UPostfixExpression) = afterVisitExpression(node)
fun afterVisitExpressionList(node: UExpressionList) = afterVisitExpression(node)
fun afterVisitIfExpression(node: UIfExpression) = afterVisitExpression(node)
fun afterVisitSwitchExpression(node: USwitchExpression) = afterVisitExpression(node)
fun afterVisitSwitchClauseExpression(node: USwitchClauseExpression) = afterVisitExpression(node)
fun afterVisitWhileExpression(node: UWhileExpression) = afterVisitExpression(node)
fun afterVisitDoWhileExpression(node: UDoWhileExpression) = afterVisitExpression(node)
fun afterVisitForExpression(node: UForExpression) = afterVisitExpression(node)
fun afterVisitForEachExpression(node: UForEachExpression) = afterVisitExpression(node)
fun afterVisitTryExpression(node: UTryExpression) = afterVisitExpression(node)
fun afterVisitCatchClause(node: UCatchClause) = afterVisitElement(node)
fun afterVisitLiteralExpression(node: ULiteralExpression) = afterVisitExpression(node)
fun afterVisitThisExpression(node: UThisExpression) = afterVisitExpression(node)
fun afterVisitSuperExpression(node: USuperExpression) = afterVisitExpression(node)
fun afterVisitReturnExpression(node: UReturnExpression) = afterVisitExpression(node)
fun afterVisitBreakExpression(node: UBreakExpression) = afterVisitExpression(node)
@JvmDefault fun afterVisitYieldExpression(node: UYieldExpression) = afterVisitExpression(node)
fun afterVisitContinueExpression(node: UContinueExpression) = afterVisitExpression(node)
fun afterVisitThrowExpression(node: UThrowExpression) = afterVisitExpression(node)
fun afterVisitArrayAccessExpression(node: UArrayAccessExpression) = afterVisitExpression(node)
fun afterVisitCallableReferenceExpression(node: UCallableReferenceExpression) = afterVisitExpression(node)
fun afterVisitClassLiteralExpression(node: UClassLiteralExpression) = afterVisitExpression(node)
fun afterVisitLambdaExpression(node: ULambdaExpression) = afterVisitExpression(node)
fun afterVisitObjectLiteralExpression(node: UObjectLiteralExpression) = afterVisitExpression(node)
fun afterVisitPolyadicExpression(node: UPolyadicExpression) = afterVisitExpression(node)
}
abstract class AbstractUastVisitor : UastVisitor {
@@ -274,12 +120,14 @@ abstract class AbstractUastVisitor : UastVisitor {
}
/**
* There is a convention in UAST-visitors that visitor will not be passed to children if `visit*` will return true.
* There is a convention in UAST-visitors that a visitor will not be passed to children if `visit*` will return `true`.
* So make sure that overridden methods returns `true` and please think twice before returning `false` if you are passing implementation to
* [com.intellij.uast.UastVisitorAdapter].
*/
@Suppress("KDocUnresolvedReference")
abstract class AbstractUastNonRecursiveVisitor : UastVisitor {
override fun visitElement(node: UElement): Boolean = true
}
@Suppress("unused")
object EmptyUastVisitor : AbstractUastVisitor()