This commit is contained in:
agra
2026-02-15 11:35:47 +02:00
parent da1a69ade8
commit 476bf0d268
3 changed files with 317 additions and 259 deletions

View File

@@ -3,6 +3,10 @@ const types = @import("types.zig");
const Type = types.Type;
const unescape = @import("unescape.zig");
fn baseName(name: []const u8) []const u8 {
return if (std.mem.lastIndexOfScalar(u8, name, '.')) |idx| name[idx + 1 ..] else name;
}
/// Runtime value for comptime evaluation.
/// Replaces codegen's JitResult with richer type support.
pub const Value = union(enum) {
@@ -651,7 +655,7 @@ pub const Compiler = struct {
if (callee_name) |name| {
// Check if it's a builtin
const base = if (std.mem.lastIndexOfScalar(u8, name, '.')) |idx| name[idx + 1 ..] else name;
const base = baseName(name);
if (std.meta.stringToEnum(BuiltinId, base)) |id| {
try self.emit(.{ .call_builtin = .{ .id = id, .arg_count = @intCast(call_node.args.len) } });
} else {