diff --git a/src/ast.zig b/src/ast.zig index a9cec29..2e029a5 100644 --- a/src/ast.zig +++ b/src/ast.zig @@ -361,16 +361,10 @@ pub const VarDecl = struct { name_span: Span, type_annotation: ?*Node, value: ?*Node, - is_foreign: bool = false, - foreign_lib: ?[]const u8 = null, - foreign_name: ?[]const u8 = null, /// `extern`-global form `g : T extern [LIB] ["csym"];` — a reference to a - /// global defined elsewhere (external linkage, resolved at link time). The - /// new extern-named surface; distinct from the legacy `#foreign` path above. + /// global defined elsewhere (external linkage, resolved at link time). /// `extern_lib` is the optional source-library reference and `extern_name` - /// the optional symbol-name override (mirroring foreign_lib/foreign_name, so - /// `extern` fully supersedes `#foreign`). Parsed in Phase 0.1; not consumed - /// by the var-decl path until Phase 1.2. + /// the optional symbol-name override. is_extern: bool = false, extern_lib: ?[]const u8 = null, extern_name: ?[]const u8 = null, diff --git a/src/ir/lower/decl.zig b/src/ir/lower/decl.zig index 7ee8327..e1f4225 100644 --- a/src/ir/lower/decl.zig +++ b/src/ir/lower/decl.zig @@ -1114,9 +1114,8 @@ pub fn registerTopLevelGlobal(self: *Lowering, vd: *const ast.VarDecl) void { }; // Foreign / extern globals reference a symbol defined in libSystem etc. // (`_NSConcreteStackBlock : *void #foreign;` or `… : *void extern;`). The C - // symbol name is the optional override (`extern_name`/`foreign_name`) or the - // sx name itself. - const sym_name = vd.extern_name orelse vd.foreign_name orelse vd.name; + // symbol name is the optional override (`extern_name`) or the sx name itself. + const sym_name = vd.extern_name orelse vd.name; const name_id = self.module.types.internString(sym_name); const init_val = self.globalInitValue(vd, var_ty); const gid = self.module.addGlobal(.{ @@ -1124,13 +1123,13 @@ pub fn registerTopLevelGlobal(self: *Lowering, vd: *const ast.VarDecl) void { .ty = var_ty, .init_val = init_val, .is_const = false, - .is_extern = vd.is_foreign or vd.is_extern, + .is_extern = vd.is_extern, }); self.putGlobal(self.current_source_file, vd.name, .{ .id = gid, .ty = var_ty }); } /// Serialize a top-level global's initializer into a static `ConstantValue`. -/// Foreign globals (extern symbol) and value-less declarations carry no +/// Extern globals (external symbol) and value-less declarations carry no /// payload — they default to zero/extern at link, which is correct. An /// identifier initializer that names a module constant is materialized from /// the recorded constant (`K : A : 42; g : A = K;` → 42); a @@ -1138,7 +1137,7 @@ pub fn registerTopLevelGlobal(self: *Lowering, vd: *const ast.VarDecl) void { /// is rejected with a diagnostic rather than silently zero-initialized — a /// global has no run site for a dynamic initializer. pub fn globalInitValue(self: *Lowering, vd: *const ast.VarDecl, var_ty: TypeId) ?inst_mod.ConstantValue { - if (vd.is_foreign or vd.is_extern) return null; + if (vd.is_extern) return null; const v = vd.value orelse return null; return switch (v.data) { .undef_literal => .zeroinit,