refactor(ffi-linkage): Phase 9.3 — purge 'foreign' from comments (src caps + examples + docs)
src/: ~21 capital-Foreign comments the case-sensitive verify grep missed (Foreign-class→Runtime-class, Foreign path→Runtime path, Foreign decls→Extern decls, FOREIGN function→extern function) across calls/inst/ffi_objc/jni_descriptor/emit_llvm/ c_import/lower.*/ops. src 'foreign' now = ONLY the hash_foreign token + 4 rejection messages (9.0-delete targets). examples/*.sx comments → extern/runtime-class (1219 stdout regen; KEPT 1176). docs/inline-asm-design + debugger purged. Comments only — no build impact. 9.0 ratified: DELETE hash_foreign token next.
This commit is contained in:
@@ -722,7 +722,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
switch (self.namespaceAliasVerdict(oname)) {
|
||||
.target => |target| {
|
||||
const fd = Lowering.namespaceFnMember(&target, fa.field) orelse break :gate;
|
||||
// Foreign / builtin / #compiler bodies keep their
|
||||
// Extern / builtin / #compiler bodies keep their
|
||||
// literal global symbol — the existing bare-name
|
||||
// machinery below resolves them.
|
||||
switch (fd.body.data) {
|
||||
@@ -891,7 +891,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
method_args.append(self.alloc, a) catch unreachable;
|
||||
}
|
||||
|
||||
// Foreign-class DSL: `inst.method(args)` where `inst`'s
|
||||
// Runtime-class DSL: `inst.method(args)` where `inst`'s
|
||||
// type is an alias declared by `#jni_class("...") { ... }`
|
||||
// (or its parallel forms). Routes to the JNI dispatch
|
||||
// shape, descriptor derived from the sx signature.
|
||||
@@ -2236,7 +2236,7 @@ pub fn resolveCallParamTypes(self: *Lowering, c: *const ast.Call, sel_author: ?*
|
||||
}
|
||||
}
|
||||
if (self.getStructTypeName(obj_ty)) |sname| {
|
||||
// Foreign-class receiver (`#objc_class` / `#jni_class` / etc.):
|
||||
// Runtime-class receiver (`#objc_class` / `#jni_class` / etc.):
|
||||
// resolve the method from `runtime_class_map` walking `#extends`.
|
||||
// Without this path, `target_type` for each arg falls back to
|
||||
// whatever `self.target_type` was on entry — typically the
|
||||
|
||||
@@ -1112,7 +1112,7 @@ pub fn registerTopLevelGlobal(self: *Lowering, vd: *const ast.VarDecl) void {
|
||||
d.addFmt(.err, null, "top-level var '{s}' has no type annotation and no initializer to infer from", .{vd.name});
|
||||
break :blk .void;
|
||||
};
|
||||
// Foreign / extern globals reference a symbol defined in libSystem etc.
|
||||
// Extern globals reference a symbol defined in libSystem etc.
|
||||
// (`_NSConcreteStackBlock : *void extern;` or `… : *void extern;`). The C
|
||||
// symbol name is the optional override (`extern_name`) or the sx name itself.
|
||||
const sym_name = vd.extern_name orelse vd.name;
|
||||
@@ -2081,7 +2081,7 @@ pub fn declareFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8)
|
||||
}
|
||||
}
|
||||
|
||||
// Foreign declarations with a trailing variadic param map to the C
|
||||
// Extern declarations with a trailing variadic param map to the C
|
||||
// calling convention's `...` tail. Drop the variadic param from the
|
||||
// IR signature (it has no C-level slot) and set is_variadic.
|
||||
// Bare `extern` import: an external C symbol declared via the `extern`
|
||||
@@ -2194,7 +2194,7 @@ pub fn registerQualifiedFn(self: *Lowering, ns_name: []const u8, fd: *const ast.
|
||||
// collision assert; registering a qualified alias for them
|
||||
// would divert that machinery and strand a per-call type binding.
|
||||
if (fd.type_params.len > 0 or hasComptimeParams(fd) or isPackFn(fd)) return;
|
||||
// Foreign / builtin / #compiler bodies keep their literal name; a
|
||||
// Extern / builtin / #compiler bodies keep their literal name; a
|
||||
// qualified alias has no distinct symbol to resolve to.
|
||||
switch (fd.body.data) {
|
||||
.builtin_expr, .compiler_expr => return,
|
||||
@@ -2300,7 +2300,7 @@ pub fn lazyLowerFunction(self: *Lowering, name: []const u8) void {
|
||||
}
|
||||
// No AST? (builtins, extern functions, or imported functions not in this file)
|
||||
const fd = self.program_index.fn_ast_map.get(name) orelse return;
|
||||
// Foreign declarations stay as extern stubs but need to be REGISTERED
|
||||
// Extern declarations stay as extern stubs but need to be REGISTERED
|
||||
// in the current module so callers get a real FuncId. Without this,
|
||||
// a comptime-lowered function (e.g. `concat` from std.sx pulled into
|
||||
// a fresh ct_module via `evalComptimeString`) emits `.call` against a
|
||||
|
||||
@@ -778,7 +778,7 @@ pub fn lowerSuperCall(
|
||||
} }, ret_ty);
|
||||
}
|
||||
|
||||
// ── Foreign-class registration ──────────────────────────────────
|
||||
// ── Runtime-class registration ──────────────────────────────────
|
||||
|
||||
/// Register a runtime-class declaration. The alias goes into
|
||||
/// `runtime_class_map` for method-dispatch lookup. The underlying
|
||||
|
||||
@@ -137,8 +137,8 @@ pub fn lookupObjcDefinedStateFieldOnPointer(self: *Lowering, obj_expr: *const as
|
||||
if (pointee_info != .@"struct") return null;
|
||||
const struct_name = self.module.types.getString(pointee_info.@"struct".name);
|
||||
const fcd = self.program_index.runtime_class_map.get(struct_name) orelse return null;
|
||||
// Only sx-defined Obj-C classes have a state struct. Foreign
|
||||
// classes' fields are purely declaration metadata (no state).
|
||||
// Only sx-defined Obj-C classes have a state struct. Extern (referenced)
|
||||
// runtime classes' fields are purely declaration metadata (no state).
|
||||
if (fcd.is_extern or fcd.runtime != .objc_class) return null;
|
||||
// Skip property fields — those dispatch via the M2.2 getter/setter
|
||||
// path. Plain instance fields take the ivar+gep path.
|
||||
|
||||
Reference in New Issue
Block a user