public static void AddExternalNotNullMethods(Compilation compilation, AdditionalText config) { lock (ExternalNotNullMethods) { var text = config.GetText(); if (lastConfigLength == text.Length) { return; } ExternalNotNullMethods.Clear(); lastConfigLength = text.Length; // SourceText.Lines sometimes doesn't actually split the text into multiple lines foreach (var method in text.ToString().Split('\n').Select(i => i.Trim())) { if (!method.Contains(".")) { return; } foreach (var match in ParseMethodName(compilation, method)) { ExternalNotNullMethods.Add(match); } } } }
public bool IsMethodCallThatIsNotNull(IMethodSymbol method) { using (new OperationTimer(i => Timings.Update(TimingOperation.SymbolLookup, i))) { var reduced = method.OriginalDefinition.ReducedFrom ?? method.OriginalDefinition; if (NotNullFrameworkMethods.Contains(reduced) || ExternalNotNullMethods.Contains(reduced)) { return(true); } return(false); } }
public bool IsPropertyThatIsNotNull(ISymbol property) { if (DictionaryValues != null && DictionaryValues.Equals(property.OriginalDefinition)) { return(true); } if (DictionaryValues != null && DictionaryKeys.Equals(property.OriginalDefinition)) { return(true); } if (ExternalNotNullMethods.Contains(property)) { return(true); } return(false); }