libs working

This commit is contained in:
nub31
2026-02-10 22:43:03 +01:00
parent 576abe1240
commit 9d8d8f255a
13 changed files with 234 additions and 30 deletions

View File

@@ -23,8 +23,6 @@ public class ModuleGraph(Dictionary<string, ModuleGraph.Module> modules)
return new Manifest(1, GetModules().Select(x => x.CreateManifestModule()).ToList());
}
public record Manifest(int Version, IReadOnlyList<Module.ManifestModule> Modules);
public sealed class Module(string name)
{
public string Name { get; } = name;
@@ -110,7 +108,7 @@ public class ModuleGraph(Dictionary<string, ModuleGraph.Module> modules)
public ManifestCustomTypeInfo CreateManifestCustomTypeInfo()
{
return new ManifestCustomTypeInfo(Type, Exported);
return new ManifestCustomTypeInfo(TypeMangler.Encode(Type), Exported);
}
}
@@ -122,13 +120,9 @@ public class ModuleGraph(Dictionary<string, ModuleGraph.Module> modules)
public ManifestIdentifierInfo CreateManifestIdentifierInfo()
{
return new ManifestIdentifierInfo(Type, Exported);
return new ManifestIdentifierInfo(TypeMangler.Encode(Type), Exported);
}
}
public record ManifestModule(string Name, Dictionary<string, ManifestCustomTypeInfo> CustomTypes, Dictionary<string, ManifestIdentifierInfo> Identifiers);
public record ManifestCustomTypeInfo(NubType Type, bool Exported);
public record ManifestIdentifierInfo(NubType Type, bool Exported);
}
public class Builder
@@ -165,12 +159,14 @@ public class ModuleGraph(Dictionary<string, ModuleGraph.Module> modules)
foreach (var customType in manifestModule.CustomTypes)
{
module.AddCustomType(customType.Key, new Module.CustomTypeInfo(customType.Value.Type, customType.Value.Exported, Module.Source.Lib));
var decoded = TypeMangler.Decode(customType.Value.EncodedType);
module.AddCustomType(customType.Key, new Module.CustomTypeInfo(decoded, customType.Value.Exported, Module.Source.Lib));
}
foreach (var customType in manifestModule.Identifiers)
foreach (var identifier in manifestModule.Identifiers)
{
module.AddIdentifier(customType.Key, new Module.IdentifierInfo(customType.Value.Type, customType.Value.Exported, Module.Source.Lib));
var decoded = TypeMangler.Decode(identifier.Value.EncodedType);
module.AddIdentifier(identifier.Key, new Module.IdentifierInfo(decoded, identifier.Value.Exported, Module.Source.Lib));
}
}
}
@@ -274,4 +270,9 @@ public class ModuleGraph(Dictionary<string, ModuleGraph.Module> modules)
}
}
}
}
}
public record Manifest(int Version, IReadOnlyList<ManifestModule> Modules);
public record ManifestModule(string Name, Dictionary<string, ManifestCustomTypeInfo> CustomTypes, Dictionary<string, ManifestIdentifierInfo> Identifiers);
public record ManifestCustomTypeInfo(string EncodedType, bool Exported);
public record ManifestIdentifierInfo(string EncodedType, bool Exported);