Package org.eclipse.jdt.core.dom

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


   
    IValue type = visitChild(node.getType());
   
    IValueList fragments = new IValueList(values);
    for (Iterator it = node.fragments().iterator(); it.hasNext();) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      fragments.add(visitChild(f));
    }
   
    ownValue = constructDeclarationNode("variables", type, fragments.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here


   
    IValue type = visitChild(node.getType());
 
    IValueList fragments = new IValueList(values);
    for (Iterator it = node.fragments().iterator(); it.hasNext();) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      fragments.add(visitChild(f));
    }
   
    ownValue = constructDeclarationNode("variables", type, fragments.asList());
    setAnnotation("modifiers", extendedModifiers);
View Full Code Here

  @Test
  public void testFieldInitializer() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldInit", FIELD_INIT);
    MethodDeclaration c = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(c.resolveBinding());
    VariableDeclarationFragment f = EclipseTACSimpleTestDriver.getFirstField(cu);
    Expression init = f.getInitializer();
    Assert.assertNotNull(init);

    TACInstruction decl = tac.instruction(f);
    Assert.assertNotNull(decl);
    Assert.assertTrue(decl instanceof StoreFieldInstruction);
View Full Code Here

  @Test
  public void testFieldInitNew() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldInitNew", FIELD_INIT_NEW);
    MethodDeclaration c = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(c.resolveBinding());
    VariableDeclarationFragment f = EclipseTACSimpleTestDriver.getFirstField(cu);
    Expression init = f.getInitializer();
    Assert.assertNotNull(init);

    TACInstruction decl = tac.instruction(f);
    Assert.assertNotNull(decl);
    Assert.assertTrue(decl instanceof StoreFieldInstruction);
View Full Code Here

  @Test
  public void testFieldNoInitializer() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldNoInit", FIELD_NO_INIT);
    MethodDeclaration c = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(c.resolveBinding());
    VariableDeclarationFragment f = EclipseTACSimpleTestDriver.getFirstField(cu);
    Expression init = f.getInitializer();
    Assert.assertNull(init);

    TACInstruction decl = tac.instruction(f);
    Assert.assertNull(decl); // make sure the field declaration doesn't become a local
  }
View Full Code Here

      printModifiers(node.modifiers());
    }
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      f.accept(this);
      if (it.hasNext()) {
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    this.buffer.append(";\n");//$NON-NLS-1$
View Full Code Here

      printModifiers(node.modifiers());
    }
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      f.accept(this);
      if (it.hasNext()) {
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    return false;
View Full Code Here

      printModifiers(node.modifiers());
    }
    node.getType().accept(this);
    this.buffer.append(" ");//$NON-NLS-1$
    for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
      VariableDeclarationFragment f = (VariableDeclarationFragment) it.next();
      f.accept(this);
      if (it.hasNext()) {
        this.buffer.append(", ");//$NON-NLS-1$
      }
    }
    this.buffer.append(";\n");//$NON-NLS-1$
View Full Code Here

    org.eclipse.jdt.core.dom.Block block = ast.newBlock();
    /*
     * define the return value
     */
    SimpleName returnValueName = ast.newSimpleName("newGXTBean");
    VariableDeclarationFragment fragment = ast.newVariableDeclarationFragment();
    fragment.setName(returnValueName);
    ClassInstanceCreation newClassInstance = ast.newClassInstanceCreation();
    newClassInstance.setType((Type)returnType.copySubtree(ast, returnType));
    fragment.setInitializer(newClassInstance);
    VariableDeclarationStatement returnValue = ast.newVariableDeclarationStatement(fragment);
    returnValue.setType((Type)returnType.copySubtree(ast, returnType));
    block.statements().add(returnValue);
    /*
     * call each get method in the original and pass the result to the new set method
View Full Code Here

            Block body = ast.newBlock();
            body.statements().add(test);
            method.setBody(body);

            // Backup the old checkpoint.
            VariableDeclarationFragment fragment = ast
                    .newVariableDeclarationFragment();
            fragment.setName(ast.newSimpleName("oldCheckpoint"));
            fragment.setInitializer(ast.newSimpleName(CHECKPOINT_NAME));

            VariableDeclarationStatement tempDeclaration = ast
                    .newVariableDeclarationStatement(fragment);
            tempDeclaration.setType(createType(ast, checkpointType));
            thenBranch.statements().add(tempDeclaration);
View Full Code Here

TOP

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

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.