Skip to content

Fix Issue #77: Allow re-adding variable with orphaned getter/setter name#84

Open
SurbhiAgarwal1 wants to merge 1 commit intomit-cml:mainfrom
SurbhiAgarwal1:fix-issue-77
Open

Fix Issue #77: Allow re-adding variable with orphaned getter/setter name#84
SurbhiAgarwal1 wants to merge 1 commit intomit-cml:mainfrom
SurbhiAgarwal1:fix-issue-77

Conversation

@SurbhiAgarwal1
Copy link

Problem

When a variable is removed from a local declaration but its getter/setter still references it, the getter correctly shows an error ("Select a valid item in the drop down"). However, re-adding a variable with the same name was incorrectly blocked because the orphaned getter/setter name was treated as a "capturable" conflict.

Fixes #77

Solution

Modified renameParamWithoutRenamingCapturables in field_lexical_variable.js to filter out orphaned variable references (those not resolving to any valid declaration) from the conflict list. This allows users to restore the original variable name and automatically fix the orphaned references.

Testing

  1. Create a local variable x with a getter using it
  2. Remove the variable x from the declaration (getter shows error)
  3. Re-add a variable named x
  4. Expected: Variable is named x (not x2) and getter is restored

@SurbhiAgarwal1
Copy link
Author

Hi @TannerGabriel!

I've fixed Issue #77 in PR #84 - the variable re-adding problem with orphaned getter/setter references.

Solution - Modified renameParamWithoutRenamingCapturables to filter out orphaned variable references from the conflict list, allowing users to restore the original variable name.

  • Tested and working as expected!

PR: #84

Please review when you have a chance. Thanks!

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.

Cannot define variable with name that is used in getter and setter

1 participant