@samitouri / QOS-React-2 / commits / 6af9c25300

[test] Run Forget only on top level functions

Sathya Gunasekaran committed Jan 14, 2023 at 10:19 UTC 6af9c25300187bc528f88f59e6f771f9337ae7dd
1 file changed +4
compiler/forget/src/__tests__/hir-test.ts
+4
@@ -121,6 +121,10 @@ function transform(text: string, file: string): Array<TestOutput> {
121 traverse(ast, {
122 FunctionDeclaration: {
123 enter(nodePath) {
124 + if (nodePath.scope.getProgramParent() !== nodePath.scope.parent) {
125 + return;
126 + }
127 +
128 const ast = compile(nodePath);
129
130 const text = prettier.format(generate(ast).code.replace("\n\n", "\n"), {