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
Nested ClassesModifier and TypeClassDescriptionprotected static classA control flow edge to be added to the CFG.Nested classes/interfaces inherited from class CAstRewriter
CAstRewriter.CopyKey<Self>, CAstRewriter.Rewrite, CAstRewriter.RewriteContext<K> -
Field Summary
Fields inherited from class CAstRewriter
Ast, DEBUG, recursive, rootContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntity(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 CAstControlFlowMapcopyFlow(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.voiddeleteFlow(CAstNode node, CAstEntity entity) protected voidenterEntity(CAstEntity entity) protected CAstNodeflowOutTo(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 booleanisFlowDeleted(CAstNode node, CAstEntity entity) protected voidrewrite(CAstEntity root) perform the rewrite on aCAstEntity, returning the newCAstEntityas the resultMethods inherited from class 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:
copyChildrenin 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:CAstRewriterinCAstRewriter.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:
flowOutToin classCAstRewriter<NodePos, CAstBasicRewriter.NoKey>
-
copyFlow
protected CAstControlFlowMap copyFlow(Map<Pair<CAstNode, CAstBasicRewriter.NoKey>, CAstNode> nodeMap, CAstControlFlowMap orig, CAstSourcePositionMap newSrc) Description copied from class:CAstRewritercreate 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:
copyFlowin classCAstRewriter<NodePos, CAstBasicRewriter.NoKey>
-
rewrite
Description copied from class:CAstRewriterperform the rewrite on aCAstEntity, returning the newCAstEntityas the result- Overrides:
rewritein classCAstRewriter<NodePos, CAstBasicRewriter.NoKey>
-
enterEntity
-
leaveEntity
protected void leaveEntity()
-