Fix small bug and add todo

This commit is contained in:
nub31
2025-06-22 20:29:36 +02:00
parent c90645f751
commit d32b40fb7b

View File

@@ -7,13 +7,14 @@ using UnaryExpressionNode = Syntax.Parsing.Node.UnaryExpressionNode;
namespace Syntax.Typing;
// TODO: Currently anonymous function does not get a new scope
public static class Binder
{
private static SyntaxTree _syntaxTree = null!;
private static DefinitionTable _definitionTable = null!;
private static NubType? _funcReturnType = null;
private static Dictionary<string, NubType> _variables = new();
private static NubType? _funcReturnType;
public static BoundSyntaxTree Bind(SyntaxTree syntaxTree, DefinitionTable definitionTable)
{
@@ -21,6 +22,7 @@ public static class Binder
_definitionTable = definitionTable;
_variables = [];
_funcReturnType = null;
var definitions = new List<BoundDefinitionNode>();
@@ -269,7 +271,8 @@ public static class Binder
private static BoundArrayInitializerNode BindArrayInitializer(ArrayInitializerNode expression)
{
return new BoundArrayInitializerNode(expression.Tokens, new NubArrayType(expression.ElementType), BindExpression(expression.Capacity, NubPrimitiveType.U64), expression.ElementType);
return new BoundArrayInitializerNode(expression.Tokens, new NubArrayType(expression.ElementType), BindExpression(expression.Capacity, NubPrimitiveType.U64),
expression.ElementType);
}
private static BoundBinaryExpressionNode BindBinaryExpression(BinaryExpressionNode expression)