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

x33g5p2x  于2022-01-18 转载在 JavaScript  
字(1.9k)|赞(0)|评价(0)|浏览(264)

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

Compiler.createConfig介绍

暂无

代码示例

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

switch (options.getLanguageIn()) {
 case ECMASCRIPT3:
  parserConfig = createConfig(Config.LanguageMode.ECMASCRIPT3);
  externsParserConfig = createConfig(Config.LanguageMode.ECMASCRIPT5);
  break;
 case ECMASCRIPT5:
  parserConfig = createConfig(Config.LanguageMode.ECMASCRIPT5);
  externsParserConfig = parserConfig;
  break;
 case ECMASCRIPT5_STRICT:
  parserConfig = createConfig(Config.LanguageMode.ECMASCRIPT5_STRICT);
  externsParserConfig = parserConfig;
  break;
 case ECMASCRIPT6:
  parserConfig = createConfig(Config.LanguageMode.ECMASCRIPT6);
  externsParserConfig = parserConfig;
  break;
 case ECMASCRIPT6_STRICT:
  parserConfig = createConfig(Config.LanguageMode.ECMASCRIPT6_STRICT);
  externsParserConfig = parserConfig;
  break;
 case ECMASCRIPT6_TYPED:
  parserConfig = createConfig(Config.LanguageMode.ECMASCRIPT6_TYPED);
  externsParserConfig = parserConfig;
  break;

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

@Override
Config getParserConfig(ConfigContext context) {
 if (parserConfig == null || externsParserConfig == null) {
  synchronized (this) {
   if (parserConfig == null) {
    Config.LanguageMode configLanguageMode = getParserConfigLanguageMode(
      options.getLanguageIn());
    Config.StrictMode strictMode =
      options.expectStrictModeInput() ? Config.StrictMode.STRICT : Config.StrictMode.SLOPPY;
    parserConfig = createConfig(configLanguageMode, strictMode);
    // Externs must always be parsed with at least ES5 language mode.
    externsParserConfig =
      configLanguageMode.equals(Config.LanguageMode.ECMASCRIPT3)
        ? createConfig(Config.LanguageMode.ECMASCRIPT5, strictMode)
        : parserConfig;
   }
  }
 }
 switch (context) {
  case EXTERNS:
   return externsParserConfig;
  default:
   return parserConfig;
 }
}

相关文章

Compiler类方法