Run zig fmt

This commit is contained in:
Alexandros Naskos 2020-06-16 15:49:57 +03:00
parent cad6b78a49
commit fd424277ab
2 changed files with 26 additions and 24 deletions

View File

@ -668,17 +668,17 @@ fn resolveTypeOfNodeInternal(
} }
const cast_map = std.ComptimeStringMap(void, .{ const cast_map = std.ComptimeStringMap(void, .{
.{ "@as" }, .{"@as"},
.{ "@bitCast" }, .{"@bitCast"},
.{ "@fieldParentPtr" }, .{"@fieldParentPtr"},
.{ "@floatCast" }, .{"@floatCast"},
.{ "@floatToInt" }, .{"@floatToInt"},
.{ "@intCast" }, .{"@intCast"},
.{ "@intToEnum" }, .{"@intToEnum"},
.{ "@intToFloat" }, .{"@intToFloat"},
.{ "@intToPtr" }, .{"@intToPtr"},
.{ "@truncate" }, .{"@truncate"},
.{ "@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;
@ -1051,7 +1051,9 @@ pub fn documentPositionContext(allocator: *std.mem.Allocator, document: types.Te
}, },
}, },
.Keyword_break, .Keyword_continue => curr_ctx.ctx = .pre_label, .Keyword_break, .Keyword_continue => curr_ctx.ctx = .pre_label,
.Colon => if (curr_ctx.ctx == .pre_label) { curr_ctx.ctx = .label; }, .Colon => if (curr_ctx.ctx == .pre_label) {
curr_ctx.ctx = .label;
},
.QuestionMark => switch (curr_ctx.ctx) { .QuestionMark => switch (curr_ctx.ctx) {
.field_access => {}, .field_access => {},
else => curr_ctx.ctx = .empty, else => curr_ctx.ctx = .empty,

View File

@ -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, .{
.{ "isize" }, .{ "usize" }, .{"isize"}, .{"usize"},
.{ "c_short" }, .{ "c_ushort" }, .{"c_short"}, .{"c_ushort"},
.{ "c_int" }, .{ "c_uint" }, .{"c_int"}, .{"c_uint"},
.{ "c_long" }, .{ "c_ulong" }, .{"c_long"}, .{"c_ulong"},
.{ "c_longlong" }, .{ "c_ulonglong" }, .{"c_longlong"}, .{"c_ulonglong"},
.{ "c_longdouble" }, .{ "c_void" }, .{"c_longdouble"}, .{"c_void"},
.{ "f16" }, .{ "f32" }, .{"f16"}, .{"f32"},
.{ "f64" }, .{ "f128" }, .{"f64"}, .{"f128"},
.{ "bool" }, .{ "void" }, .{"bool"}, .{"void"},
.{ "noreturn" }, .{ "type" }, .{"noreturn"}, .{"type"},
.{ "anyerror" }, .{ "comptime_int" }, .{"anyerror"}, .{"comptime_int"},
.{ "comptime_float" }, .{ "anyframe" }, .{"comptime_float"}, .{"anyframe"},
}); });
const text = tree.tokenSlice(token_idx); const text = tree.tokenSlice(token_idx);