当前位置: 首页>>代码示例>>Java>>正文


Java SourceFile.clearCachedSource方法代码示例

本文整理汇总了Java中com.google.javascript.jscomp.SourceFile.clearCachedSource方法的典型用法代码示例。如果您正苦于以下问题:Java SourceFile.clearCachedSource方法的具体用法?Java SourceFile.clearCachedSource怎么用?Java SourceFile.clearCachedSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.javascript.jscomp.SourceFile的用法示例。


在下文中一共展示了SourceFile.clearCachedSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseSources

import com.google.javascript.jscomp.SourceFile; //导入方法依赖的package包/类
/**
 * Parses all source files for dependency information.
 * @param preparsedFiles A set of closure-relative paths.
 *     Files in this set are not parsed if they are encountered in srcs.
 * @return Returns a map of closure-relative paths -> DependencyInfo for the
 *     newly parsed files.
 * @throws IOException Occurs upon an IO error.
 */
private Map<String, DependencyInfo> parseSources(
    Set<String> preparsedFiles) throws IOException {
  Map<String, DependencyInfo> parsedFiles = Maps.newHashMap();
  JsFileParser jsParser = new JsFileParser(errorManager);

  for (SourceFile file : srcs) {
    String closureRelativePath =
        PathUtil.makeRelative(
            closurePathAbs, PathUtil.makeAbsolute(file.getName()));
    logger.fine("Closure-relative path: " + closureRelativePath);

    if (InclusionStrategy.WHEN_IN_SRCS == mergeStrategy ||
        !preparsedFiles.contains(closureRelativePath)) {
      DependencyInfo depInfo =
          jsParser.parseFile(
              file.getName(), closureRelativePath,
              file.getCode());

      // Kick the source out of memory.
      file.clearCachedSource();
      parsedFiles.put(closureRelativePath, depInfo);
    }
  }

  return parsedFiles;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:DepsGenerator.java

示例2: parseSources

import com.google.javascript.jscomp.SourceFile; //导入方法依赖的package包/类
/**
 * Parses all source files for dependency information.
 * @param preparsedFiles A set of closure-relative paths.
 *     Files in this set are not parsed if they are encountered in srcs.
 * @return Returns a map of closure-relative paths -> DependencyInfo for the
 *     newly parsed files.
 * @throws IOException Occurs upon an IO error.
 */
private Map<String, DependencyInfo> parseSources(
    Set<String> preparsedFiles) throws IOException {
  Map<String, DependencyInfo> parsedFiles = new LinkedHashMap<>();
  JsFileParser jsParser = new JsFileParser(errorManager).setModuleLoader(loader);
  Compiler compiler = new Compiler();
  compiler.init(
      ImmutableList.<SourceFile>of(), ImmutableList.<SourceFile>of(), new CompilerOptions());

  for (SourceFile file : srcs) {
    String closureRelativePath =
        PathUtil.makeRelative(
            closurePathAbs, PathUtil.makeAbsolute(file.getName()));
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("Closure-relative path: " + closureRelativePath);
    }
    if (InclusionStrategy.WHEN_IN_SRCS == mergeStrategy ||
        !preparsedFiles.contains(closureRelativePath)) {
      DependencyInfo depInfo =
          jsParser.parseFile(
              file.getName(), closureRelativePath,
              file.getCode());
      depInfo = new LazyParsedDependencyInfo(depInfo, new JsAst(file), compiler);

      // Kick the source out of memory.
      file.clearCachedSource();
      parsedFiles.put(closureRelativePath, depInfo);
    }
  }

  return parsedFiles;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:40,代码来源:DepsGenerator.java


注:本文中的com.google.javascript.jscomp.SourceFile.clearCachedSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。