@Override public final boolean matches(final INode other, final Match match) { final INode node = lastOrDefault(match.get(_referencedGroupName)); return node != null && node.matches(other); } }
@Override public final boolean matches(final INode other, final Match match) { final INode node = lastOrDefault(match.get(_referencedGroupName)); return node != null && node.matches(other); } }
@Override public final boolean matches(final INode other, final Match match) { final INode node = lastOrDefault(match.get(_referencedGroupName)); return node != null && node.matches(other); } }
private boolean canConvertStoreToAssignment(final Node store, final Variable variable) { if (store instanceof Expression) { final Expression storeExpression = (Expression) store; switch (storeExpression.getCode()) { case Store: case PutStatic: case PutField: case StoreElement: return matchLoad(lastOrDefault(storeExpression.getArguments()), variable); } } return false; } }
private boolean canConvertStoreToAssignment(final Node store, final Variable variable) { if (store instanceof Expression) { final Expression storeExpression = (Expression) store; switch (storeExpression.getCode()) { case Store: case PutStatic: case PutField: case StoreElement: return matchLoad(lastOrDefault(storeExpression.getArguments()), variable); } } return false; } }
private boolean canConvertStoreToAssignment(final Node store, final Variable variable) { if (store instanceof Expression) { final Expression storeExpression = (Expression) store; switch (storeExpression.getCode()) { case Store: case PutStatic: case PutField: case StoreElement: return matchLoad(lastOrDefault(storeExpression.getArguments()), variable); } } return false; } }
return checkExit(lastOrDefault(((BasicBlock) node).getBody())); final Label exitLabel = checkExit(lastOrDefault(tryCatch.getTryBlock().getBody())); if (checkExit(lastOrDefault(catchBlock.getBody())) != exitLabel) { return null; if (finallyBlock != null && checkExit(lastOrDefault(finallyBlock.getBody())) != exitLabel) { return null;
final BasicBlock childBasicBlock = (BasicBlock) child; final Node firstChild = firstOrDefault(childBasicBlock.getBody()); final Node lastChild = lastOrDefault(childBasicBlock.getBody());
public Instruction tryGetAtOffset(final int offset) { final int index = Collections.binarySearch( this, new Instruction(offset, OpCode.NOP), new Comparator<Instruction>() { @Override public int compare(@NotNull final Instruction o1, @NotNull final Instruction o2) { return Integer.compare(o1.getOffset(), o2.getOffset()); } } ); if (index < 0) { final Instruction last = lastOrDefault(this); if (last != null && last.getNext() != null && last.getNext().getOffset() == offset) { return last.getNext(); } return null; } return get(index); }
public Instruction tryGetAtOffset(final int offset) { final int index = Collections.binarySearch( this, new Instruction(offset, OpCode.NOP), new Comparator<Instruction>() { @Override public int compare(@NotNull final Instruction o1, @NotNull final Instruction o2) { return Integer.compare(o1.getOffset(), o2.getOffset()); } } ); if (index < 0) { final Instruction last = lastOrDefault(this); if (last != null && last.getNext() != null && last.getNext().getOffset() == offset) { return last.getNext(); } return null; } return get(index); }
public Instruction tryGetAtOffset(final int offset) { final int index = Collections.binarySearch( this, new Instruction(offset, OpCode.NOP), new Comparator<Instruction>() { @Override public int compare(@NotNull final Instruction o1, @NotNull final Instruction o2) { return Integer.compare(o1.getOffset(), o2.getOffset()); } } ); if (index < 0) { final Instruction last = lastOrDefault(this); if (last != null && last.getNext() != null && last.getNext().getOffset() == offset) { return last.getNext(); } return null; } return get(index); }
@Override public final boolean matches(final INode other, final Match match) { if (other instanceof IdentifierExpression && !any(((IdentifierExpression) other).getTypeArguments())) { final INode referenced = lastOrDefault(match.get(_referencedGroupName)); return referenced instanceof AstNode && StringUtilities.equals( ((IdentifierExpression) other).getIdentifier(), ((AstNode) referenced).getChildByRole(Roles.IDENTIFIER).getName() ); } return false; } }
@Override public final boolean matches(final INode other, final Match match) { if (other instanceof IdentifierExpression && !any(((IdentifierExpression) other).getTypeArguments())) { final INode referenced = lastOrDefault(match.get(_referencedGroupName)); return referenced instanceof AstNode && StringUtilities.equals( ((IdentifierExpression) other).getIdentifier(), ((AstNode) referenced).getChildByRole(Roles.IDENTIFIER).getName() ); } return false; } }
@Override public final boolean matches(final INode other, final Match match) { if (other instanceof IdentifierExpression && !any(((IdentifierExpression) other).getTypeArguments())) { final INode referenced = lastOrDefault(match.get(_referencedGroupName)); return referenced instanceof AstNode && StringUtilities.equals( ((IdentifierExpression) other).getIdentifier(), ((AstNode) referenced).getChildByRole(Roles.IDENTIFIER).getName() ); } return false; } }
@Override public final boolean matches(final INode other, final Match match) { if (other instanceof AstNode) { final INode lastInGroup = lastOrDefault(match.get(_referencedGroupName)); if (lastInGroup instanceof VariableDeclarationStatement) { final VariableDeclarationStatement referenced = (VariableDeclarationStatement) lastInGroup; final AstNodeCollection<VariableInitializer> variables = referenced.getVariables(); return variables.hasSingleElement() && matchString( variables.firstOrNullObject().getName(), ((AstNode) other).getChildByRole(Roles.IDENTIFIER).getName() ); } } return false; } }
@Override public final boolean matches(final INode other, final Match match) { if (other instanceof AstNode) { final INode lastInGroup = lastOrDefault(match.get(_referencedGroupName)); if (lastInGroup instanceof VariableDeclarationStatement) { final VariableDeclarationStatement referenced = (VariableDeclarationStatement) lastInGroup; final AstNodeCollection<VariableInitializer> variables = referenced.getVariables(); return variables.hasSingleElement() && matchString( variables.firstOrNullObject().getName(), ((AstNode) other).getChildByRole(Roles.IDENTIFIER).getName() ); } } return false; } }
@Override public final boolean matches(final INode other, final Match match) { if (other instanceof AstNode) { final INode lastInGroup = lastOrDefault(match.get(_referencedGroupName)); if (lastInGroup instanceof VariableDeclarationStatement) { final VariableDeclarationStatement referenced = (VariableDeclarationStatement) lastInGroup; final AstNodeCollection<VariableInitializer> variables = referenced.getVariables(); return variables.hasSingleElement() && matchString( variables.firstOrNullObject().getName(), ((AstNode) other).getChildByRole(Roles.IDENTIFIER).getName() ); } } return false; } }
private void visitChoice(final Choice choice) { writeKeyword("choice"); space(); leftParenthesis(); newLine(); formatter.indent(); final INode last = lastOrDefault(choice); for (final INode alternative : choice) { visitNodeInPattern(alternative); if (alternative != last) { writeToken(Roles.COMMA); } newLine(); } formatter.unindent(); rightParenthesis(); }
private void visitChoice(final Choice choice) { writeKeyword("choice"); space(); leftParenthesis(); newLine(); formatter.indent(); final INode last = lastOrDefault(choice); for (final INode alternative : choice) { visitNodeInPattern(alternative); if (alternative != last) { writeToken(Roles.COMMA); } newLine(); } formatter.unindent(); rightParenthesis(); }
private void visitChoice(final Choice choice) { writeKeyword("choice"); space(); leftParenthesis(); newLine(); formatter.indent(); final INode last = lastOrDefault(choice); for (final INode alternative : choice) { visitNodeInPattern(alternative); if (alternative != last) { writeToken(Roles.COMMA); } newLine(); } formatter.unindent(); rightParenthesis(); }