From 3d64f909cfb55d8886ac4b4839a98f8f6cdc98e7 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 2 Dec 2025 15:45:14 +0100 Subject: feat: support of struct literal composite Added missing vm instructions to allocate a typed value on the stack and to set a structure field. It's possible now to generate struct literal composites for non keyed struct fields. --- vm/op_string.go | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'vm/op_string.go') diff --git a/vm/op_string.go b/vm/op_string.go index ac5b557..63bf738 100644 --- a/vm/op_string.go +++ b/vm/op_string.go @@ -20,34 +20,36 @@ func _() { _ = x[Deref-9] _ = x[Dup-10] _ = x[Fdup-11] - _ = x[Equal-12] - _ = x[EqualSet-13] - _ = x[Exit-14] - _ = x[Field-15] - _ = x[Greater-16] - _ = x[Grow-17] - _ = x[Index-18] - _ = x[Jump-19] - _ = x[JumpTrue-20] - _ = x[JumpFalse-21] - _ = x[JumpSetTrue-22] - _ = x[JumpSetFalse-23] - _ = x[Lower-24] - _ = x[Loweri-25] - _ = x[Mul-26] - _ = x[New-27] - _ = x[Not-28] - _ = x[Pop-29] - _ = x[Push-30] - _ = x[Return-31] - _ = x[Sub-32] - _ = x[Subi-33] - _ = x[Swap-34] + _ = x[Fnew-12] + _ = x[Equal-13] + _ = x[EqualSet-14] + _ = x[Exit-15] + _ = x[Field-16] + _ = x[FieldSet-17] + _ = x[Greater-18] + _ = x[Grow-19] + _ = x[Index-20] + _ = x[Jump-21] + _ = x[JumpTrue-22] + _ = x[JumpFalse-23] + _ = x[JumpSetTrue-24] + _ = x[JumpSetFalse-25] + _ = x[Lower-26] + _ = x[Loweri-27] + _ = x[Mul-28] + _ = x[New-29] + _ = x[Not-30] + _ = x[Pop-31] + _ = x[Push-32] + _ = x[Return-33] + _ = x[Sub-34] + _ = x[Subi-35] + _ = x[Swap-36] } -const _Op_name = "NopAddAddrAssignFassignVassignCallCalliCallXDerefDupFdupEqualEqualSetExitFieldGreaterGrowIndexJumpJumpTrueJumpFalseJumpSetTrueJumpSetFalseLowerLoweriMulNewNotPopPushReturnSubSubiSwap" +const _Op_name = "NopAddAddrAssignFassignVassignCallCalliCallXDerefDupFdupFnewEqualEqualSetExitFieldFieldSetGreaterGrowIndexJumpJumpTrueJumpFalseJumpSetTrueJumpSetFalseLowerLoweriMulNewNotPopPushReturnSubSubiSwap" -var _Op_index = [...]uint8{0, 3, 6, 10, 16, 23, 30, 34, 39, 44, 49, 52, 56, 61, 69, 73, 78, 85, 89, 94, 98, 106, 115, 126, 138, 143, 149, 152, 155, 158, 161, 165, 171, 174, 178, 182} +var _Op_index = [...]uint8{0, 3, 6, 10, 16, 23, 30, 34, 39, 44, 49, 52, 56, 60, 65, 73, 77, 82, 90, 97, 101, 106, 110, 118, 127, 138, 150, 155, 161, 164, 167, 170, 173, 177, 183, 186, 190, 194} func (i Op) String() string { idx := int(i) - 0 -- cgit v1.2.3