Skip to content

chore: hygiene round 7 — delete dead Intl stubs + orphaned call helpers, dedup singleton populate#1272

Merged
nickna merged 2 commits into
mainfrom
worktree-hygiene-r7
Jul 11, 2026
Merged

chore: hygiene round 7 — delete dead Intl stubs + orphaned call helpers, dedup singleton populate#1272
nickna merged 2 commits into
mainfrom
worktree-hygiene-r7

Conversation

@nickna

@nickna nickna commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Round 7 of the dead-code/duplication hygiene series (follows #1265#1271). Net −604 lines, no behavior change.

Dead code removed (verified: zero call sites AND zero name-string references, including the binary-flagged TSRegExp.cs)

  • Intl instance-method stub cluster (~330 lines): the 20 non-Create Intl EmittedRuntime holders, their EmitReflectionHelper assignments, and the now-unreachable RuntimeTypes.Intl.cs instance-method statics. Compiled Intl instance calls (nf.format(x) etc.) dispatch reflectively on the SharpTSIntl* objects returned by the kept CreateIntl* factories — the stubs were assigned but never read. FormatDateToLocale also kept (live via RuntimeEmitter.Date.cs:115).
  • 16 orphaned protected helpers in ExpressionEmitterBase.CallHelpers.cs (~260 lines): stranded by the CallHandlerRegistry unification (b0e4ffe, 2026-04). The live implementations are private statics in TimersPrimitiveEmitter/TimersPromisesPrimitiveEmitter/TimerHandler and the registry handlers; the base-class copies had zero callers.
  • GuestErrorEmitter.ThrowReferenceError (zero callers, added speculatively in refactor(compile): single-source the guest-error raise idiom (159 sites, −407 lines) #1271). ThrowSyntaxError was also flagged dead by grep but is keptRuntimeEmitter.TSRegExp.cs is binary-flagged (grep-invisible) and calls it at 3 sites; the compiler caught it.

Duplication removed

  • EmitBuiltinSingletonPopulate (Math/JSON value-form populate) carried a local InstallNonEnumerable closure + inline idempotency guard byte-identical to the shared EmitInstallNonEnumerable/EmitPrototypePopulateGuard; now routed through them. This closes the last true inline duplicate of the non-enumerable PDS install idiom — remaining CompiledPropertyDescriptorCtor sites are legitimately different variants.

Verification

  • Full unit suite: 15452 passed / 0 failed / 0 skipped
  • Solution build: 0 warnings
  • Compiled Intl smoke (all 8 constructors + format/formatToParts/resolvedOptions/compare/select/of/segment): passes; SharpTS.dll soft-dependency co-location still triggers ("required at runtime by: Intl")
  • Compiled Math/JSON singleton smoke (value-form dispatch, m.max === Math.max identity, Object.keys(Math).length === 0 non-enumerability): passes
  • --verify IL verification: passes

nickna added 2 commits July 11, 2026 14:56
…lpers

- Remove the 20 non-Create Intl EmittedRuntime holders, their
  EmitReflectionHelper assignments, and the now-unreachable
  RuntimeTypes.Intl.cs instance-method statics. Compiled Intl instance
  calls dispatch reflectively on the SharpTSIntl* objects returned by
  the (kept) CreateIntl* factories; the stubs were never read or
  name-referenced. Verified with a compiled smoke covering
  format/formatToParts/resolvedOptions/compare/select/of/segment.
- Delete 16 orphaned protected helpers in
  ExpressionEmitterBase.CallHelpers.cs stranded by the
  CallHandlerRegistry unification (b0e4ffe): EmitGlobalParseInt/
  ParseFloat/IsNaN/IsFinite, EmitSet/ClearTimeout, EmitSet/ClearInterval,
  EmitQueueMicrotask, EmitTimerArgsArray, EmitSymbolCall, EmitBigIntCall,
  EmitErrorCall, EmitSuperConstructorCall, EmitAsyncFunctionCall,
  TryEmitProcessStreamCall. Live equivalents are private statics in
  TimersPrimitiveEmitter/TimerHandler and the registry handlers.
- Drop GuestErrorEmitter.ThrowReferenceError (zero callers).
  ThrowSyntaxError stays: RuntimeEmitter.TSRegExp.cs (binary-flagged,
  invisible to grep) calls it at three sites — the build caught it.
…S helpers

EmitBuiltinSingletonPopulate carried a local InstallNonEnumerable
closure and an inline idempotency guard that were byte-for-byte copies
of EmitInstallNonEnumerable / EmitPrototypePopulateGuard in
RuntimeEmitter.PrototypePopulateShared.cs. Route through the shared
helpers; emitted IL is unchanged (verified with --verify plus a
compiled smoke checking value-form Math/JSON dispatch, wrapper
identity, and Object.keys non-enumerability).
@nickna
nickna merged commit 6c7a794 into main Jul 11, 2026
2 checks passed
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