gumtree-spoon-ast-diff icon indicating copy to clipboard operation
gumtree-spoon-ast-diff copied to clipboard

[bug] The generated Tree misses information

Open martinezmatias opened this issue 5 years ago • 0 comments

Summary of the problem

The generated tree of a Method invocation (target.call(p1)) misses information: the children of the Invocation are both: the target's node and the parameters (if any). For example, from the previous example, there is a node of type invocation labeled with call with two children: target and p1, both of type var access.

Details:

We can produce incorrect outputs when both target and parameters nodes are modified (updates, insert, etc).

##Real Example (a bit simplified to ease the explanation):

- extension.startsWith(".")
+ startsWith(extension,".")

There, there is not any differences: both trees are equivalent: a node startsWith with two children: first extension, second ".".

Proposed Solution:

As we have done in other situations (e.g., method modifiers), we can consider to add new Virtual nodes. In this case, we can add a new virtual node as new parent of target node, and a second one as parent of all the parameters. Thus, a method invocation would have always only two virtual children.

martinezmatias avatar May 25 '20 06:05 martinezmatias