Fix empty location in if chains

This commit is contained in:
Nikita Lisitsa 2026-03-13 13:39:01 +03:00
parent ad46b230d8
commit 902d272deb
2 changed files with 2 additions and 0 deletions

View file

@ -63,6 +63,7 @@ namespace pslang::parser
if (auto if_block = std::get_if<ast::if_block>(statement.statement.get()))
{
ast::if_chain chain;
chain.location = if_block->location;
chain.blocks.push_back({.condition = std::move(if_block->condition), .statements = std::make_unique<ast::statement_list>()});
list = chain.blocks.back().statements.get();
current_statement_list(location)->statements.push_back(std::make_unique<ast::statement>(std::move(chain)));

View file

@ -18,6 +18,7 @@ Aarch64 compiler backlog:
* Struct values
General backlog:
* Separate single-line location & full statement list location for function definitions, if chains, while blocks, structs, etc
* Mutually recursive structs (relevant only with pointers)
* Empty array expression
* Calling functions as methods