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


Java ResolveMode类代码示例

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


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

示例1: forceResolve

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
/**
 * Force this type to resolve, even if the registry is in a lazy
 * resolving mode.
 * @see #resolve
 */
public final JSType forceResolve(ErrorReporter t, StaticScope<JSType> scope) {
  ResolveMode oldResolveMode = registry.getResolveMode();
  registry.setResolveMode(ResolveMode.IMMEDIATE);
  JSType result = resolve(t, scope);
  registry.setResolveMode(oldResolveMode);
  return result;
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:13,代码来源:JSType.java

示例2: testTypeResolutionModes

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
public void testTypeResolutionModes() {
  SimpleErrorReporter reporter = new SimpleErrorReporter();

  JSTypeRegistry lazyExprRegistry = new JSTypeRegistry(reporter);
  lazyExprRegistry.setResolveMode(ResolveMode.LAZY_EXPRESSIONS);

  JSTypeRegistry lazyNameRegistry = new JSTypeRegistry(reporter);
  lazyNameRegistry.setResolveMode(ResolveMode.LAZY_NAMES);

  JSTypeRegistry immediateRegistry = new JSTypeRegistry(reporter);
  immediateRegistry.setResolveMode(ResolveMode.IMMEDIATE);

  Node expr = new Node(Token.QMARK, Node.newString("foo"));
  StaticScope<JSType> empty = new EmptyScope();

  JSType type = lazyExprRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertTrue(type instanceof UnresolvedTypeExpression);
  assertTrue(type.isUnknownType());
  assertEquals("?", type.toString());
  assertNull("Unexpected warnings: " + reporter.warnings(),
      reporter.warnings());

  type = lazyNameRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertTrue(type instanceof UnionType);
  assertTrue(type.isUnknownType());
  assertEquals("(foo|null)", type.toString());
  assertNull("Unexpected warnings: " + reporter.warnings(),
      reporter.warnings());

  type = immediateRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertTrue(type instanceof UnknownType);
  assertEquals("Expected warnings", 1, reporter.warnings().size());
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:37,代码来源:JSTypeRegistryTest.java

示例3: testForceResolve

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
public void testForceResolve() {
  SimpleErrorReporter reporter = new SimpleErrorReporter();

  JSTypeRegistry lazyExprRegistry = new JSTypeRegistry(reporter);
  lazyExprRegistry.setResolveMode(ResolveMode.LAZY_EXPRESSIONS);

  Node expr = new Node(Token.QMARK, Node.newString("foo"));
  StaticScope<JSType> empty = new EmptyScope();

  JSType type = lazyExprRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertFalse(type.isResolved());
  assertTrue(type.forceResolve(reporter, empty).isResolved());
  assertEquals("Expected warnings", 1, reporter.warnings().size());
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:16,代码来源:JSTypeRegistryTest.java

示例4: testAllTypeResolvesImmediately

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
public void testAllTypeResolvesImmediately() {
  JSTypeRegistry lazyExprRegistry = new JSTypeRegistry(
      new SimpleErrorReporter());
  lazyExprRegistry.setResolveMode(ResolveMode.LAZY_EXPRESSIONS);

  Node expr = new Node(Token.STAR);
  JSType type = lazyExprRegistry.createFromTypeNodes(
      expr, "source.js", new EmptyScope());
  assertTrue(type instanceof AllType);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:11,代码来源:JSTypeRegistryTest.java

示例5: testTypeResolutionModes

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
public void testTypeResolutionModes() {
  SimpleErrorReporter reporter = new SimpleErrorReporter();

  JSTypeRegistry lazyExprRegistry = new JSTypeRegistry(reporter);
  lazyExprRegistry.setResolveMode(ResolveMode.LAZY_EXPRESSIONS);

  JSTypeRegistry lazyNameRegistry = new JSTypeRegistry(reporter);
  lazyNameRegistry.setResolveMode(ResolveMode.LAZY_NAMES);

  JSTypeRegistry immediateRegistry = new JSTypeRegistry(reporter);
  immediateRegistry.setResolveMode(ResolveMode.IMMEDIATE);

  Node expr = new Node(Token.QMARK, Node.newString("foo"));
  StaticScope<JSType> empty = MapBasedScope.emptyScope();

  JSType type = lazyExprRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertTrue(type instanceof UnresolvedTypeExpression);
  assertTrue(type.isUnknownType());
  assertEquals("?", type.toString());
  assertNull("Unexpected warnings: " + reporter.warnings(),
      reporter.warnings());

  type = lazyNameRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertTrue(type instanceof UnionType);
  assertTrue(type.isUnknownType());
  assertEquals("(foo|null)", type.toString());
  assertNull("Unexpected warnings: " + reporter.warnings(),
      reporter.warnings());

  type = immediateRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertTrue(type instanceof UnknownType);
  assertEquals("Expected warnings", 1, reporter.warnings().size());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:37,代码来源:JSTypeRegistryTest.java

示例6: testForceResolve

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
public void testForceResolve() {
  SimpleErrorReporter reporter = new SimpleErrorReporter();

  JSTypeRegistry lazyExprRegistry = new JSTypeRegistry(reporter);
  lazyExprRegistry.setResolveMode(ResolveMode.LAZY_EXPRESSIONS);

  Node expr = new Node(Token.QMARK, Node.newString("foo"));
  StaticScope<JSType> empty = MapBasedScope.emptyScope();

  JSType type = lazyExprRegistry.createFromTypeNodes(
      expr, "source.js", empty);
  assertFalse(type.isResolved());
  assertTrue(type.forceResolve(reporter, empty).isResolved());
  assertEquals("Expected warnings", 1, reporter.warnings().size());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:JSTypeRegistryTest.java

示例7: testAllTypeResolvesImmediately

import com.google.javascript.rhino.jstype.JSTypeRegistry.ResolveMode; //导入依赖的package包/类
public void testAllTypeResolvesImmediately() {
  JSTypeRegistry lazyExprRegistry = new JSTypeRegistry(
      new SimpleErrorReporter());
  lazyExprRegistry.setResolveMode(ResolveMode.LAZY_EXPRESSIONS);

  Node expr = new Node(Token.STAR);
  JSType type = lazyExprRegistry.createFromTypeNodes(
      expr, "source.js", MapBasedScope.emptyScope());
  assertTrue(type instanceof AllType);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:JSTypeRegistryTest.java


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