use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testTypeof2.
@Test
public void testTypeof2() {
FlowScope[] blind = newScope();
testBinop(blind, Token.EQ, new Node(Token.TYPEOF, createVar(blind, "a", getNativeAllType())), Node.newString("function"), ImmutableSet.of(new TypedName("a", getNativeFunctionType())), ImmutableSet.of(new TypedName("a", getNativeAllType())));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testTypeof3.
@Test
public void testTypeof3() {
FlowScope[] blind = newScope();
testBinop(blind, Token.EQ, new Node(Token.TYPEOF, createVar(blind, "a", getNativeObjectNumberStringBooleanType())), Node.newString("function"), ImmutableSet.of(new TypedName("a", getNativeFunctionType())), ImmutableSet.of(new TypedName("a", getNativeObjectNumberStringBooleanType())));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class SemanticReverseAbstractInterpreterTest method testTypeof4.
@Test
public void testTypeof4() {
FlowScope[] blind = newScope();
testBinop(blind, Token.EQ, new Node(Token.TYPEOF, createVar(blind, "a", createUnionType(getNativeFunctionType(), getNativeNumberStringBooleanType()))), Node.newString("function"), ImmutableSet.of(new TypedName("a", getNativeFunctionType())), ImmutableSet.of(new TypedName("a", getNativeNumberStringBooleanType())));
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class TypeInference method traverseTaggedTemplateLit.
private FlowScope traverseTaggedTemplateLit(Node tagTempLitNode, FlowScope originalScope) {
checkArgument(tagTempLitNode.isTaggedTemplateLit(), tagTempLitNode);
FlowScope scopeAfterChildren = traverseChildren(tagTempLitNode, originalScope);
// A tagged template literal is really a special kind of function call.
FlowScope scopeAfterExecution = setCallNodeTypeAfterChildrenTraversed(tagTempLitNode, scopeAfterChildren);
if (tagTempLitNode.getJSType() == null) {
tagTempLitNode.setJSType(unknownType);
}
return scopeAfterExecution;
}
use of com.google.javascript.jscomp.type.FlowScope in project closure-compiler by google.
the class TypeInference method traverseCall.
private FlowScope traverseCall(Node callNode, FlowScope originalScope) {
checkArgument(callNode.isCall() || callNode.isOptChainCall(), callNode);
FlowScope scopeAfterChildren = traverseChildren(callNode, originalScope);
FlowScope scopeAfterExecution = setCallNodeTypeAfterChildrenTraversed(callNode, scopeAfterChildren);
// e.g. after `goog.assertString(x);` we can infer `x` is a string.
return tightenTypesAfterAssertions(scopeAfterExecution, callNode);
}
Aggregations