Copy location info when copying JS AST subtrees
This is necessary to preserve source information of a function's body after inlining.
This commit is contained in:
@@ -28,8 +28,12 @@ abstract class AbstractNode extends HasMetadata implements JsNode {
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
protected <T extends HasMetadata> T withMetadataFrom(T other) {
|
||||
protected <T extends HasMetadata & JsNode> T withMetadataFrom(T other) {
|
||||
this.copyMetadataFrom(other);
|
||||
Object otherSource = other.getSource();
|
||||
if (otherSource != null) {
|
||||
source(otherSource);
|
||||
}
|
||||
//noinspection unchecked
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user