refactor(ffi-linkage): Phase 9.2b — rename runtime-class fns + state → runtime_* / is_reference
The runtime-class object-model identifiers (Decision 5): parse/lower/find/resolve/ register/stamp fns Foreign→Runtime (parseRuntimeClassDecl, lowerRuntimeMethodCall, findRuntimeMethodInChain, resolveRuntimeMethodReturnType, registerRuntimeClassDecl, runtimeClassStructType, runtimeKindForOffset, …); state foreign_class_map→ runtime_class_map, current_foreign_class/_method→current_runtime_*, the foreign_class_decl union variant→runtime_class_decl, foreign_method/static/instance/ class→runtime_*; and the reference-vs-define flag is_foreign→is_reference (+ is_foreign_eff→is_reference_eff) now that it only lives on RuntimeClassDecl. Snapshot-neutral; suite green (646/444). Remaining 9.2: the foreign_path family (coupled .sx hooks: jni_main_foreign_path_at spans build.sx/bundle.sx/compiler_hooks.zig/specs.md) + the extern-ref validators (checkForeignRefs etc. → Extern, linkage not runtime) + bare 'foreign' comments.
This commit is contained in:
@@ -51,8 +51,8 @@ pub const CallPlan = struct {
|
||||
/// type prefix). Distinct from `namespace_fn` precisely because the
|
||||
/// receiver IS prepended (`prepends_receiver`).
|
||||
free_fn_ufcs,
|
||||
foreign_instance,
|
||||
foreign_static,
|
||||
runtime_instance,
|
||||
runtime_static,
|
||||
/// `pkg.fn(args)` — the receiver is a namespace / module prefix, NOT a
|
||||
/// value, so nothing is prepended.
|
||||
namespace_fn,
|
||||
@@ -82,7 +82,7 @@ pub const CallPlan = struct {
|
||||
/// Protocol method, by index in the protocol's method table.
|
||||
protocol_method: u32,
|
||||
/// Foreign-class method (Obj-C / JNI), with its static-ness.
|
||||
foreign_method: struct { name: []const u8, is_static: bool },
|
||||
runtime_method: struct { name: []const u8, is_static: bool },
|
||||
/// Enum / tagged-union type under construction.
|
||||
constructed: TypeId,
|
||||
};
|
||||
@@ -254,13 +254,13 @@ pub const CallResolver = struct {
|
||||
const inner_info = self.l.module.types.get(recv_inner);
|
||||
if (inner_info == .@"struct") {
|
||||
const sn = self.l.module.types.getString(inner_info.@"struct".name);
|
||||
if (self.l.program_index.foreign_class_map.get(sn)) |fcd| {
|
||||
if (self.l.program_index.runtime_class_map.get(sn)) |fcd| {
|
||||
for (fcd.members) |m| switch (m) {
|
||||
.method => |md| if (!md.is_static and std.mem.eql(u8, md.name, cfa.field)) {
|
||||
return .{
|
||||
.kind = .foreign_instance,
|
||||
.return_type = self.l.resolveForeignMethodReturnType(fcd, md),
|
||||
.target = .{ .foreign_method = .{ .name = md.name, .is_static = false } },
|
||||
.kind = .runtime_instance,
|
||||
.return_type = self.l.resolveRuntimeMethodReturnType(fcd, md),
|
||||
.target = .{ .runtime_method = .{ .name = md.name, .is_static = false } },
|
||||
.prepends_receiver = true,
|
||||
};
|
||||
},
|
||||
@@ -396,13 +396,13 @@ pub const CallResolver = struct {
|
||||
};
|
||||
if (type_name) |tn| {
|
||||
// Foreign-class static method: `Alias.static_method(args)`.
|
||||
if (self.l.program_index.foreign_class_map.get(tn)) |fcd| {
|
||||
if (self.l.program_index.runtime_class_map.get(tn)) |fcd| {
|
||||
for (fcd.members) |m| switch (m) {
|
||||
.method => |md| if (md.is_static and std.mem.eql(u8, md.name, cfa.field)) {
|
||||
return .{
|
||||
.kind = .foreign_static,
|
||||
.return_type = self.l.resolveForeignMethodReturnType(fcd, md),
|
||||
.target = .{ .foreign_method = .{ .name = md.name, .is_static = true } },
|
||||
.kind = .runtime_static,
|
||||
.return_type = self.l.resolveRuntimeMethodReturnType(fcd, md),
|
||||
.target = .{ .runtime_method = .{ .name = md.name, .is_static = true } },
|
||||
};
|
||||
},
|
||||
else => {},
|
||||
|
||||
Reference in New Issue
Block a user