...
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using NubLang.Parsing.Syntax;
|
||||
using NubLang.TypeChecking.Node;
|
||||
|
||||
namespace NubLang.Modules;
|
||||
|
||||
public class Module
|
||||
{
|
||||
private readonly List<ModuleStruct> _structs = [];
|
||||
private readonly List<ModuleStructTemplate> _structTemplates = [];
|
||||
private readonly List<StructTemplateSyntax> _structTemplates = [];
|
||||
private readonly List<ModuleFunction> _functions = [];
|
||||
|
||||
public void RegisterStruct(bool exported, string name, List<ModuleStructField> fields, List<ModuleStructFunction> functions)
|
||||
@@ -14,9 +13,9 @@ public class Module
|
||||
_structs.Add(new ModuleStruct(exported, name, fields, functions));
|
||||
}
|
||||
|
||||
public void RegisterStructTemplate(bool exported, string name, List<string> templateArguments, List<StructFieldNode> fields, List<StructFuncNode> functions)
|
||||
public void RegisterStructTemplate(StructTemplateSyntax structTemplate)
|
||||
{
|
||||
_structTemplates.Add(new ModuleStructTemplate(exported, name, templateArguments, fields, functions));
|
||||
_structTemplates.Add(structTemplate);
|
||||
}
|
||||
|
||||
public void RegisterFunction(bool exported, string name, string? externSymbol, List<ModuleFunctionParameter> parameters, TypeSyntax returnType)
|
||||
@@ -43,6 +42,4 @@ public record ModuleStruct(bool Exported, string Name, List<ModuleStructField> F
|
||||
|
||||
public record ModuleFunctionParameter(string Name, TypeSyntax Type);
|
||||
|
||||
public record ModuleFunction(bool Exported, string Name, string? ExternSymbol, List<ModuleFunctionParameter> Parameters, TypeSyntax ReturnType);
|
||||
|
||||
public record ModuleStructTemplate(bool Exported, string Name, List<string> TemplateArguments, List<StructFieldNode> Fields, List<StructFuncNode> Functions);
|
||||
public record ModuleFunction(bool Exported, string Name, string? ExternSymbol, List<ModuleFunctionParameter> Parameters, TypeSyntax ReturnType);
|
||||
@@ -53,7 +53,7 @@ public class ModuleRepository
|
||||
}
|
||||
case StructTemplateSyntax structDef:
|
||||
{
|
||||
// todo(nub31): Include templates in modules
|
||||
module.RegisterStructTemplate(structDef);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user