Remove an Option from the parsed source ref in parse_execution

This was never None.
This commit is contained in:
Peter Ammon 2024-06-29 13:58:07 -07:00
parent 3aa12c1be9
commit ad1ea94405
No known key found for this signature in database

View File

@ -76,9 +76,9 @@ pub enum EndExecutionReason {
error,
}
#[derive(Default)]
pub struct ExecutionContext {
pstree: RefCell<Option<ParsedSourceRef>>,
// The parsed source and its AST.
pstree: RefCell<ParsedSourceRef>,
// If set, one of our processes received a cancellation signal (INT or QUIT) so we are
// unwinding.
@ -138,7 +138,7 @@ impl<'a> ExecutionContext {
/// The execution context may access the parser and parent job group (if any) through ctx.
pub fn new(pstree: ParsedSourceRef, block_io: IoChain) -> Self {
Self {
pstree: RefCell::new(Some(pstree)),
pstree: RefCell::new(pstree),
cancel_signal: RefCell::default(),
executing_job_node: RefCell::default(),
cached_lineno: RefCell::default(),
@ -148,7 +148,7 @@ impl<'a> ExecutionContext {
pub fn pstree(&self) -> ParsedSourceRef {
// todo!("don't clone but expose a Ref<'_, ParsedSourceRef> or similar")
self.pstree.borrow().as_ref().unwrap().clone()
ParsedSourceRef::clone(&self.pstree.borrow())
}
/// Returns the current line number, indexed from 1. Updates cached line ranges.