本文整理汇总了Java中com.google.javascript.jscomp.CompilerOptions.DevMode类的典型用法代码示例。如果您正苦于以下问题:Java DevMode类的具体用法?Java DevMode怎么用?Java DevMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DevMode类属于com.google.javascript.jscomp.CompilerOptions包,在下文中一共展示了DevMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: optimize
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void optimize() {
// Ideally, this pass should be the first pass run, however:
// 1) VariableReferenceCheck reports unexpected warnings if Normalize
// is done first.
// 2) ReplaceMessages, stripCode, and potentially custom passes rely on
// unmodified local names.
normalize();
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker);
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
phaseOptimizer.consume(getPassConfig().getOptimizations());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:19,代码来源:Compiler.java
示例2: testAlwaysRunSafetyCheck
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void testAlwaysRunSafetyCheck() {
CompilerOptions options = createCompilerOptions();
options.setDevMode(DevMode.OFF);
options.setCheckSymbols(false);
options.addCustomPass(
CustomPassExecutionTime.BEFORE_OPTIMIZATIONS,
new CompilerPass() {
@Override
public void process(Node externs, Node root) {
Node var = root.getLastChild().getFirstChild();
assertEquals(Token.VAR, var.getToken());
var.detach();
}
});
try {
test(options,
"var x = 3; function f() { return x + z; }",
"function f() { return x + z; }");
fail("Expected run-time exception");
} catch (RuntimeException e) {
assertThat(e).hasMessageThat().contains("Unexpected variable x");
}
}
开发者ID:google,项目名称:closure-compiler,代码行数:26,代码来源:IntegrationTest.java
示例3: optimize
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void optimize() {
// Ideally, this pass should be the first pass run, however:
// 1) VariableReferenceCheck reports unexpected warnings if Normalize
// is done first.
// 2) ReplaceMessages, stripCode, and potentially custom passes rely on
// unmodified local names.
normalize();
// Create extern exports after the normalize because externExports depends on unique names.
if (options.isExternExportsEnabled()
|| options.externExportsPath != null) {
externExports();
}
phaseOptimizer = new PhaseOptimizer(this, tracker, null);
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
if (options.getCheckDeterminism()) {
phaseOptimizer.setPrintAstHashcodes(true);
}
phaseOptimizer.consume(getPassConfig().getOptimizations());
phaseOptimizer.process(externsRoot, jsRoot);
phaseOptimizer = null;
}
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:26,代码来源:Compiler.java
示例4: compileInternal
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
private void compileInternal() {
parse();
if (hasErrors()) {
return;
}
if (!precheck()) {
return;
}
if (options_.nameAnonymousFunctionsOnly) {
// TODO(nicksantos): Move this into an instrument() phase maybe?
check();
return;
}
if (!options_.skipAllPasses) {
check();
if (hasErrors()) {
return;
}
if (options_.externExportsPath != null) {
externExports();
}
// IDE-mode is defined to stop here, before the heavy rewriting begins.
if (!options_.ideMode) {
optimize();
}
}
if (options_.recordFunctionInformation) {
recordFunctionInformation();
}
if (options_.devMode == DevMode.START_AND_END) {
runSanityCheck();
}
}
开发者ID:andyjko,项目名称:feedlack,代码行数:41,代码来源:Compiler.java
示例5: check
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void check() {
runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker);
if (options_.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
phaseOptimizer.consume(getPassConfig().getChecks());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
// TODO(nicksantos): clean this up. The flow here is too hard to follow.
if (options_.nameAnonymousFunctionsOnly) {
return;
}
if (options_.removeTryCatchFinally) {
removeTryCatchFinally();
}
if (!options_.stripTypes.isEmpty() ||
!options_.stripNameSuffixes.isEmpty() ||
!options_.stripTypePrefixes.isEmpty() ||
!options_.stripNamePrefixes.isEmpty()) {
stripCode(options_.stripTypes, options_.stripNameSuffixes,
options_.stripTypePrefixes, options_.stripNamePrefixes);
}
runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
// Ideally, this pass should be the first pass run, however:
// 1) VariableReferenceCheck reports unexpected warnings if Normalize
// is done first.
// 2) ReplaceMessages, stripCode, and potentially custom passes rely on
// unmodified local names.
normalize();
}
开发者ID:andyjko,项目名称:feedlack,代码行数:40,代码来源:Compiler.java
示例6: optimize
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void optimize() {
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker);
if (options_.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
phaseOptimizer.consume(getPassConfig().getOptimizations());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
}
开发者ID:andyjko,项目名称:feedlack,代码行数:12,代码来源:Compiler.java
示例7: check
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void check() {
runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker);
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
phaseOptimizer.consume(getPassConfig().getChecks());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
// TODO(nicksantos): clean this up. The flow here is too hard to follow.
if (options.nameAnonymousFunctionsOnly) {
return;
}
if (options.removeTryCatchFinally) {
removeTryCatchFinally();
}
if (!options.stripTypes.isEmpty() ||
!options.stripNameSuffixes.isEmpty() ||
!options.stripTypePrefixes.isEmpty() ||
!options.stripNamePrefixes.isEmpty()) {
stripCode(options.stripTypes, options.stripNameSuffixes,
options.stripTypePrefixes, options.stripNamePrefixes);
}
runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:33,代码来源:Compiler.java
示例8: check
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void check() {
runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
// We are currently only interested in check-passes for progress reporting
// as it is used for IDEs, that's why the maximum progress is set to 1.0.
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker,
new PhaseOptimizer.ProgressRange(getProgress(), 1.0));
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
phaseOptimizer.consume(getPassConfig().getChecks());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
// TODO(nicksantos): clean this up. The flow here is too hard to follow.
if (options.nameAnonymousFunctionsOnly) {
return;
}
if (options.removeTryCatchFinally) {
removeTryCatchFinally();
}
if (options.getTweakProcessing().shouldStrip() ||
!options.stripTypes.isEmpty() ||
!options.stripNameSuffixes.isEmpty() ||
!options.stripTypePrefixes.isEmpty() ||
!options.stripNamePrefixes.isEmpty()) {
stripCode(options.stripTypes, options.stripNameSuffixes,
options.stripTypePrefixes, options.stripNamePrefixes);
}
runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:37,代码来源:Compiler.java
示例9: optimize
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void optimize() {
// Ideally, this pass should be the first pass run, however:
// 1) VariableReferenceCheck reports unexpected warnings if Normalize
// is done first.
// 2) ReplaceMessages, stripCode, and potentially custom passes rely on
// unmodified local names.
normalize();
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker, null);
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
phaseOptimizer.consume(getPassConfig().getOptimizations());
phaseOptimizer.process(externsRoot, jsRoot);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:Compiler.java
示例10: performPostCompilationTasksInternal
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
/**
* Performs all the bookkeeping required at the end of a compilation.
*/
private void performPostCompilationTasksInternal() {
if (options.recordFunctionInformation) {
recordFunctionInformation();
}
if (options.devMode == DevMode.START_AND_END) {
runValidityCheck();
}
setProgress(1.0, "recordFunctionInformation");
if (tracker != null) {
tracker.outputTracerReport();
}
}
开发者ID:google,项目名称:closure-compiler,代码行数:18,代码来源:Compiler.java
示例11: createPhaseOptimizer
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
private PhaseOptimizer createPhaseOptimizer() {
PhaseOptimizer phaseOptimizer = new PhaseOptimizer(this, tracker);
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setValidityCheck(validityCheck);
}
if (options.getCheckDeterminism()) {
phaseOptimizer.setPrintAstHashcodes(true);
}
return phaseOptimizer;
}
开发者ID:google,项目名称:closure-compiler,代码行数:11,代码来源:Compiler.java
示例12: testExpose
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void testExpose() {
CompilerOptions options = createCompilerOptions();
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
// TODO(tbreisacher): Re-enable dev mode and fix test failure.
options.setDevMode(DevMode.OFF);
test(options,
new String[] {"var x = {eeny: 1, /** @expose */ meeny: 2};" +
"/** @constructor */ var Foo = function() {};" +
"/** @expose */ Foo.prototype.miny = 3;" +
"Foo.prototype.moe = 4;" +
"/** @expose */ Foo.prototype.tiger;" +
"function moe(a, b) { return a.meeny + b.miny + a.tiger; }" +
"window['x'] = x;" +
"window['Foo'] = Foo;" +
"window['moe'] = moe;"},
new String[] {"function a(){}" +
"a.prototype.miny=3;" +
"window.x={a:1,meeny:2};" +
"window.Foo=a;" +
"window.moe=function(b,c){" +
" return b.meeny+c.miny+b.tiger" +
"}"},
new DiagnosticType[]{
CheckJSDoc.ANNOTATION_DEPRECATED,
CheckJSDoc.ANNOTATION_DEPRECATED,
CheckJSDoc.ANNOTATION_DEPRECATED});
}
开发者ID:google,项目名称:closure-compiler,代码行数:30,代码来源:IntegrationTest.java
示例13: testBadBreakStatementInIdeMode
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void testBadBreakStatementInIdeMode() {
// Ensure that type-checking doesn't crash, even if the CFG is malformed.
// This can happen in IDE mode.
CompilerOptions options = createCompilerOptions();
options.setDevMode(DevMode.OFF);
options.setIdeMode(true);
options.setCheckTypes(true);
options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF);
test(options,
"function f() { try { } catch(e) { break; } }",
RhinoErrorReporter.PARSE_ERROR);
}
开发者ID:google,项目名称:closure-compiler,代码行数:14,代码来源:IntegrationTest.java
示例14: testIssue1131
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void testIssue1131() {
CompilerOptions options = createCompilerOptions();
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
// TODO(tbreisacher): Re-enable dev mode and fix test failure.
options.setDevMode(DevMode.OFF);
test(options,
"function f(k) { return k(k); } alert(f(f));",
"function a(b) { return b(b); } alert(a(a));");
}
开发者ID:google,项目名称:closure-compiler,代码行数:12,代码来源:IntegrationTest.java
示例15: createCompilerOptions
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
/** Creates a CompilerOptions object with google coding conventions. */
@Override
protected CompilerOptions createCompilerOptions() {
CompilerOptions options = new CompilerOptions();
options.setLanguageOut(LanguageMode.ECMASCRIPT3);
options.setDevMode(DevMode.EVERY_PASS);
options.setCodingConvention(new GoogleCodingConvention());
options.setRenamePrefixNamespaceAssumeCrossModuleNames(true);
options.declaredGlobalExternsOnWindow = false;
return options;
}
开发者ID:google,项目名称:closure-compiler,代码行数:12,代码来源:IntegrationTest.java
示例16: createCompilerOptions
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
@Override
CompilerOptions createCompilerOptions() {
CompilerOptions options = new CompilerOptions();
options.setDevMode(DevMode.EVERY_PASS);
options.setLanguageIn(LanguageMode.ECMASCRIPT_2017);
options.setLanguageOut(LanguageMode.ECMASCRIPT5);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setTypeCheckEs6Natively(true);
return options;
}
开发者ID:google,项目名称:closure-compiler,代码行数:12,代码来源:TranspileAfterNTITest.java
示例17: check
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void check() {
runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
// We are currently only interested in check-passes for progress reporting
// as it is used for IDEs, that's why the maximum progress is set to 1.0.
phaseOptimizer = new PhaseOptimizer(this, tracker,
new PhaseOptimizer.ProgressRange(getProgress(), 1.0));
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
if (options.getCheckDeterminism()) {
phaseOptimizer.setPrintAstHashcodes(true);
}
phaseOptimizer.consume(getPassConfig().getChecks());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
// TODO(nicksantos): clean this up. The flow here is too hard to follow.
if (options.nameAnonymousFunctionsOnly) {
return;
}
if (options.getTweakProcessing().shouldStrip() ||
!options.stripTypes.isEmpty() ||
!options.stripNameSuffixes.isEmpty() ||
!options.stripTypePrefixes.isEmpty() ||
!options.stripNamePrefixes.isEmpty()) {
stripCode(options.stripTypes, options.stripNameSuffixes,
options.stripTypePrefixes, options.stripNamePrefixes);
}
runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
phaseOptimizer = null;
}
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:37,代码来源:Compiler.java
示例18: check
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
public void check() {
runCustomPasses(CustomPassExecutionTime.BEFORE_CHECKS);
// We are currently only interested in check-passes for progress reporting
// as it is used for IDEs, that's why the maximum progress is set to 1.0.
phaseOptimizer = new PhaseOptimizer(this, tracker,
new PhaseOptimizer.ProgressRange(getProgress(), 1.0));
if (options.devMode == DevMode.EVERY_PASS) {
phaseOptimizer.setSanityCheck(sanityCheck);
}
if (options.getCheckDeterminism()) {
phaseOptimizer.setPrintAstHashcodes(true);
}
phaseOptimizer.consume(getPassConfig().getChecks());
phaseOptimizer.process(externsRoot, jsRoot);
if (hasErrors()) {
return;
}
// TODO(nicksantos): clean this up. The flow here is too hard to follow.
if (options.nameAnonymousFunctionsOnly) {
return;
}
if (options.removeTryCatchFinally) {
removeTryCatchFinally();
}
if (options.getTweakProcessing().shouldStrip() ||
!options.stripTypes.isEmpty() ||
!options.stripNameSuffixes.isEmpty() ||
!options.stripTypePrefixes.isEmpty() ||
!options.stripNamePrefixes.isEmpty()) {
stripCode(options.stripTypes, options.stripNameSuffixes,
options.stripTypePrefixes, options.stripNamePrefixes);
}
runCustomPasses(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS);
phaseOptimizer = null;
}
开发者ID:Robbert,项目名称:closure-compiler-copy,代码行数:41,代码来源:Compiler.java
示例19: maybeSanityCheck
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
private void maybeSanityCheck() {
if (options_.devMode == DevMode.EVERY_PASS) {
runSanityCheck();
}
}
开发者ID:andyjko,项目名称:feedlack,代码行数:6,代码来源:Compiler.java
示例20: compileInternal
import com.google.javascript.jscomp.CompilerOptions.DevMode; //导入依赖的package包/类
private void compileInternal() {
parse();
if (hasErrors()) {
return;
}
if (!precheck()) {
return;
}
if (options.nameAnonymousFunctionsOnly) {
// TODO(nicksantos): Move this into an instrument() phase maybe?
check();
return;
}
if (!options.skipAllPasses) {
check();
if (hasErrors()) {
return;
}
if (options.isExternExportsEnabled()
|| options.externExportsPath != null) {
externExports();
}
// IDE-mode is defined to stop here, before the heavy rewriting begins.
if (!options.ideMode) {
optimize();
}
}
if (options.recordFunctionInformation) {
recordFunctionInformation();
}
if (options.devMode == DevMode.START_AND_END) {
runSanityCheck();
}
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:42,代码来源:Compiler.java
注:本文中的com.google.javascript.jscomp.CompilerOptions.DevMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论