...
This commit is contained in:
@@ -224,6 +224,11 @@ public partial class QBEGenerator
|
||||
EmitStructInitializer(structInitializer, destinationPointer);
|
||||
return true;
|
||||
}
|
||||
case InterfaceInitializerNode interfaceInitializer:
|
||||
{
|
||||
EmitInterfaceInitializer(interfaceInitializer, destinationPointer);
|
||||
return true;
|
||||
}
|
||||
case LiteralNode { Kind: LiteralKind.String } literal:
|
||||
{
|
||||
EmitStore(source.Type, EmitUnwrap(EmitLiteral(literal)), destinationPointer);
|
||||
@@ -250,9 +255,9 @@ public partial class QBEGenerator
|
||||
}
|
||||
else
|
||||
{
|
||||
if (complexType is StructTypeNode structType)
|
||||
if (complexType is StructTypeNode or InterfaceTypeNode)
|
||||
{
|
||||
EmitMemcpy(value, destinationPointer, SizeOf(structType).ToString());
|
||||
EmitMemcpy(value, destinationPointer, SizeOf(complexType).ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -261,7 +266,6 @@ public partial class QBEGenerator
|
||||
ArrayTypeNode arrayType => EmitArraySizeInBytes(arrayType, value),
|
||||
CStringTypeNode => EmitCStringSizeInBytes(value),
|
||||
StringTypeNode => EmitStringSizeInBytes(value),
|
||||
InterfaceTypeNode => 16.ToString(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(source.Type))
|
||||
};
|
||||
|
||||
@@ -311,7 +315,7 @@ public partial class QBEGenerator
|
||||
ArrayTypeNode arrayType => EmitArraySizeInBytes(arrayType, value),
|
||||
CStringTypeNode => EmitCStringSizeInBytes(value),
|
||||
StringTypeNode => EmitStringSizeInBytes(value),
|
||||
InterfaceTypeNode => 16.ToString(),
|
||||
InterfaceTypeNode interfaceType => SizeOf(interfaceType).ToString(),
|
||||
StructTypeNode structType => SizeOf(structType).ToString(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(source.Type))
|
||||
};
|
||||
@@ -486,11 +490,6 @@ public partial class QBEGenerator
|
||||
{
|
||||
var offset = 0;
|
||||
|
||||
// if (structType.InterfaceImplementations.Any())
|
||||
// {
|
||||
// offset = 8;
|
||||
// }
|
||||
|
||||
foreach (var field in structType.Fields)
|
||||
{
|
||||
var fieldAlignment = AlignmentOf(field);
|
||||
|
||||
Reference in New Issue
Block a user