interpreter: make nock 2 tail have correct subject

This commit is contained in:
Edward Amsden 2023-08-31 14:09:56 -05:00
parent bfecdf9aa4
commit 92e98cba29

View File

@ -305,6 +305,7 @@ pub fn interpret(
Nock2ComputeResult => { Nock2ComputeResult => {
if vale.tail { if vale.tail {
stack.pop::<NockWork>(); stack.pop::<NockWork>();
subject = vale.subject;
push_formula(stack, res, true); push_formula(stack, res, true);
} else { } else {
vale.todo = Nock2RestoreSubject; vale.todo = Nock2RestoreSubject;
@ -478,6 +479,7 @@ pub fn interpret(
push_formula(stack, diet.patch, false); push_formula(stack, diet.patch, false);
} }
Nock10Edit => { Nock10Edit => {
eprintln!("edit axis {} patch {} tree {}", diet.axis, res, diet.tree);
res = edit(stack, diet.axis.as_bitslice(), res, diet.tree); res = edit(stack, diet.axis.as_bitslice(), res, diet.tree);
stack.pop::<NockWork>(); stack.pop::<NockWork>();
} }
@ -542,7 +544,7 @@ pub fn interpret(
} }
fn push_formula(stack: &mut NockStack, formula: Noun, tail: bool) { fn push_formula(stack: &mut NockStack, formula: Noun, tail: bool) {
// eprintln!("push_formula {} tail {}", formula, tail); eprintln!("push_formula {} tail {}", formula, tail);
unsafe { unsafe {
if let Ok(formula_cell) = formula.as_cell() { if let Ok(formula_cell) = formula.as_cell() {
// Formula // Formula