SqlScriptDOM icon indicating copy to clipboard operation
SqlScriptDOM copied to clipboard

Is `VisitBaseType` internal field used consistently?

Open IVNSTN opened this issue 6 months ago • 0 comments

While diving deep into debugging my app I accidentally have noticed this: TSqlFragmentVisitor final code contains many blocks which check of VisitBaseType internal field value and if it is true then Visit method for base types is called, but for some sql-fragment classes Visit method implementation has this check negated and the behavior is reversed:

    // Summary:
    //     Visitor for DeclareCursorStatement
    public virtual void Visit(DeclareCursorStatement node)
    {
        if (!VisitBaseType)     <<<--- here
        {
            Visit((TSqlFragment)node);
        }
    }

    //
    // Summary:
    //     Explicit Visitor for DeclareCursorStatement
    public virtual void ExplicitVisit(DeclareCursorStatement node)
    {
        if (VisitBaseType)
        {
            Visit((TSqlStatement)node);
            Visit((TSqlFragment)node);
        }

        Visit(node);
        node.AcceptChildren(this);
    }

Is this expected behavior? If so, please clarify what was the intent, how VisitBaseType should be understood.

IVNSTN avatar Jul 03 '25 08:07 IVNSTN