Skip to content

Legacy rewriter blocks enum-prefixed names that aren't enum members #27

Open

Description

@Zanzavar

Follow-up from #24.

rewriteLegacyVariableReferences blocks any dotted legacy global whose first segment is an enum name, even when the rest isn't a member of that enum.

Repro (TS, at 8a0c46c): enum QuestStatus { Inactive, Active }, a legacy global named QuestStatus.Done, and code show(QuestStatus.Done), rewritten to renamed.

  • Actual: code unchanged, blockedVariableIds: ["legacy"]
  • Expected: show(renamed), nothing blocked

The check at TypeScript/src/LegacyVariableReferenceRewriter.ts:411 only tests namespaces.has(scope). It errs on the safe side: real member references like QuestStatus.Active must stay blocked, and they are. Checking the actual member names for enum-prefixed candidates, or probing with parsesAsArcscript and the declarations context, would block only real member references.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions