Examples of VariableStatement


Examples of anvil.script.statements.VariableStatement

  Expression expr = null;
    symbol = jj_consume_token(SYMBOL);
      Location location = toLocation(symbol);
      String name = symbol.image;
      DefinitionStatement target = flowPeek().getDefinitionStatement();
      VariableStatement var = null;
      if (target.lookupDeclaration(name) == null && !target.isEntityReserved(name)) {
        var = target.declare(location, name, expr, document, statik);
      } else {
        error(location, "Entity '" + name + "' is already declared");
      }
      if (var != null) {
        flowPush(var);
      }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case ASSIGN:
      jj_consume_token(ASSIGN);
      ValueExpression();
                                 expr = (Expression)pop();
      break;
    default:
      jj_la1[46] = jj_gen;
      ;
    }
      if (var != null) {
        var.setExpression(expr);
        flowPop();
      }
  }
View Full Code Here

Examples of com.google.minijoe.compiler.ast.VariableStatement

      declarationVector.addElement(parseVariableDeclaration(true));
    }

    readTokenSemicolon();

    return new VariableStatement(Util.vectorToDeclarationArray(declarationVector));
  }
View Full Code Here

Examples of com.google.minijoe.compiler.ast.VariableStatement

    super(name);
  }

  public void testVariableStatement() throws CompilerException {
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    null
                )
            }
        ),
        "var foo;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    new NumberLiteral(1.0)
                )
            }
        ),
        "var foo = 1.0;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("bar"),
                    new BinaryOperatorExpression(
                        new Identifier("x"),
                        new Identifier("baz"),
                        Token.KEYWORD_IN
                    )
                )
            }
        ),
        "var bar = x in baz;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    null
                ),
                new VariableDeclaration(
                    new Identifier("bar"),
                    null
                )
            }
        ),
        "var foo, bar;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    new NumberLiteral(1.0)
                ),
                new VariableDeclaration(
                    new Identifier("bar"),
                    null
                )
            }
        ),
        "var foo = 1.0, bar;"
    );
    assertParserOutput(
        new VariableStatement(
            new VariableDeclaration[] {
                new VariableDeclaration(
                    new Identifier("foo"),
                    new NumberLiteral(1.0)
                ),
View Full Code Here

Examples of com.google.minijoe.compiler.ast.VariableStatement

        "{ 1 \n 2 } 3 "
    );
    assertParserOutput(
        new Program(
            new Statement[] {
                new VariableStatement(
                    new VariableDeclaration[] {
                        new VariableDeclaration(
                            new Identifier("foo"),
                            null
                        )
View Full Code Here

Examples of com.google.minijoe.compiler.ast.VariableStatement

                    new Identifier("a"),
                    new Identifier("b"),
                    new Identifier("c"),
                },
                new Statement[] {
                    new VariableStatement(
                        new VariableDeclaration[] {
                            new VariableDeclaration(
                                new Identifier("bar"),
                                new NumberLiteral(0.0)
                            )
View Full Code Here

Examples of org.lilystudio.javascript.statement.VariableStatement

      fnScope.compress(isVar, env);
    }
    List<Constant> constants = fnScope.getVarConstants();
    int size = constants.size();
    if (size > 0) {
      VariableStatement statement;
      if (isVar) {
        statement = (VariableStatement) statements.get(0);
      } else {
        statement = new VariableStatement(getLineno());
        statement.setParent(this);
        statements.add(0, statement);
      }
      for (size--; size >= 0; size--) {
        Constant constant = constants.get(size);
        statement.addParam(statement.getLineno(), constant.getString(false),
            constant.getLiteral());
      }
    }

    writer.write("function");
View Full Code Here

Examples of org.lilystudio.javascript.statement.VariableStatement

        return blockStatement;
      }
    }

    case Token.VAR:
      return new VariableStatement(node, root, scope);

    case Token.EMPTY:
      return new EmptyStatement(node, root, scope);

    case Token.EXPR_RESULT:
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.