Fixes for modules and function binding

This commit is contained in:
Deukhoofd 2019-01-20 22:57:18 +01:00
parent 3737ac826c
commit 01d408e5fd
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 12 additions and 5 deletions

View File

@ -77,6 +77,9 @@ namespace Upsilon.BaseTypes.ScriptFunction
{
var callingVariable = variables[index];
var optionVariable = option.Parameters[index];
if (callingVariable.Type == BaseTypes.Type.Unknown || callingVariable.Type == BaseTypes.Type.Nil ||
optionVariable.Type == BaseTypes.Type.Unknown)
continue;
if (callingVariable.Type != optionVariable.Type)
{
isCompatible = false;

View File

@ -258,12 +258,16 @@ namespace Upsilon.Binder
unbound = functionExpression;
break;
}
unbound.Block = (BoundBlockStatement) BindBlockStatement(unbound.UnboundBlock);
returnType = Scope.ReturnType;
Scope = Scope.ParentScope;
functionOption.IsBound = true;
functionOption.ResultType = returnType;
if (unbound != null)
{
unbound.Block = (BoundBlockStatement) BindBlockStatement(unbound.UnboundBlock);
returnType = Scope.ReturnType;
Scope = Scope.ParentScope;
functionOption.IsBound = true;
functionOption.ResultType = returnType;
}
}
}