本文整理汇总了Java中com.google.javascript.jscomp.CompilerOptions.setCheckGlobalNamesLevel方法的典型用法代码示例。如果您正苦于以下问题:Java CompilerOptions.setCheckGlobalNamesLevel方法的具体用法?Java CompilerOptions.setCheckGlobalNamesLevel怎么用?Java CompilerOptions.setCheckGlobalNamesLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.jscomp.CompilerOptions
的用法示例。
在下文中一共展示了CompilerOptions.setCheckGlobalNamesLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCompilerOptions
import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
public CompilerOptions getCompilerOptions() {
final CompilerOptions options = new CompilerOptions();
options.setClosurePass(true);
options.setCheckGlobalNamesLevel(CheckLevel.ERROR);
// Report duplicate definitions, e.g. for accidentally duplicated externs.
options.setWarningLevel(DiagnosticGroups.DUPLICATE_VARS, CheckLevel.ERROR);
options.setLanguage(CompilerOptions.LanguageMode.ECMASCRIPT_2015);
options.setLanguageOut(CompilerOptions.LanguageMode.NO_TRANSPILE);
// Do not transpile module declarations
options.setWrapGoogModulesForWhitespaceOnly(false);
// Stop escaping the characters "=&<>"
options.setTrustedStrings(true);
options.setPreferSingleQuotes(true);
// Compiler passes must be disabled to disable down-transpilation to ES5.
options.skipAllCompilerPasses();
// turns off optimizations.
options.setChecksOnly(true);
options.setPreserveDetailedSourceInfo(true);
options.setParseJsDocDocumentation(Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE);
return options;
}
示例2: getCompilerOptions
import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
public CompilerOptions getCompilerOptions() {
final CompilerOptions options = new CompilerOptions();
options.setClosurePass(true);
DependencyOptions deps = new DependencyOptions();
deps.setDependencySorting(true);
options.setDependencyOptions(deps);
if (!this.entryPoints.isEmpty()) {
options.setManageClosureDependencies(this.entryPoints);
}
// All diagnostics are WARNINGs (or off) and thus ignored unless debug == true.
// Only report issues (and fail for them) that are specifically causing problems for Clutz.
// The idea is to not do a general sanity check of Closure code, just make sure Clutz works.
// Report missing types as errors.
options.setCheckGlobalNamesLevel(CheckLevel.ERROR);
// Report duplicate definitions, e.g. for accidentally duplicated externs.
options.setWarningLevel(DiagnosticGroups.DUPLICATE_VARS, CheckLevel.ERROR);
// Late Provides are errors by default, but they do not prevent clutz from transpiling.
options.setWarningLevel(DiagnosticGroups.LATE_PROVIDE, CheckLevel.OFF);
options.setLanguage(LanguageMode.ECMASCRIPT_2017);
options.setLanguageOut(LanguageMode.ECMASCRIPT5);
options.setCheckTypes(true);
options.setInferTypes(true);
// turns off optimizations.
options.setChecksOnly(true);
options.setPreserveDetailedSourceInfo(true);
options.setParseJsDocDocumentation(Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE);
if (partialInput) {
options.setAssumeForwardDeclaredForMissingTypes(true);
options.setWarningLevel(DiagnosticGroups.MISSING_SOURCES_WARNINGS, CheckLevel.OFF);
}
return options;
}
示例3: determineOptions
import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
/**
* Creates and returns the options used for compiling in
* {@link #closureCompile(CompilationLevel, List, List, ILogger)}.
*/
private CompilerOptions determineOptions(CompilationLevel level) {
CompilerOptions options = new CompilerOptions();
level.setOptionsForCompilationLevel(options);
options.prettyPrint = prettyPrint;
options.setCodingConvention(new ClosureCodingConvention());
options.checkEs5Strict = true;
options.checkTypes = true;
options.setCheckUnreachableCode(CheckLevel.WARNING);
options.setCheckMissingReturn(CheckLevel.WARNING);
options.checkDuplicateMessages = true;
options.checkControlStructures = true;
options.checkTypedPropertyCalls = true;
options.checkSuspiciousCode = true;
options.setReportMissingOverride(CheckLevel.WARNING);
options.setCheckFunctions(CheckLevel.WARNING);
options.setCheckGlobalNamesLevel(CheckLevel.WARNING);
options.setCheckGlobalThisLevel(CheckLevel.WARNING);
options.setCheckMethods(CheckLevel.WARNING);
options.setCheckProvides(CheckLevel.WARNING);
options.setCheckRequires(CheckLevel.WARNING);
options.setCheckShadowVars(CheckLevel.WARNING);
options.setAggressiveVarCheck(CheckLevel.WARNING);
return options;
}
示例4: determineOptions
import com.google.javascript.jscomp.CompilerOptions; //导入方法依赖的package包/类
/** Returns the compiler options used. */
private CompilerOptions determineOptions() {
CompilerOptions options = new CompilerOptions();
CompilationLevel.ADVANCED_OPTIMIZATIONS
.setOptionsForCompilationLevel(options);
options.setCodingConvention(new ClosureCodingConvention());
options.checkEs5Strict = true;
options.checkTypes = false;
options.setCheckUnreachableCode(CheckLevel.WARNING);
options.setCheckMissingReturn(CheckLevel.WARNING);
options.checkDuplicateMessages = true;
options.checkControlStructures = true;
options.checkTypedPropertyCalls = true;
options.checkSuspiciousCode = true;
options.setReportMissingOverride(CheckLevel.WARNING);
options.setCheckFunctions(CheckLevel.WARNING);
options.setCheckGlobalNamesLevel(CheckLevel.OFF);
options.setCheckGlobalThisLevel(CheckLevel.OFF);
options.setCheckMethods(CheckLevel.WARNING);
options.setCheckProvides(CheckLevel.OFF);
options.setCheckRequires(CheckLevel.OFF);
options.setCheckShadowVars(CheckLevel.WARNING);
options.setAggressiveVarCheck(CheckLevel.WARNING);
return options;
}