Class CAstRewriterExt
java.lang.Object
com.ibm.wala.cast.tree.rewrite.CAstRewriter<NodePos,CAstBasicRewriter.NoKey>
com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction.CAstRewriterExt
- Direct Known Subclasses:
ClosureExtractor
Extension of
CAstRewriter
which allows adding or deleting control flow edges, and keeps
track of the current entity.
TODO: This class is an unholy mess. It should be restructured considerably.
- Author:
- mschaefer
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A control flow edge to be added to the CFG.Nested classes/interfaces inherited from class com.ibm.wala.cast.tree.rewrite.CAstRewriter
CAstRewriter.CopyKey<Self extends CAstRewriter.CopyKey<Self>>, CAstRewriter.Rewrite, CAstRewriter.RewriteContext<K extends CAstRewriter.CopyKey<K>>
-
Field Summary
Fields inherited from class com.ibm.wala.cast.tree.rewrite.CAstRewriter
Ast, DEBUG, recursive, rootContext
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntity
(CAstNode anchor, CAstEntity entity) addFlow
(CAstNode node, Object label, CAstNode target, CAstControlFlowMap flow) addNode
(CAstNode node, CAstControlFlowMap flow) protected Map
<CAstNode, Collection<CAstEntity>> copyChildren
(CAstNode root, Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, Map<CAstNode, Collection<CAstEntity>> children) protected CAstControlFlowMap
copyFlow
(Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, CAstControlFlowMap orig, CAstSourcePositionMap newSrc) create a control-flow map for the rewritten tree, given the mapping from (original node, copy key) pairs ot new nodes and the original control-flow map.void
deleteFlow
(CAstNode node, CAstEntity entity) protected void
enterEntity
(CAstEntity entity) protected CAstNode
flowOutTo
(Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, CAstControlFlowMap orig, CAstSourcePositionMap src) inCAstRewriter.copyFlow(Map, CAstControlFlowMap, CAstSourcePositionMap)
, if the source of some original CFG edge is replicated, but we find no replica for the target, what node should be the target of the CFG edge in the rewritten AST? By default, just uses the original target.protected boolean
isFlowDeleted
(CAstNode node, CAstEntity entity) protected void
rewrite
(CAstEntity root) perform the rewrite on aCAstEntity
, returning the newCAstEntity
as the resultMethods inherited from class com.ibm.wala.cast.tree.rewrite.CAstRewriter
copyChildrenArray, copyChildrenArrayAndTargets, copyNodes, copySource, copySubtreesIntoNewNode, copySubtreesIntoNewNode, copyTypes, rewrite
-
Constructor Details
-
CAstRewriterExt
-
-
Method Details
-
addNode
-
addFlow
-
deleteFlow
-
isFlowDeleted
-
getCurrentEntity
-
getEnclosingEntities
-
addEntity
-
copyChildren
protected Map<CAstNode,Collection<CAstEntity>> copyChildren(CAstNode root, Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, Map<CAstNode, Collection<CAstEntity>> children) - Overrides:
copyChildren
in classCAstRewriter<NodePos,
CAstBasicRewriter.NoKey>
-
flowOutTo
protected CAstNode flowOutTo(Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, CAstControlFlowMap orig, CAstSourcePositionMap src) Description copied from class:CAstRewriter
inCAstRewriter.copyFlow(Map, CAstControlFlowMap, CAstSourcePositionMap)
, if the source of some original CFG edge is replicated, but we find no replica for the target, what node should be the target of the CFG edge in the rewritten AST? By default, just uses the original target.- Overrides:
flowOutTo
in classCAstRewriter<NodePos,
CAstBasicRewriter.NoKey>
-
copyFlow
protected CAstControlFlowMap copyFlow(Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, CAstControlFlowMap orig, CAstSourcePositionMap newSrc) Description copied from class:CAstRewriter
create a control-flow map for the rewritten tree, given the mapping from (original node, copy key) pairs ot new nodes and the original control-flow map.- Overrides:
copyFlow
in classCAstRewriter<NodePos,
CAstBasicRewriter.NoKey>
-
rewrite
Description copied from class:CAstRewriter
perform the rewrite on aCAstEntity
, returning the newCAstEntity
as the result- Overrides:
rewrite
in classCAstRewriter<NodePos,
CAstBasicRewriter.NoKey>
-
enterEntity
-
leaveEntity
protected void leaveEntity()
-