From edccffd6187f47640b2543c9aaff19ca0667ec2b Mon Sep 17 00:00:00 2001 From: nub31 Date: Mon, 8 Sep 2025 17:41:08 +0200 Subject: [PATCH] ... --- example/src/main.nub | 2 +- .../NubLang/Generation/QBE/QBEGenerator.cs | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/example/src/main.nub b/example/src/main.nub index 70ad1ef..84e3a9e 100644 --- a/example/src/main.nub +++ b/example/src/main.nub @@ -22,7 +22,7 @@ func main(args: []cstring): i64 let x: Printable = struct Human { name = "Oliver" age = 23 - } + } x.print() diff --git a/src/compiler/NubLang/Generation/QBE/QBEGenerator.cs b/src/compiler/NubLang/Generation/QBE/QBEGenerator.cs index 92f40b9..92dc40f 100644 --- a/src/compiler/NubLang/Generation/QBE/QBEGenerator.cs +++ b/src/compiler/NubLang/Generation/QBE/QBEGenerator.cs @@ -197,28 +197,28 @@ public class QBEGenerator return size; } - private bool EmitTryMoveInto(ExpressionNode source, string destinationPointer) + private bool EmitTryMoveInto(ExpressionNode source, string destinationLValue) { switch (source) { case ArrayInitializerNode arrayInitializer: { - EmitStore(source.Type, EmitArrayInitializer(arrayInitializer), destinationPointer); + EmitStore(source.Type, EmitArrayInitializer(arrayInitializer), destinationLValue); return true; } case StructInitializerNode structInitializer: { - EmitStructInitializer(structInitializer, destinationPointer); + EmitStructInitializer(structInitializer, destinationLValue); return true; } case InterfaceInitializerNode interfaceInitializer: { - EmitInterfaceInitializer(interfaceInitializer, destinationPointer); + EmitInterfaceInitializer(interfaceInitializer, destinationLValue); return true; } case LiteralNode { Kind: LiteralKind.String } literal: { - EmitStore(source.Type, EmitLiteral(literal), destinationPointer); + EmitStore(source.Type, EmitLiteral(literal), destinationLValue); return true; } } @@ -226,10 +226,10 @@ public class QBEGenerator return false; } - private void EmitCopyIntoOrInitialize(ExpressionNode source, string destinationPointer) + private void EmitCopyIntoOrInitialize(ExpressionNode source, string destinationLValue) { // If the source is a value which is not used yet such as an array/struct initializer or literal, we can skip copying - if (EmitTryMoveInto(source, destinationPointer)) + if (EmitTryMoveInto(source, destinationLValue)) { return; } @@ -238,13 +238,13 @@ public class QBEGenerator if (source.Type.IsSimpleType(out var simpleType, out var complexType)) { - EmitStore(simpleType, value, destinationPointer); + EmitStore(simpleType, value, destinationLValue); } else { if (complexType is StructTypeNode or InterfaceTypeNode) { - EmitMemcpy(value, destinationPointer, SizeOf(complexType).ToString()); + EmitMemcpy(value, destinationLValue, SizeOf(complexType).ToString()); } else { @@ -259,7 +259,7 @@ public class QBEGenerator var buffer = TmpName(); _writer.Indented($"{buffer} =l alloc8 {size}"); EmitMemcpy(value, buffer, size); - EmitStore(complexType, buffer, destinationPointer); + EmitStore(complexType, buffer, destinationLValue); } } }