Package org.lilystudio.javascript.scope

Examples of org.lilystudio.javascript.scope.Constant


        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");
    if (name != null) {
View Full Code Here


  public void write(Writer writer, Environment env) throws IOException {
    switch (tokenType) {
    case Token.DO:
    case Token.WHILE:
      if (checkExpression instanceof InbuildLiteral) {
        Constant literal = ((InbuildLiteral) checkExpression).getLiteral();
        if (literal.getString(false).equals("true")) {
          literal.dec(false);
          writer.write("for(;;)");
          bodyStatement.write(writer, env);
          break;
        }
      }

      if (tokenType == Token.DO) {
        writer.write("do");
        if (bodyStatement.isNeedLeftSeparator()) {
          writer.write(" ");
        }

        bodyStatement.write(writer, env);

        if (bodyStatement.isNeedRightSeparator()) {
          writer.write(";");
        }

        writer.write("while(");
        checkExpression.write(writer, env);
        writer.write(")");
      } else {
        writer.write("while(");
        checkExpression.write(writer, env);
        writer.write(")");
        bodyStatement.write(writer, env);
      }
      break;

    default:
      writer.write("for(");

      if (startNode != null) {
        startNode.write(writer, env);
      }

      writer.write(";");

      if (checkExpression instanceof InbuildLiteral) {
        Constant literal = ((InbuildLiteral) checkExpression).getLiteral();
        if (literal.getString(false).equals("true")) {
          literal.dec(false);
        }
      } else {
        checkExpression.write(writer, env);
      }
View Full Code Here

TOP

Related Classes of org.lilystudio.javascript.scope.Constant

Copyright © 2018 www.massapicom. 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.