Rename ParseExecutionContext to ExecutionContext

This commit is contained in:
Peter Ammon 2024-06-29 12:29:40 -07:00
parent 2a0f7e411f
commit 3aa12c1be9
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View file

@ -77,7 +77,7 @@ pub enum EndExecutionReason {
}
#[derive(Default)]
pub struct ParseExecutionContext {
pub struct ExecutionContext {
pstree: RefCell<Option<ParsedSourceRef>>,
// If set, one of our processes received a cancellation signal (INT or QUIT) so we are
@ -102,7 +102,7 @@ struct CachedLineno {
count: usize,
}
impl ParseExecutionContext {
impl ExecutionContext {
pub fn swap(left: &Self, right: Self) -> Self {
left.pstree.swap(&right.pstree);
left.cancel_signal.swap(&right.cancel_signal);
@ -133,7 +133,7 @@ macro_rules! report_error_formatted {
}};
}
impl<'a> ParseExecutionContext {
impl<'a> ExecutionContext {
/// Construct a context in preparation for evaluating a node in a tree, with the given block_io.
/// The execution context may access the parser and parent job group (if any) through ctx.
pub fn new(pstree: ParsedSourceRef, block_io: IoChain) -> Self {

View file

@ -21,7 +21,7 @@ use crate::parse_constants::{
ParseError, ParseErrorList, ParseTreeFlags, FISH_MAX_EVAL_DEPTH, FISH_MAX_STACK_DEPTH,
SOURCE_LOCATION_UNKNOWN,
};
use crate::parse_execution::{EndExecutionReason, ParseExecutionContext};
use crate::parse_execution::{EndExecutionReason, ExecutionContext};
use crate::parse_tree::{parse_source, ParsedSourceRef};
use crate::proc::{job_reap, JobGroupRef, JobList, JobRef, ProcStatus};
use crate::signal::{signal_check_cancel, signal_clear_cancel, Signal};
@ -363,7 +363,7 @@ pub enum CancelBehavior {
pub struct Parser {
/// The current execution context.
execution_context: RefCell<Option<ParseExecutionContext>>,
execution_context: RefCell<Option<ExecutionContext>>,
/// The jobs associated with this parser.
job_list: RefCell<JobList>,
@ -429,7 +429,7 @@ impl Parser {
result
}
fn execution_context(&self) -> Ref<'_, Option<ParseExecutionContext>> {
fn execution_context(&self) -> Ref<'_, Option<ExecutionContext>> {
self.execution_context.borrow()
}
@ -604,13 +604,13 @@ impl Parser {
std::mem::replace(&mut self.execution_context.borrow_mut(), new_value)
} else {
#[allow(clippy::unnecessary_unwrap)]
Some(ParseExecutionContext::swap(
Some(ExecutionContext::swap(
self.execution_context.borrow().as_ref().unwrap(),
new_value.unwrap(),
))
}
},
Some(ParseExecutionContext::new(ps.clone(), block_io.clone())),
Some(ExecutionContext::new(ps.clone(), block_io.clone())),
);
// Check the exec count so we know if anything got executed.