Cleaned up ComptimeStringMaps
This commit is contained in:
parent
fc921f10a4
commit
cad6b78a49
@ -667,19 +667,18 @@ fn resolveTypeOfNodeInternal(
|
|||||||
return innermostContainer(handle, handle.tree.token_locs[builtin_call.firstToken()].start);
|
return innermostContainer(handle, handle.tree.token_locs[builtin_call.firstToken()].start);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: https://github.com/ziglang/zig/issues/4335
|
|
||||||
const cast_map = std.ComptimeStringMap(void, .{
|
const cast_map = std.ComptimeStringMap(void, .{
|
||||||
.{ .@"0" = "@as" },
|
.{ "@as" },
|
||||||
.{ .@"0" = "@bitCast" },
|
.{ "@bitCast" },
|
||||||
.{ .@"0" = "@fieldParentPtr" },
|
.{ "@fieldParentPtr" },
|
||||||
.{ .@"0" = "@floatCast" },
|
.{ "@floatCast" },
|
||||||
.{ .@"0" = "@floatToInt" },
|
.{ "@floatToInt" },
|
||||||
.{ .@"0" = "@intCast" },
|
.{ "@intCast" },
|
||||||
.{ .@"0" = "@intToEnum" },
|
.{ "@intToEnum" },
|
||||||
.{ .@"0" = "@intToFloat" },
|
.{ "@intToFloat" },
|
||||||
.{ .@"0" = "@intToPtr" },
|
.{ "@intToPtr" },
|
||||||
.{ .@"0" = "@truncate" },
|
.{ "@truncate" },
|
||||||
.{ .@"0" = "@ptrCast" },
|
.{ "@ptrCast" },
|
||||||
});
|
});
|
||||||
if (cast_map.has(call_name)) {
|
if (cast_map.has(call_name)) {
|
||||||
if (builtin_call.params_len < 1) return null;
|
if (builtin_call.params_len < 1) return null;
|
||||||
|
@ -84,18 +84,18 @@ fn isAllDigit(str: []const u8) bool {
|
|||||||
|
|
||||||
fn isTypeIdent(tree: *ast.Tree, token_idx: ast.TokenIndex) bool {
|
fn isTypeIdent(tree: *ast.Tree, token_idx: ast.TokenIndex) bool {
|
||||||
const PrimitiveTypes = std.ComptimeStringMap(void, .{
|
const PrimitiveTypes = std.ComptimeStringMap(void, .{
|
||||||
.{ .@"0" = "isize" }, .{ .@"0" = "usize" },
|
.{ "isize" }, .{ "usize" },
|
||||||
.{ .@"0" = "c_short" }, .{ .@"0" = "c_ushort" },
|
.{ "c_short" }, .{ "c_ushort" },
|
||||||
.{ .@"0" = "c_int" }, .{ .@"0" = "c_uint" },
|
.{ "c_int" }, .{ "c_uint" },
|
||||||
.{ .@"0" = "c_long" }, .{ .@"0" = "c_ulong" },
|
.{ "c_long" }, .{ "c_ulong" },
|
||||||
.{ .@"0" = "c_longlong" }, .{ .@"0" = "c_ulonglong" },
|
.{ "c_longlong" }, .{ "c_ulonglong" },
|
||||||
.{ .@"0" = "c_longdouble" }, .{ .@"0" = "c_void" },
|
.{ "c_longdouble" }, .{ "c_void" },
|
||||||
.{ .@"0" = "f16" }, .{ .@"0" = "f32" },
|
.{ "f16" }, .{ "f32" },
|
||||||
.{ .@"0" = "f64" }, .{ .@"0" = "f128" },
|
.{ "f64" }, .{ "f128" },
|
||||||
.{ .@"0" = "bool" }, .{ .@"0" = "void" },
|
.{ "bool" }, .{ "void" },
|
||||||
.{ .@"0" = "noreturn" }, .{ .@"0" = "type" },
|
.{ "noreturn" }, .{ "type" },
|
||||||
.{ .@"0" = "anyerror" }, .{ .@"0" = "comptime_int" },
|
.{ "anyerror" }, .{ "comptime_int" },
|
||||||
.{ .@"0" = "comptime_float" }, .{ .@"0" = "anyframe" },
|
.{ "comptime_float" }, .{ "anyframe" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const text = tree.tokenSlice(token_idx);
|
const text = tree.tokenSlice(token_idx);
|
||||||
|
Loading…
Reference in New Issue
Block a user