public Enumerator(SmallDictionary <K, V> dict) : this() { var root = dict._root; if (root != null) { // left == right only if both are nulls if (root.Left == root.Right) { _next = dict._root; } else { _stack = new Stack <AvlNode>(dict.HeightApprox()); _stack.Push(dict._root); } } }
public ValueCollection(SmallDictionary <K, V> dict) { _dict = dict; }
public KeyCollection(SmallDictionary <K, V> dict) { _dict = dict; }
static void addOptions( AnalyzerConfig.Section section, TreeOptions.Builder treeBuilder, AnalyzerOptions.Builder analyzerBuilder, ArrayBuilder <Diagnostic> diagnosticBuilder, string analyzerConfigPath, SmallDictionary <ReadOnlyMemory <char>, string> diagIdCache) { const string DiagnosticOptionPrefix = "dotnet_diagnostic."; const string DiagnosticOptionSuffix = ".severity"; foreach (var(key, value) in section.Properties) { // Keys are lowercased in editorconfig parsing int diagIdLength = -1; if (key.StartsWith(DiagnosticOptionPrefix, StringComparison.Ordinal) && key.EndsWith(DiagnosticOptionSuffix, StringComparison.Ordinal)) { diagIdLength = key.Length - (DiagnosticOptionPrefix.Length + DiagnosticOptionSuffix.Length); } if (diagIdLength >= 0) { ReadOnlyMemory <char> idSlice = key.AsMemory().Slice(DiagnosticOptionPrefix.Length, diagIdLength); if (!diagIdCache.TryGetValue(idSlice, out var diagId)) { diagId = idSlice.ToString(); diagIdCache.Add(diagId.AsMemory(), diagId); } ReportDiagnostic?severity; var comparer = StringComparer.OrdinalIgnoreCase; if (comparer.Equals(value, "default")) { severity = ReportDiagnostic.Default; } else if (comparer.Equals(value, "error")) { severity = ReportDiagnostic.Error; } else if (comparer.Equals(value, "warning")) { severity = ReportDiagnostic.Warn; } else if (comparer.Equals(value, "suggestion")) { severity = ReportDiagnostic.Info; } else if (comparer.Equals(value, "silent") || comparer.Equals(value, "refactoring")) { severity = ReportDiagnostic.Hidden; } else if (comparer.Equals(value, "none")) { severity = ReportDiagnostic.Suppress; } else { severity = null; diagnosticBuilder.Add(Diagnostic.Create( InvalidAnalyzerConfigSeverityDescriptor, Location.None, diagId, value, analyzerConfigPath)); } if (severity.HasValue) { treeBuilder[diagId] = severity.GetValueOrDefault(); } } else { analyzerBuilder[key] = value; } } }