From e9e456bc88854b66028cd504f17794d7be745183 Mon Sep 17 00:00:00 2001 From: Stepami Date: Mon, 3 Feb 2025 15:41:21 +0300 Subject: [PATCH] =?UTF-8?q?#133=20-=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20AsString=20=D0=B2=20=D0=B2=D0=B5=D1=82=D0=BA=D1=83=20?= =?UTF-8?q?=D1=81=D0=BB=D0=BE=D0=B6=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B2=D1=8B?= =?UTF-8?q?=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=B4=20=D0=B3=D0=B5=D0=BD=D0=B0=20PrintStateme?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Visitors/InstructionProvider.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Application/HydraScript.Application.CodeGeneration/Visitors/InstructionProvider.cs b/src/Application/HydraScript.Application.CodeGeneration/Visitors/InstructionProvider.cs index 25511b4..142aad9 100644 --- a/src/Application/HydraScript.Application.CodeGeneration/Visitors/InstructionProvider.cs +++ b/src/Application/HydraScript.Application.CodeGeneration/Visitors/InstructionProvider.cs @@ -228,10 +228,13 @@ public AddressedInstructions Visit(PrintStatement visitable) if (visitable.Expression is PrimaryExpression prim) result.Add(new AsString(_valueDtoConverter.Convert(prim.ToValueDto()))); else + { result.AddRange(visitable.Expression.Accept(_expressionVisitor)); + var name = new Name(result.OfType().Last().Left!); + result.Add(new AsString(name)); + } - var last = new Name(result.OfType().Last().Left!); - result.Add(new Print(last)); + result.Add(new Print(new Name((result[result.End] as AsString)!.Left!))); return result; }