Remove checks again
This commit is contained in:
parent
83f153e87e
commit
c7158f7625
@ -222,8 +222,6 @@ pub fn isPascalCase(name: []const u8) bool {
|
|||||||
pub fn getDeclNameToken(tree: ast.Tree, node: ast.Node.Index) ?ast.TokenIndex {
|
pub fn getDeclNameToken(tree: ast.Tree, node: ast.Node.Index) ?ast.TokenIndex {
|
||||||
const tags = tree.nodes.items(.tag);
|
const tags = tree.nodes.items(.tag);
|
||||||
const main_token = tree.nodes.items(.main_token)[node];
|
const main_token = tree.nodes.items(.main_token)[node];
|
||||||
if (tree.errors.len > 0)
|
|
||||||
return null;
|
|
||||||
return switch (tags[node]) {
|
return switch (tags[node]) {
|
||||||
// regular declaration names. + 1 to mut token because name comes after 'const'/'var'
|
// regular declaration names. + 1 to mut token because name comes after 'const'/'var'
|
||||||
.local_var_decl => tree.localVarDecl(node).ast.mut_token + 1,
|
.local_var_decl => tree.localVarDecl(node).ast.mut_token + 1,
|
||||||
@ -348,8 +346,6 @@ pub fn resolveVarDeclAlias(store: *DocumentStore, arena: *std.heap.ArenaAllocato
|
|||||||
const token_tags = tree.tokens.items(.tag);
|
const token_tags = tree.tokens.items(.tag);
|
||||||
const main_tokes = tree.nodes.items(.main_token);
|
const main_tokes = tree.nodes.items(.main_token);
|
||||||
const node_tags = tree.nodes.items(.tag);
|
const node_tags = tree.nodes.items(.tag);
|
||||||
if (tree.errors.len > 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (varDecl(handle.tree, decl)) |var_decl| {
|
if (varDecl(handle.tree, decl)) |var_decl| {
|
||||||
if (var_decl.ast.init_node == 0) return null;
|
if (var_decl.ast.init_node == 0) return null;
|
||||||
@ -1234,8 +1230,6 @@ pub fn getFieldAccessType(
|
|||||||
.node = undefined,
|
.node = undefined,
|
||||||
.handle = handle,
|
.handle = handle,
|
||||||
});
|
});
|
||||||
if (handle.tree.errors.len > 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// TODO Actually bind params here when calling functions instead of just skipping args.
|
// TODO Actually bind params here when calling functions instead of just skipping args.
|
||||||
var bound_type_params = BoundTypeParams.init(&arena.allocator);
|
var bound_type_params = BoundTypeParams.init(&arena.allocator);
|
||||||
@ -1881,8 +1875,6 @@ fn getDocumentSymbolsInternal(allocator: *std.mem.Allocator, tree: ast.Tree, nod
|
|||||||
|
|
||||||
pub fn getDocumentSymbols(allocator: *std.mem.Allocator, tree: ast.Tree, encoding: offsets.Encoding) ![]types.DocumentSymbol {
|
pub fn getDocumentSymbols(allocator: *std.mem.Allocator, tree: ast.Tree, encoding: offsets.Encoding) ![]types.DocumentSymbol {
|
||||||
var symbols = try std.ArrayList(types.DocumentSymbol).initCapacity(allocator, tree.rootDecls().len);
|
var symbols = try std.ArrayList(types.DocumentSymbol).initCapacity(allocator, tree.rootDecls().len);
|
||||||
if (tree.errors.len > 0)
|
|
||||||
return symbols.items;
|
|
||||||
|
|
||||||
var context = GetDocumentSymbolsContext{
|
var context = GetDocumentSymbolsContext{
|
||||||
.symbols = &symbols,
|
.symbols = &symbols,
|
||||||
@ -2440,12 +2432,6 @@ pub const DocumentScope = struct {
|
|||||||
error_completions: CompletionSet,
|
error_completions: CompletionSet,
|
||||||
enum_completions: CompletionSet,
|
enum_completions: CompletionSet,
|
||||||
|
|
||||||
pub const none = DocumentScope{
|
|
||||||
.scopes = &[0]Scope{},
|
|
||||||
.error_completions = CompletionSet{},
|
|
||||||
.enum_completions = CompletionSet{},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn debugPrint(self: DocumentScope) void {
|
pub fn debugPrint(self: DocumentScope) void {
|
||||||
for (self.scopes) |scope| {
|
for (self.scopes) |scope| {
|
||||||
log.debug(
|
log.debug(
|
||||||
@ -2509,9 +2495,6 @@ pub fn makeDocumentScope(allocator: *std.mem.Allocator, tree: ast.Tree) !Documen
|
|||||||
var error_completions = CompletionSet{};
|
var error_completions = CompletionSet{};
|
||||||
var enum_completions = CompletionSet{};
|
var enum_completions = CompletionSet{};
|
||||||
|
|
||||||
if (tree.errors.len > 0)
|
|
||||||
return DocumentScope.none;
|
|
||||||
|
|
||||||
errdefer {
|
errdefer {
|
||||||
scopes.deinit(allocator);
|
scopes.deinit(allocator);
|
||||||
for (error_completions.entries.items) |entry| {
|
for (error_completions.entries.items) |entry| {
|
||||||
@ -2763,10 +2746,7 @@ fn makeScopeInternal(
|
|||||||
param.type_expr,
|
param.type_expr,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const a = data[node_idx];
|
|
||||||
const left = data[a.lhs];
|
|
||||||
const right = data[a.rhs];
|
|
||||||
// log.debug("Alive 3.2 - {}- {}- {}-{} {}- {}-{}", .{tags[node_idx], tags[a.lhs], tags[left.lhs], tags[left.rhs], tags[a.rhs], tags[right.lhs], tags[right.rhs]});
|
|
||||||
// Visit the return type
|
// Visit the return type
|
||||||
try makeScopeInternal(
|
try makeScopeInternal(
|
||||||
allocator,
|
allocator,
|
||||||
|
@ -356,8 +356,6 @@ fn nodeToCompletion(
|
|||||||
const node_tags = tree.nodes.items(.tag);
|
const node_tags = tree.nodes.items(.tag);
|
||||||
const datas = tree.nodes.items(.data);
|
const datas = tree.nodes.items(.data);
|
||||||
const token_tags = tree.tokens.items(.tag);
|
const token_tags = tree.tokens.items(.tag);
|
||||||
if (tree.errors.len > 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const doc_kind: types.MarkupContent.Kind = if (client_capabilities.completion_doc_supports_md)
|
const doc_kind: types.MarkupContent.Kind = if (client_capabilities.completion_doc_supports_md)
|
||||||
.Markdown
|
.Markdown
|
||||||
|
@ -85,9 +85,6 @@ fn symbolReferencesInternal(
|
|||||||
const main_tokens = tree.nodes.items(.main_token);
|
const main_tokens = tree.nodes.items(.main_token);
|
||||||
const starts = tree.tokens.items(.start);
|
const starts = tree.tokens.items(.start);
|
||||||
|
|
||||||
if (tree.errors.len > 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (node_tags[node]) {
|
switch (node_tags[node]) {
|
||||||
.block, .block_semicolon, .block_two, .block_two_semicolon => {
|
.block, .block_semicolon, .block_two, .block_two_semicolon => {
|
||||||
const statements: []const ast.Node.Index = switch (node_tags[node]) {
|
const statements: []const ast.Node.Index = switch (node_tags[node]) {
|
||||||
|
@ -1145,9 +1145,6 @@ fn writeNodeTokens(
|
|||||||
// TODO Range version, edit version.
|
// TODO Range version, edit version.
|
||||||
pub fn writeAllSemanticTokens(arena: *std.heap.ArenaAllocator, store: *DocumentStore, handle: *DocumentStore.Handle, encoding: offsets.Encoding) ![]u32 {
|
pub fn writeAllSemanticTokens(arena: *std.heap.ArenaAllocator, store: *DocumentStore, handle: *DocumentStore.Handle, encoding: offsets.Encoding) ![]u32 {
|
||||||
var builder = Builder.init(arena.child_allocator, handle, encoding);
|
var builder = Builder.init(arena.child_allocator, handle, encoding);
|
||||||
if (handle.tree.errors.len > 0) {
|
|
||||||
return builder.toOwnedSlice();
|
|
||||||
}
|
|
||||||
|
|
||||||
// reverse the ast from the root declarations
|
// reverse the ast from the root declarations
|
||||||
var gap_highlighter = GapHighlighter.init(&builder, 0);
|
var gap_highlighter = GapHighlighter.init(&builder, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user