private void permuteSubroutineInInterfaceBlocks() { for (Definition declaration : getInterfaceDeclarations()) { ASTSubroutineStmtNode subroutineStmt = declaration.getTokenRef().findToken().findNearestAncestor(ASTSubroutineStmtNode.class); if (subroutineStmt != null && subroutineStmt.getSubroutinePars() != null && subroutineStmt.getSubroutinePars().size() == newParameterList.size()) permuteDummyArguments(subroutineStmt); } }
private Collection<Definition> getInterfaceDeclarations() { List<Definition> subroutineDefinitions = selectedSubroutine.getSubroutineName().getSubroutineName().resolveBinding(); if (subroutineDefinitions.size() != 1) return new ArrayList<Definition>(); return subroutineDefinitions.get(0).findMatchingDeclarationsInInterfaces(); }
private Set<ASTCallStmtNode> getCallSites() { List<Definition> subroutineDefinitions = selectedSubroutine.getSubroutineName().getSubroutineName().resolveBinding(); HashSet<ASTCallStmtNode> result = new HashSet<ASTCallStmtNode>(); if (subroutineDefinitions.size() != 1) return result; // probably should throw an error of some sort! for (PhotranTokenRef tokenRef : subroutineDefinitions.get(0).findAllReferences(true)) { Token token = tokenRef.findToken(); ASTCallStmtNode callStmtNode = token.findNearestAncestor(ASTCallStmtNode.class); if (callStmtNode != null) result.add(callStmtNode); } return result; }
public List<ASTSubroutineParNode> getSubroutineParameters() { if (selectedSubroutine.getSubroutinePars() != null) return selectedSubroutine.getSubroutinePars(); return new ArrayList<ASTSubroutineParNode>(); }
protected void permuteDummyArguments(ASTSubroutineStmtNode node) { ASTSeparatedListNode<ASTSubroutineParNode> newParameterList = new ASTSeparatedListNode<ASTSubroutineParNode>( new Token(Terminal.T_COMMA, ","), this.newParameterList); // $NON-NLS-1$ node.setSubroutinePars(newParameterList); }