Fix for exception when userdata method call does not exist

This commit is contained in:
Deukhoofd 2018-12-07 18:53:56 +01:00
parent e8369bb672
commit fa967383d6
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 5 additions and 2 deletions

View File

@ -281,9 +281,12 @@ namespace Upsilon.Binder
}
else if (resolved is UserDataVariableSymbol udSymbol)
{
if (udSymbol.Parent != null && udSymbol.Parent.Properties[resolved.Name] is UserDataBoundMethod ubMethod)
if (udSymbol.Parent != null )
{
returnType = ubMethod.ResultType;
if (udSymbol.Parent.Properties.TryGetValue(resolved.Name, out var ubProperty) && ubProperty is UserDataBoundMethod ubMethod)
{
returnType = ubMethod.ResultType;
}
}
}
return new BoundFunctionCallExpression(expression, parameters.ToImmutable(), e.Span, returnType);