refactor(ffi-linkage): Phase 9.3-src — purge 'foreign' from src/ comments + a user-facing diagnostic
Reword every 'foreign' comment to the extern/runtime-class vocabulary matching the renamed identifiers (foreign call→extern call, foreign class→runtime class, foreign path→runtime path, the #foreign-literal comment mentions → extern, etc.). Also fixes two USER-FACING issues: the 'expected … #foreign … after type annotation' parse error no longer advertises the removed keyword, and the Android 'no #jni_main' help diagnostic now shows '#jni_class(…) extern' instead of the rejected '#foreign #jni_class'. Removed the now-dead prefix-#foreign-vs-postfix conflict branch in parseRuntimeClassDecl (the caller rejects #foreign before it runs). src/ now contains 'foreign' ONLY in the hash_foreign token machinery + its 4 rejection messages — the deprecation mechanism (kept per the 9.0 recommendation; the message MUST name #foreign to guide migration). Snapshot-neutral; suite green (646 corpus / 444 unit, 0 failed).
This commit is contained in:
@@ -30,7 +30,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
var c = c_in;
|
||||
// A bare reserved-type-name spelling in call position parses as a
|
||||
// `.type_expr` (e.g. `i2(4)`), but if a function of that name is in
|
||||
// scope — a backtick-declared sx fn or a `#import c` foreign fn whose C
|
||||
// scope — a backtick-declared sx fn or a `#import c` extern fn whose C
|
||||
// name collides with a reserved type spelling — it is a CALL to that
|
||||
// function. `TypeName(val)` is not a cast (casts are `cast(T, val)`), so
|
||||
// there is no ambiguity. Rewrite the callee to an identifier so the
|
||||
@@ -38,7 +38,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
// reference that already resolves via scope/globals.
|
||||
//
|
||||
// Scoped to RAW provenance: only a backtick (`is_raw`) or `#import c`
|
||||
// foreign fn declaration may legally carry a reserved-name spelling
|
||||
// extern fn declaration may legally carry a reserved-name spelling
|
||||
// (the decl check rejects every bare reserved-name sx fn). Refusing the
|
||||
// rewrite for a non-raw match keeps a genuine reserved type spelling a
|
||||
// type — belt-and-suspenders should any future path ever reintroduce a
|
||||
@@ -603,7 +603,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref {
|
||||
return self.lowerSuperCall(fa.field, args.items, c.callee.span);
|
||||
}
|
||||
|
||||
// `Alias.method(args)` where Alias is a foreign-class
|
||||
// `Alias.method(args)` where Alias is a runtime-class
|
||||
// identifier and `method` is a `static` member — JNI
|
||||
// dispatch via FindClass + GetStaticMethodID + CallStatic*,
|
||||
// OR (for `new`) via FindClass + GetMethodID("<init>") +
|
||||
@@ -1251,7 +1251,7 @@ pub fn allocViaContext(self: *Lowering, size_ref: Ref, void_ptr_ty: TypeId) Ref
|
||||
} }, void_ptr_ty);
|
||||
}
|
||||
|
||||
/// Emit a call to a foreign-declared function looked up by name.
|
||||
/// Emit a call to a extern-declared function looked up by name.
|
||||
/// Used for the compiler-internal byte-copy in the protocol-erasure
|
||||
/// heap path and the closure env-copy path, both of which need
|
||||
/// libc `memcpy` after the `#builtin` form was dropped.
|
||||
@@ -1285,7 +1285,7 @@ fn protocolHasMethod(proto_info: anytype, name: []const u8) bool {
|
||||
}
|
||||
|
||||
pub fn resolveFuncByName(self: *Lowering, name: []const u8) ?FuncId {
|
||||
// Check foreign name map first (e.g., "c_abs" → "abs")
|
||||
// Check extern name map first (e.g., "c_abs" → "abs")
|
||||
const effective_name = self.extern_name_map.get(name) orelse name;
|
||||
const name_id = self.module.types.internString(effective_name);
|
||||
for (self.module.functions.items, 0..) |func, i| {
|
||||
|
||||
Reference in New Issue
Block a user