Bind functions even when they're not called, but with `Unknown` type parameters

This commit is contained in:
Deukhoofd 2018-11-15 20:54:44 +01:00
parent da6e95bfac
commit eff60375ea
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,19 @@ namespace Upsilon.Binder
public BoundScript BindScript(BlockStatementSyntax e)
{
var bound = BindStatement(e);
foreach (var unboundFunctionStatement in _unboundFunctions)
{
_scope = new BoundScope(_scope);
foreach (var valueParameter in unboundFunctionStatement.Value.Parameters)
{
_scope.SetVariable(valueParameter);
}
unboundFunctionStatement.Value.Block =
(BoundBlockStatement) BindBlockStatement(unboundFunctionStatement.Value.UnboundBlock);
_scope = _scope.ParentScope;
unboundFunctionStatement.Key.IsBound = true;
}
_unboundFunctions = new Dictionary<FunctionVariableSymbol, UnboundFunctionStatement>();
return new BoundScript(bound);
}