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