dillon1000/react
Commit
Browse files Promote and rename within nested functions
Another title for this PR could be "Yet another reason for HIR-everywhere" ReactiveFunctionVisitor doesn't traverse into HIRFunctions from FunctionExpression and ObjectMethod values. This means that PromoteUsedTemporaries and RenameVariables also weren't traversing into such functions, and those values weren't getting promoted and renamed correctly. This PR updates ReactiveFunctionVisitor with a method that can optionally be invoked to traverse an HIRFunction and call the appropriate visitor methods. PromoteUsedTemporaries and RenameVariables invoke this to ensure they visit all places, even in nested HIRFunctions.
Changed paths8 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PromoteUsedTemporaries.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/RenameVariables.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/visitors.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/deeply-nested-function-expressions-with-params.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/deeply-nested-function-expressions-with-params.js AddedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/nested-function-with-param-as-captured-dep.expect.md ModifiedM compiler/packages/snap/src/SproutTodoFilter.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…