From ad1ea9440572a0ceb42137268fab05cdff598f76 Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Sat, 29 Jun 2024 13:58:07 -0700 Subject: [PATCH] Remove an Option from the parsed source ref in parse_execution This was never None. --- src/parse_execution.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parse_execution.rs b/src/parse_execution.rs index e6ea4e214..87175daf9 100644 --- a/src/parse_execution.rs +++ b/src/parse_execution.rs @@ -76,9 +76,9 @@ pub enum EndExecutionReason { error, } -#[derive(Default)] pub struct ExecutionContext { - pstree: RefCell>, + // The parsed source and its AST. + pstree: RefCell, // 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 @@ pub fn new(pstree: ParsedSourceRef, block_io: IoChain) -> Self { 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.