当前位置: 首页>>代码示例>>Java>>正文


Java LanguageMode.ECMASCRIPT5属性代码示例

本文整理汇总了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}}");

}
 
开发者ID:google,项目名称:closure-compiler,代码行数:23,代码来源:CodePrinterTest.java

示例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){}}");
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:21,代码来源:CodePrinterTest.java

示例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;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:38,代码来源:CompilerTestCase.java

示例4: testKeywordProperties1

public void testKeywordProperties1() {
  languageMode = LanguageMode.ECMASCRIPT5;
  assertPrintSame("x.foo=2");
  assertPrintSame("x.function=2");

  languageMode = LanguageMode.ECMASCRIPT3;
  assertPrintSame("x.foo=2");
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:8,代码来源:CodePrinterTest.java

示例5: testKeywordProperties2

public void testKeywordProperties2() {
  languageMode = LanguageMode.ECMASCRIPT5;
  assertPrintSame("x={foo:2}");
  assertPrintSame("x={function:2}");

  languageMode = LanguageMode.ECMASCRIPT3;
  assertPrintSame("x={foo:2}");
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:8,代码来源:CodePrinterTest.java

示例6: setUp

@Override
protected void setUp() throws Exception {
  super.setUp();
  allowWarnings = false;
  preserveTypeAnnotations = false;
  trustedStrings = true;
  lastCompiler = null;
  languageMode = LanguageMode.ECMASCRIPT5;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:9,代码来源:CodePrinterTestBase.java

示例7: testOctalNumericKey

public void testOctalNumericKey() {
  allowWarnings = true;
  languageMode = LanguageMode.ECMASCRIPT5;

  assertPrint("var x = {010: 1};", "var x={8:1}");
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:6,代码来源:CodePrinterTest.java

示例8: testKeywordProperties1a

public void testKeywordProperties1a() {
  languageMode = LanguageMode.ECMASCRIPT5;
  Node nodes = parse("x.function=2");
  languageMode = LanguageMode.ECMASCRIPT3;
  assertPrintNode("x[\"function\"]=2", nodes);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:6,代码来源:CodePrinterTest.java

示例9: testKeywordProperties2a

public void testKeywordProperties2a() {
  languageMode = LanguageMode.ECMASCRIPT5;
  Node nodes = parse("x={function:2}");
  languageMode = LanguageMode.ECMASCRIPT3;
  assertPrintNode("x={\"function\":2}", nodes);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:6,代码来源:CodePrinterTest.java


注:本文中的com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT5属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。