add '$unattributed_var' builtin (#1758)
This commit is contained in:
@@ -5239,6 +5239,14 @@ impl Machine {
|
||||
self.delete_all_attributes_from_var();
|
||||
self.machine_st.p = self.machine_st.cp;
|
||||
}
|
||||
&Instruction::CallUnattributedVar(_) => {
|
||||
self.machine_st.unattributed_var();
|
||||
step_or_fail!(self, self.machine_st.p += 1);
|
||||
}
|
||||
&Instruction::ExecuteUnattributedVar(_) => {
|
||||
self.machine_st.unattributed_var();
|
||||
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -471,6 +471,25 @@ struct AttrListMatch {
|
||||
}
|
||||
|
||||
impl MachineState {
|
||||
#[inline(always)]
|
||||
pub(crate) fn unattributed_var(&mut self) {
|
||||
let attr_var = self.store(self.deref(self.registers[1]));
|
||||
|
||||
if !attr_var.is_var() {
|
||||
self.fail = true;
|
||||
return;
|
||||
}
|
||||
|
||||
read_heap_cell!(attr_var,
|
||||
(HeapCellValueTag::AttrVar, h) => {
|
||||
let list_cell = self.store(self.deref(self.heap[h+1]));
|
||||
self.fail = list_cell.get_tag() == HeapCellValueTag::Lis;
|
||||
}
|
||||
_ => {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
pub(crate) fn get_attr_var_list(&mut self, attr_var: HeapCellValue) -> Option<usize> {
|
||||
read_heap_cell!(attr_var,
|
||||
(HeapCellValueTag::AttrVar, h) => {
|
||||
|
||||
Reference in New Issue
Block a user