ios + ir cleanup

- ios: --target ios/ios-sim shorthands, iOS SDK auto-discovery,
  #framework directive + BuildOptions.add_framework hook,
  .app bundle + Info.plist + codesign (ad-hoc and real),
  --codesign-identity/--provisioning-profile/--entitlements flags,
  modules/std/{objc,uikit}.sx, dynamic class registration,
  typed objc_msgSend cast pattern, UIApplicationMain handoff,
  UIWindow scene attach. Runs on iPhone hardware.
- ir: silent .s64 defaults → loud diagnostics,
  resolveReturnType infers from body, sub-byte int sizes match LLVM,
  tuple type interning includes names, compile errors exit 1
- issue-NNNN convention: resolved bugs rename to focused features
- 50 regression tests passing
This commit is contained in:
agra
2026-05-17 13:19:08 +03:00
parent 69934592d8
commit 1c32d54e01
57 changed files with 978 additions and 106 deletions

View File

@@ -77,6 +77,19 @@ pub const Parser = struct {
return try self.createNode(start, .{ .comptime_expr = .{ .expr = expr } });
}
// Top-level #framework directive: link against an Apple framework.
if (self.current.tag == .hash_framework) {
self.advance();
if (self.current.tag != .string_literal) {
return self.fail("expected string after '#framework'");
}
const raw = self.tokenSlice(self.current);
const fw_name = raw[1 .. raw.len - 1];
self.advance();
try self.expect(.semicolon);
return try self.createNode(start, .{ .framework_decl = .{ .name = fw_name } });
}
// impl Protocol for Type { methods }
if (self.current.tag == .kw_impl) {
return self.parseImplBlock(start);
@@ -240,15 +253,17 @@ pub const Parser = struct {
return try self.createNode(start_pos, .{ .const_decl = .{ .name = name, .type_annotation = value, .value = bi } });
}
// name :: type_expr #foreign lib ["c_name"]; — foreign with type annotation
// name :: type_expr #foreign [lib] ["c_name"]; — foreign with type annotation
if (self.current.tag == .hash_foreign) {
const fi_start = self.current.loc.start;
self.advance();
// Required: library reference (identifier)
if (self.current.tag != .identifier)
return self.fail("expected library name after '#foreign'");
const lib_ref = self.tokenSlice(self.current);
self.advance();
// Optional: library reference (identifier). Omitted when the symbol
// resolves at link time from a framework or auto-detected library.
var lib_ref: ?[]const u8 = null;
if (self.current.tag == .identifier) {
lib_ref = self.tokenSlice(self.current);
self.advance();
}
// Optional: C symbol name (string literal)
var c_name: ?[]const u8 = null;
if (self.current.tag == .string_literal) {
@@ -1254,10 +1269,12 @@ pub const Parser = struct {
const fi_start = self.current.loc.start;
self.advance();
// Required: library reference (identifier)
if (self.current.tag != .identifier)
return self.fail("expected library name after '#foreign'");
const lib_ref = self.tokenSlice(self.current);
self.advance();
// Optional: library reference (identifier).
var lib_ref: ?[]const u8 = null;
if (self.current.tag == .identifier) {
lib_ref = self.tokenSlice(self.current);
self.advance();
}
// Optional: C symbol name (string literal)
var c_name: ?[]const u8 = null;
if (self.current.tag == .string_literal) {