Emit catch type mentions without variables

This commit is contained in:
copilot-swe-agent[bot]
2026-06-22 09:37:24 +00:00
committed by GitHub
parent 568a147f77
commit 4c9fa4dddc
2 changed files with 16 additions and 1 deletions

View File

@@ -23,7 +23,9 @@ namespace Semmle.Extraction.CSharp.Entities.Statements
}
else if (isSpecificCatchClause) // A catch clause of the form 'catch(Ex) { ... }'
{
trapFile.catch_type(this, Type.Create(Context, Context.GetType(Stmt.Declaration!.Type)).TypeRef, true);
var type = Type.Create(Context, Context.GetType(Stmt.Declaration!.Type));
trapFile.catch_type(this, type.TypeRef, true);
TypeMention.Create(Context, Stmt.Declaration!.Type, this, type);
}
else // A catch clause of the form 'catch { ... }'
{

View File

@@ -50,6 +50,19 @@ class TypeMentions
}
}
class CatchTypeMentions
{
void F()
{
try
{
}
catch (Exception)
{
}
}
}
class NameOfMethodGroups
{
int MethodGroup() => 0;