@@ -204,11 +204,11 @@ func TestCompiler_Compile(t *testing.T) {
204
204
expectCompile (t , `if true { 10 }; 3333` ,
205
205
bytecode (
206
206
concatInsts (
207
- tengo .MakeInstruction (parser .OpTrue ), // 0000
208
- tengo .MakeInstruction (parser .OpJumpFalsy , 8 ), // 0001
209
- tengo .MakeInstruction (parser .OpConstant , 0 ), // 0004
210
- tengo .MakeInstruction (parser .OpPop ), // 0007
211
- tengo .MakeInstruction (parser .OpConstant , 1 ), // 0008
207
+ tengo .MakeInstruction (parser .OpTrue ), // 0000
208
+ tengo .MakeInstruction (parser .OpJumpFalsy , 10 ), // 0001
209
+ tengo .MakeInstruction (parser .OpConstant , 0 ), // 0004
210
+ tengo .MakeInstruction (parser .OpPop ), // 0007
211
+ tengo .MakeInstruction (parser .OpConstant , 1 ), // 0008
212
212
tengo .MakeInstruction (parser .OpPop ),
213
213
tengo .MakeInstruction (parser .OpSuspend )), // 0011
214
214
objectsArray (
@@ -219,10 +219,10 @@ func TestCompiler_Compile(t *testing.T) {
219
219
bytecode (
220
220
concatInsts (
221
221
tengo .MakeInstruction (parser .OpTrue ), // 0000
222
- tengo .MakeInstruction (parser .OpJumpFalsy , 11 ), // 0001
222
+ tengo .MakeInstruction (parser .OpJumpFalsy , 15 ), // 0001
223
223
tengo .MakeInstruction (parser .OpConstant , 0 ), // 0004
224
224
tengo .MakeInstruction (parser .OpPop ), // 0007
225
- tengo .MakeInstruction (parser .OpJump , 15 ), // 0008
225
+ tengo .MakeInstruction (parser .OpJump , 19 ), // 0008
226
226
tengo .MakeInstruction (parser .OpConstant , 1 ), // 0011
227
227
tengo .MakeInstruction (parser .OpPop ), // 0014
228
228
tengo .MakeInstruction (parser .OpConstant , 2 ), // 0015
@@ -577,12 +577,12 @@ func TestCompiler_Compile(t *testing.T) {
577
577
intObject (1 ),
578
578
intObject (2 ),
579
579
compiledFunction (0 , 0 ,
580
- tengo .MakeInstruction (parser .OpTrue ), // 0000
581
- tengo .MakeInstruction (parser .OpJumpFalsy , 9 ), // 0001
582
- tengo .MakeInstruction (parser .OpConstant , 0 ), // 0004
583
- tengo .MakeInstruction (parser .OpReturn , 1 ), // 0007
584
- tengo .MakeInstruction (parser .OpConstant , 1 ), // 0009
585
- tengo .MakeInstruction (parser .OpReturn , 1 ))))) // 0012
580
+ tengo .MakeInstruction (parser .OpTrue ), // 0000
581
+ tengo .MakeInstruction (parser .OpJumpFalsy , 11 ), // 0001
582
+ tengo .MakeInstruction (parser .OpConstant , 0 ), // 0004
583
+ tengo .MakeInstruction (parser .OpReturn , 1 ), // 0007
584
+ tengo .MakeInstruction (parser .OpConstant , 1 ), // 0009
585
+ tengo .MakeInstruction (parser .OpReturn , 1 ))))) // 0012
586
586
587
587
expectCompile (t , `func() { 1; if(true) { 2 } else { 3 }; 4 }` ,
588
588
bytecode (
@@ -599,10 +599,10 @@ func TestCompiler_Compile(t *testing.T) {
599
599
tengo .MakeInstruction (parser .OpConstant , 0 ), // 0000
600
600
tengo .MakeInstruction (parser .OpPop ), // 0003
601
601
tengo .MakeInstruction (parser .OpTrue ), // 0004
602
- tengo .MakeInstruction (parser .OpJumpFalsy , 15 ), // 0005
602
+ tengo .MakeInstruction (parser .OpJumpFalsy , 19 ), // 0005
603
603
tengo .MakeInstruction (parser .OpConstant , 1 ), // 0008
604
604
tengo .MakeInstruction (parser .OpPop ), // 0011
605
- tengo .MakeInstruction (parser .OpJump , 19 ), // 0012
605
+ tengo .MakeInstruction (parser .OpJump , 23 ), // 0012
606
606
tengo .MakeInstruction (parser .OpConstant , 2 ), // 0015
607
607
tengo .MakeInstruction (parser .OpPop ), // 0018
608
608
tengo .MakeInstruction (parser .OpConstant , 3 ), // 0019
@@ -932,7 +932,7 @@ func() {
932
932
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
933
933
tengo .MakeInstruction (parser .OpConstant , 1 ),
934
934
tengo .MakeInstruction (parser .OpBinaryOp , 38 ),
935
- tengo .MakeInstruction (parser .OpJumpFalsy , 31 ),
935
+ tengo .MakeInstruction (parser .OpJumpFalsy , 35 ),
936
936
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
937
937
tengo .MakeInstruction (parser .OpConstant , 2 ),
938
938
tengo .MakeInstruction (parser .OpBinaryOp , 11 ),
@@ -954,7 +954,7 @@ func() {
954
954
tengo .MakeInstruction (parser .OpSetGlobal , 1 ),
955
955
tengo .MakeInstruction (parser .OpGetGlobal , 1 ),
956
956
tengo .MakeInstruction (parser .OpIteratorNext ),
957
- tengo .MakeInstruction (parser .OpJumpFalsy , 37 ),
957
+ tengo .MakeInstruction (parser .OpJumpFalsy , 41 ),
958
958
tengo .MakeInstruction (parser .OpGetGlobal , 1 ),
959
959
tengo .MakeInstruction (parser .OpIteratorKey ),
960
960
tengo .MakeInstruction (parser .OpSetGlobal , 2 ),
@@ -973,11 +973,11 @@ func() {
973
973
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
974
974
tengo .MakeInstruction (parser .OpConstant , 0 ),
975
975
tengo .MakeInstruction (parser .OpEqual ),
976
- tengo .MakeInstruction (parser .OpAndJump , 23 ),
976
+ tengo .MakeInstruction (parser .OpAndJump , 25 ),
977
977
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
978
978
tengo .MakeInstruction (parser .OpConstant , 1 ),
979
979
tengo .MakeInstruction (parser .OpNotEqual ),
980
- tengo .MakeInstruction (parser .OpOrJump , 34 ),
980
+ tengo .MakeInstruction (parser .OpOrJump , 38 ),
981
981
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
982
982
tengo .MakeInstruction (parser .OpConstant , 1 ),
983
983
tengo .MakeInstruction (parser .OpBinaryOp , 38 ),
@@ -1089,7 +1089,7 @@ func() {
1089
1089
intObject (4 ),
1090
1090
compiledFunction (0 , 0 ,
1091
1091
tengo .MakeInstruction (parser .OpTrue ),
1092
- tengo .MakeInstruction (parser .OpJumpFalsy , 9 ),
1092
+ tengo .MakeInstruction (parser .OpJumpFalsy , 11 ),
1093
1093
tengo .MakeInstruction (parser .OpConstant , 0 ),
1094
1094
tengo .MakeInstruction (parser .OpReturn , 1 ),
1095
1095
tengo .MakeInstruction (parser .OpConstant , 1 ),
@@ -1123,7 +1123,7 @@ func() {
1123
1123
tengo .MakeInstruction (parser .OpGetLocal , 0 ),
1124
1124
tengo .MakeInstruction (parser .OpConstant , 1 ),
1125
1125
tengo .MakeInstruction (parser .OpEqual ),
1126
- tengo .MakeInstruction (parser .OpJumpFalsy , 19 ),
1126
+ tengo .MakeInstruction (parser .OpJumpFalsy , 21 ),
1127
1127
tengo .MakeInstruction (parser .OpConstant , 2 ),
1128
1128
tengo .MakeInstruction (parser .OpReturn , 1 ),
1129
1129
tengo .MakeInstruction (parser .OpConstant , 1 ),
@@ -1156,7 +1156,7 @@ func() {
1156
1156
intObject (4 ),
1157
1157
compiledFunction (0 , 0 ,
1158
1158
tengo .MakeInstruction (parser .OpTrue ),
1159
- tengo .MakeInstruction (parser .OpJumpFalsy , 9 ),
1159
+ tengo .MakeInstruction (parser .OpJumpFalsy , 11 ),
1160
1160
tengo .MakeInstruction (parser .OpConstant , 0 ),
1161
1161
tengo .MakeInstruction (parser .OpReturn , 1 ),
1162
1162
tengo .MakeInstruction (parser .OpConstant , 1 ),
@@ -1180,7 +1180,7 @@ func() {
1180
1180
intObject (123 ),
1181
1181
compiledFunction (0 , 0 ,
1182
1182
tengo .MakeInstruction (parser .OpTrue ),
1183
- tengo .MakeInstruction (parser .OpJumpFalsy , 6 ),
1183
+ tengo .MakeInstruction (parser .OpJumpFalsy , 8 ),
1184
1184
tengo .MakeInstruction (parser .OpReturn , 0 ),
1185
1185
tengo .MakeInstruction (parser .OpReturn , 0 ),
1186
1186
tengo .MakeInstruction (parser .OpConstant , 0 ),
@@ -1200,12 +1200,12 @@ if a := 1; a {
1200
1200
tengo .MakeInstruction (parser .OpConstant , 0 ),
1201
1201
tengo .MakeInstruction (parser .OpSetGlobal , 0 ),
1202
1202
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
1203
- tengo .MakeInstruction (parser .OpJumpFalsy , 27 ),
1203
+ tengo .MakeInstruction (parser .OpJumpFalsy , 31 ),
1204
1204
tengo .MakeInstruction (parser .OpConstant , 1 ),
1205
1205
tengo .MakeInstruction (parser .OpSetGlobal , 0 ),
1206
1206
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
1207
1207
tengo .MakeInstruction (parser .OpSetGlobal , 1 ),
1208
- tengo .MakeInstruction (parser .OpJump , 39 ),
1208
+ tengo .MakeInstruction (parser .OpJump , 43 ),
1209
1209
tengo .MakeInstruction (parser .OpConstant , 2 ),
1210
1210
tengo .MakeInstruction (parser .OpSetGlobal , 0 ),
1211
1211
tengo .MakeInstruction (parser .OpGetGlobal , 0 ),
@@ -1238,12 +1238,12 @@ func() {
1238
1238
tengo .MakeInstruction (parser .OpConstant , 0 ),
1239
1239
tengo .MakeInstruction (parser .OpDefineLocal , 0 ),
1240
1240
tengo .MakeInstruction (parser .OpGetLocal , 0 ),
1241
- tengo .MakeInstruction (parser .OpJumpFalsy , 22 ),
1241
+ tengo .MakeInstruction (parser .OpJumpFalsy , 26 ),
1242
1242
tengo .MakeInstruction (parser .OpConstant , 1 ),
1243
1243
tengo .MakeInstruction (parser .OpSetLocal , 0 ),
1244
1244
tengo .MakeInstruction (parser .OpGetLocal , 0 ),
1245
1245
tengo .MakeInstruction (parser .OpDefineLocal , 1 ),
1246
- tengo .MakeInstruction (parser .OpJump , 31 ),
1246
+ tengo .MakeInstruction (parser .OpJump , 35 ),
1247
1247
tengo .MakeInstruction (parser .OpConstant , 2 ),
1248
1248
tengo .MakeInstruction (parser .OpSetLocal , 0 ),
1249
1249
tengo .MakeInstruction (parser .OpGetLocal , 0 ),
0 commit comments