- objc.sx, objc_block.sx (from std/) + sdl3/opengl/raylib/stb/stb_truetype/ wasm vendor bindings (from modules/ root) -> modules/ffi/ - std/uikit.sx deleted: platform/uikit.sx already declares UIApplicationMain and imports objc; '#framework "UIKit"' cannot live in a file imported on macOS targets (unconditional link directive, UIKit is iOS-only), so the three iOS-only examples carry the 3-line glue inline. 1607/1608/1616 also un-rotted (dead ns_string -> 'xx "..."' Into conversions, callconv(.c) msgSend fn-ptrs) — all three build for ios-sim/ios again. - math/math.sx -> math/scalar.sx; one spelling '#import "modules/math"' everywhere (4 pinned IR snapshots regenerated: dir import adds Vec2/Mat4 to the type tables). - compiler.sx -> build.sx (imports, CLAUDE.md bundling table, specs.md). - testpkg/ + test_c.sx -> tests/fixtures/ (resolve CWD-relative from repo root, same as vendors/). - library-internal imports use full modules/... paths (std.sx tail, platform/bundle.sx, fixtures).
43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
// M1.2 A.2c / A.3 — instance-method body lowering on sx-defined
|
|
// `#objc_class`.
|
|
//
|
|
// The Obj-C runtime invokes class methods via the IMP pointers
|
|
// wired up in M1.2 A.4. No sx-side call path drives lazy lowering,
|
|
// so the eager pass `lowerObjcDefinedClassMethods` walks the
|
|
// `objc_defined_class_cache` and force-lowers every bodied method
|
|
// after Pass 1 finishes.
|
|
//
|
|
// `*Self` substitution (A.2b) routes the param's pointee type to
|
|
// the hidden state-struct `__<ClassName>State`. `self.counter`
|
|
// then resolves as a plain struct field access — A.3's "free if
|
|
// types align". The IR snapshot pins the round-trip:
|
|
//
|
|
// define internal void @SxFoo.bump(ptr __sx_ctx, ptr self) {
|
|
// %gep = getelementptr inbounds { i32 }, ptr %self, 0, 0
|
|
// %v = load i32, ptr %gep
|
|
// %inc = add i32 %v, 1
|
|
// store i32 %inc, ptr %gep
|
|
// ret void
|
|
// }
|
|
//
|
|
// IMP-trampoline emission (the C-ABI shim that the Obj-C runtime
|
|
// calls and that reads the `__sx_state` ivar) lands separately
|
|
// in M1.2 A.4 alongside class-pair init. Runtime dispatch
|
|
// (M1.2 A.7) stays gated until then.
|
|
|
|
#import "modules/std.sx";
|
|
#import "modules/build.sx";
|
|
|
|
SxFoo :: #objc_class("SxFoo") {
|
|
counter: s32;
|
|
|
|
bump :: (self: *Self) {
|
|
self.counter += 1;
|
|
}
|
|
}
|
|
|
|
main :: () -> s32 {
|
|
print("compiled\n");
|
|
0
|
|
}
|