/// <summary>
        /// AnalyzeScript: Analyzes the ast to check variables in script blocks that will run in new runspaces are properly initialized or passed in with $using:
        /// </summary>
        /// <param name="ast">The script's ast</param>
        /// <param name="fileName">The script's file name</param>
        /// <returns>A List of results from this rule</returns>
        public IEnumerable <DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
        {
            var visitor = new SyntaxCompatibilityVisitor(this, fileName);

            ast.Visit(visitor);
            return(visitor.GetDiagnosticRecords());
        }
        /// <summary>
        /// Analyze the given PowerShell AST for incompatible syntax usage.
        /// </summary>
        /// <param name="ast">The PowerShell AST to analyze.</param>
        /// <param name="fileName">The name of the PowerShell file being analyzed.</param>
        /// <returns>Diagnostics for any issues found while analyzing the given AST.</returns>
        public override IEnumerable <DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
        {
            HashSet <Version> targetVersions = GetTargetedVersions(TargetVersions);

            var visitor = new SyntaxCompatibilityVisitor(this, fileName, targetVersions);

            ast.Visit(visitor);
            return(visitor.GetDiagnosticRecords());
        }