You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case where I need the information of the target nodes in the EditScript. However, only the target node text is passed to the Update objects. For example the code at code_diff/__init__.py:L200 is
ifsource_ast.type==target_ast.typeandlen(source_ast.children) ==0andlen(target_ast.children) ==0:
# Both nodes are tokens of the same type # Only an update is requiredreturnEditScript([Update(source_ast, target_ast.text)])
The text was updated successfully, but these errors were encountered:
mohayemin
changed the title
The target node information is not available in edit script
The target node information is not available in update operation
Nov 27, 2023
I am not a fan of referencing the target tree in the edit script. I would prefer if the edit script is only dependent on the tree for which it was computed for.
In addition, finding the subtree which is related to specific operation is not always possible (e.g. what is the related subtree for Move or Delete operations?)
If you are only interested in the update operation, you could compute the edit map (see code_diff/gumtree/init.py#L23 ). Whenever there are two nodes with different labels in the edit map, we would generate an update operation (+ some adjustments of the child nodes).
I have a use case where I need the information of the target nodes in the EditScript. However, only the target node text is passed to the
Update
objects. For example the code atcode_diff/__init__.py:L200
isI suggest that the last line to be replaced with:
The text was updated successfully, but these errors were encountered: