Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ASTNode


  protected IResult<LE> transferNode(ICFGNode<ASTNode> cfgNode, LE incoming,
      ILabel transferLabel) throws CancellationException {
    // are we canceled?
    checkCancel(); // FIXME hook up cancel support all the way (FlowAnalysis, branch-insensitive)
   
    final ASTNode astNode = cfgNode.getASTNode();
    if(astNode == null) {
      // dummy node
      // return immediately using the incoming result for all outgoing edges
      return LabeledSingleResult.createResult(incoming, getLabels(cfgNode));
    }
View Full Code Here


   
    Map<ICompilationUnit, ASTNode> parsedCompilationUnits = new HashMap<ICompilationUnit, ASTNode>();
     Iterator<ICompilationUnit> iter = compilationUnits.iterator();
     ICompilationUnit compUnit = null;
     ASTParser parser = null;
     ASTNode node = null;
     for(; iter.hasNext() ;) {
       compUnit = iter.next();
        parser = ASTParser.newParser(AST.JLS3);
       parser.setResolveBindings(true);
       parser.setSource(compUnit);
View Full Code Here

    Set<ICompilationUnit> compUnits = compilationUnitToASTNode.keySet();
    Iterator<ICompilationUnit> compUnitIterator = compUnits.iterator();
    ICompilationUnit icu;
    for(;compUnitIterator.hasNext();){
      icu = compUnitIterator.next();
      ASTNode node = compilationUnitToASTNode.get(icu);
      node.accept(new BindingsCollectorVisitor(bindings));
    }
    return bindings;
  }
View Full Code Here

   */
  private static <NODETYPE extends ASTNode> Option<NODETYPE>
    findNodeForModel(IMember model_element, final Class<? extends NODETYPE> clazz,
      final Lambda<NODETYPE,Boolean> isCorrectNode) {
    ICompilationUnit comp_unit = model_element.getCompilationUnit();
    ASTNode node = getASTNodeFromCompilationUnit(comp_unit);
   
    // Now, find the corresponding type node
    final Box<NODETYPE> result = new Box<NODETYPE>(null);
    node.accept(new ASTVisitor() {
     
      @Override
      public void postVisit(ASTNode node) {
        // If this node is a subtype of the node we are
        // interested in, then we can ask the client's
        // function if this is the right instance.
        if( clazz.isAssignableFrom(node.getClass()) ) {
          @SuppressWarnings("unchecked") NODETYPE node2 = (NODETYPE)node;
          if( isCorrectNode.call(node2) ) {
            result.setValue(node2);
          }
        }
View Full Code Here

   * {@link TempVariable temps}.
   * @return the result variable for the node represented
   * by this instruction using <i>default variable resolution</i>.
   */
  private Variable defaultVariable() {
    ASTNode copyFor = checkIfCopyNeeded(getNode());
    if(copyFor != null)
      return targetVariable(copyFor);

    // unique target variable for this instruction
    return createTemp(getNode());
View Full Code Here

   * Returns the AST node for which a copy is needed, if any.
   * @param n
   * @return The AST node for which a copy is needed; <code>null</code> if no copy is needed.
   */
  protected static ASTNode checkIfCopyNeeded(ASTNode n) {
    ASTNode p = n.getParent();
    boolean branches = false;
    while(p != null) {
      // skip over parentheses
      if((p instanceof ParenthesizedExpression)
          // skip over assignments, unless previously hit a branch
View Full Code Here

   * @param current
   * @return
   */
  private EclipseCFGNode copySubgraphRecur(EclipseCFGNode current, EclipseCFGNode stopNode,
      HashMap<EclipseCFGNode, EclipseCFGNode> cloneMap) {
    ASTNode node = current.getASTNode();
    EclipseCFGNode clone = new EclipseCFGNode(node);
    EclipseCFGNode start = current.getStart();
    EclipseCFGNode end = current.getEnd();

    clone.setName(current.getName());
View Full Code Here

   * @return
   */
  private EclipseCFGNode setUpConstructorBody(MethodDeclaration node) {
    EclipseCFGNode last = null, current = null;
    List<ASTNode> statements = new ArrayList<ASTNode>(node.getBody().statements());
    ASTNode firstStmt = null;
    EclipseCFGNode body = new EclipseCFGNode(node.getBody());

    // connect field declarations with initializers together
    for (FieldDeclaration field : ((TypeDeclaration) node.getParent()).getFields()) {
      if (Modifier.isStatic(field.getModifiers()))
View Full Code Here

    createEdge(switchBegin, exp.getStart());

    last = switchEnd;
    for (int ndx = stmnts.size() - 1; ndx >= 0; ndx--) {
      ASTNode currentAST = stmnts.get(ndx);
      EclipseCFGNode current = nodeMap.get(currentAST);

      if (currentAST instanceof SwitchCase) {
        createEdge(exp.getEnd(), current.getStart(), ((SwitchCase) currentAST)
            .getExpression());
View Full Code Here

  public IVariableBinding resolveBinding() {
    return getNode().resolveBinding();
  }

  public boolean isCaughtVariable() {
    ASTNode parent = this.getNode().getParent();
    if( parent instanceof CatchClause ) {
      // This is not enough. We must make sure that this variable
      // is being declared inside the declaration part.
      CatchClause catch_clause = (CatchClause)parent;
      if( catch_clause.getException().equals(this.getNode()) ) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.ASTNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.