ir done'ish
This commit is contained in:
@@ -800,6 +800,7 @@ pub const Interpreter = struct {
|
||||
const fields = switch (info) {
|
||||
.@"struct" => |s| s.fields,
|
||||
.@"union" => |u| u.fields,
|
||||
.tagged_union => |u| u.fields,
|
||||
else => return error.CannotEvalComptime,
|
||||
};
|
||||
if (idx >= fields.len) return error.OutOfBounds;
|
||||
@@ -821,6 +822,7 @@ pub const Interpreter = struct {
|
||||
const fields = switch (info) {
|
||||
.@"struct" => |s| s.fields,
|
||||
.@"union" => |u| u.fields,
|
||||
.tagged_union => |u| u.fields,
|
||||
else => return error.CannotEvalComptime,
|
||||
};
|
||||
const field_ty_tag: i64 = if (idx < fields.len) @intFromEnum(fields[idx].ty) else 0;
|
||||
@@ -1225,6 +1227,21 @@ pub const Interpreter = struct {
|
||||
const f = val.asFloat() orelse return error.TypeError;
|
||||
return .{ .value = .{ .float = @sqrt(f) } };
|
||||
},
|
||||
.sin => {
|
||||
const val = frame.getRef(bi.args[0]);
|
||||
const f = val.asFloat() orelse return error.TypeError;
|
||||
return .{ .value = .{ .float = @sin(f) } };
|
||||
},
|
||||
.cos => {
|
||||
const val = frame.getRef(bi.args[0]);
|
||||
const f = val.asFloat() orelse return error.TypeError;
|
||||
return .{ .value = .{ .float = @cos(f) } };
|
||||
},
|
||||
.floor => {
|
||||
const val = frame.getRef(bi.args[0]);
|
||||
const f = val.asFloat() orelse return error.TypeError;
|
||||
return .{ .value = .{ .float = @floor(f) } };
|
||||
},
|
||||
.cast, .type_of, .alloc, .dealloc => {
|
||||
return error.CannotEvalComptime;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user