no-mistakes-postgres-engine 0.109.129

PostgreSQL embedded SQL extraction, schema catalog, and replay-safety analysis for no-mistakes
Documentation
use super::*;
impl<'a> ScopeVisitor<'a> {
    pub(super) fn record_unknown_lock_helper(&mut self, call: &CallExpression<'_>, name: &str) {
        for (executor, argument) in call.arguments.iter().enumerate() {
            let Some(expression) = argument.as_expression() else {
                continue;
            };
            let Some(_) = summary::access(expression) else {
                continue;
            };
            let receiver = match unwrap_ts_wrappers(expression) {
                Expression::StaticMemberExpression(member) => &member.object,
                expression => expression,
            };
            let mut fact = EmbeddedSqlCall::default();
            super::super::transaction::annotate_receiver(
                self,
                receiver,
                call.span.start,
                &mut fact,
            );
            super::super::transaction::annotate_pending_receiver(self, receiver, &mut fact);
            if !fact.executor_transaction_known || fact.transaction_id.is_none() {
                continue;
            }
            fact.lock_scope_analysis = true;
            fact.track_share_lock_writes = self.executor_options.track_share_lock_writes;
            super::super::transaction::annotate_execution_location(
                self,
                call,
                &mut fact,
                super::super::transaction::execution_scope(self),
            );
            fact.execution_loop = self.execution_loop;
            fact.line = byte_offset_to_line(self.source, call.span.start as usize);
            fact.callee = name.to_owned();
            fact.kind = EmbeddedSqlKind::Dynamic;
            fact.execution_unconditional = self.helper_execution_unconditional();
            let arguments = call
                .arguments
                .iter()
                .map(|argument| {
                    argument.as_expression().and_then(|expression| {
                        super::super::transaction::identity(self, expression)
                    })
                })
                .collect();
            self.imported_lock_helpers.push(Invocation {
                accesses: call
                    .arguments
                    .iter()
                    .map(|argument| argument.as_expression().and_then(summary::access))
                    .collect(),
                resolve_helper: self.awaited_lock_helper_calls.contains(&call.span.start)
                    && !call.optional
                    && self.imported_names.contains(name)
                    && self.lookup(name).is_none()
                    && call
                        .arguments
                        .iter()
                        .all(|argument| argument.as_expression().is_some()),
                name: name.to_owned(),
                executor,
                arguments,
                call: fact,
                span: (call.span.start, call.span.end),
            });
        }
    }
}

impl ScopeVisitor<'_> {
    pub(super) fn helper_execution_unconditional(&self) -> bool {
        use super::super::transaction::{execution_scope, execution_unconditional};
        execution_unconditional(self, execution_scope(self))
    }
}