fix partial_string_tail panic (#530)
This commit is contained in:
@@ -348,7 +348,9 @@ fn compile_into_module(
|
|||||||
);
|
);
|
||||||
|
|
||||||
match compile_into_module_impl(wam, &mut compiler, module, src, indices) {
|
match compile_into_module_impl(wam, &mut compiler, module, src, indices) {
|
||||||
Ok(()) => EvalSession::EntrySuccess,
|
Ok(()) => {
|
||||||
|
EvalSession::EntrySuccess
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
compiler.drop_expansions(&mut wam.code_repo);
|
compiler.drop_expansions(&mut wam.code_repo);
|
||||||
EvalSession::from(e)
|
EvalSession::from(e)
|
||||||
|
|||||||
@@ -1154,10 +1154,19 @@ impl MachineState {
|
|||||||
|
|
||||||
match pstr {
|
match pstr {
|
||||||
Addr::PStrLocation(h, _) => {
|
Addr::PStrLocation(h, _) => {
|
||||||
|
if let HeapCellValue::PartialString(_, true) = &self.heap[h] {
|
||||||
let tail = self.heap[h + 1].as_addr(h + 1);
|
let tail = self.heap[h + 1].as_addr(h + 1);
|
||||||
let target = self[temp_v!(2)];
|
let target = self[temp_v!(2)];
|
||||||
|
|
||||||
self.unify(tail, target);
|
self.unify(tail, target);
|
||||||
|
} else {
|
||||||
|
self.fail = true;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Addr::EmptyList => {
|
||||||
|
self.fail = true;
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
|
|||||||
Reference in New Issue
Block a user