Address warnings and (some) nullables (#2013)

This commit is contained in:
Cheena Malhotra
2023-04-18 20:57:13 -07:00
committed by GitHub
parent d56f2309da
commit 648d7dbd3c
83 changed files with 674 additions and 588 deletions

View File

@@ -1011,13 +1011,13 @@ namespace Microsoft.Kusto.ServiceLayer.LanguageServices
/// </summary>
/// <param name="uri"></param>
/// <param name="createIfNotExists">Creates a new instance if one doesn't exist</param>
internal ScriptParseInfo GetScriptParseInfo(string uri, bool createIfNotExists = false)
internal ScriptParseInfo? GetScriptParseInfo(string uri, bool createIfNotExists = false)
{
lock (this.parseMapLock)
{
if (this.ScriptParseInfoMap.ContainsKey(uri))
if (this.ScriptParseInfoMap.TryGetValue(uri, out ScriptParseInfo? scriptParseInfo))
{
return this.ScriptParseInfoMap[uri];
return scriptParseInfo;
}
else if (createIfNotExists)
{
@@ -1091,7 +1091,7 @@ namespace Microsoft.Kusto.ServiceLayer.LanguageServices
}
// If there is a single statement on the line, track it so that we can return it regardless of where the user's cursor is
SqlStatement lineStatement = null;
SqlStatement? lineStatement = null;
bool? lineHasSingleStatement = null;
// check if the batch matches parameters
@@ -1125,7 +1125,7 @@ namespace Microsoft.Kusto.ServiceLayer.LanguageServices
if (lineHasSingleStatement == true)
{
return lineStatement.Sql;
return lineStatement?.Sql ?? string.Empty;
}
}
}