public class IfHandler extends BlockParentHandler
| Constructor and Description |
|---|
IfHandler(IndentationCheck indentCheck,
DetailAST ast,
AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check,
abstract syntax tree, and parent handler.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkCondExpr()
Check the indentation of the conditional expression.
|
void |
checkIndentation()
Check the indentation of the expression we are handling.
|
protected void |
checkTopLevelToken()
Check the indent of the top level token.
|
private static DetailAST |
getIfStatementRightParen(DetailAST literalIfAst)
Returns right parenthesis of if statement.
|
protected IndentLevel |
getIndentImpl()
Compute the indentation amount for this handler.
|
IndentLevel |
getSuggestedChildIndent(AbstractExpressionHandler child)
Indentation level suggested for a child element.
|
private boolean |
isIfAfterElse()
Determines if this 'if' statement is part of an 'else' clause
and on the same line.
|
canChildrenBeNested, curlyIndent, getCheckedChildren, getChildrenExpectedIndent, getLeftCurly, getListChild, getNonListChild, getRightCurly, getTopLevelAstcheckChildren, checkExpressionSubtree, checkLeftParen, checkModifiers, checkRightParen, checkWrappingIndentation, checkWrappingIndentation, expandedTabsColumnNo, findSubtreeAst, getBasicOffset, getBraceAdjustment, getFirstAstNode, getFirstLine, getFirstToken, getIndent, getIndentCheck, getLineStart, getLineStart, getMainAst, getParent, isOnStartOfLine, logError, logError, shouldIncreaseIndentpublic IfHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
indentCheck - the indentation checkast - the abstract syntax treeparent - the parent handlerpublic IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child)
AbstractExpressionHandlergetSuggestedChildIndent in class BlockParentHandlerchild - child AST (so suggestion level can differ based on child
type)protected IndentLevel getIndentImpl()
AbstractExpressionHandlergetIndentImpl in class AbstractExpressionHandlerprivate boolean isIfAfterElse()
protected void checkTopLevelToken()
BlockParentHandlercheckTopLevelToken in class BlockParentHandlerprivate void checkCondExpr()
public void checkIndentation()
AbstractExpressionHandlercheckIndentation in class BlockParentHandlerprivate static DetailAST getIfStatementRightParen(DetailAST literalIfAst)
literalIfAst - literal-if ast node(TokenTypes.LITERAL_IF)Copyright © 2001-2022. All Rights Reserved.