37 lines
903 B
C#
37 lines
903 B
C#
using NubLang.Syntax;
|
|
|
|
namespace NubLang.Modules;
|
|
|
|
public class Module
|
|
{
|
|
private readonly List<DefinitionSyntax> _definitions = [];
|
|
|
|
public void Register(DefinitionSyntax definition)
|
|
{
|
|
_definitions.Add(definition);
|
|
}
|
|
|
|
public List<StructSyntax> Structs(bool includePrivate)
|
|
{
|
|
return _definitions
|
|
.OfType<StructSyntax>()
|
|
.Where(x => x.Exported || includePrivate)
|
|
.ToList();
|
|
}
|
|
|
|
public List<StructTemplateSyntax> StructTemplates(bool includePrivate)
|
|
{
|
|
return _definitions
|
|
.OfType<StructTemplateSyntax>()
|
|
.Where(x => x.Exported || includePrivate)
|
|
.ToList();
|
|
}
|
|
|
|
public List<FuncSyntax> Functions(bool includePrivate)
|
|
{
|
|
return _definitions
|
|
.OfType<FuncSyntax>()
|
|
.Where(x => x.Exported || includePrivate)
|
|
.ToList();
|
|
}
|
|
} |