本文整理汇总了Java中com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT5属性的典型用法代码示例。如果您正苦于以下问题:Java LanguageMode.ECMASCRIPT5属性的具体用法?Java LanguageMode.ECMASCRIPT5怎么用?Java LanguageMode.ECMASCRIPT5使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.javascript.jscomp.CompilerOptions.LanguageMode
的用法示例。
在下文中一共展示了LanguageMode.ECMASCRIPT5属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetter
public void testGetter() {
assertPrint("var x = {}", "var x={}");
assertPrint("var x = {get a() {return 1}}", "var x={get a(){return 1}}");
assertPrint(
"var x = {get a() {}, get b(){}}",
"var x={get a(){},get b(){}}");
assertPrint(
"var x = {get 'a'() {return 1}}",
"var x={get \"a\"(){return 1}}");
assertPrint(
"var x = {get 1() {return 1}}",
"var x={get 1(){return 1}}");
assertPrint(
"var x = {get \"()\"() {return 1}}",
"var x={get \"()\"(){return 1}}");
languageMode = LanguageMode.ECMASCRIPT5;
assertPrintSame("var x={get function(){return 1}}");
}
示例2: testSetter
public void testSetter() {
assertPrint("var x = {}", "var x={}");
assertPrint(
"var x = {set a(y) {return 1}}",
"var x={set a(y){return 1}}");
assertPrint(
"var x = {get 'a'() {return 1}}",
"var x={get \"a\"(){return 1}}");
assertPrint(
"var x = {set 1(y) {return 1}}",
"var x={set 1(y){return 1}}");
assertPrint(
"var x = {set \"(x)\"(y) {return 1}}",
"var x={set \"(x)\"(y){return 1}}");
languageMode = LanguageMode.ECMASCRIPT5;
assertPrintSame("var x={set function(x){}}");
}
示例3: setUp
@Override
protected void setUp() throws Exception {
super.setUp();
// TODO(sdh): Initialize *all* the options here, but first we must ensure no subclass
// is changing them in the constructor, rather than in their own setUp method.
this.acceptedLanguage = LanguageMode.ECMASCRIPT_2017;
this.moduleResolutionMode = ModuleLoader.ResolutionMode.BROWSER;
this.allowExternsChanges = false;
this.allowSourcelessWarnings = false;
this.astValidationEnabled = true;
this.checkAccessControls = false;
this.checkAstChangeMarking = true;
this.checkLineNumbers = true;
this.closurePassEnabled = false;
this.closurePassEnabledForExpected = false;
this.compareAsTree = true;
this.compareJsDoc = true;
this.computeSideEffects = false;
this.expectParseWarningsThisTest = false;
this.expectedSymbolTableError = null;
this.gatherExternPropertiesEnabled = false;
this.inferConsts = false;
this.languageOut = LanguageMode.ECMASCRIPT5;
this.markNoSideEffects = false;
this.multistageCompilation = true;
this.newTypeInferenceEnabled = false;
this.normalizeEnabled = false;
this.parseTypeInfo = false;
this.polymerPass = false;
this.processCommonJsModules = false;
this.rewriteClosureCode = false;
this.runTypeCheckAfterProcessing = false;
this.transpileEnabled = false;
this.typeCheckEnabled = false;
this.setUpRan = true;
}
示例4: testKeywordProperties1
public void testKeywordProperties1() {
languageMode = LanguageMode.ECMASCRIPT5;
assertPrintSame("x.foo=2");
assertPrintSame("x.function=2");
languageMode = LanguageMode.ECMASCRIPT3;
assertPrintSame("x.foo=2");
}
示例5: testKeywordProperties2
public void testKeywordProperties2() {
languageMode = LanguageMode.ECMASCRIPT5;
assertPrintSame("x={foo:2}");
assertPrintSame("x={function:2}");
languageMode = LanguageMode.ECMASCRIPT3;
assertPrintSame("x={foo:2}");
}
示例6: setUp
@Override
protected void setUp() throws Exception {
super.setUp();
allowWarnings = false;
preserveTypeAnnotations = false;
trustedStrings = true;
lastCompiler = null;
languageMode = LanguageMode.ECMASCRIPT5;
}
示例7: testOctalNumericKey
public void testOctalNumericKey() {
allowWarnings = true;
languageMode = LanguageMode.ECMASCRIPT5;
assertPrint("var x = {010: 1};", "var x={8:1}");
}
示例8: testKeywordProperties1a
public void testKeywordProperties1a() {
languageMode = LanguageMode.ECMASCRIPT5;
Node nodes = parse("x.function=2");
languageMode = LanguageMode.ECMASCRIPT3;
assertPrintNode("x[\"function\"]=2", nodes);
}
示例9: testKeywordProperties2a
public void testKeywordProperties2a() {
languageMode = LanguageMode.ECMASCRIPT5;
Node nodes = parse("x={function:2}");
languageMode = LanguageMode.ECMASCRIPT3;
assertPrintNode("x={\"function\":2}", nodes);
}