Java Code Examples for com.google.javascript.jscomp.CompilerOptions#setStrictModeInput()
The following examples show how to use
com.google.javascript.jscomp.CompilerOptions#setStrictModeInput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClosureJsInteropGenerator.java From jsinterop-generator with Apache License 2.0 | 5 votes |
private CompilerOptions createCompilerOptions() { CompilerOptions options = new CompilerOptions(); options.setLanguageOut(ECMASCRIPT5); options.setChecksOnly(true); options.setStrictModeInput(true); options.setCheckTypes(true); options.setPreserveDetailedSourceInfo(true); options.setWarningLevel(DiagnosticGroups.UNRECOGNIZED_TYPE_ERROR, CheckLevel.ERROR); return options; }
Example 2
Source File: MinifyUtil.java From minifierbeans with Apache License 2.0 | 4 votes |
public String compressSelectedJavaScript(String inputFilename, String content, MinifyProperty minifyProperty) throws IOException { Compiler compiler = new Compiler(); CompilerOptions options = new CompilerOptions(); compiler.initOptions(options); options.setStrictModeInput(false); options.setEmitUseStrict(false); options.setTrustedStrings(true); CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options); List<SourceFile> inputs = new ArrayList<SourceFile>(); inputs.add(SourceFile.fromCode(inputFilename, content)); StringWriter outputWriter = new StringWriter(); compiler.compile(CommandLineRunner.getDefaultExterns(), inputs, options); outputWriter.flush(); return compiler.toSource(); }