fix odd initial scope (is now -1usize)

This commit is contained in:
janis 2025-10-31 01:20:19 +01:00
parent cd04a5a4ca
commit 935a3e0a53
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8

View file

@ -1226,6 +1226,7 @@ ast_build_symtable_for_each:
mov [rsp], rsi ; Ast
mov [rsp + 8], rdi ; Ctx
mov [rsp + 16], rdx ; index
mov [rsp + 88], rcx ; scope
mov rdi, rsi ; Ast
mov rsi, rdx ; index
@ -1358,24 +1359,24 @@ ast_walk_for_each:
push r14
push rbx
; INVALID_SCOPE [48..56]
; current_index [40..48]
; *current_scope [32..40]
; current_node_ptr [24..32]
; for_each [16..24]
; ctx [8..16]
; ast [0..8]
sub rsp, 48
sub rsp, 56
mov [rsp], rdi ; Ast
mov [rsp + 8], rdx ; ctx
mov [rsp + 16], rcx ; for_each
mov qword [rsp + 24], 0 ; current_node_ptr
lea rdi, [rsp + 48] ; &INVALID_SCOPE
mov [rsp + 32], rdi ; current_scope
mov [rsp + 40], rsi ; current_index
mov qword [rsp + 48], -1 ; INVALID_SCOPE
mov rbp, rsp
lea rdi, [rbp + 32] ; current_scope
push rdi
push rsi
mov [rbp + 32], rsp ; initialise current_scope pointer
push rsi
; `current_scope` points to the index of the current scope on the stack.
@ -1520,7 +1521,7 @@ ast_walk_for_each:
jmp .check_scope
.done:
add rsp, 48
add rsp, 56
pop rbx
pop r14
pop r15