remove read only stuff

This commit is contained in:
nub31
2025-09-12 17:08:10 +02:00
parent bace846a2a
commit 314f7efc7b
15 changed files with 41 additions and 42 deletions

View File

@@ -8,7 +8,7 @@ public class Module
private readonly List<ModuleInterfaceType> _interfaces = [];
private readonly List<ModuleFuncType> _functions = [];
public void RegisterStruct(bool exported, string name, IReadOnlyList<ModuleStructTypeField> fields)
public void RegisterStruct(bool exported, string name, List<ModuleStructTypeField> fields)
{
_structs.Add(new ModuleStructType(exported, name, fields));
}
@@ -23,17 +23,17 @@ public class Module
_functions.Add(new ModuleFuncType(exported, name, externSymbol, type));
}
public IReadOnlyList<ModuleStructType> StructTypes(bool includePrivate)
public List<ModuleStructType> StructTypes(bool includePrivate)
{
return _structs.Where(x => x.Exported || includePrivate).ToList();
}
public IReadOnlyList<ModuleInterfaceType> InterfaceTypes(bool includePrivate)
public List<ModuleInterfaceType> InterfaceTypes(bool includePrivate)
{
return _interfaces.Where(x => x.Exported || includePrivate).ToList();
}
public IReadOnlyList<ModuleFuncType> Functions(bool includePrivate)
public List<ModuleFuncType> Functions(bool includePrivate)
{
return _functions.Where(x => x.Exported || includePrivate).ToList();
}
@@ -41,7 +41,7 @@ public class Module
public record ModuleStructTypeField(string Name, TypeSyntax Type, bool HasDefaultValue);
public record ModuleStructType(bool Exported, string Name, IReadOnlyList<ModuleStructTypeField> Fields);
public record ModuleStructType(bool Exported, string Name, List<ModuleStructTypeField> Fields);
public record ModuleInterfaceType(bool Exported, string Name);

View File

@@ -6,7 +6,7 @@ public class ModuleRepository
{
private readonly Dictionary<string, Module> _modules = new();
public ModuleRepository(IReadOnlyList<SyntaxTree> syntaxTrees)
public ModuleRepository(List<SyntaxTree> syntaxTrees)
{
foreach (var syntaxTree in syntaxTrees)
{
@@ -48,7 +48,7 @@ public class ModuleRepository
}
}
public IReadOnlyDictionary<string, Module> Modules()
public Dictionary<string, Module> Modules()
{
return _modules;
}