mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-08 08:53:04 +00:00
Add a new test and fix for logging statements in child blocks
This commit is contained in:
parent
40bceebacb
commit
81988c9ed8
2 changed files with 32 additions and 2 deletions
|
@ -146,9 +146,9 @@ namespace Ryujinx.Analyzers
|
|||
bool exceptionLogged = false;
|
||||
|
||||
// Iterate through all expression statements
|
||||
foreach (var statement in catchClauseSyntax.Block.Statements)
|
||||
foreach (var blockNode in catchClauseSyntax.Block.DescendantNodes())
|
||||
{
|
||||
if (statement is not ExpressionStatementSyntax expressionStatement)
|
||||
if (blockNode is not ExpressionStatementSyntax expressionStatement)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -214,6 +214,36 @@ public class MyClass
|
|||
}
|
||||
}
|
||||
}
|
||||
";
|
||||
|
||||
await Verifier.VerifyAnalyzerAsync(text).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LogWithIdentifierInSubBlock_NoDiagnostic()
|
||||
{
|
||||
string text = _loggerText + @"
|
||||
public class MyClass
|
||||
{
|
||||
public void MyMethod9()
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine(""test"");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string testString = ""first time?"";
|
||||
|
||||
if (1 == 1)
|
||||
{
|
||||
Ryujinx.Common.Logging.Logger.Info?.Print(Ryujinx.Common.Logging.LogClass.Application, $""test: {testString} Error: {ex.Message}"");
|
||||
}
|
||||
|
||||
Console.WriteLine(""Test"");
|
||||
}
|
||||
}
|
||||
}
|
||||
";
|
||||
|
||||
await Verifier.VerifyAnalyzerAsync(text).ConfigureAwait(false);
|
||||
|
|
Loading…
Reference in a new issue