sanex3339
2020-03-05 01:25:56 +03:00
parent 3b0c20d69d
commit 39870010e8
12 changed files with 81 additions and 18 deletions
+6
View File
@@ -89,10 +89,16 @@ export class NodeUtils {
* @returns {T}
*/
public static parentizeAst <T extends ESTree.Node = ESTree.Node> (astTree: T): T {
const parentNode: ESTree.Node | null = astTree.parentNode ?? null;
estraverse.replace(astTree, {
enter: NodeUtils.parentizeNode
});
if (parentNode) {
astTree.parentNode = parentNode;
}
return astTree;
}