Examples of Compiler


Examples of com.google.gwt.thirdparty.javascript.jscomp.Compiler

    }
    // Turn off Closure Compiler logging
    Logger.getLogger("com.google.gwt.thirdparty.javascript.jscomp").setLevel(Level.OFF);

    // Create a fresh compiler instance.
    compiler = new Compiler();

    // Translate the ASTs and build the modules
    computeFragmentMap(jprogram, program);
    List<JSModule> modules = createClosureModules(program);
View Full Code Here

Examples of com.google.gxp.compiler.Compiler

      }
      AlertSink alertSink =  new PrintingAlertSink(config.getAlertPolicy(),
                                                   config.isVerboseEnabled(),
                                                   stderr);
      AlertCounter counter = new AlertCounter(alertSink, config.getAlertPolicy());
      new Compiler(config).call(counter);
      return (counter.getErrorCount() > 0) ? 1 : 0;
    } catch (CmdLineException usageError) {
      stderr.append(usageError.getMessage() + "\n");
      return 1;
    } catch (InvalidConfigException invalidConfigException) {
View Full Code Here

Examples of com.google.gxp.compiler.Compiler

    configure();
    AlertSink alertSink = new LoggingAlertSink(getAlertPolicy(), this);
    AlertCounter counter = new AlertCounter(alertSink, getAlertPolicy());

    try {
      new Compiler(this).call(counter);
    } catch (InvalidConfigException e) {
      throw new BuildException(e);
    }

    if (counter.getErrorCount() > 0) {
View Full Code Here

Examples of com.google.gxp.compiler.Compiler

    Configuration configuration = new RuntimeConfiguration(systemFS, outFs, srcGxps, srcSchemas,
                                                           srcPaths, javaFile, compilationVersion,
                                                           alertPolicy);
    try {
      // Perform GXP Compilation
      AlertSet alertSet = new Compiler(configuration).call();

      // check for gxp compilation errors
      if (alertSet.hasErrors(alertPolicy)) {
        throw new GxpCompilationException.Gxp(alertPolicy, alertSet);
      }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  }

  @Test
  public void testApplySuggestedFixes() throws Exception {
    String code = "var someNode;";
    Compiler compiler = getCompiler(code);
    Node root = compileToScriptRoot(compiler);
    List<SuggestedFix> fixes = ImmutableList.of(new SuggestedFix.Builder().delete(root).build());
    Map<String, String> codeMap = ImmutableMap.of("test", code);
    Map<String, String> newCodeMap = ApplySuggestedFixes.applySuggestedFixesToCode(
        fixes, codeMap);
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  }

  @Test
  public void testApplySuggestedFixes_insideJSDoc() throws Exception {
    String code = "/** @type {Foo} */\nvar foo = new Foo()";
    Compiler compiler = getCompiler(code);
    Node root = compileToScriptRoot(compiler);
    Node varNode = root.getFirstChild();
    Node jsdocRoot =
        Iterables.getOnlyElement(varNode.getJSDocInfo().getTypeNodes());
    SuggestedFix fix = new SuggestedFix.Builder()
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  }

  @Test
  public void testApplySuggestedFixes_multipleFixesInJsdoc() throws Exception {
    String code = "/** @type {Array<Foo>} */\nvar arr = [new Foo()];";
    Compiler compiler = getCompiler(code);
    Node root = compileToScriptRoot(compiler);
    Node varNode = root.getFirstChild();
    Node jsdocRoot =
        Iterables.getOnlyElement(varNode.getJSDocInfo().getTypeNodes());
    SuggestedFix fix1 = new SuggestedFix.Builder()
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

  @Test
  public void testApplySuggestedFixes_missingCodeForFile() throws Exception {
    Map<String, String> codeMap = ImmutableMap.of();
    String code = "var someNode;";
    Compiler compiler = getCompiler(code);
    Node root = compileToScriptRoot(compiler);
    List<SuggestedFix> fixes = ImmutableList.of(new SuggestedFix.Builder().delete(root).build());
    try {
      Map<String, String> newCodeMap = ApplySuggestedFixes.applySuggestedFixesToCode(
          fixes, codeMap);
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

    // of that is the Script node.
    return root.getLastChild().getFirstChild();
  }

  private Compiler getCompiler(String jsInput) {
    Compiler compiler = new Compiler();
    CompilerOptions options = RefactoringDriver.getCompilerOptions();
    compiler.init(
        ImmutableList.<SourceFile>of(), // Externs
        ImmutableList.of(SourceFile.fromCode("test", jsInput)),
        options);
    compiler.parse();
    return compiler;
  }
View Full Code Here

Examples of com.google.javascript.jscomp.Compiler

public class RefasterJsScannerTest {

  @Test
  public void testInitialize_missingTemplates() throws Exception {
    try {
      Compiler compiler = createCompiler();
      compileTestCode(compiler, "", "");
      createScanner(compiler, "");
      fail("An exception should have been thrown for missing templates.");
    } catch (IllegalStateException expected) {}

    try {
      Compiler compiler = createCompiler();
      compileTestCode(compiler, "", "");
      createScanner(compiler, "function notATemplate() {}");
      fail("An exception should have been thrown for missing templates.");
    } catch (IllegalStateException expected) {}

    try {
      Compiler compiler = createCompiler();
      compileTestCode(compiler, "", "");
      createScanner(compiler, "function after_foo() {}");
      fail("An exception should have been thrown for missing templates.");
    } catch (IllegalStateException expected) {}
  }
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.