• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DecompositionType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType的典型用法代码示例。如果您正苦于以下问题:Java DecompositionType类的具体用法?Java DecompositionType怎么用?Java DecompositionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DecompositionType类属于com.google.javascript.jscomp.ExpressionDecomposer包,在下文中一共展示了DecompositionType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCanExposeExpression1

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression1() {
  // Can't move or decompose some classes of expressions.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(x = goo()&&foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(x += goo()&&foo()){}", "foo");
  
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "do{}while(foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "for(;foo(););", "foo");
  // This case could be supported for loops without conditional continues
  // by moving the increment into the loop body.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "for(;;foo());", "foo");
  // FOR initializer could be supported but they never occur
  // as they are normalized away.

  // This is potentially doable but a bit too complex currently.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "switch(1){case foo():;}", "foo");
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:25,代码来源:ExpresssionDecomposerTest.java


示例2: testCanExposeExpression2

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression2() {
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "var x = foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "if(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "switch(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "switch(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "function (){ return foo();}", "foo");

  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() && 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() || 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() ? 0 : 1", "foo");
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:24,代码来源:ExpresssionDecomposerTest.java


示例3: testCanExposeExpression1

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression1() {
  // Can't move or decompose some classes of expressions.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(x = goo()&&foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(x += goo()&&foo()){}", "foo");

  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "do{}while(foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "for(;foo(););", "foo");
  // This case could be supported for loops without conditional continues
  // by moving the increment into the loop body.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "for(;;foo());", "foo");
  // FOR initializer could be supported but they never occur
  // as they are normalized away.

  // This is potentially doable but a bit too complex currently.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "switch(1){case foo():;}", "foo");
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:25,代码来源:ExpresssionDecomposerTest.java


示例4: testCanExposeExpression2

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression2() {
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "var x = foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "if(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "switch(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "switch(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "function (){ return foo();}", "foo");

  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() && 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() || 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() ? 0 : 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "(function(a){b = a})(foo())", "foo");
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:26,代码来源:ExpresssionDecomposerTest.java


示例5: helperCanExposeFunctionExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperCanExposeFunctionExpression(
    DecompositionType expectedResult, String code, int call) {
  Compiler compiler = new Compiler();
  Set<String> knownConstants = Sets.newHashSet();
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(), knownConstants);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = parse(compiler,
      "function goo() {}" +
      "function foo() {}");
  assertNotNull(externsRoot);
  Node mainRoot = tree;

  Node callSite = findCall(tree, null, 2);
  assertNotNull("Call " + call + " was not found.", callSite);

  compiler.resetUniqueNameId();
  DecompositionType result = decomposer.canExposeExpression(
      callSite);
  assertEquals(expectedResult, result);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:24,代码来源:ExpresssionDecomposerTest.java


示例6: testCanExposeExpression2

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression2() {
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "var x = foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "if(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "switch(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "switch(foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "function f(){ return foo();}", "foo");

  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() && 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() || 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "x = foo() ? 0 : 1", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "(function(a){b = a})(foo())", "foo");
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:26,代码来源:ExpressionDecomposerTest.java


示例7: helperCanExposeFunctionExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperCanExposeFunctionExpression(
    DecompositionType expectedResult, String code, int call) {
  Compiler compiler = getCompiler();
  Set<String> knownConstants = Sets.newHashSet();
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(), knownConstants);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = parse(compiler,
      "function goo() {}" +
      "function foo() {}");
  assertNotNull(externsRoot);
  Node mainRoot = tree;

  Node callSite = findCall(tree, null, 2);
  assertNotNull("Call " + call + " was not found.", callSite);

  compiler.resetUniqueNameId();
  DecompositionType result = decomposer.canExposeExpression(
      callSite);
  assertEquals(expectedResult, result);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:ExpressionDecomposerTest.java


示例8: shouldExtractClass

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private boolean shouldExtractClass(Node classNode, Node parent) {
  boolean isAnonymous = classNode.getFirstChild().isEmpty();
  if (NodeUtil.isClassDeclaration(classNode)
      || (isAnonymous && parent.isName())
      || (isAnonymous
          && parent.isAssign()
          && parent.getFirstChild().isQualifiedName()
          && parent.getParent().isExprResult())) {
    // No need to extract. Handled directly by Es6ToEs3Converter.ClassDeclarationMetadata#create.
    return false;
  }

  if (NodeUtil.mayHaveSideEffects(classNode)
      // Don't extract the class if it's not safe to do so. For example,
      // var c = maybeTrue() && class extends someSideEffect() {};
      // TODO(brndn): it is possible to be less conservative. If the classNode is DECOMPOSABLE,
      // we could use the expression decomposer to move it out of the way.
      || expressionDecomposer.canExposeExpression(classNode) != DecompositionType.MOVABLE) {
    compiler.report(
        JSError.make(classNode, CANNOT_CONVERT, "class expression that cannot be extracted"));
    return false;
  }

  return true;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:26,代码来源:Es6ExtractClasses.java


示例9: testCanExposeExpression1

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression1() {
  // Can't move or decompose some classes of expressions.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(x = goo()&&foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "while(x += goo()&&foo()){}", "foo");

  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "do{}while(foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "for(;foo(););", "foo");
  // This case could be supported for loops without conditional continues
  // by moving the increment into the loop body.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "for(;;foo());", "foo");
  helperCanExposeExpression(
      DecompositionType.MOVABLE, "for(foo();;);", "foo");

  // This is potentially doable but a bit too complex currently.
  helperCanExposeExpression(
      DecompositionType.UNDECOMPOSABLE, "switch(1){case foo():;}", "foo");
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:25,代码来源:ExpressionDecomposerTest.java


示例10: helperCanExposeFunctionExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperCanExposeFunctionExpression(
    DecompositionType expectedResult, String code, int call) {
  Compiler compiler = getCompiler();
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(),
      knownConstants, newScope(), allowMethodCallDecomposing);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = parse(compiler, "function goo() {} function foo() {}");
  assertNotNull(externsRoot);

  Node callSite = findCall(tree, null, call);
  assertNotNull("Call " + call + " was not found.", callSite);

  compiler.resetUniqueNameId();
  DecompositionType result = decomposer.canExposeExpression(callSite);
  assertEquals(expectedResult, result);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:20,代码来源:ExpressionDecomposerTest.java


示例11: helperCanExposeExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperCanExposeExpression(
    DecompositionType expectedResult,
    String code,
    String fnName) {
  Compiler compiler = getCompiler();
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(),
      knownConstants, newScope(), allowMethodCallDecomposing);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = parse(compiler, "function goo() {} function foo() {}");
  assertNotNull(externsRoot);

  Node callSite = findCall(tree, fnName);
  assertNotNull("Call to " + fnName + " was not found.", callSite);

  compiler.resetUniqueNameId();
  DecompositionType result = decomposer.canExposeExpression(callSite);
  assertEquals(expectedResult, result);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:22,代码来源:ExpressionDecomposerTest.java


示例12: helperCanExposeFunctionExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperCanExposeFunctionExpression(
    DecompositionType expectedResult, String code, int call) {
  Compiler compiler = getCompiler();
  Set<String> knownConstants = Sets.newHashSet();
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(),
      knownConstants, newScope());
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = parse(compiler,
      "function goo() {}" +
      "function foo() {}");
  assertNotNull(externsRoot);

  Node callSite = findCall(tree, null, 2);
  assertNotNull("Call " + call + " was not found.", callSite);

  compiler.resetUniqueNameId();
  DecompositionType result = decomposer.canExposeExpression(
      callSite);
  assertEquals(expectedResult, result);
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:24,代码来源:ExpressionDecomposerTest.java


示例13: helperCanExposeFunctionExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperCanExposeFunctionExpression(
    DecompositionType expectedResult, String code, int call) {
  Compiler compiler = getCompiler();
  Set<String> knownConstants = Sets.newHashSet();
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(), knownConstants);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = parse(compiler,
      "function goo() {}" +
      "function foo() {}");
  assertNotNull(externsRoot);

  Node callSite = findCall(tree, null, 2);
  assertNotNull("Call " + call + " was not found.", callSite);

  compiler.resetUniqueNameId();
  DecompositionType result = decomposer.canExposeExpression(
      callSite);
  assertEquals(expectedResult, result);
}
 
开发者ID:Robbert,项目名称:closure-compiler-copy,代码行数:23,代码来源:ExpressionDecomposerTest.java


示例14: testCanExposeExpression3

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression3() {
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x = 0 && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x = 1 || foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "var x = 1 ? foo() : 0", "foo");

  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x = goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x += goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "var x = goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "if(goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "switch(goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "switch(goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "switch(x = goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE,
      "function (){ return goo() && foo();}", "foo");
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:29,代码来源:ExpresssionDecomposerTest.java


示例15: helperCanExposeExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
/** Test case helpers. */

  private void helperCanExposeExpression(
      DecompositionType expectedResult,
      String code,
      String fnName
      ) {
    helperCanExposeExpression(expectedResult, code, fnName, null);
  }
 
开发者ID:andyjko,项目名称:feedlack,代码行数:10,代码来源:ExpresssionDecomposerTest.java


示例16: helperExposeExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperExposeExpression(
    String code,
    String fnName,
    String expectedResult,
    Set<String> knownConstants
    ) {
  Compiler compiler = new Compiler();
  if (knownConstants == null) {
    knownConstants = Sets.newHashSet();
  }
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(), knownConstants);
  decomposer.setTempNamePrefix("temp_");
  Node expectedRoot = parse(compiler, expectedResult);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = new Node(Token.EMPTY);
  Node mainRoot = tree;

  Node callSite = findCall(tree, fnName);
  assertNotNull("Call to " + fnName + " was not found.", callSite);

  DecompositionType result = decomposer.canExposeExpression(callSite);
  assertTrue(result == DecompositionType.DECOMPOSABLE);

  compiler.resetUniqueNameId();
  decomposer.exposeExpression(callSite);
  String explanation = expectedRoot.checkTreeEquals(tree);
  assertNull("\nExpected: " + compiler.toSource(expectedRoot) +
      "\nResult: " + compiler.toSource(tree) +
      "\n" + explanation, explanation);
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:34,代码来源:ExpresssionDecomposerTest.java


示例17: testCanExposeExpression7

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression7() {
  // Verify calls to function expressions are movable.
  helperCanExposeFunctionExpression(
      DecompositionType.MOVABLE,
      "(function(map){descriptions_=map})(\n" +
          "function(){\n" +
              "var ret={};\n" +
              "ret[INIT]='a';\n" +
              "ret[MIGRATION_BANNER_DISMISS]='b';\n" +
              "return ret\n" +
          "}()\n" +
      ");", 2);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:14,代码来源:ExpresssionDecomposerTest.java


示例18: helperExposeExpression

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
private void helperExposeExpression(
    String code,
    String fnName,
    String expectedResult,
    Set<String> knownConstants
    ) {
  Compiler compiler = new Compiler();
  if (knownConstants == null) {
    knownConstants = Sets.newHashSet();
  }
  ExpressionDecomposer decomposer = new ExpressionDecomposer(
      compiler, compiler.getUniqueNameIdSupplier(), knownConstants);
  decomposer.setTempNamePrefix("temp");
  Node expectedRoot = parse(compiler, expectedResult);
  Node tree = parse(compiler, code);
  assertNotNull(tree);

  Node externsRoot = new Node(Token.EMPTY);
  Node mainRoot = tree;

  Node callSite = findCall(tree, fnName);
  assertNotNull("Call to " + fnName + " was not found.", callSite);

  DecompositionType result = decomposer.canExposeExpression(callSite);
  assertTrue(result == DecompositionType.DECOMPOSABLE);

  compiler.resetUniqueNameId();
  decomposer.exposeExpression(callSite);
  validateSourceInfo(compiler, tree);
  String explanation = expectedRoot.checkTreeEquals(tree);
  assertNull("\nExpected: " + compiler.toSource(expectedRoot) +
      "\nResult: " + compiler.toSource(tree) +
      "\n" + explanation, explanation);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:35,代码来源:ExpresssionDecomposerTest.java


示例19: testCanExposeExpression3

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression3() {
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x = 0 && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x = 1 || foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "var x = 1 ? foo() : 0", "foo");

  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x = goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "x += goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "var x = goo() && foo()", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "if(goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "switch(goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "switch(goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE, "switch(x = goo() && foo()){}", "foo");
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE,
      "function f(){ return goo() && foo();}", "foo");
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:29,代码来源:ExpressionDecomposerTest.java


示例20: testCanExposeExpression8

import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; //导入依赖的package包/类
public void testCanExposeExpression8() {
  // Can it be decompose?
  helperCanExposeExpression(
      DecompositionType.DECOMPOSABLE,
      "HangoutStarter.prototype.launchHangout = function() {\n" +
      "  var self = a.b;\n" +
      "  var myUrl = new goog.Uri(getDomServices_(self).getDomHelper()." +
      "getWindow().location.href);\n" +
      "};",
      "getDomServices_");

  // Verify it is properly expose the target expression.
  helperExposeExpression(
      "HangoutStarter.prototype.launchHangout = function() {\n" +
      "  var self = a.b;\n" +
      "  var myUrl = new goog.Uri(getDomServices_(self).getDomHelper()." +
      "getWindow().location.href);\n" +
      "};",
      "getDomServices_",
      "HangoutStarter.prototype.launchHangout = function() {" +
      "  var self = a.b;" +
      "  var temp_const$$0 = goog.Uri;" +
      "  var myUrl = new temp_const$$0(getDomServices_(self)." +
      "      getDomHelper().getWindow().location.href)}");

  // Verify the results can be properly moved.
  helperMoveExpression(
      "HangoutStarter.prototype.launchHangout = function() {" +
      "  var self = a.b;" +
      "  var temp_const$$0 = goog.Uri;" +
      "  var myUrl = new temp_const$$0(getDomServices_(self)." +
      "      getDomHelper().getWindow().location.href)}",
      "getDomServices_",
      "HangoutStarter.prototype.launchHangout = function() {" +
      "  var self=a.b;" +
      "  var temp_const$$0=goog.Uri;" +
      "  var result$$0=getDomServices_(self);" +
      "  var myUrl=new temp_const$$0(result$$0.getDomHelper()." +
      "      getWindow().location.href)}");
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:41,代码来源:ExpressionDecomposerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UsersApi类代码示例发布时间:2022-05-22
下一篇:
Java GroovyCategorySupport类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap