示例#1
0
 protected void findOccurrences() {
   fDescription = Messages.format(EXIT_POINT_OF, fFunctionDeclaration.getFunctionName().getName());
   fFunctionDeclaration.accept(this);
   // TODO : check execution path to determine if the last bracket
   // is also a possible exit path
   // Block block= fMethodDeclaration.getBody();
   // if (block != null) {
   // List statements= block.statements();
   // if (statements.size() > 0) {
   // Statement last= (Statement)statements.get(statements.size() - 1);
   // int maxVariableId= LocalVariableIndex.perform(fMethodDeclaration);
   // FlowContext flowContext= new FlowContext(0, maxVariableId + 1);
   // flowContext.setConsiderAccessMode(false);
   // flowContext.setComputeMode(FlowContext.ARGUMENTS);
   // InOutFlowAnalyzer flowAnalyzer= new InOutFlowAnalyzer(flowContext);
   // FlowInfo info= flowAnalyzer.perform(new ASTNode[] {last});
   // if (!info.isNoReturn() && !isVoid) {
   // if (!info.isPartialReturn())
   // return;
   // }
   // }
   int offset = fFunctionDeclaration.getEnd() - 1;
   fResult.add(new OccurrenceLocation(offset, 1, getOccurrenceType(null), fDescription));
   // }
 }
    public boolean apply(ASTNode node) {
      // stops when found - that's the reason to use ApplyAll
      if (exists) return false;

      if (node.getType() == ASTNode.CLASS_DECLARATION) {
        // do nothing never catch method names
      } else if (node.getType() == ASTNode.FUNCTION_DECLARATION) {
        FunctionDeclaration functionDeclaration = (FunctionDeclaration) node;
        Identifier identifier = functionDeclaration.getFunctionName();
        if (identifier.getName().equalsIgnoreCase(name)) {
          exists = true;
        }
      }

      return true;
    }
示例#3
0
 public String getElementName() {
   return fFunctionDeclaration.getFunctionName().getName();
 }