Examples of JsStatement


Examples of com.google.gwt.dev.js.ast.JsStatement

    //
    JsExpression toTestExpr = mapExpression(fromTestExpr);

    // Map the body block.
    //
    JsStatement toBody = mapStatement(fromBody);

    popSourceInfo();

    // Create and attach the "while" or "do" statement we're mapping to.
    //
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsStatement

      }
      toForIn.setObjExpr(mapExpression(fromObjExpr));

      // The body stmt.
      //
      JsStatement bodyStmt = mapStatement(fromBody);
      if (bodyStmt != null) {
        toForIn.setBody(bodyStmt);
      } else {
        toForIn.setBody(program.getEmptyStmt());
      }

      return toForIn;
    } else {
      // Regular ol' for loop.
      //
      JsFor toFor = new JsFor(makeSourceInfo(forNode));

      // The first item is either an expression or a JsVars.
      // Javac 1.6.0_01 doesn't like the cast below if this is parameterized
      @SuppressWarnings("unchecked")
      JsNode initThingy = map(fromInit);
      if (initThingy != null) {
        if (initThingy instanceof JsVars) {
          toFor.setInitVars((JsVars) initThingy);
        } else {
          assert (initThingy instanceof JsExpression);
          toFor.setInitExpr((JsExpression) initThingy);
        }
      }
      toFor.setCondition(mapOptionalExpression(fromTest));
      toFor.setIncrExpr(mapOptionalExpression(fromIncr));

      JsStatement bodyStmt = mapStatement(fromBody);
      if (bodyStmt != null) {
        toFor.setBody(bodyStmt);
      } else {
        toFor.setBody(program.getEmptyStmt());
      }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsStatement

  private void mapStatements(List<JsStatement> stmts, Node nodeStmts)
      throws JsParserException {
    Node curr = nodeStmts.getFirstChild();
    while (curr != null) {
      JsStatement stmt = mapStatement(curr);
      if (stmt != null) {
        stmts.add(stmt);
      } else {
        // When mapStatement() returns null, we just ignore it.
        //
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsStatement

        ListIterator<JsStatement> i = statements.listIterator();
        List<JsStatement> statementsInNewBlock = null;

        // This loop represents a single fold over the list of statements
        while (statements.size() > MAX_BLOCK_SIZE && i.hasNext()) {
          JsStatement current = i.next();

          if (statementsInNewBlock == null) {
            // Replace the current statement with a new block
            JsBlock newBlock = new JsBlock(sourceInfo);
            statementsInNewBlock = newBlock.getStatements();
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsStatement

  public boolean visit(JsBlock x, JsContext<JsStatement> ctx) {
    if (x == scopeStack.peek()) {
      ListIterator<JsStatement> itr = x.getStatements().listIterator();
      itrStack.push(itr);
      while (itr.hasNext()) {
        JsStatement stmt = itr.next();
        JsFunction func = JsStaticEval.isFunctionDecl(stmt);
        // Already at the top level.
        if (func != null) {
          dontMove.add(func);
        }
View Full Code Here

Examples of org.hisrc.jscm.codemodel.statement.JSStatement

    f.lineTerminator();
    final CodeWriter fi = f.indented();
    final List<JSStatement> statements = value.getStatements();

    for (int index = 0; index < statements.size(); index++) {
      final JSStatement statement = statements.get(index);
      fi.statement(statement);
      fi.lineTerminator();
    }
    f.closeCurlyBracket();
    return f;
View Full Code Here

Examples of org.odlabs.wiquery.core.javascript.JsStatement

  @Test
  public void testQuickScopeJsStatement()
  {
    String expectedJavascript = "function(dateText, inst) {\n\talert('test');\n}";
    JsScopeUiDatePickerDateTextEvent quickScope =
      JsScopeUiDatePickerDateTextEvent.quickScope(new JsStatement().append("alert('test')"));
    String generatedJavascript = quickScope.render().toString();

    log.info(expectedJavascript);
    log.info(generatedJavascript);
View Full Code Here

Examples of org.odlabs.wiquery.core.javascript.JsStatement

  @Test
  public void testQuickScopeJsStatement()
  {
    String expectedJavascript = "function(date) {\n\talert('test');\n}";
    JsScopeUiDatePickerEvent quickScope =
      JsScopeUiDatePickerEvent.quickScope(new JsStatement().append("alert('test')"));
    String generatedJavascript = quickScope.render().toString();

    log.info(expectedJavascript);
    log.info(generatedJavascript);
View Full Code Here

Examples of org.odlabs.wiquery.core.javascript.JsStatement

  @Test
  public void testQuickScopeJsStatement()
  {
    String expectedJavascript = "function(year, month, inst) {\n\talert('test');\n}";
    JsScopeUiDatePickerOnChangeEvent quickScope =
      JsScopeUiDatePickerOnChangeEvent.quickScope(new JsStatement().append("alert('test')"));
    String generatedJavascript = quickScope.render().toString();

    log.info(expectedJavascript);
    log.info(generatedJavascript);
View Full Code Here

Examples of org.odlabs.wiquery.core.javascript.JsStatement

  @Override
  public void renderHead(Component component, IHeaderResponse response)
  {
    super.renderHead(component, response);

    JsStatement statement = statement();
    if (statement != null)
    {
      String statementString = statement.render().toString();
      if (!Strings.isEmpty(statementString))
      {
        response.render(OnDomReadyHeaderItem.forScript(statementString));
      }
    }
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.