mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
builder: implement float options
This commit is contained in:
parent
b090451646
commit
dd7b816d98
@ -509,7 +509,26 @@ pub const Builder = struct {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
.Float => panic("TODO float options to build script", .{}),
|
||||
.Float => switch (entry.value.value) {
|
||||
.Flag => {
|
||||
warn("Expected -D{} to be a float, but received a boolean.\n", .{name});
|
||||
self.markInvalidUserInput();
|
||||
return null;
|
||||
},
|
||||
.Scalar => |s| {
|
||||
const n = std.fmt.parseFloat(T, s) catch |err| {
|
||||
warn("Expected -D{} to be a float of type {}.\n", .{ name, @typeName(T) });
|
||||
self.markInvalidUserInput();
|
||||
return null;
|
||||
};
|
||||
return n;
|
||||
},
|
||||
.List => {
|
||||
warn("Expected -D{} to be a float, but received a list.\n", .{name});
|
||||
self.markInvalidUserInput();
|
||||
return null;
|
||||
},
|
||||
},
|
||||
.Enum => switch (entry.value.value) {
|
||||
.Flag => {
|
||||
warn("Expected -D{} to be a string, but received a boolean.\n", .{name});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user