Add for loop
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
7182024342
commit
42e0056374
16 changed files with 775 additions and 44 deletions
87
tests/cases/3-instructions@simple_for.snap
Normal file
87
tests/cases/3-instructions@simple_for.snap
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
source: tests/file_tests.rs
|
||||
expression: emit
|
||||
info:
|
||||
context:
|
||||
values:
|
||||
- one
|
||||
- two
|
||||
input_file: tests/cases/simple_for.nomo
|
||||
---
|
||||
VMInstructions {
|
||||
labels: {
|
||||
LabelSlot {
|
||||
index: 0,
|
||||
}: 10,
|
||||
LabelSlot {
|
||||
index: 1,
|
||||
}: 10,
|
||||
LabelSlot {
|
||||
index: 2,
|
||||
}: 4,
|
||||
},
|
||||
instructions: [
|
||||
PushScope {
|
||||
inherit_parent: true,
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "values" (16..22),
|
||||
slot: VariableSlot {
|
||||
index: 4,
|
||||
},
|
||||
},
|
||||
CreateIteratorFromSlotToSlot {
|
||||
iterator_slot: VariableSlot {
|
||||
index: 5,
|
||||
},
|
||||
iterator_source_slot: VariableSlot {
|
||||
index: 4,
|
||||
},
|
||||
},
|
||||
GetIteratorEmptyOrJump {
|
||||
iterator_slot: VariableSlot {
|
||||
index: 5,
|
||||
},
|
||||
jump: LabelSlot {
|
||||
index: 0,
|
||||
},
|
||||
},
|
||||
AdvanceIteratorOrJump {
|
||||
iterator_slot: VariableSlot {
|
||||
index: 5,
|
||||
},
|
||||
value_slot: VariableSlot {
|
||||
index: 3,
|
||||
},
|
||||
jump: LabelSlot {
|
||||
index: 1,
|
||||
},
|
||||
},
|
||||
LoadFromSlotToContext {
|
||||
value_ident: "value" (7..12),
|
||||
value_slot: VariableSlot {
|
||||
index: 3,
|
||||
},
|
||||
},
|
||||
LoadFromContextToSlot {
|
||||
name: "value" (36..41),
|
||||
slot: VariableSlot {
|
||||
index: 6,
|
||||
},
|
||||
},
|
||||
EmitFromSlot {
|
||||
slot: VariableSlot {
|
||||
index: 6,
|
||||
},
|
||||
},
|
||||
AppendContent {
|
||||
content: "\n" (44..45),
|
||||
},
|
||||
Jump {
|
||||
jump: LabelSlot {
|
||||
index: 2,
|
||||
},
|
||||
},
|
||||
PopScope,
|
||||
],
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue