test/com/google/javascript/jscomp/TemplateAstMatcherTest.java
/**
   * Compiles the template and test code. The code must be compiled together
   * using the same Compiler in order for the JsSourceMatcher to work properly.
   */
Compiles the template and test code. The code must be compiled together
using the same Compiler in order for the JsSourceMatcher to work properly.
Compiles the template and test code . The code must be compiled together using the same Compiler in order for the JsSourceMatcher to work properly .
private TestNodePair compile(String externs, String template, String code) {
    Compiler compiler = lastCompiler = new Compiler();
    compiler.disableThreads();
    CompilerOptions options = new CompilerOptions();
    options.setLanguageIn(LanguageMode.ECMASCRIPT3);
    options.setCheckTypes(true);
    Node templateNode = compiler.parse(SourceFile.fromCode("template", template));
    compiler.compile(
        ImmutableList.of(SourceFile.fromCode("externs", externs)),
        ImmutableList.of(
            SourceFile.fromCode("test", "{" + code + "}")),
        options);
    Node root = compiler.getRoot();
    return new TestNodePair(templateNode, root.getLastChild());
  }
private TestNodePair compile ( String externs , String template , String code ) { Compiler compiler = lastCompiler = new Compiler ( ) ; compiler . disableThreads ( ) ; CompilerOptions options = new CompilerOptions ( ) ; options . setLanguageIn ( LanguageMode . ECMASCRIPT3 ) ; options . setCheckTypes ( true ) ; Node templateNode = compiler . parse ( SourceFile . fromCode ( "template" , template ) ) ; compiler . compile ( ImmutableList . of ( SourceFile . fromCode ( "externs" , externs ) ) , ImmutableList . of ( SourceFile . fromCode ( "test" , "{" + code + "}" ) ) , options ) ; Node root = compiler . getRoot ( ) ; return new TestNodePair ( templateNode , root . getLastChild ( ) ) ; }
Compiles the template and test code.
Compiles the template and test code .
// The extra block allows easier separation of template and test // code.