...
This commit is contained in:
@@ -18,7 +18,7 @@ public static class CType
|
||||
NubConstArrayType arr => CreateConstArrayType(arr, variableName, constArraysAsPointers),
|
||||
NubArrayType arr => CreateArrayType(arr, variableName),
|
||||
NubFuncType fn => CreateFuncType(fn, variableName),
|
||||
NubStructType st => $"struct {st.Module}_{st.Name}" + (variableName != null ? $" {variableName}" : ""),
|
||||
NubStructType st => $"struct {st.Module}_{st.Name}_{NameMangler.Mangle(st)}" + (variableName != null ? $" {variableName}" : ""),
|
||||
_ => throw new NotSupportedException($"C type generation not supported for: {type}")
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,11 +29,6 @@ public class Generator
|
||||
return externSymbol ?? $"{module}_{name}";
|
||||
}
|
||||
|
||||
private static string StructName(string module, string name)
|
||||
{
|
||||
return $"{module}_{name}";
|
||||
}
|
||||
|
||||
public string Emit()
|
||||
{
|
||||
_writer.WriteLine("""
|
||||
@@ -53,7 +48,7 @@ public class Generator
|
||||
|
||||
foreach (var structType in _compilationUnit.ImportedStructTypes)
|
||||
{
|
||||
_writer.WriteLine($"struct {StructName(structType.Module, structType.Name)}");
|
||||
_writer.WriteLine(CType.Create(structType));
|
||||
_writer.WriteLine("{");
|
||||
using (_writer.Indent())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user