Skip to content

Commit 66885b4

Browse files
committed
#196 - handle string values directly in AsString instruction
1 parent d087b15 commit 66885b4

File tree

1 file changed

+6
-3
lines changed
  • src/Domain/HydraScript.Domain.BackEnd/Impl/Instructions/WithAssignment

1 file changed

+6
-3
lines changed

src/Domain/HydraScript.Domain.BackEnd/Impl/Instructions/WithAssignment/AsString.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ public partial class AsString(IValue value) : Simple(value)
1818
public override IAddress? Execute(IExecuteParams executeParams)
1919
{
2020
var frame = executeParams.Frames.Peek();
21-
frame[Left!] = JsonSerializer.Serialize(
22-
value: Right.right!.Get(frame)!,
23-
AsStringJsonContext.Object);
21+
var value = Right.right!.Get(frame);
22+
frame[Left!] = value is string
23+
? value
24+
: JsonSerializer.Serialize(
25+
value: Right.right!.Get(frame)!,
26+
AsStringJsonContext.Object);
2427

2528
return Address.Next;
2629
}

0 commit comments

Comments
 (0)