refactor(ffi-linkage): Phase 7.2 — migrate 13xx ffi-objc examples #foreign→extern

18 obj-c examples migrated (1308/1311-1317/1319/1320/1321/1341-1347): import
runtime classes '#foreign #objc_class("X") {' → '#objc_class("X") extern {'
(prefix→postfix) + fn/comment '#foreign'→'extern'. No 13xx snapshot asserts on
'foreign' text → all behavior-preserving; empty snapshot diff, corpus-validated.

Per the keep-list policy: KEPT identity-#foreign tests 1306/1318 (filename
ffi-*-foreign*); LEFT comment-only #foreign in the extern/export test files
1332/1348/1349 (no decls). Bare defined #objc_class examples (no #foreign) untouched
— not a purge target. Suite green (647 corpus / 444 unit, 0 failed).
This commit is contained in:
agra
2026-06-15 06:53:33 +03:00
parent 496390e442
commit a68f7c2e64
18 changed files with 21 additions and 21 deletions

View File

@@ -16,7 +16,7 @@
#import "modules/ffi/objc.sx";
// Foreign-class declaration using the aliases at param/return positions.
NSObjectAlias :: #foreign #objc_class("NSObject") {
NSObjectAlias :: #objc_class("NSObject") extern {
alloc :: () -> *Self;
init :: (self: *Self) -> *Self;
isKindOfClass :: (self: *Self, cls: Class) -> BOOL;

View File

@@ -20,7 +20,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void extern objc;
SxFoo :: #objc_class("SxFoo") {
counter: i32;

View File

@@ -15,7 +15,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void extern objc;
SxFoo :: #objc_class("SxFoo") {
counter: i32;

View File

@@ -18,7 +18,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void extern objc;
SxFoo :: #objc_class("SxFoo") {
counter: i32;

View File

@@ -16,8 +16,8 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void extern objc;
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void extern objc;
SxFoo :: #objc_class("SxFoo") {
counter: i32;

View File

@@ -14,7 +14,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
NSObjectFwd :: #foreign #objc_class("NSObject") {
NSObjectFwd :: #objc_class("NSObject") extern {
alloc :: () -> *NSObjectFwd;
init :: (self: *NSObjectFwd) -> *NSObjectFwd;
}

View File

@@ -16,7 +16,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
class_getClassMethod :: (cls: *void, sel: *void) -> *void #foreign objc;
class_getClassMethod :: (cls: *void, sel: *void) -> *void extern objc;
SxFoo :: #objc_class("SxFoo") {
counter: i32;

View File

@@ -14,7 +14,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
NSObject :: #foreign #objc_class("NSObject") {
NSObject :: #objc_class("NSObject") extern {
alloc :: () -> *NSObject;
init :: (self: *NSObject) -> *NSObject;
}

View File

@@ -21,7 +21,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
class_getInstanceMethod :: (cls: *void, sel: *void) -> *void #foreign objc;
class_getInstanceMethod :: (cls: *void, sel: *void) -> *void extern objc;
SxBox :: #objc_class("SxBox") {
width: i32 #property;

View File

@@ -12,7 +12,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
NSObjectBase :: #foreign #objc_class("NSObject") {
NSObjectBase :: #objc_class("NSObject") extern {
alloc :: () -> *NSObjectBase;
init :: (self: *NSObjectBase) -> *NSObjectBase;
hash :: (self: *NSObjectBase) -> u64;

View File

@@ -3,7 +3,7 @@
// call site, not get truncated to i8 by the enclosing function's
// BOOL return type. Regression locks in the
// `resolveCallParamTypes` fix that threads foreign-class method
// param types correctly even when the receiver is a `#foreign
// param types correctly even when the receiver is a `extern
// #objc_class` alias. Every probe round-trips the receiver pointer
// — a regression would read only the low byte and the observer
// pointer would appear as e.g. 0xC0 / 0x20 instead of its real
@@ -17,7 +17,7 @@ g_observer : *void = null;
// Stand-in for NSNotificationCenter — we just need a foreign-class
// method with several *void args so the call site's arg-target-type
// resolution exercises the same path as uikit.sx's keyboard observer.
SxIssue44Bus :: #foreign #objc_class("NSNotificationCenter") {
SxIssue44Bus :: #objc_class("NSNotificationCenter") extern {
defaultCenter :: () -> *SxIssue44Bus;
addObserver_selector_name_object :: (self: *Self, observer: *void, sel: *void, name: *void, obj: *void);
}

View File

@@ -16,7 +16,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
SxProbeNiladic :: #foreign #objc_class("SxProbeNiladic") {
SxProbeNiladic :: #objc_class("SxProbeNiladic") extern {
length :: (self: *Self) -> i32;
}

View File

@@ -8,7 +8,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
SxProbeOneArg :: #foreign #objc_class("SxProbeOneArg") {
SxProbeOneArg :: #objc_class("SxProbeOneArg") extern {
addObject :: (self: *Self, val: i32) -> i32;
}

View File

@@ -7,7 +7,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
SxProbeMultiKeyword :: #foreign #objc_class("SxProbeMultiKeyword") {
SxProbeMultiKeyword :: #objc_class("SxProbeMultiKeyword") extern {
combine_and :: (self: *Self, a: i32, b: i32) -> i32;
}

View File

@@ -8,7 +8,7 @@
#import "modules/std.sx";
#import "modules/build.sx";
SxProbeMismatch :: #foreign #objc_class("SxProbeMismatch") {
SxProbeMismatch :: #objc_class("SxProbeMismatch") extern {
something_extra :: (self: *Self, x: i32) -> i32;
}

View File

@@ -15,7 +15,7 @@
#import "modules/std.sx";
#import "modules/build.sx";
NSObject :: #foreign #objc_class("NSObject") {
NSObject :: #objc_class("NSObject") extern {
// `+(Class)class` — niladic, name verbatim, selector = "class".
// Returns the class object itself. No `self: *Self` first param ⇒
// class method (sx parser keys on the param TYPE).

View File

@@ -13,7 +13,7 @@
#import "modules/std.sx";
#import "modules/build.sx";
NSObject :: #foreign #objc_class("NSObject") {
NSObject :: #objc_class("NSObject") extern {
// Default mangling would yield selector "gimme" — NSObject has no
// such IMP. The override pins it to the real selector
// "description". Static method (no `self: *Self` first param).
@@ -25,7 +25,7 @@ NSObject :: #foreign #objc_class("NSObject") {
// only on this side — main only invokes the static path because we
// don't have a real NSDictionary in scope, but the declaration locks
// in the parser + AST + lowering wiring for the multi-arg shape.
NSDictionary :: #foreign #objc_class("NSDictionary") {
NSDictionary :: #objc_class("NSDictionary") extern {
lookup :: (self: *Self, key: *void) -> *void #selector("objectForKey:");
}

View File

@@ -17,7 +17,7 @@
#import "modules/build.sx";
#import "modules/ffi/objc.sx";
SxManglingProbe :: #foreign #objc_class("SxManglingProbe") {
SxManglingProbe :: #objc_class("SxManglingProbe") extern {
length :: (self: *Self) -> i32;
addObject :: (self: *Self, a: i32) -> i32;
combine_and :: (self: *Self, a: i32, b: i32) -> i32;