From b106fe19b55e9fe3348b3a5c9992c21dac27b02c Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 20 Jan 2026 12:51:23 +0000 Subject: Working a bit on the LSP + fixed some bugs --- src/parser/parser_stmt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/parser') diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 7433525..c5efe8a 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -335,6 +335,14 @@ ASTNode *parse_match(ParserContext *ctx, Lexer *l) zpanic_at(lexer_peek(l), "Expected =>"); } + // Create scope for the case to hold the binding + enter_scope(ctx); + if (binding) + { + // If ref binding, mark as pointer type so auto-deref (->) works + add_symbol(ctx, binding, is_ref ? "void*" : "unknown", NULL); + } + ASTNode *body; Token pk = lexer_peek(l); if (pk.type == TOK_LBRACE) @@ -355,6 +363,8 @@ ASTNode *parse_match(ParserContext *ctx, Lexer *l) body = parse_expression(ctx, l); } + exit_scope(ctx); + ASTNode *c = ast_create(NODE_MATCH_CASE); c->match_case.pattern = pattern; c->match_case.binding_name = binding; -- cgit v1.2.3