Skip to content

Commit f2ed303

Browse files
authored
#133 - добавил AsString в ветку сложного выражения для код гена PrintStatement (#134)
1 parent 12a289d commit f2ed303

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Application/HydraScript.Application.CodeGeneration/Visitors/InstructionProvider.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,13 @@ public AddressedInstructions Visit(PrintStatement visitable)
228228
if (visitable.Expression is PrimaryExpression prim)
229229
result.Add(new AsString(_valueDtoConverter.Convert(prim.ToValueDto())));
230230
else
231+
{
231232
result.AddRange(visitable.Expression.Accept(_expressionVisitor));
233+
var name = new Name(result.OfType<Simple>().Last().Left!);
234+
result.Add(new AsString(name));
235+
}
232236

233-
var last = new Name(result.OfType<Simple>().Last().Left!);
234-
result.Add(new Print(last));
237+
result.Add(new Print(new Name((result[result.End] as AsString)!.Left!)));
235238

236239
return result;
237240
}

0 commit comments

Comments
 (0)