Skip to content

chore: remove dead namespace-scope _attributedString#48

Draft
haileyok wants to merge 1 commit into
mainfrom
worktree-cleanup-dead-attributedstring-global
Draft

chore: remove dead namespace-scope _attributedString#48
haileyok wants to merge 1 commit into
mainfrom
worktree-cleanup-dead-attributedstring-global

Conversation

@haileyok
Copy link
Copy Markdown
Member

@haileyok haileyok commented May 9, 2026

Summary

Drive-by cleanup spotted while working on #21.

RNUITextViewShadowNode.h declares a mutable AttributedString _attributedString member. RNUITextViewShadowNode.cpp:15 also defined an AttributedString _attributedString = AttributedString{}; at namespace scope. In C++, unqualified name lookup inside a member function searches class scope before enclosing namespace scope, so every reference to _attributedString in measureContent and layout already binds to the member — the namespace-scope variable is shadowed, never read, never written.

Today this is harmless dead code. The reason to delete it: if anyone ever removes the member from the header thinking it's redundant with the cpp definition, name lookup silently falls through to the global and every shadow node instance will start trampling the others' state. Removing the global makes the intent obvious and defuses the footgun.

No behavior change. The member-resolution semantics are unchanged.

Test plan

  • pod install and build the example app succeeds.
  • Existing rendering / measurement / onTextLayout behavior unchanged in the example app.

🤖 Generated with Claude Code

The class declares a mutable _attributedString member, which shadows
this namespace-scope variable in unqualified name lookup, so the
namespace variable is never read or written. Deleting it removes the
footgun: if the member were ever removed from the header, lookup would
silently fall through to a single shared global and every shadow node
instance would trample the others' state.
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.

1 participant