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:
agra
2026-06-15 09:01:04 +03:00
parent 3354446412
commit 5c8af6eb73
22 changed files with 205 additions and 205 deletions

View File

@@ -121,7 +121,7 @@ pub const Domain = enum {
generic_struct_head,
type_fn_head,
protocol_head,
foreign_class,
runtime_class,
struct_const,
namespace_member,
ufcs,
@@ -135,7 +135,7 @@ pub fn eligibleKind(domain: Domain, raw: RawDeclRef, field: ?[]const u8) bool {
return switch (domain) {
.bare_type => switch (raw) {
.struct_decl, .enum_decl, .union_decl, .error_set_decl,
.protocol_decl, .foreign_class_decl => true,
.protocol_decl, .runtime_class_decl => true,
else => false,
},
.value_const => raw == .const_decl,
@@ -143,7 +143,7 @@ pub fn eligibleKind(domain: Domain, raw: RawDeclRef, field: ?[]const u8) bool {
.generic_struct_head => if (structDeclOf(raw)) |sd| sd.type_params.len > 0 else false,
.type_fn_head => if (fnDeclOf(raw)) |fd| fd.type_params.len > 0 else false,
.protocol_head => raw == .protocol_decl,
.foreign_class => raw == .foreign_class_decl,
.runtime_class => raw == .runtime_class_decl,
.struct_const => structHasConstMember(raw, field orelse return false),
.namespace_member => true,
.ufcs => fnDeclOf(raw) != null,
@@ -229,9 +229,9 @@ pub fn classifyHeadKind(raw: RawDeclRef, gs: *bool, tf: *bool, pr: *bool) void {
/// True when the bare-type verdict selected a foreign-class author
/// unambiguously. Used by lowering to route to the foreign-class path.
pub fn foreignClassWinsType(set: AuthorSet, verdict: Verdict) bool {
pub fn runtimeClassWinsType(set: AuthorSet, verdict: Verdict) bool {
return switch (verdict) {
.own_wins => if (set.own) |a| std.meta.activeTag(a.raw) == .foreign_class_decl else false,
.own_wins => if (set.own) |a| std.meta.activeTag(a.raw) == .runtime_class_decl else false,
.single => blk: {
var selected: ?RawAuthor = null;
for (set.flat) |a| {
@@ -240,7 +240,7 @@ pub fn foreignClassWinsType(set: AuthorSet, verdict: Verdict) bool {
selected = a;
}
const a = selected orelse break :blk false;
break :blk std.meta.activeTag(a.raw) == .foreign_class_decl;
break :blk std.meta.activeTag(a.raw) == .runtime_class_decl;
},
.ambiguous, .not_visible, .domain_filtered => false,
};