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 callingVariable = variables[index];
var optionVariable = option.Parameters[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) if (callingVariable.Type != optionVariable.Type)
{ {
isCompatible = false; isCompatible = false;

View File

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