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

@@ -6,6 +6,10 @@ const Type = @import("types.zig").Type;
const errors = @import("errors.zig");
const Diagnostic = errors.Diagnostic;
fn baseName(name: []const u8) []const u8 {
return if (std.mem.lastIndexOfScalar(u8, name, '.')) |idx| name[idx + 1 ..] else name;
}
pub const SymbolKind = enum {
variable,
constant,
@@ -344,7 +348,7 @@ pub const Analyzer = struct {
return sig.return_type;
}
// Built-in: sqrt/sin/cos returns same type as argument
const base = if (std.mem.lastIndexOfScalar(u8, callee_name, '.')) |idx| callee_name[idx + 1 ..] else callee_name;
const base = baseName(callee_name);
if (std.mem.eql(u8, base, "sqrt") or
std.mem.eql(u8, base, "sin") or
std.mem.eql(u8, base, "cos"))