Introduce JumpLabels instead of manually correct jump positions

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-11 15:50:05 +01:00
parent e64256b65f
commit 7182024342
12 changed files with 485 additions and 381 deletions

View file

@ -3,86 +3,89 @@ source: tests/file_tests.rs
expression: emit
input_file: tests/cases/identifiers.nomo
---
[
LoadFromContextToSlot {
name: "_name" (4..9),
slot: VariableSlot {
index: 0,
VMInstructions {
labels: {},
instructions: [
LoadFromContextToSlot {
name: "_name" (4..9),
slot: VariableSlot {
index: 0,
},
},
},
EmitFromSlot {
slot: VariableSlot {
index: 0,
EmitFromSlot {
slot: VariableSlot {
index: 0,
},
},
},
AppendContent {
content: "\n" (12..13),
},
LoadFromContextToSlot {
name: "a_name" (17..23),
slot: VariableSlot {
index: 1,
AppendContent {
content: "\n" (12..13),
},
},
EmitFromSlot {
slot: VariableSlot {
index: 1,
LoadFromContextToSlot {
name: "a_name" (17..23),
slot: VariableSlot {
index: 1,
},
},
},
AppendContent {
content: "\n" (26..27),
},
LoadFromContextToSlot {
name: "1name" (31..36),
slot: VariableSlot {
index: 2,
EmitFromSlot {
slot: VariableSlot {
index: 1,
},
},
},
EmitFromSlot {
slot: VariableSlot {
index: 2,
AppendContent {
content: "\n" (26..27),
},
},
AppendContent {
content: "\n" (39..40),
},
LoadFromContextToSlot {
name: "_name1" (44..50),
slot: VariableSlot {
index: 3,
LoadFromContextToSlot {
name: "1name" (31..36),
slot: VariableSlot {
index: 2,
},
},
},
EmitFromSlot {
slot: VariableSlot {
index: 3,
EmitFromSlot {
slot: VariableSlot {
index: 2,
},
},
},
AppendContent {
content: "\n" (53..54),
},
LoadFromContextToSlot {
name: "_namE" (58..63),
slot: VariableSlot {
index: 4,
AppendContent {
content: "\n" (39..40),
},
},
EmitFromSlot {
slot: VariableSlot {
index: 4,
LoadFromContextToSlot {
name: "_name1" (44..50),
slot: VariableSlot {
index: 3,
},
},
},
AppendContent {
content: "\n" (66..67),
},
LoadFromContextToSlot {
name: "name1" (71..76),
slot: VariableSlot {
index: 5,
EmitFromSlot {
slot: VariableSlot {
index: 3,
},
},
},
EmitFromSlot {
slot: VariableSlot {
index: 5,
AppendContent {
content: "\n" (53..54),
},
},
]
LoadFromContextToSlot {
name: "_namE" (58..63),
slot: VariableSlot {
index: 4,
},
},
EmitFromSlot {
slot: VariableSlot {
index: 4,
},
},
AppendContent {
content: "\n" (66..67),
},
LoadFromContextToSlot {
name: "name1" (71..76),
slot: VariableSlot {
index: 5,
},
},
EmitFromSlot {
slot: VariableSlot {
index: 5,
},
},
],
}