Examples of JDeclarationStatement


Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

      }
    }

    private JDeclarationStatement createDeclaration(SourceInfo info,
        JLocal local, JExpression value) {
      return new JDeclarationStatement(info, new JLocalRef(info, local), value);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

    public void endVisit(JDeclarationStatement x, Context ctx) {
      JExpression init = x.getInitializer();
      if (init != null) {
        init = checkAndReplace(init, x.getVariableRef().getType());
        if (init != x.getInitializer()) {
          JDeclarationStatement newStmt = new JDeclarationStatement(x.getSourceInfo(),
              x.getVariableRef(), init);
          ctx.replaceMe(newStmt);
        }
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

        catchInfo = block.getSourceInfo();
        JReferenceType argType = (JReferenceType) arg.getType();
        // if ($e instanceof ArgType) { var userVar = $e; <user code> }
        JExpression ifTest = new JInstanceOf(catchInfo, argType, new JLocalRef(
            catchInfo, exVar));
        JDeclarationStatement declaration = new JDeclarationStatement(
            catchInfo, arg, new JLocalRef(catchInfo, exVar));
        if (!block.getStatements().isEmpty()) {
          // Only bother adding the assignment if the block is non-empty
          block.addStmt(0, declaration);
        }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

     */
    @Override
    public boolean visit(JField x, Context ctx) {
      if (x instanceof JEnumField && canBeOrdinal(x.getEnclosingType())) {
        int ordinal = ((JEnumField) x).ordinal();
        x.setInitializer(new JDeclarationStatement(x.getSourceInfo(), new JFieldRef(x
            .getSourceInfo(), null, x, x.getEnclosingType()), program.getLiteralInt(ordinal)));
      }
      return true;
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

     * when the block contains no local declarations.
     */
    private boolean canPromoteBlock(JBlock block) {
      for (JStatement nestedStmt : block.statements) {
        if (nestedStmt instanceof JDeclarationStatement) {
          JDeclarationStatement decl = (JDeclarationStatement) nestedStmt;
          if (decl.getVariableRef() instanceof JLocalRef) {
            return false;
          }
        }
      }
      return true;
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

        }

        if (initializer != null) {
          SourceInfo info = makeSourceInfo(declaration);
          // JDeclarationStatement's ctor sets up the field's initializer.
          JStatement decl = new JDeclarationStatement(program, info,
              createVariableRef(info, field), initializer);
          // will either be init or clinit
          currentMethodBody.getStatements().add(decl);
        }
      } catch (Throwable e) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

      }

      JLocal elementVar = (JLocal) typeMap.get(x.elementVariable.binding);
      String elementVarName = elementVar.getName();

      JDeclarationStatement elementDecl = (JDeclarationStatement) processStatement(x.elementVariable);
      assert (elementDecl.initializer == null);

      JForStatement result;
      if (x.collection.resolvedType.isArrayType()) {
        /**
 
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

    JStatement processStatement(LocalDeclaration x) {
      SourceInfo info = makeSourceInfo(x);
      JLocal local = (JLocal) typeMap.get(x.binding);
      JLocalRef localRef = new JLocalRef(program, info, local);
      JExpression initializer = dispProcessExpression(x.initialization);
      return new JDeclarationStatement(program, info, localRef, initializer);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

      }
    }

    private JDeclarationStatement createDeclaration(SourceInfo info,
        JLocal local, JExpression value) {
      return new JDeclarationStatement(program, info, new JLocalRef(program,
          info, local), value);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JDeclarationStatement

    public void endVisit(JDeclarationStatement x, Context ctx) {
      JExpression init = x.getInitializer();
      if (init != null) {
        init = checkAndReplace(init, x.getVariableRef().getType());
        if (init != x.getInitializer()) {
          JDeclarationStatement newStmt = new JDeclarationStatement(program,
              x.getSourceInfo(), x.getVariableRef(), init);
          ctx.replaceMe(newStmt);
        }
      }
    }
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.