Examples of JsProgram


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

    BindingProperty stackMode = new BindingProperty("compiler.stackMode");
    stackMode.addDefinedValue(new ConditionNone(), "STRIP");
    setProperties(new BindingProperty[]{stackMode}, new String[]{"STRIP"},
        new ConfigurationProperty[]{initialSequenceProp});
    super.setUp();
    jsProgram = new JsProgram();
  }
View Full Code Here

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

    BindingProperty stackMode = new BindingProperty("compiler.stackMode");
    stackMode.addDefinedValue(new ConditionNone(), "STRIP");
    setProperties(new BindingProperty[]{stackMode}, new String[]{"STRIP"},
        new ConfigurationProperty[]{});
    super.setUp();
    jsProgram = new JsProgram();
  }
View Full Code Here

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

    // Run it.
    JsNamespaceChooser.exec(program, jjsmap);
  }

  private static JsProgram parseJs(String js) throws IOException, JsParserException {
    JsProgram program = new JsProgram();
    List<JsStatement> statements = JsParser.parse(SourceOrigin.UNKNOWN, program.getScope(),
        new StringReader(js));
    program.getGlobalBlock().getStatements().addAll(statements);
    return program;
  }
View Full Code Here

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

   * @param toExec a list of classes that implement
   *          <code>static void exec(JsProgram)</code>
   * @return optimized JS
   */
  protected String optimize(String js, Class<?>... toExec) throws Exception {
    JsProgram program = new JsProgram();
    List<JsStatement> expected = JsParser.parse(SourceOrigin.UNKNOWN,
        program.getScope(), new StringReader(js));

    program.getGlobalBlock().getStatements().addAll(expected);

    for (Class<?> clazz : toExec) {
      Method m = clazz.getMethod("exec", JsProgram.class);
      m.invoke(null, program);
    }
View Full Code Here

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

  }

  private void checkTranslation(String source, String expectedJs,
      boolean internObjectAndArrayLiterals)
      throws IOException, JsParserException {
    JsProgram program = parseJs(source);
    // Mark all object literals as internable
    if (internObjectAndArrayLiterals) {
      new JsModVisitor() {
        @Override
        public void endVisit(JsObjectLiteral x, JsContext ctx) {
View Full Code Here

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

    JsSymbolResolver.exec(program);
    return JsLiteralInterner.exec(null, program, JsLiteralInterner.INTERN_ALL);
  }

  private static JsProgram parseJs(String js) throws IOException, JsParserException {
    JsProgram program = new JsProgram();
    List<JsStatement> statements = JsParser.parse(SourceOrigin.UNKNOWN, program.getScope(),
        new StringReader(js));
    program.getGlobalBlock().getStatements().addAll(statements);
    return program;
  }
View Full Code Here

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

   * @param oracles
   * @return processed JS
   */
  private String process(String js, PropertyOracle[] oracles)
      throws Exception {
    JsProgram program = new JsProgram();
    List<JsStatement> expected = JsParser.parse(SourceOrigin.UNKNOWN,
        program.getScope(), new StringReader(js));

    program.getGlobalBlock().getStatements().addAll(expected);

    JsCoerceIntShift.exec(program, logger, oracles);

    TextOutput text = new DefaultTextOutput(true);
    JsVisitor generator = new JsSourceGenerationVisitor(text);
View Full Code Here

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

        "a"
    );
  }

  private JsProgram parseJs(String js) throws IOException, JsParserException {
    JsProgram program = new JsProgram();
    SourceInfo info = SourceOrigin.create(0, js.length(), 123, "test.js");
    List<JsStatement> statements = JsParser.parse(info, program.getScope(),
        new StringReader(js));
    program.getGlobalBlock().getStatements().addAll(statements);
    return program;
  }
View Full Code Here

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

    doTestEscapes("\u0100\u117f\u2345", "'\\u0100\\u117F\\u2345'");
  }

  private void doTest(String js) throws Exception {
    List<JsStatement> expected = JsParser.parse(SourceOrigin.UNKNOWN,
        new JsProgram().getScope(), new StringReader(js));
    List<JsStatement> actual = parse(expected, true);
    ComparingVisitor.exec(expected, actual);

    actual = parse(expected, false);
    ComparingVisitor.exec(expected, actual);
View Full Code Here

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

    ComparingVisitor.exec(expected, actual);
  }

  private void doTest(String js, String expectedJs) throws Exception {
    List<JsStatement> actual = JsParser.parse(SourceOrigin.UNKNOWN,
        new JsProgram().getScope(), new StringReader(js));
    List<JsStatement> expected = JsParser.parse(SourceOrigin.UNKNOWN,
        new JsProgram().getScope(), new StringReader(expectedJs));
    ComparingVisitor.exec(expected, actual);
  }
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.