Package com.google.javascript.jscomp
Class CallGraph.Function
- java.lang.Object
-
- com.google.javascript.jscomp.CallGraph.Function
-
- Enclosing class:
- CallGraph
public class CallGraph.Function extends java.lang.ObjectAn inner class that represents functions in the call graph. A Function knows how to get its AST node and what Callsites it contains.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodegetAstNode()Returns the underlying AST node for the function.NodegetBodyNode()Returns the AST node for the body of the function.java.util.Collection<CallGraph.Callsite>getCallsitesInFunction()Returns the callsites in this function.java.util.Collection<CallGraph.Callsite>getCallsitesPossiblyTargetingFunction()Returns a collection of callsites that might call this function.java.lang.StringgetName()Gets the name of this function.booleanisAliased()Returns true if the function is aliased.booleanisExposedToCallOrApply()Returns true if the function is ever exposed to ".call" or ".apply".booleanisMain()Does this function represent the global "main" function?
-
-
-
Method Detail
-
isMain
public boolean isMain()
Does this function represent the global "main" function?
-
getAstNode
public Node getAstNode()
Returns the underlying AST node for the function. This usually has type Token.FUNCTION but in the case of the "main" function will have type Token.BLOCK.
-
getBodyNode
public Node getBodyNode()
Returns the AST node for the body of the function. If this function is the main function, it will return the global block.
-
getName
public java.lang.String getName()
Gets the name of this function. Returns null if the function is anonymous.
-
getCallsitesInFunction
public java.util.Collection<CallGraph.Callsite> getCallsitesInFunction()
Returns the callsites in this function.
-
getCallsitesPossiblyTargetingFunction
public java.util.Collection<CallGraph.Callsite> getCallsitesPossiblyTargetingFunction()
Returns a collection of callsites that might call this function. getCallsitesPossiblyTargetingFunction() is a best effort only: the collection may include callsites that do not actually call this function and if this function is exported or aliased may be missing actual targets. This method should not be called on a Function from a CallGraph that was constructed withcomputeBackwardGraphfalse.
-
isAliased
public boolean isAliased()
Returns true if the function is aliased.
-
isExposedToCallOrApply
public boolean isExposedToCallOrApply()
Returns true if the function is ever exposed to ".call" or ".apply".
-
-