1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

C#: Ignore late bound methods in MustBeVariantAnalyzer

If symbol is late bound (as is the case when using `dynamic`) we can't obtain the symbol to analyze the usage of `[MustBeVariant]`.
This commit is contained in:
Raul Santos
2024-04-30 19:36:43 +02:00
parent d282e4f0e6
commit 1510f88ae1
2 changed files with 18 additions and 2 deletions

View File

@@ -50,8 +50,18 @@ namespace Godot.SourceGenerators
var typeSymbol = sm.GetSymbolInfo(typeSyntax).Symbol as ITypeSymbol;
Helper.ThrowIfNull(typeSymbol);
var parentSymbol = sm.GetSymbolInfo(parentSyntax).Symbol;
Helper.ThrowIfNull(parentSymbol);
var parentSymbolInfo = sm.GetSymbolInfo(parentSyntax);
var parentSymbol = parentSymbolInfo.Symbol;
if (parentSymbol == null)
{
if (parentSymbolInfo.CandidateReason == CandidateReason.LateBound)
{
// Invocations on dynamic are late bound so we can't retrieve the symbol.
continue;
}
Helper.ThrowIfNull(parentSymbol);
}
if (!ShouldCheckTypeArgument(context, parentSyntax, parentSymbol, typeSyntax, typeSymbol, i))
{