Interfaces working?

This commit is contained in:
nub31
2025-08-13 00:41:28 +02:00
parent 853f57102c
commit 41edf3b64b
5 changed files with 119 additions and 58 deletions

View File

@@ -346,11 +346,6 @@ public partial class QBEGenerator
return StructTypeName(structType.Name);
}
if (complexType is InterfaceTypeNode interfaceType)
{
return InterfaceTypeName(interfaceType.Name);
}
return "l";
}
@@ -434,11 +429,6 @@ public partial class QBEGenerator
return StructTypeName(structType.Name);
}
if (complexType is InterfaceTypeNode interfaceType)
{
return InterfaceTypeName(interfaceType.Name);
}
return "l";
}
}
@@ -496,10 +486,10 @@ public partial class QBEGenerator
{
var offset = 0;
if (structType.InterfaceImplementations.Any())
{
offset = 8;
}
// if (structType.InterfaceImplementations.Any())
// {
// offset = 8;
// }
foreach (var field in structType.Fields)
{
@@ -561,10 +551,10 @@ public partial class QBEGenerator
{
var offset = 0;
if (structDef.InterfaceImplementations.Any())
{
offset = 8;
}
// if (structDef.InterfaceImplementations.Any())
// {
// offset = 8;
// }
foreach (var field in structDef.Fields)
{
@@ -619,11 +609,6 @@ public partial class QBEGenerator
return $":{name}";
}
private string InterfaceTypeName(string name)
{
return $":{name}";
}
private string StructFuncName(string structName, string funcName)
{
return $"${structName}_{funcName}";
@@ -649,7 +634,7 @@ public class CStringLiteral(string value, string name)
public string Name { get; } = name;
}
public record Val(string Name, TypeNode Type, ValKind Kind, Val? ThisArg = null);
public record Val(string Name, TypeNode Type, ValKind Kind, string? ThisArg = null);
public class Scope(Scope? parent = null)
{