Class CallGraph2JSON
java.lang.Object
com.ibm.wala.cast.js.util.CallGraph2JSON
Utility class to serialize call graphs as JSON objects.
The serialised objects have the form
{
"<callsite1>": [ "<callee1>", "<callee2>", ... ],
"<callsite2>": ...
}
where both call sites and callees are encoded as strings of the form
"<filename>@<lineno>:<beginoff>-<endoff>"Here,
filename is the name of the containing JavaScript file (not including its
directory), and lineno, beginoff and endoff encode the source position of
the call expression (for call sites) or the function declaration/expression (for callees) inside
the file in terms of its starting line, its starting offset (in characters from the beginning of
the file), and its end offset.- Author:
- mschaefer
-
Constructor Summary
ConstructorsConstructorDescriptionCallGraph2JSON(boolean ignoreHarness) CallGraph2JSON(boolean ignoreHarness, boolean exposeContexts) -
Method Summary
Modifier and TypeMethodDescriptionExtract the edges of the given callgraph as a map over strings that is easy to serialize.voidserializeCallSite(CGNode nd, CallSiteReference callsite, Set<CGNode> targets, Map<String, Set<String>> edges) static StringConverts a call graph map produced byextractEdges(CallGraph)to JSON, eliding call sites with no targets.
-
Constructor Details
-
CallGraph2JSON
public CallGraph2JSON() -
CallGraph2JSON
public CallGraph2JSON(boolean ignoreHarness) -
CallGraph2JSON
public CallGraph2JSON(boolean ignoreHarness, boolean exposeContexts)
-
-
Method Details
-
serialize
-
extractEdges
Extract the edges of the given callgraph as a map over strings that is easy to serialize. The map keys are locations of methods. The map values are themselves maps, from call site locations within a method to the (locations of) potential target methods for the call sites. -
serializeCallSite
-
toJSON
-