Skip to content

Refactor ordinary [[Set]] prototype-chain walking into a shared runtime helper #453

Description

@dowdiness

Follow-up from PR #449.

Problem

PR #449 reduced duplication between Map/Set string and symbol prototype walks, but ordinary [[Set]] prototype-chain traversal remains distributed across several object-family paths. Object, Array, Map, Set, Promise, TypedArray, and Proxy handling each encode overlapping pieces of descriptor stopping, inherited setter invocation, receiver landing, typed-array stops, Promise prototype fallback, and Proxy delegation.

That makes future correctness fixes in this area easy to apply to one path but miss in another.

Suggested work

  • Inventory the existing ordinary [[Set]] walk implementations and the special cases each one owns.
  • Design a shared runtime helper for descriptor/prototype traversal that can preserve existing family-specific semantics.
  • Migrate callers incrementally with regression coverage for Object, Array, Map, Set, Promise, TypedArray, and Proxy cases.
  • Keep the helper private/internal unless a stable public runtime API is clearly needed.

Acceptance criteria

  • Shared helper covers inherited setter invocation, getter-only and non-writable blockers, writable-data stop behavior, receiver landing, Promise fallback, and Proxy delegation.
  • TypedArray integer-index stop behavior remains covered.
  • Existing Map/Set PR [codex] Fix Map and Set expando assignment #449 regression tests continue to pass.
  • New tests demonstrate at least one shared path for string and symbol keys.
  • No public API surface changes unless explicitly justified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions