コード例 #1
0
 public boolean visit(SimpleName node) {
   if (fIgnoreBinding != null && Bindings.equals(fIgnoreBinding, node.resolveBinding()))
     return false;
   if (fIgnoreRange != null && fIgnoreRange.covers(node)) return false;
   fScope.addName(node.getIdentifier());
   return false;
 }
コード例 #2
0
 public boolean visit(FunctionInvocation node) {
   Expression receiver = node.getExpression();
   if (receiver == null) {
     SimpleName name = node.getName();
     if (fIgnoreBinding == null
         || (name != null && !Bindings.equals(fIgnoreBinding, name.resolveBinding())))
       node.getName().accept(this);
   } else {
     receiver.accept(this);
   }
   accept(node.arguments());
   return false;
 }
コード例 #3
0
    public boolean visit(SimpleName node) {
      IBinding binding = node.resolveBinding();
      if (binding == null || binding.getKind() != fBinding.getKind()) {
        return false;
      }
      binding = getDeclaration(binding);

      if (fBinding == binding) {
        fResult.add(node);
      } else if (binding.getKind() == IBinding.METHOD) {
        IFunctionBinding curr = (IFunctionBinding) binding;
        IFunctionBinding methodBinding = (IFunctionBinding) fBinding;
        if (methodBinding.overrides(curr) || curr.overrides(methodBinding)) {
          fResult.add(node);
        }
      }
      return false;
    }
コード例 #4
0
 /**
  * Find all nodes connected to the given name node. If the node has a binding then all nodes
  * connected to this binding are returned. If the node has no binding, then all nodes that also
  * miss a binding and have the same name are returned.
  *
  * @param root The root of the AST tree to search
  * @param name The node to find linked nodes for
  * @return Return
  */
 public static SimpleName[] findByNode(ASTNode root, SimpleName name) {
   IBinding binding = name.resolveBinding();
   if (binding != null) {
     return findByBinding(root, binding);
   }
   SimpleName[] names = findByProblems(root, name);
   if (names != null) {
     return names;
   }
   int parentKind = name.getParent().getNodeType();
   if (parentKind == ASTNode.LABELED_STATEMENT
       || parentKind == ASTNode.BREAK_STATEMENT
       || parentKind == ASTNode.CONTINUE_STATEMENT) {
     ArrayList res = new ArrayList();
     LabelFinder nodeFinder = new LabelFinder(name, res);
     root.accept(nodeFinder);
     return (SimpleName[]) res.toArray(new SimpleName[res.size()]);
   }
   return new SimpleName[] {name};
 }