do not print unbound vars at toplevel
This commit is contained in:
@@ -250,6 +250,17 @@ impl Machine {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn remove_unbound_vars(&self, heap_locs: &mut HeapVarDict) {
|
||||||
|
for (var, addr) in heap_locs.clone() {
|
||||||
|
match self.machine_st.store(self.machine_st.deref(addr.clone())) {
|
||||||
|
new_addr =>
|
||||||
|
if addr.is_ref() && new_addr == addr {
|
||||||
|
heap_locs.remove(&var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_batched_code(&mut self, code: Code, code_dir: CodeDir)
|
pub fn add_batched_code(&mut self, code: Code, code_dir: CodeDir)
|
||||||
{
|
{
|
||||||
// error detection has finished, so update the master index of keys.
|
// error detection has finished, so update the master index of keys.
|
||||||
|
|||||||
@@ -373,6 +373,8 @@ pub fn print(wam: &mut Machine, result: EvalSession) {
|
|||||||
match result {
|
match result {
|
||||||
EvalSession::InitialQuerySuccess(alloc_locs, mut heap_locs) => {
|
EvalSession::InitialQuerySuccess(alloc_locs, mut heap_locs) => {
|
||||||
loop {
|
loop {
|
||||||
|
wam.remove_unbound_vars(&mut heap_locs);
|
||||||
|
|
||||||
if wam.or_stack_is_empty() {
|
if wam.or_stack_is_empty() {
|
||||||
if heap_locs.is_empty() {
|
if heap_locs.is_empty() {
|
||||||
println!("true.");
|
println!("true.");
|
||||||
|
|||||||
Reference in New Issue
Block a user