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:
@@ -16,7 +16,7 @@
|
|||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
// Foreign-class declaration using the aliases at param/return positions.
|
// Foreign-class declaration using the aliases at param/return positions.
|
||||||
NSObjectAlias :: #foreign #objc_class("NSObject") {
|
NSObjectAlias :: #objc_class("NSObject") extern {
|
||||||
alloc :: () -> *Self;
|
alloc :: () -> *Self;
|
||||||
init :: (self: *Self) -> *Self;
|
init :: (self: *Self) -> *Self;
|
||||||
isKindOfClass :: (self: *Self, cls: Class) -> BOOL;
|
isKindOfClass :: (self: *Self, cls: Class) -> BOOL;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.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") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: i32;
|
counter: i32;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.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") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: i32;
|
counter: i32;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.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") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: i32;
|
counter: i32;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void extern objc;
|
||||||
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
|
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void extern objc;
|
||||||
|
|
||||||
SxFoo :: #objc_class("SxFoo") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: i32;
|
counter: i32;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
NSObjectFwd :: #foreign #objc_class("NSObject") {
|
NSObjectFwd :: #objc_class("NSObject") extern {
|
||||||
alloc :: () -> *NSObjectFwd;
|
alloc :: () -> *NSObjectFwd;
|
||||||
init :: (self: *NSObjectFwd) -> *NSObjectFwd;
|
init :: (self: *NSObjectFwd) -> *NSObjectFwd;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.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") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: i32;
|
counter: i32;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #objc_class("NSObject") extern {
|
||||||
alloc :: () -> *NSObject;
|
alloc :: () -> *NSObject;
|
||||||
init :: (self: *NSObject) -> *NSObject;
|
init :: (self: *NSObject) -> *NSObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.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") {
|
SxBox :: #objc_class("SxBox") {
|
||||||
width: i32 #property;
|
width: i32 #property;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
NSObjectBase :: #foreign #objc_class("NSObject") {
|
NSObjectBase :: #objc_class("NSObject") extern {
|
||||||
alloc :: () -> *NSObjectBase;
|
alloc :: () -> *NSObjectBase;
|
||||||
init :: (self: *NSObjectBase) -> *NSObjectBase;
|
init :: (self: *NSObjectBase) -> *NSObjectBase;
|
||||||
hash :: (self: *NSObjectBase) -> u64;
|
hash :: (self: *NSObjectBase) -> u64;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// call site, not get truncated to i8 by the enclosing function's
|
// call site, not get truncated to i8 by the enclosing function's
|
||||||
// BOOL return type. Regression locks in the
|
// BOOL return type. Regression locks in the
|
||||||
// `resolveCallParamTypes` fix that threads foreign-class method
|
// `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
|
// #objc_class` alias. Every probe round-trips the receiver pointer
|
||||||
// — a regression would read only the low byte and the observer
|
// — a regression would read only the low byte and the observer
|
||||||
// pointer would appear as e.g. 0xC0 / 0x20 instead of its real
|
// 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
|
// Stand-in for NSNotificationCenter — we just need a foreign-class
|
||||||
// method with several *void args so the call site's arg-target-type
|
// method with several *void args so the call site's arg-target-type
|
||||||
// resolution exercises the same path as uikit.sx's keyboard observer.
|
// resolution exercises the same path as uikit.sx's keyboard observer.
|
||||||
SxIssue44Bus :: #foreign #objc_class("NSNotificationCenter") {
|
SxIssue44Bus :: #objc_class("NSNotificationCenter") extern {
|
||||||
defaultCenter :: () -> *SxIssue44Bus;
|
defaultCenter :: () -> *SxIssue44Bus;
|
||||||
addObserver_selector_name_object :: (self: *Self, observer: *void, sel: *void, name: *void, obj: *void);
|
addObserver_selector_name_object :: (self: *Self, observer: *void, sel: *void, name: *void, obj: *void);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxProbeNiladic :: #foreign #objc_class("SxProbeNiladic") {
|
SxProbeNiladic :: #objc_class("SxProbeNiladic") extern {
|
||||||
length :: (self: *Self) -> i32;
|
length :: (self: *Self) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxProbeOneArg :: #foreign #objc_class("SxProbeOneArg") {
|
SxProbeOneArg :: #objc_class("SxProbeOneArg") extern {
|
||||||
addObject :: (self: *Self, val: i32) -> i32;
|
addObject :: (self: *Self, val: i32) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.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;
|
combine_and :: (self: *Self, a: i32, b: i32) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxProbeMismatch :: #foreign #objc_class("SxProbeMismatch") {
|
SxProbeMismatch :: #objc_class("SxProbeMismatch") extern {
|
||||||
something_extra :: (self: *Self, x: i32) -> i32;
|
something_extra :: (self: *Self, x: i32) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #objc_class("NSObject") extern {
|
||||||
// `+(Class)class` — niladic, name verbatim, selector = "class".
|
// `+(Class)class` — niladic, name verbatim, selector = "class".
|
||||||
// Returns the class object itself. No `self: *Self` first param ⇒
|
// Returns the class object itself. No `self: *Self` first param ⇒
|
||||||
// class method (sx parser keys on the param TYPE).
|
// class method (sx parser keys on the param TYPE).
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #objc_class("NSObject") extern {
|
||||||
// Default mangling would yield selector "gimme" — NSObject has no
|
// Default mangling would yield selector "gimme" — NSObject has no
|
||||||
// such IMP. The override pins it to the real selector
|
// such IMP. The override pins it to the real selector
|
||||||
// "description". Static method (no `self: *Self` first param).
|
// "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
|
// only on this side — main only invokes the static path because we
|
||||||
// don't have a real NSDictionary in scope, but the declaration locks
|
// don't have a real NSDictionary in scope, but the declaration locks
|
||||||
// in the parser + AST + lowering wiring for the multi-arg shape.
|
// 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:");
|
lookup :: (self: *Self, key: *void) -> *void #selector("objectForKey:");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#import "modules/build.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/ffi/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxManglingProbe :: #foreign #objc_class("SxManglingProbe") {
|
SxManglingProbe :: #objc_class("SxManglingProbe") extern {
|
||||||
length :: (self: *Self) -> i32;
|
length :: (self: *Self) -> i32;
|
||||||
addObject :: (self: *Self, a: i32) -> i32;
|
addObject :: (self: *Self, a: i32) -> i32;
|
||||||
combine_and :: (self: *Self, a: i32, b: i32) -> i32;
|
combine_and :: (self: *Self, a: i32, b: i32) -> i32;
|
||||||
|
|||||||
Reference in New Issue
Block a user