Skip to content

Commit

Permalink
Only do the top level
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Sep 18, 2024
1 parent b940450 commit c913502
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/graphile-export/src/optimize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ export const optimize = (inAst: t.File, runs = 1): t.File => {
const scope = t.isFunctionDeclaration(path.node)
? path.scope.parent
: path.scope;
// Only optimize at top level
if (scope !== exitPath.scope) {
return;
}
const binding = scope.bindings[bindingName];
if (!binding) {
return;
Expand Down

0 comments on commit c913502

Please sign in to comment.