...
This commit is contained in:
@@ -8,7 +8,7 @@ namespace NubLang.Syntax.Binding;
|
||||
|
||||
public sealed class Binder
|
||||
{
|
||||
private readonly SyntaxTree _syntaxTree;
|
||||
private readonly ParseTree _parseTree;
|
||||
private readonly DefinitionTable _definitionTable;
|
||||
|
||||
private readonly Stack<Scope> _scopes = [];
|
||||
@@ -16,9 +16,9 @@ public sealed class Binder
|
||||
|
||||
private Scope Scope => _scopes.Peek();
|
||||
|
||||
public Binder(SyntaxTree syntaxTree, DefinitionTable definitionTable)
|
||||
public Binder(ParseTree parseTree, DefinitionTable definitionTable)
|
||||
{
|
||||
_syntaxTree = syntaxTree;
|
||||
_parseTree = parseTree;
|
||||
_definitionTable = definitionTable;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public sealed class Binder
|
||||
var diagnostics = new List<Diagnostic>();
|
||||
var definitions = new List<BoundDefinition>();
|
||||
|
||||
foreach (var definition in _syntaxTree.Definitions)
|
||||
foreach (var definition in _parseTree.Definitions)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -42,7 +42,7 @@ public sealed class Binder
|
||||
}
|
||||
}
|
||||
|
||||
return new BoundSyntaxTree(_syntaxTree.Namespace, definitions, diagnostics);
|
||||
return new BoundSyntaxTree(_parseTree.Namespace, definitions, diagnostics);
|
||||
}
|
||||
|
||||
private BoundDefinition BindDefinition(DefinitionSyntax node)
|
||||
@@ -309,7 +309,7 @@ public sealed class Binder
|
||||
|
||||
private BoundExpression BindIdentifier(IdentifierSyntax expression)
|
||||
{
|
||||
var @namespace = expression.Namespace.Or(_syntaxTree.Namespace);
|
||||
var @namespace = expression.Namespace.Or(_parseTree.Namespace);
|
||||
var localFuncs = _definitionTable.LookupLocalFunc(@namespace, expression.Name).ToArray();
|
||||
if (localFuncs.Length > 0)
|
||||
{
|
||||
@@ -365,7 +365,7 @@ public sealed class Binder
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
|
||||
return new BoundLiteral(expression.Tokens, type, expression.Literal, expression.Kind);
|
||||
return new BoundLiteral(expression.Tokens, type, expression.Value, expression.Kind);
|
||||
}
|
||||
|
||||
private BoundExpression BindMemberAccess(MemberAccessSyntax expression)
|
||||
|
||||
Reference in New Issue
Block a user