Fixes for script binding not working

This commit is contained in:
Deukhoofd 2019-01-20 22:27:47 +01:00
parent 20dfcf6ec6
commit b9183be4e7
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
4 changed files with 8 additions and 6 deletions

View File

@ -41,11 +41,11 @@ namespace Upsilon.BaseTypes.ScriptFunction
{ {
if (option.Parameters.Length != variables.Length) if (option.Parameters.Length != variables.Length)
continue; continue;
bool isCompatible = true; var isCompatible = true;
for (var index = 0; index < variables.Length; index++) for (var index = 0; index < variables.Length; index++)
{ {
var parameter = option.Parameters[index]; var parameter = option.Parameters[index];
var parameterSymbol = ((UserDataVariableSymbol)parameter.VariableSymbol); var parameterSymbol = ((UserDataVariableSymbol) parameter.VariableSymbol);
var parameterType = variables[index].GetType(); var parameterType = variables[index].GetType();
if (parameterSymbol.BoundTypeDefinition != null) if (parameterSymbol.BoundTypeDefinition != null)
{ {

View File

@ -245,7 +245,7 @@ namespace Upsilon.Binder
} }
UnboundFunctionExpression unbound = null; UnboundFunctionExpression unbound = null;
foreach (var functionExpression in this._unboundFunctions.Where(x => foreach (var functionExpression in _unboundFunctions.Where(x =>
{ {
if (x.Name == function.Name) if (x.Name == function.Name)
{ {

View File

@ -39,8 +39,7 @@ namespace Upsilon.Binder.VariableSymbols
var callingParameter = callingParameters[i]; var callingParameter = callingParameters[i];
if (callingParameter.Type == Type.Unknown || callingParameter.Type == Type.Nil) if (callingParameter.Type == Type.Unknown || callingParameter.Type == Type.Nil)
{ {
isValid = false; continue;
break;
} }
if (!functionParameter.ValidTypes.Type.HasFlag(callingParameter.Type)) if (!functionParameter.ValidTypes.Type.HasFlag(callingParameter.Type))

View File

@ -84,7 +84,10 @@ namespace Upsilon.BoundTypes
else else
{ {
methods.Add(methodName, methods.Add(methodName,
new UserDataBoundMethod(methodName, new List<UserDataBoundMethodOption>() {option})); new UserDataBoundMethod(methodName, new List<UserDataBoundMethodOption>() {option})
{
Type = Type.Function
});
} }
} }