Remove the shared_from_this for Parser

We no longer need this.
This commit is contained in:
Peter Ammon
2024-06-19 10:32:35 -07:00
parent 924d6aac71
commit d2d2d8cb45

View File

@@ -37,7 +37,7 @@
use std::ffi::{CStr, OsStr};
use std::os::fd::{AsRawFd, OwnedFd, RawFd};
use std::os::unix::prelude::OsStrExt;
use std::rc::{Rc, Weak};
use std::rc::Rc;
use std::sync::{
atomic::{AtomicIsize, AtomicU64, Ordering},
Arc,
@@ -354,8 +354,6 @@ pub enum ParserStatusVar {
pub type ParserRef = Rc<Parser>;
pub struct Parser {
this: Weak<Self>,
/// The current execution context.
execution_context: RefCell<Option<ParseExecutionContext>>,
@@ -397,8 +395,7 @@ pub struct Parser {
impl Parser {
/// Create a parser
pub fn new(variables: Rc<EnvStack>, is_principal: bool) -> ParserRef {
let result = Rc::new_cyclic(|this: &Weak<Self>| Self {
this: Weak::clone(this),
let result = Rc::new(Self {
execution_context: RefCell::default(),
job_list: RefCell::default(),
wait_handles: RefCell::new(WaitHandleStore::new()),
@@ -1128,11 +1125,6 @@ pub fn set_syncs_uvars(&self, flag: bool) {
self.syncs_uvars.store(flag);
}
/// Return a shared pointer reference to this parser.
pub fn shared(&self) -> ParserRef {
self.this.upgrade().unwrap()
}
/// Return the operation context for this parser.
pub fn context(&self) -> OperationContext<'_> {
OperationContext::foreground(