Class PropertyReadExpander
java.lang.Object
com.ibm.wala.cast.tree.rewrite.CAstRewriter<com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>
com.ibm.wala.cast.js.translator.PropertyReadExpander
public class PropertyReadExpander
extends CAstRewriter<com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>
Transforms property reads to make prototype chain operations explicit. Each read is converted to
a do loop that walks up the prototype chain until the property is found or the chain has ended.
-
Nested Class Summary
Nested classes/interfaces inherited from class CAstRewriter
CAstRewriter.CopyKey<Self>, CAstRewriter.RewriteModifier and TypeClassDescriptionstatic interfaceCAstRewriter.CopyKey<Self extends CAstRewriter.CopyKey<Self>>interface to be implemented by keys used for cloning sub-trees during the rewritestatic interfacerepresents a rewritten CAst -
Field Summary
Fields inherited from class CAstRewriter
Ast, DEBUG, recursive, rootContextModifier and TypeFieldDescriptionprotected final CAstprotected static final booleanprotected final booleanfor CAstEntity nodes r s.t.protected final com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CAstNodecopyNodes(CAstNode root, CAstControlFlowMap cfg, com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext context, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap) rewrite the CAst rooted at root under some context, returning the node at the root of the rewritten tree.Methods inherited from class CAstRewriter
copyChildren, copyChildrenArray, copyChildrenArrayAndTargets, copyFlow, copySource, copySubtreesIntoNewNode, copySubtreesIntoNewNode, copyTypes, flowOutTo, rewrite, rewriteModifier and TypeMethodDescriptionprotected Map<CAstNode, Collection<CAstEntity>> copyChildren(CAstNode root, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap, Map<CAstNode, @NonNull Collection<CAstEntity>> children) copyChildrenArray(CAstNode n, CAstControlFlowMap cfg, com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext context, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap) copyChildrenArrayAndTargets(CAstNode n, CAstControlFlowMap cfg, com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext context, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap) protected CAstControlFlowMapcopyFlow(Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, @NonNull 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.protected CAstSourcePositionMapcopySource(Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap, CAstSourcePositionMap orig) protected CAstNodecopySubtreesIntoNewNode(CAstNode n, CAstControlFlowMap cfg, com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext c, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap) protected CAstNodecopySubtreesIntoNewNode(CAstNode n, CAstControlFlowMap cfg, com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext c, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap, Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey> pairKey) protected CAstNodeTypeMapcopyTypes(Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap, CAstNodeTypeMap orig) protected CAstNodeflowOutTo(Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, 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.rewrite(CAstEntity root) perform the rewrite on aCAstEntity, returning the newCAstEntityas the resultrewrite(CAstNode root, CAstControlFlowMap cfg, CAstSourcePositionMap pos, CAstNodeTypeMap types, Map<CAstNode, Collection<CAstEntity>> children, CAstNode[] defaults) rewrite the CAst sub-tree rooted at root
-
Constructor Details
-
PropertyReadExpander
-
-
Method Details
-
copyNodes
protected CAstNode copyNodes(CAstNode root, CAstControlFlowMap cfg, com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext context, Map<Pair<CAstNode, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>, CAstNode> nodeMap) Description copied from class:CAstRewriterrewrite the CAst rooted at root under some context, returning the node at the root of the rewritten tree. mutate nodeMap in the process, indicating how (original node, copy key) pairs are mapped to nodes in the rewritten tree.- Specified by:
copyNodesin classCAstRewriter<com.ibm.wala.cast.js.translator.PropertyReadExpander.RewriteContext, com.ibm.wala.cast.js.translator.PropertyReadExpander.ExpanderKey>
-