correct get_byte/1 not emitted -1 upon discovery of end_of_stream position (#555)
This commit is contained in:
@@ -2166,6 +2166,13 @@ impl MachineState {
|
||||
)?;
|
||||
|
||||
if stream.past_end_of_stream() {
|
||||
self.eof_action(
|
||||
self[temp_v!(2)],
|
||||
&mut stream,
|
||||
clause_name!("get_byte"),
|
||||
2,
|
||||
)?;
|
||||
|
||||
if EOFAction::Reset != stream.options.eof_action {
|
||||
return return_from_clause!(self.last_call, self);
|
||||
} else if self.fail {
|
||||
@@ -2173,12 +2180,6 @@ impl MachineState {
|
||||
}
|
||||
}
|
||||
|
||||
if stream.at_end_of_stream() {
|
||||
stream.set_past_end_of_stream();
|
||||
self.unify(self[temp_v!(2)], Addr::Fixnum(-1));
|
||||
return return_from_clause!(self.last_call, self);
|
||||
}
|
||||
|
||||
let addr =
|
||||
match self.store(self.deref(self[temp_v!(2)])) {
|
||||
addr if addr.is_ref() => {
|
||||
@@ -2238,18 +2239,9 @@ impl MachineState {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
self.eof_action(
|
||||
self[temp_v!(2)],
|
||||
&mut stream,
|
||||
clause_name!("get_byte"),
|
||||
2,
|
||||
)?;
|
||||
|
||||
if EOFAction::Reset != stream.options.eof_action {
|
||||
return return_from_clause!(self.last_call, self);
|
||||
} else if self.fail {
|
||||
return Ok(());
|
||||
}
|
||||
stream.set_past_end_of_stream();
|
||||
self.unify(self[temp_v!(2)], Addr::Fixnum(-1));
|
||||
return return_from_clause!(self.last_call, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user