ffi 3.2 C2: migrate uikit.sx Notifications + Bundle cluster

Second cluster: NSNotification, NSBundle, NSNotificationCenter move
from `#objc_call(T)(recv, "sel:", args)` to declarative
`#foreign #objc_class("Cls") { ... }` blocks.

Classes declared (alongside the C1 Foundation utility group):

- NSNotification        → userInfo (instance, returns *NSDictionary)
- NSBundle              → mainBundle (class), resourcePath (instance)
- NSNotificationCenter  → defaultCenter (class),
                          addObserver_selector_name_object (instance)

The 4-keyword `addObserver:selector:name:object:` selector derives
from the underscore-separated sx name via the default mangling rule
— no `#selector` override needed.

Cleanup wins:

- `objc_getClass("NSBundle")` and `objc_getClass("NSNotificationCenter")`
  call sites gone — class slots now populated by emit_llvm's
  `__sx_objc_class_init` constructor.
- `userInfo`'s return type is `*NSDictionary` directly, so the
  previous `*void → *NSDictionary` cast at the keyboard-frame
  callsite collapses.

166/166 tests; chess builds clean on macOS + iOS + Android via
`sx build main.sx`.
This commit is contained in:
agra
2026-05-25 17:12:33 +03:00
parent 1ea9cda12b
commit 17775b27a4
2 changed files with 31 additions and 10 deletions

View File

@@ -553,8 +553,15 @@ foreign-class pointer at the dispatch site. The `objc_getClass(...)`
calls for these classes are gone — the class slot is now populated
by emit_llvm's `__sx_objc_class_init` constructor (Phase 3.1).
Phase 3.2 C2 landed: notifications + bundle cluster migrated.
NSNotification (`userInfo`), NSBundle (`mainBundle`, `resourcePath`),
NSNotificationCenter (`defaultCenter`, `addObserver_selector_name_object`)
declared as `#foreign #objc_class` blocks. The 4-keyword
`addObserver:selector:name:object:` selector derives cleanly from
the underscore-separated sx name (`addObserver_selector_name_object`).
Open work:
- **Phase 3 step 3.2 — C2..C5** — uikit.sx migration, one cluster
- **Phase 3 step 3.2 — C3..C5** — uikit.sx migration, one cluster
per commit, chess regression after each.
test for the default-mangling table. Escape hatch for selectors
that don't fit the underscore-split rule (e.g. `tableView_