...
This commit is contained in:
@@ -15,7 +15,7 @@ public static class Parser
|
||||
private static IEnumerable<Token> _tokens = [];
|
||||
private static int _index;
|
||||
|
||||
public static SyntaxTree? ParseFile(IEnumerable<Token> tokens, string filePath, out IEnumerable<Diagnostic> diagnostics)
|
||||
public static SyntaxTree? ParseFile(IEnumerable<Token> tokens, out IEnumerable<Diagnostic> diagnostics)
|
||||
{
|
||||
_tokens = tokens;
|
||||
_namespace = null!;
|
||||
@@ -46,7 +46,7 @@ public static class Parser
|
||||
}
|
||||
|
||||
diagnostics = _diagnostics;
|
||||
return new SyntaxTree(filePath, _namespace, definitions);
|
||||
return new SyntaxTree(_namespace, definitions);
|
||||
}
|
||||
catch (ParseException ex)
|
||||
{
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
namespace Syntax.Parsing;
|
||||
|
||||
public record SyntaxTree(string FilePath, string Namespace, List<DefinitionNode> Definitions);
|
||||
public record SyntaxTree(string Namespace, List<DefinitionNode> Definitions);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Common;
|
||||
using Syntax.Diagnostics;
|
||||
using Syntax.Parsing;
|
||||
using Syntax.Parsing.Node;
|
||||
using Syntax.Tokenization;
|
||||
@@ -16,7 +17,7 @@ public static class Binder
|
||||
private static Dictionary<string, NubType> _variables = new();
|
||||
private static NubType? _funcReturnType;
|
||||
|
||||
public static BoundSyntaxTree Bind(SyntaxTree syntaxTree, DefinitionTable definitionTable)
|
||||
public static BoundSyntaxTree Bind(SyntaxTree syntaxTree, DefinitionTable definitionTable, out IEnumerable<Diagnostic> diagnostics)
|
||||
{
|
||||
_syntaxTree = syntaxTree;
|
||||
_definitionTable = definitionTable;
|
||||
@@ -31,7 +32,8 @@ public static class Binder
|
||||
definitions.Add(BindDefinition(definition));
|
||||
}
|
||||
|
||||
return new BoundSyntaxTree(syntaxTree.FilePath, syntaxTree.Namespace, definitions);
|
||||
diagnostics = [];
|
||||
return new BoundSyntaxTree(syntaxTree.Namespace, definitions);
|
||||
}
|
||||
|
||||
private static BoundDefinitionNode BindDefinition(DefinitionNode node)
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
namespace Syntax.Typing;
|
||||
|
||||
public record BoundSyntaxTree(string FilePath, string Namespace, List<BoundDefinitionNode> Definitions);
|
||||
public record BoundSyntaxTree(string Namespace, List<BoundDefinitionNode> Definitions);
|
||||
|
||||
Reference in New Issue
Block a user