...
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace Compiler;
|
||||
|
||||
public sealed class Generator(List<TypedNodeDefinitionFunc> functions, ModuleGraph moduleGraph)
|
||||
public sealed class Generator(List<TypedNodeDefinitionFunc> functions, ModuleGraph moduleGraph, bool compileLib)
|
||||
{
|
||||
public static string Emit(List<TypedNodeDefinitionFunc> functions, ModuleGraph moduleGraph)
|
||||
public static string Emit(List<TypedNodeDefinitionFunc> functions, ModuleGraph moduleGraph, bool compileLib)
|
||||
{
|
||||
return new Generator(functions, moduleGraph).Emit();
|
||||
return new Generator(functions, moduleGraph, compileLib).Emit();
|
||||
}
|
||||
|
||||
private readonly IndentedTextWriter writer = new();
|
||||
@@ -79,10 +79,10 @@ public sealed class Generator(List<TypedNodeDefinitionFunc> functions, ModuleGra
|
||||
|
||||
writer.WriteLine();
|
||||
|
||||
var main = functions.FirstOrDefault(x => x.Module == "main" && x.Name.Ident == "main");
|
||||
|
||||
if (main != null)
|
||||
if (!compileLib)
|
||||
{
|
||||
var main = functions.First(x => x.Module == "main" && x.Name.Ident == "main");
|
||||
|
||||
writer.WriteLine($$"""
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user