public static bool Matches()

in src/Kusto.Language/Symbols/SymbolMatch.cs [82:134]


        public static bool Matches(this Symbol symbol, string name, SymbolMatch match, bool ignoreCase = false)
        {
            if (name != null)
            {
                if (ignoreCase)
                {
                    if (string.Compare(symbol.Name, name, ignoreCase) != 0)
                        return false;
                }
                else 
                {
                    // compare first character before calling string.Compare (perf)
                    var sn = symbol.Name;
                    if (name.Length == 0 
                        || sn.Length == 0 
                        || name[0] != sn[0]
                        || string.Compare(sn, name) != 0)
                        return false;
                }
            }

            if ((match & SymbolMatch.Column) != 0 && symbol.Kind == SymbolKind.Column)
                return true;

            if ((match & SymbolMatch.Table) != 0 && symbol is TableSymbol ts && !ts.IsExternal && !ts.IsMaterializedView)
                return true;

            if ((match & SymbolMatch.ExternalTable) != 0 && symbol is TableSymbol ets && ets.IsExternal)
                return true;

            if ((match & SymbolMatch.MaterializedView) != 0 && symbol is TableSymbol mv && mv.IsMaterializedView)
                return true;

            if ((match & SymbolMatch.Database) != 0 && symbol.Kind == SymbolKind.Database)
                return true;

            if ((match & SymbolMatch.Cluster) != 0 && symbol.Kind == SymbolKind.Cluster)
                return true;

            if ((match & SymbolMatch.Scalar) != 0 && (match & SymbolMatch.Tabular) == 0 && !symbol.IsScalar)
                return false;

            if ((match & SymbolMatch.Tabular) != 0 && (match & SymbolMatch.Scalar) == 0 && !symbol.IsTabular)
                return false;

            if ((match & SymbolMatch.Function) != 0 && (symbol.Kind == SymbolKind.Function || symbol.Kind == SymbolKind.Pattern))
                return true;

            if ((match & SymbolMatch.Local) != 0 && (symbol.Kind == SymbolKind.Variable || symbol.Kind == SymbolKind.Parameter))
                return true;

            return false;
        }