private class GlobalTypeInfo.ProcessScope extends NodeTraversal.AbstractShallowCallback
Modifier and Type | Field and Description |
---|---|
private NTIScope |
currentScope |
private java.util.Set<Node> |
lendsObjlits |
Constructor and Description |
---|
ProcessScope(NTIScope currentScope) |
Modifier and Type | Method and Description |
---|---|
(package private) RawNominalType |
checkValidLendsToPrototypeAndGetClass(QualifiedName lendsQname,
java.lang.String lendsName,
Node objlit) |
private DeclaredFunctionType |
computeFnDeclaredType(JSDocInfo fnDoc,
java.lang.String functionName,
Node declNode,
RawNominalType ownerType,
NTIScope parentScope) |
private DeclaredFunctionType |
computeFnDeclaredTypeFromCallee(Node declNode,
JSType declaredTypeAsJSType) |
(package private) void |
finishProcessingScope() |
private DeclaredFunctionType |
getDeclaredFunctionTypeFromContext(java.lang.String functionName,
Node declNode,
NTIScope parentScope) |
(package private) GlobalTypeInfo.PropertyType |
getPropTypeHelper(JSDocInfo jsdoc,
Node initializer,
RawNominalType thisType) |
private JSType |
inferConstTypeFromRhs(Node constExpr) |
private boolean |
isNamedType(Node getProp) |
private boolean |
isStaticCtorProp(Node getProp,
NTIScope s) |
private void |
mayAddPropToPrototype(RawNominalType rawType,
java.lang.String pname,
Node defSite,
Node initializer)
Called for the usual style of prototype-property definitions,
but also for @lends and for direct assignments of object literals to prototypes.
|
private boolean |
mayAddPropToType(Node getProp,
RawNominalType rawType) |
private RawNominalType |
maybeGetOwnerType(Node funNode,
Node parent) |
private void |
maybeWarnFunctionDeclaration(Node funNode,
DeclaredFunctionType funType) |
private JSType |
mayInferFromRhsIfConst(Node lvalueNode) |
private boolean |
mayWarnAboutExistingProp(RawNominalType classType,
java.lang.String pname,
Node propCreationNode,
JSType typeInJsdoc) |
private void |
mayWarnAboutInterfacePropInit(RawNominalType rawType,
Node initializer) |
(package private) boolean |
mayWarnAboutNoInit(Node constExpr) |
(package private) void |
processLendsNode(Node objlit) |
(package private) void |
processLendsToNamespace(QualifiedName lendsQname,
java.lang.String lendsName,
Node objlit) |
private JSType |
simpleInferCallNewType(Node n) |
private JSType |
simpleInferDeclaration(Declaration decl) |
private JSType |
simpleInferExprType(Node n) |
private FunctionType |
simpleInferFunctionType(Node n) |
private JSType |
simpleInferGetpropType(Node n) |
private boolean |
suppressDupPropWarning(JSDocInfo propCreationJsdoc,
JSType typeInJsdoc,
JSType previousType) |
void |
visit(NodeTraversal t,
Node n,
Node parent)
Visits a node in postorder (after its children have been visited).
|
private void |
visitCall(Node call) |
private void |
visitClassPropertyDeclaration(Node getProp) |
private void |
visitConstructorPropertyDeclaration(Node getProp) |
private NTIScope |
visitFunctionLate(Node fn,
RawNominalType ownerType)
Compute the declared type for a given scope.
|
private void |
visitNamespacePropertyDeclaration(Node getProp) |
private void |
visitNamespacePropertyDeclaration(Node declNode,
Node recv,
java.lang.String pname) |
private void |
visitObjectLit(Node objLitNode,
Node parent) |
private void |
visitOtherPropertyDeclaration(Node getProp) |
private void |
visitPropertyDeclaration(Node getProp) |
private void |
visitPrototypeAssignment(Node getProp) |
private void |
visitPrototypePropertyDeclaration(Node getProp) |
private void |
visitVar(Node nameNode,
Node parent) |
shouldTraverse
private final NTIScope currentScope
private java.util.Set<Node> lendsObjlits
ProcessScope(NTIScope currentScope)
void finishProcessingScope()
void processLendsNode(Node objlit)
void processLendsToNamespace(QualifiedName lendsQname, java.lang.String lendsName, Node objlit)
RawNominalType checkValidLendsToPrototypeAndGetClass(QualifiedName lendsQname, java.lang.String lendsName, Node objlit)
public void visit(NodeTraversal t, Node n, Node parent)
NodeTraversal.Callback
Visits a node in postorder (after its children have been visited).
A node is visited only if all its parents should be traversed
(NodeTraversal.Callback.shouldTraverse(NodeTraversal, Node, Node)
).
Implementations can have side effects (e.g. modifying the parse tree).
private void visitCall(Node call)
private void visitPropertyDeclaration(Node getProp)
private NTIScope visitFunctionLate(Node fn, RawNominalType ownerType)
GlobalTypeInfo.PropertyType getPropTypeHelper(JSDocInfo jsdoc, Node initializer, RawNominalType thisType)
private void visitPrototypePropertyDeclaration(Node getProp)
private void mayWarnAboutInterfacePropInit(RawNominalType rawType, Node initializer)
private void visitPrototypeAssignment(Node getProp)
private void visitConstructorPropertyDeclaration(Node getProp)
private void visitNamespacePropertyDeclaration(Node getProp)
private void visitNamespacePropertyDeclaration(Node declNode, Node recv, java.lang.String pname)
private void visitClassPropertyDeclaration(Node getProp)
private void visitOtherPropertyDeclaration(Node getProp)
boolean mayWarnAboutNoInit(Node constExpr)
private FunctionType simpleInferFunctionType(Node n)
private JSType simpleInferDeclaration(Declaration decl)
private boolean mayAddPropToType(Node getProp, RawNominalType rawType)
private boolean mayWarnAboutExistingProp(RawNominalType classType, java.lang.String pname, Node propCreationNode, JSType typeInJsdoc)
private boolean suppressDupPropWarning(JSDocInfo propCreationJsdoc, JSType typeInJsdoc, JSType previousType)
private DeclaredFunctionType computeFnDeclaredType(JSDocInfo fnDoc, java.lang.String functionName, Node declNode, RawNominalType ownerType, NTIScope parentScope)
private void maybeWarnFunctionDeclaration(Node funNode, DeclaredFunctionType funType)
private DeclaredFunctionType computeFnDeclaredTypeFromCallee(Node declNode, JSType declaredTypeAsJSType)
private DeclaredFunctionType getDeclaredFunctionTypeFromContext(java.lang.String functionName, Node declNode, NTIScope parentScope)
private void mayAddPropToPrototype(RawNominalType rawType, java.lang.String pname, Node defSite, Node initializer)
private RawNominalType maybeGetOwnerType(Node funNode, Node parent)
private boolean isNamedType(Node getProp)