com.google.javascript.jscomp.SourceFile.getName()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 JavaScript  
字(6.8k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.google.javascript.jscomp.SourceFile.getName()方法的一些代码示例,展示了SourceFile.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SourceFile.getName()方法的具体详情如下:
包路径:com.google.javascript.jscomp.SourceFile
类名称:SourceFile
方法名:getName

SourceFile.getName介绍

[英]Returns a unique name for the source file.
[中]返回源文件的唯一名称。

代码示例

代码示例来源:origin: com.google.javascript/closure-compiler

@Override
public void setSourceFile(SourceFile file) {
 checkState(fileName.equals(file.getName()));
 sourceFile = file;
}

代码示例来源:origin: com.google.javascript/closure-compiler

public JsAst(SourceFile sourceFile) {
 this.inputId = new InputId(sourceFile.getName());
 this.sourceFile = sourceFile;
 this.fileName = sourceFile.getName();
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

public JsAst(SourceFile sourceFile) {
 this.inputId = new InputId(sourceFile.getName());
 this.sourceFile = sourceFile;
 this.fileName = sourceFile.getName();
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

@Override
public void setSourceFile(SourceFile file) {
 Preconditions.checkState(fileName.equals(file.getName()));
 sourceFile = file;
}

代码示例来源:origin: com.google.javascript/closure-compiler

public CompilerInput(SourceAst ast) {
 this(ast, ast.getSourceFile().getName(), false);
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

public CompilerInput(SourceAst ast) {
 this(ast, ast.getSourceFile().getName(), false);
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

cumulatedJsFileNum += currentModule.numJsFiles;
String fullPath = sourceFile.getName();
if (!fullPath.contains("!/")) {
 if (firstSourceFile.getCode().equals(sourceFile.getCode())) {
  errors.add(JSError.make(
    SourceFile.DUPLICATE_ZIP_CONTENTS, firstSourceFile.getName(), sourceFile.getName()));
  fileIterator.remove();
  if (currentModule != null) {
    CONFLICTING_DUPLICATE_ZIP_CONTENTS, firstSourceFile.getName(), sourceFile.getName()));

代码示例来源:origin: com.google.javascript/closure-compiler

public Node parse(SourceFile file) {
 initCompilerOptionsIfTesting();
 logger.finest("Parsing: " + file.getName());
 return new JsAst(file).getAstRoot(this);
}

代码示例来源:origin: com.google.javascript/closure-compiler

cumulatedJsFileNum += currentModule.numJsFiles;
String fullPath = sourceFile.getName();
if (!fullPath.contains("!/")) {
    JSError.make(
      CONFLICTING_DUPLICATE_ZIP_CONTENTS,
      firstSourceFile.getName(),
      sourceFile.getName()));

代码示例来源:origin: com.google.javascript/closure-compiler

/**
 * For a given //# sourceMappingUrl, this locates the appropriate sourcemap on disk. This is use
 * for sourcemap merging (--apply_input_source_maps) and for error resolution.
 *
 * @param parseInlineSourceMaps Whether to parse Base64 encoded source maps.
 */
static SourceFile extractSourceMap(
  SourceFile jsFile, String sourceMapURL, boolean parseInlineSourceMaps) {
 if (parseInlineSourceMaps && sourceMapURL.startsWith(BASE64_URL_PREFIX)) {
  String extractedString = extractBase64String(sourceMapURL);
  if (extractedString != null) {
   return SourceFile.fromCode(jsFile.getName() + ".inline.map", extractedString);
  }
  return null;
 }
 // TODO(tdeegan): Handle absolute urls here.  The compiler needs to come up with a scheme for
 // properly resolving absolute urls from http:// or the root /some/abs/path/... See b/62544959.
 if (isAbsolute(sourceMapURL)) {
  return null;
 }
 // If not absolute, its relative.
 // TODO(tdeegan): Handle urls relative to //# sourceURL. See the sourcemap spec.
 return getRelativePath(jsFile.getName(), sourceMapURL);
}

代码示例来源:origin: org.apache.flex.flexjs.compiler/compiler-jx

System.out.println(file.getName());
System.out.println("end of list of source files");
compiler_.compile(jsExternsFiles_, jsSourceFiles_, options_);

代码示例来源:origin: org.scala-js/closure-compiler-java-6

List<DependencyInfo>
   depInfos = depsParser.parseFileReader(
     file.getName(), file.getCodeReader());
 if (depInfos.isEmpty()) {
  reportNoDepsInDepsFile(file.getName());
 } else {
  for (DependencyInfo info : depInfos) {
if ((new File(src.getName())).exists() &&
  !shouldSkipDepsFile(src)) {
 List<DependencyInfo> srcInfos =
   depsParser.parseFileReader(src.getName(), src.getCodeReader());
 for (DependencyInfo info : srcInfos) {
  depsFiles.put(info.getPathRelativeToClosureBase(), info);

代码示例来源:origin: com.google.javascript/closure-compiler

private synchronized void addFilesToSourceMap(Iterable<? extends SourceFile> files) {
 // synchronized annotation guards concurrent access to sourceMap during parsing.
 if (getOptions().sourceMapIncludeSourcesContent && getSourceMap() != null) {
  for (SourceFile file : files) {
   try {
    getSourceMap().addSourceFile(file.getName(), file.getCode());
   } catch (IOException e) {
    throw new RuntimeException("Cannot read code of a source map's source file.", e);
   }
  }
 }
}

代码示例来源:origin: org.scala-js/closure-compiler-java-6

public Node parse(SourceFile file) {
 initCompilerOptionsIfTesting();
 addToDebugLog("Parsing: " + file.getName());
 return new JsAst(file).getAstRoot(this);
}

代码示例来源:origin: com.google.javascript/closure-compiler

String rootFilename = rootRelativePathsMap.get(filename);
for (SourceFile zipEntry : newFiles) {
 String zipEntryName = zipEntry.getName();
 checkState(zipEntryName.contains(filename));
 String zipmap = zipEntryName.replace(filename, rootFilename);

代码示例来源:origin: com.google.javascript/closure-compiler

List<DependencyInfo>
   depInfos = depsParser.parseFileReader(
     file.getName(), file.getCodeReader());
 if (depInfos.isEmpty()) {
  reportNoDepsInDepsFile(file.getName());
 } else {
  for (DependencyInfo info : depInfos) {
if (!shouldSkipDepsFile(src)) {
 List<DependencyInfo> srcInfos =
   depsParser.parseFileReader(src.getName(), src.getCodeReader());
 for (DependencyInfo info : srcInfos) {
  depsFiles.put(info.getPathRelativeToClosureBase(), removeRelativePathProvide(info));

代码示例来源:origin: com.google.javascript/closure-compiler

String closureRelativePath =
  PathUtil.makeRelative(
    closurePathAbs, PathUtil.makeAbsolute(file.getName()));
if (logger.isLoggable(Level.FINE)) {
 logger.fine("Closure-relative path: " + closureRelativePath);
 DependencyInfo depInfo =
   jsParser.parseFile(
     file.getName(), closureRelativePath,
     file.getCode());
 depInfo = new LazyParsedDependencyInfo(depInfo, new JsAst(file), compiler);

代码示例来源:origin: org.scala-js/closure-compiler-java-6

String closureRelativePath =
  PathUtil.makeRelative(
    closurePathAbs, PathUtil.makeAbsolute(file.getName()));
logger.fine("Closure-relative path: " + closureRelativePath);
 DependencyInfo depInfo =
   jsParser.parseFile(
     file.getName(), closureRelativePath,
     file.getCode());
 depInfo = new LazyParsedDependencyInfo(depInfo, new JsAst(file), compiler);

代码示例来源:origin: com.google.javascript/closure-compiler

compiler.addComments(sourceFile.getName(), result.comments);
  SourceMapResolver.extractSourceMap(sourceFile, result.sourceMapURL, parseInline);
if (sourceMapSourceFile != null) {
 compiler.addInputSourceMap(sourceFile.getName(), new SourceMapInput(sourceMapSourceFile));
 JSError.make(AbstractCompiler.READ_ERROR, sourceFile.getName(), e.getMessage()));

代码示例来源:origin: org.scala-js/closure-compiler-java-6

compiler.addComments(sourceFile.getName(), result.comments);
 JSError.make(AbstractCompiler.READ_ERROR, sourceFile.getName()));

相关文章