nomo/tests/cases/deep_access.3-instructions.snap
Marcel Müller ffd9baf90f Add deep access
Signed-off-by: Marcel Müller <neikos@neikos.email>
2026-03-15 14:31:46 +01:00

313 lines
7.3 KiB
Text

---
source: tests/file_tests.rs
expression: emit
info:
input: "{{ if world?.active }}\nHello {{= world.name }}\n{{ end }}\n\n{{ if world?.foo?.bar?.active }}\n Weird!\n{{ else }}\n Deep access is working :)\n{{ end }}"
context:
world:
active: true
name: World!
---
VMInstructions {
labels: {
LabelSlot {
index: 0,
}: 18,
LabelSlot {
index: 2,
}: 4,
LabelSlot {
index: 4,
}: 18,
LabelSlot {
index: 6,
}: 13,
LabelSlot {
index: 8,
}: 43,
LabelSlot {
index: 10,
}: 31,
LabelSlot {
index: 12,
}: 27,
LabelSlot {
index: 14,
}: 23,
LabelSlot {
index: 16,
}: 38,
},
instructions: [
LoadFromContextToSlot {
name: "world" (6..11),
slot: VariableSlot {
index: 3,
},
fail_on_not_found: false,
},
JumpIfUndefined {
slot: VariableSlot {
index: 3,
},
jump: LabelSlot {
index: 2,
},
},
IndexSlotToSlot {
name: "active" (13..19),
from_slot: VariableSlot {
index: 3,
},
to_slot: VariableSlot {
index: 3,
},
fail_on_not_found: true,
},
JumpIfUndefined {
slot: VariableSlot {
index: 3,
},
jump: LabelSlot {
index: 2,
},
},
LoadFromSlotToSlot {
from_slot: VariableSlot {
index: 3,
},
to_slot: VariableSlot {
index: 1,
},
},
JumpIfNotTrue {
emit_slot: VariableSlot {
index: 1,
},
jump: LabelSlot {
index: 4,
},
},
AppendContent {
content: "\n" (22..23),
},
AppendContent {
content: "Hello" (23..28),
},
AppendContent {
content: " " (28..29),
},
LoadFromContextToSlot {
name: "world" (33..38),
slot: VariableSlot {
index: 7,
},
fail_on_not_found: true,
},
JumpIfUndefined {
slot: VariableSlot {
index: 7,
},
jump: LabelSlot {
index: 6,
},
},
IndexSlotToSlot {
name: "name" (39..43),
from_slot: VariableSlot {
index: 7,
},
to_slot: VariableSlot {
index: 7,
},
fail_on_not_found: true,
},
JumpIfUndefined {
slot: VariableSlot {
index: 7,
},
jump: LabelSlot {
index: 6,
},
},
LoadFromSlotToSlot {
from_slot: VariableSlot {
index: 7,
},
to_slot: VariableSlot {
index: 5,
},
},
EmitFromSlot {
slot: VariableSlot {
index: 5,
},
},
AppendContent {
content: "\n" (46..47),
},
Jump {
jump: LabelSlot {
index: 0,
},
},
AppendContent {
content: "\n" (22..23),
},
AppendContent {
content: "\n\n" (56..58),
},
LoadFromContextToSlot {
name: "world" (64..69),
slot: VariableSlot {
index: 15,
},
fail_on_not_found: false,
},
JumpIfUndefined {
slot: VariableSlot {
index: 15,
},
jump: LabelSlot {
index: 14,
},
},
IndexSlotToSlot {
name: "foo" (71..74),
from_slot: VariableSlot {
index: 15,
},
to_slot: VariableSlot {
index: 15,
},
fail_on_not_found: false,
},
JumpIfUndefined {
slot: VariableSlot {
index: 15,
},
jump: LabelSlot {
index: 14,
},
},
LoadFromSlotToSlot {
from_slot: VariableSlot {
index: 15,
},
to_slot: VariableSlot {
index: 13,
},
},
JumpIfUndefined {
slot: VariableSlot {
index: 13,
},
jump: LabelSlot {
index: 12,
},
},
IndexSlotToSlot {
name: "bar" (76..79),
from_slot: VariableSlot {
index: 13,
},
to_slot: VariableSlot {
index: 13,
},
fail_on_not_found: false,
},
JumpIfUndefined {
slot: VariableSlot {
index: 13,
},
jump: LabelSlot {
index: 12,
},
},
LoadFromSlotToSlot {
from_slot: VariableSlot {
index: 13,
},
to_slot: VariableSlot {
index: 11,
},
},
JumpIfUndefined {
slot: VariableSlot {
index: 11,
},
jump: LabelSlot {
index: 10,
},
},
IndexSlotToSlot {
name: "active" (81..87),
from_slot: VariableSlot {
index: 11,
},
to_slot: VariableSlot {
index: 11,
},
fail_on_not_found: true,
},
JumpIfUndefined {
slot: VariableSlot {
index: 11,
},
jump: LabelSlot {
index: 10,
},
},
LoadFromSlotToSlot {
from_slot: VariableSlot {
index: 11,
},
to_slot: VariableSlot {
index: 9,
},
},
JumpIfNotTrue {
emit_slot: VariableSlot {
index: 9,
},
jump: LabelSlot {
index: 16,
},
},
AppendContent {
content: "\n " (90..95),
},
AppendContent {
content: "Weird!" (95..101),
},
AppendContent {
content: "\n" (101..102),
},
Jump {
jump: LabelSlot {
index: 8,
},
},
AppendContent {
content: "\n " (90..95),
},
AppendContent {
content: "\n " (112..117),
},
AppendContent {
content: "Deep access is working :)" (117..142),
},
AppendContent {
content: "\n" (142..143),
},
Jump {
jump: LabelSlot {
index: 8,
},
},
AppendContent {
content: "\n " (112..117),
},
NoOp,
],
}