Abstract node types should declare fullCopy

Issue #42 resolved
Jesper Öqvist created an issue

Click here to view original trac ticket.

All non-abstract node types override ASTNode.fullCopy(), and thus the following will compile clean:

A newA = getA().fullCopy();

However, for abstract node types it will need a cast, since the return type of fullCopy will be the nearest non-abstract superclass.

I suggest that the following declaration is added to all abstract node types:

public abstract A fullCopy();

Where A is the name of the node type. This would mean that the return type of B.fullCopy() would be B even if B is abstract.

Comments (2)

  1. Log in to comment