Templates are working, but the code is ugly af
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Reflection;
|
||||
using NubLang.CLI;
|
||||
using NubLang;
|
||||
using NubLang.Common;
|
||||
using NubLang.Diagnostics;
|
||||
using NubLang.Generation;
|
||||
using NubLang.Generation.QBE;
|
||||
@@ -8,6 +9,7 @@ using NubLang.Syntax.Binding;
|
||||
using NubLang.Syntax.Binding.Node;
|
||||
using NubLang.Syntax.Parsing;
|
||||
using NubLang.Syntax.Parsing.Node;
|
||||
using NubLang.Syntax.Templating;
|
||||
using NubLang.Syntax.Tokenization;
|
||||
using Binder = NubLang.Syntax.Binding.Binder;
|
||||
|
||||
@@ -93,6 +95,15 @@ foreach (var file in options.Files)
|
||||
syntaxTrees[file] = syntaxTree;
|
||||
}
|
||||
|
||||
var templateTable = new TemplateTable(syntaxTrees.Values);
|
||||
|
||||
foreach (var (file, syntaxTree) in syntaxTrees)
|
||||
{
|
||||
var templateGenerator = new TemplateGenerator(syntaxTree, templateTable);
|
||||
var definitions = templateGenerator.Generate();
|
||||
syntaxTrees[file] = syntaxTree with { Definitions = syntaxTree.Definitions.Concat(definitions).ToList() };
|
||||
}
|
||||
|
||||
var definitionTable = new DefinitionTable(syntaxTrees.Values);
|
||||
|
||||
var boundSyntaxTrees = new Dictionary<string, BoundSyntaxTree>();
|
||||
|
||||
Reference in New Issue
Block a user