Examples of VariableDeclarationStatement


Examples of com.google.dart.engine.ast.VariableDeclarationStatement

    NodeList<Statement> statements = block.getStatements();
    int statementCount = statements.size();
    for (int i = 0; i < statementCount; i++) {
      Statement statement = statements.get(i);
      if (statement instanceof VariableDeclarationStatement) {
        VariableDeclarationStatement vds = (VariableDeclarationStatement) statement;
        NodeList<VariableDeclaration> variables = vds.getVariables().getVariables();
        int variableCount = variables.size();
        for (int j = 0; j < variableCount; j++) {
          scope.hide(variables.get(j).getElement());
        }
      } else if (statement instanceof FunctionDeclarationStatement) {
View Full Code Here

Examples of com.strobel.decompiler.languages.java.ast.VariableDeclarationStatement

    public final boolean matches(final INode other, final Match match) {
        if (other instanceof AstNode) {
            final INode lastInGroup = lastOrDefault(match.get(_referencedGroupName));

            if (lastInGroup instanceof VariableDeclarationStatement) {
                final VariableDeclarationStatement referenced = (VariableDeclarationStatement) lastInGroup;
                final AstNodeCollection<VariableInitializer> variables = referenced.getVariables();

                return variables.hasSingleElement() &&
                       matchString(
                           variables.firstOrNullObject().getName(),
                           ((AstNode) other).getChildByRole(Roles.IDENTIFIER).getName()
View Full Code Here

Examples of com.strobel.decompiler.languages.java.ast.VariableDeclarationStatement

    public final boolean matches(final INode other, final Match match) {
        if (other instanceof AstNode) {
            final INode lastInGroup = lastOrDefault(match.get(_referencedGroupName));

            if (lastInGroup instanceof VariableDeclarationStatement) {
                final VariableDeclarationStatement referenced = (VariableDeclarationStatement) lastInGroup;
                final AstNodeCollection<VariableInitializer> variables = referenced.getVariables();

                return variables.hasSingleElement() &&
                       matchString(
                           variables.firstOrNullObject().getName(),
                           ((AstNode) other).getChildByRole(Roles.IDENTIFIER).getName()
View Full Code Here

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

     * @param vname
     */
    public void addLocalVariableDeclaration(String type, String vname) {
        VariableDeclarationFragment vfrag = m_ast.newVariableDeclarationFragment();
        vfrag.setName(m_ast.newSimpleName(vname));
        VariableDeclarationStatement stmt = m_ast.newVariableDeclarationStatement(vfrag);
        stmt.setType(m_source.createType(type));
        m_block.statements().add(stmt);
    }
View Full Code Here

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

     */
    public void addLocalVariableDeclaration(Type type, String vname, ExpressionBuilderBase expr) {
        VariableDeclarationFragment vfrag = m_ast.newVariableDeclarationFragment();
        vfrag.setName(m_ast.newSimpleName(vname));
        vfrag.setInitializer(expr.getExpression());
        VariableDeclarationStatement stmt = m_ast.newVariableDeclarationStatement(vfrag);
        stmt.setType(type);
        m_block.statements().add(stmt);
    }
View Full Code Here

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

      VariableDeclarationExpression parent = (VariableDeclarationExpression)parentASTNode;
      parent.getType().accept(this);
      visitListOfModifiers(parent.modifiers());
    }
    else {
      VariableDeclarationStatement parent = (VariableDeclarationStatement)parentASTNode;
      parent.getType().accept(this);
      visitListOfModifiers(parent.modifiers());
    }
    scopeManager.pop();
    return true;
  }
View Full Code Here

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

    List<Statement> stmts = m.getBody().statements();
    Assert.assertTrue(stmts.size() == 5);
   
    TACInstruction decl, init;
    for(int i = 0; i < 4; i++) {
      VariableDeclarationStatement s = (VariableDeclarationStatement) stmts.get(i);
      Assert.assertTrue("Statement: " + s, s.fragments().size() == 1);
      VariableDeclaration d = (VariableDeclaration) s.fragments().get(0);
      decl = tac.instruction(d);
      Assert.assertNotNull("Statement: " + s, decl);
      Assert.assertNotNull("Statement: " + s, d.getInitializer());
      if(d.getInitializer() instanceof ParenthesizedExpression)
        init = tac.instruction(((ParenthesizedExpression) d.getInitializer()).getExpression());
View Full Code Here

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

    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

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

            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);

            // Record the old checkpoint if the new checkpoint is not null.
            // If it is null, it is impossible to roll back to the previous
            // checkpoint.
View Full Code Here

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

            if (invokedMethod.getElementName().equals(fromMethod.getElementName())
              && invokedMethod.getSignature().equals(fromMethod.getSignature())){

              ASTNode varDeclarationStmt = node.getParent().getParent();
              if (varDeclarationStmt instanceof VariableDeclarationStatement) {
                VariableDeclarationStatement vds = (VariableDeclarationStatement) varDeclarationStmt;
               
                // change the type
                Type returnType = JDTUtils.createQualifiedType(vds.getAST(), toClass);
                vds.setType(returnType);
              }
             
              ASTNode varDeclarationFragment = node.getParent();
              if (varDeclarationFragment instanceof VariableDeclarationFragment) {
                VariableDeclarationFragment vdf = (VariableDeclarationFragment) varDeclarationFragment;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.