Examples of Compiler


Examples of com.google.javascript.jscomp.Compiler

  }

  @Test
  public void testInitialize_missingAfterTemplate() throws Exception {
    try {
      Compiler compiler = createCompiler();
      compileTestCode(compiler, "", "");
      createScanner(compiler, "function before_foo() {'bar'};");
      fail("An exception should have been thrown for missing the after template.");
    } catch (IllegalStateException expected) {}
  }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  }

  @Test
  public void testInitialize_duplicateTemplateName() throws Exception {
    try {
      Compiler compiler = createCompiler();
      compileTestCode(compiler, "", "");
      createScanner(compiler, "function before_foo() {}; function before_foo() {};");
      fail("RefasterJS templates are not allowed to have the same name.");
    } catch (IllegalStateException expected) {}
  }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  }

  @Test
  public void testInitialize_emptyBeforeTemplates() throws Exception {
    try {
      Compiler compiler = createCompiler();
      compileTestCode(compiler, "", "");
      createScanner(compiler, "function before_foo() {}; function after_foo() {};");
      fail("RefasterJS templates are not allowed to be empty!.");
    } catch (IllegalStateException expected) {}
  }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

    } catch (IllegalStateException expected) {}
  }

  @Test
  public void testInitialize_success() throws Exception {
    Compiler compiler = createCompiler();
    compileTestCode(compiler, "", "");
    createScanner(compiler, "function before_foo() {'str';}; function after_foo() {};");
  }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

        + "  var a = 'str';\n"
        + "};\n"
        + "function after_foo() {\n"
        + "  'bar';\n"
        + "}\n";
    Compiler compiler = createCompiler();
    String testCode = "var loc = 'str';";
    compileTestCode(compiler, testCode, "");
    Node root = getScriptRoot(compiler);
    RefasterJsScanner scanner = createScanner(compiler, template);
    Match match = new Match(root.getFirstChild(), new NodeMetadata(compiler));
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

        + "  loc.href = 'str';\n"
        + "};\n"
        + "function after_foo() {\n"
        + "  foo();\n"
        + "}\n";
    Compiler compiler = createCompiler();
    String preamble = "var loc = new Location();";
    String testCode = "loc.href = 'str';";
    compileTestCode(compiler, preamble + testCode, externs);
    Node root = getScriptRoot(compiler);
    RefasterJsScanner scanner = createScanner(compiler, template);
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

        + " * @param {FooType} foo\n"
        + " */\n"
        + "function after_foo(foo) {\n"
        + "  foo.baz();\n"
        + "}\n";
    Compiler compiler = createCompiler();
    String preamble = "var obj = new FooType();\n";
    String testCode = preamble + "obj.bar();";
    compileTestCode(compiler, testCode, externs);
    Node root = getScriptRoot(compiler);
    RefasterJsScanner scanner = createScanner(compiler, template);
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

        + "  foo.bar();\n"
        + "  foo.baz();\n"
        + "};\n"
        + "function after_foo() {\n"
        + "}\n";
    Compiler compiler = createCompiler();
    String preamble = "var obj = new FooType();\n";
    String postamble = "var someOtherCode = 3;\n";
    String testCode = ""
        + preamble
        + "obj.bar();\n"
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

        new CodeReplacement(preamble.length() + "obj.bar();\n".length(), "obj.baz();".length(), ""),
        iterator.next());
  }

  private Compiler createCompiler() {
    return new Compiler();
  }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  @Test
  public void testInsertBefore() {
    String before = "var someRandomCode = {};";
    String after = "/** some comment */\ngoog.foo();";
    Compiler compiler = getCompiler(before + after);
    Node root = compileToScriptRoot(compiler);
    Node newNode = IR.exprResult(IR.call(
        IR.getprop(IR.name("goog2"), IR.string("get")),
        IR.string("service")));
    SuggestedFix fix = new SuggestedFix.Builder()
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.