undefined assignment
This commit is contained in:
@@ -613,7 +613,6 @@ lower_statements :: proc(state: ^State, statements: []hir.Stmt_Id) {
|
||||
statement := hir_module.statements[statement_id]
|
||||
switch statement.kind {
|
||||
case .Declaration:
|
||||
value := lower_expr(state, statement.expr)
|
||||
if statement.local == hir.INVALID_LOCAL || int(statement.local) >= len(state.func_locals) {
|
||||
append_instruction(state, ir.Instruction{
|
||||
op=.Trap, span=statement.span, type=types.VOID,
|
||||
@@ -632,6 +631,19 @@ lower_statements :: proc(state: ^State, statements: []hir.Stmt_Id) {
|
||||
diagnostic=source.INVALID_DIAGNOSTIC,
|
||||
})
|
||||
state.local_slots[statement.local] = slot
|
||||
if statement.expr == hir.INVALID_EXPR {
|
||||
append_instruction(state, ir.Instruction{
|
||||
op=.Fill,
|
||||
span=statement.span,
|
||||
type=local.type,
|
||||
target=ir.INVALID_REF,
|
||||
a=slot,
|
||||
b=ir.INVALID_INSTRUCTION,
|
||||
diagnostic=source.INVALID_DIAGNOSTIC,
|
||||
})
|
||||
continue
|
||||
}
|
||||
value := lower_expr(state, statement.expr)
|
||||
append_instruction(state, ir.Instruction{
|
||||
op=.Store,
|
||||
span=statement.span,
|
||||
|
||||
Reference in New Issue
Block a user