Examples of JLocalRef


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

            "Temporary assignment for instance with side-effects");
        JLocal local = program.createLocal(info,
            "maybeJsoInvocation".toCharArray(), instance.getType(), true,
            currentMethodBody.peek());
        multi.exprs.add(program.createAssignmentStmt(info,
            new JLocalRef(info, local), instance).getExpr());

        instance = new JLocalRef(info, local);
      }
      return instance;
    }
View Full Code Here

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

    return false;
  }

  @Override
  public boolean visit(JLocalRef x, Context ctx) {
    expression = new JLocalRef(x.getSourceInfo(), x.getLocal());
    return false;
  }
View Full Code Here

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

      // Now generate the appropriate expressions.
      JLocal tempLocal = getTempLocal(expressionReturn.getType());

      // t = x
      JLocalRef tempRef = new JLocalRef(x.getSourceInfo(), tempLocal);
      JBinaryOperation asg = new JBinaryOperation(x.getSourceInfo(), x.getType(),
          JBinaryOperator.ASG, tempRef, expressionReturn);
      multi.exprs.add(asg);

      // x += 1
      asg = createAsgOpFromUnary(newArg, op);
      // Break the resulting asg op before adding to multi.
      multi.exprs.add(accept(asg));

      // t
      tempRef = new JLocalRef(x.getSourceInfo(), tempLocal);
      multi.exprs.add(tempRef);

      ctx.replaceMe(multi);
      exitTempUsageScope();
    }
View Full Code Here

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

      // Create a temp local
      JLocal tempLocal = getTempLocal(x.getType());

      // Create an assignment for this temp and add it to multi.
      JLocalRef tempRef = new JLocalRef(x.getSourceInfo(), tempLocal);
      JBinaryOperation asg = new JBinaryOperation(x.getSourceInfo(), x.getType(),
          JBinaryOperator.ASG, tempRef, x);
      multi.exprs.add(asg);
      // Update me with the temp
      return cloner.cloneExpression(tempRef);
View Full Code Here

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

      {
        // $e = Exceptions.caught($e)
        JMethod caughtMethod = program.getIndexedMethod("Exceptions.caught");
        JMethodCall call = new JMethodCall(catchInfo, null, caughtMethod);
        call.addArg(new JLocalRef(catchInfo, exVar));
        newCatchBlock.addStmt(program.createAssignmentStmt(catchInfo,
            new JLocalRef(catchInfo, exVar), call));
      }

      /*
       * Build up a series of if, else if statements to test the type of the
       * exception object against the type of the user's catch block.
       *
       * Go backwards so we can nest the else statements in the correct order!
       */
      // rethrow the current exception if no one caught it
      JStatement cur = new JThrowStatement(catchInfo, new JLocalRef(catchInfo,
          exVar));
      for (int i = x.getCatchBlocks().size() - 1; i >= 0; --i) {
        JBlock block = x.getCatchBlocks().get(i);
        JLocalRef arg = x.getCatchArgs().get(i);
        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);
        }
        // nest the previous as an else for me
        cur = new JIfStatement(catchInfo, ifTest, block, cur);
      }

      newCatchBlock.addStmt(cur);
      x.getCatchArgs().clear();
      x.getCatchArgs().add(new JLocalRef(newCatchBlock.getSourceInfo(), exVar));
      x.getCatchBlocks().clear();
      x.getCatchBlocks().add(newCatchBlock);
    }
View Full Code Here

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

      accept(x.getTryBlock());

      List catchArgs = x.getCatchArgs();
      List catchBlocks = x.getCatchBlocks();
      for (int i = 0, c = catchArgs.size(); i < c; ++i) {
        JLocalRef arg = (JLocalRef) catchArgs.get(i);
        JBlock catchBlock = (JBlock) catchBlocks.get(i);
        JsCatch jsCatch = new JsCatch(peek(), arg.getTarget().getName());
        JsParameter jsParam = jsCatch.getParameter();
        names.put(arg.getTarget(), jsParam.getName());
        catchMap.put(catchBlock, jsCatch);

        push(jsCatch.getScope());
        accept(catchBlock);
        pop();
View Full Code Here

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

    }

    // @Override
    public void endVisit(JLocalRef x, Context ctx) {
      JLocal local = (JLocal) varMap.get(x.getTarget());
      JLocalRef localRef = new JLocalRef(program, x.getSourceInfo(), local);
      ctx.replaceMe(localRef);
    }
View Full Code Here

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

    print(CHARS_TRY);
    accept(x.getTryBlock());
    for (int i = 0, c = x.getCatchArgs().size(); i < c; ++i) {
      print(CHARS_CATCH);
      lparen();
      JLocalRef localRef = (JLocalRef) x.getCatchArgs().get(i);
      accept(localRef.getTarget());
      rparen();
      space();
      JBlock block = (JBlock) x.getCatchBlocks().get(i);
      accept(block);
    }
View Full Code Here

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

      // Create a temp local
      JLocal tempLocal = getTempLocal();

      // Create an assignment for this temp and add it to multi.
      JLocalRef tempRef = new JLocalRef(program, x.getSourceInfo(), tempLocal);
      JBinaryOperation asg = new JBinaryOperation(program, x.getSourceInfo(),
          x.getType(), JBinaryOperator.ASG, tempRef, x);
      multi.exprs.add(asg);
      // Update me with the temp
      return tempRef;
View Full Code Here

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

      }

      SourceInfo catchInfo = ((JBlock) x.getCatchBlocks().get(0)).getSourceInfo();

      JLocal exObj = popTempLocal();
      JLocalRef exRef = new JLocalRef(program, catchInfo, exObj);
      JBlock newCatchBlock = new JBlock(program, catchInfo);
      // $e = Exceptions.caught($e)
      JMethod caughtMethod = program.getSpecialMethod("Exceptions.caught");
      JMethodCall call = new JMethodCall(program, catchInfo, null, caughtMethod);
      call.getArgs().add(exRef);
      JExpressionStatement asg = program.createAssignmentStmt(catchInfo, exRef,
          call);
      newCatchBlock.statements.add(asg);

      /*
       * Build up a series of if, else if statements to test the type of the
       * exception object against the type of the user's catch block.
       *
       * Go backwards so we can nest the else statements in the correct order!
       */
      // rethrow the current exception if no one caught it
      JStatement cur = new JThrowStatement(program, null, exRef);
      for (int i = x.getCatchBlocks().size() - 1; i >= 0; --i) {
        JBlock block = (JBlock) x.getCatchBlocks().get(i);
        JLocalRef arg = (JLocalRef) x.getCatchArgs().get(i);
        catchInfo = block.getSourceInfo();
        JReferenceType argType = (JReferenceType) arg.getType();
        // if ($e instanceof Argtype) { userVar = $e; <user code> }
        JExpression ifTest = new JInstanceOf(program, catchInfo, argType, exRef);
        asg = program.createAssignmentStmt(catchInfo, arg, exRef);
        if (!block.statements.isEmpty()) {
          // Only bother adding the assingment if the block is non-empty
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.