コード例 #1
0
  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);
    }
  }
コード例 #2
0
  private Collection<Definition> getInterfaceDeclarations() {
    List<Definition> subroutineDefinitions =
        selectedSubroutine.getSubroutineName().getSubroutineName().resolveBinding();

    if (subroutineDefinitions.size() != 1) return new ArrayList<Definition>();

    return subroutineDefinitions.get(0).findMatchingDeclarationsInInterfaces();
  }
コード例 #3
0
  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;
  }
コード例 #4
0
  public List<ASTSubroutineParNode> getSubroutineParameters() {
    if (selectedSubroutine.getSubroutinePars() != null)
      return selectedSubroutine.getSubroutinePars();

    return new ArrayList<ASTSubroutineParNode>();
  }
コード例 #5
0
 protected void permuteDummyArguments(ASTSubroutineStmtNode node) {
   ASTSeparatedListNode<ASTSubroutineParNode> newParameterList =
       new ASTSeparatedListNode<ASTSubroutineParNode>(
           new Token(Terminal.T_COMMA, ","), this.newParameterList); // $NON-NLS-1$
   node.setSubroutinePars(newParameterList);
 }