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;
 }
Exemplo n.º 2
0
  public static SimpleName[] findByProblems(ASTNode parent, SimpleName nameNode) {
    ArrayList res = new ArrayList();

    ASTNode astRoot = parent.getRoot();
    if (!(astRoot instanceof JavaScriptUnit)) {
      return null;
    }

    IProblem[] problems = ((JavaScriptUnit) astRoot).getProblems();
    int nameNodeKind = getNameNodeProblemKind(problems, nameNode);
    if (nameNodeKind == 0) { // no problem on node
      return null;
    }

    int bodyStart = parent.getStartPosition();
    int bodyEnd = bodyStart + parent.getLength();

    String name = nameNode.getIdentifier();

    for (int i = 0; i < problems.length; i++) {
      IProblem curr = problems[i];
      int probStart = curr.getSourceStart();
      int probEnd = curr.getSourceEnd() + 1;

      if (probStart > bodyStart && probEnd < bodyEnd) {
        int currKind = getProblemKind(curr);
        if ((nameNodeKind & currKind) != 0) {
          ASTNode node = NodeFinder.perform(parent, probStart, probEnd - probStart);
          if (node instanceof SimpleName && name.equals(((SimpleName) node).getIdentifier())) {
            res.add(node);
          }
        }
      }
    }
    return (SimpleName[]) res.toArray(new SimpleName[res.size()]);
  }
Exemplo n.º 3
0
 private boolean isSameLabel(SimpleName label) {
   return label != null && fLabel.getIdentifier().equals(label.getIdentifier());
 }
 /*
  * @see ASTVisitor#visit(SimpleName)
  */
 public boolean visit(SimpleName node) {
   this.fBuffer.append(node.getIdentifier());
   return false;
 }