Class CallGraph.Function

  • Enclosing class:
    CallGraph

    public class CallGraph.Function
    extends java.lang.Object
    An inner class that represents functions in the call graph. A Function knows how to get its AST node and what Callsites it contains.
    • 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 with computeBackwardGraph false.
      • 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".