correct get_byte/1 not emitted -1 upon discovery of end_of_stream position
@@ -2166,6 +2166,13 @@ fn system_call(
)?;
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 @@ fn system_call(
}
}
- 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 @@ fn system_call(
}
}
_ => {
- self.eof_action(
- self[temp_v!(2)],
- &mut stream,
- clause_name!("get_byte"),
- 2,
- )?;
-
- if EOFAction::Reset != stream.options.eof_action {
+ stream.set_past_end_of_stream();
+ self.unify(self[temp_v!(2)], Addr::Fixnum(-1));
return return_from_clause!(self.last_call, self);
- } else if self.fail {
- return Ok(());
- }
}
}
}
