Skip to content

Conversation

@mohammedahmed18
Copy link
Contributor

Summary

  • Skip arrow functions that are object properties (e.g., { foo: () => {} }) when extracting helper functions
  • These are values in object literals, not standalone functions
  • Previously, object property arrow functions were incorrectly extracted as "helper functions", causing invalid floating code in the output

Problem

When a function references dependencies.getSlackChannelId(), the extractor was finding the arrow function property:

let dependencies = {
  getSlackChannelId: () => process.env.SLACK_CHANNEL_ID,
}

And extracting just the property line, resulting in invalid syntax:

  getSlackChannelId: () => process.env.SLACK_CHANNEL_ID,

Fix

Added a check in _walk_tree_for_functions() to skip arrow functions whose parent is a pair node (object property).

Test plan

  • Added test test_with_tricky_helpers with full string assertion
  • All 598 language tests pass

🤖 Generated with Claude Code

@mohammedahmed18 mohammedahmed18 force-pushed the fix/dont-extract-object-properties branch from 5202d54 to 64ffda2 Compare February 2, 2026 19:08
@mohammedahmed18 mohammedahmed18 force-pushed the fix/dont-extract-object-properties branch from 7ed3908 to b2b4cde Compare February 2, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants