Skip to content

Commit fd9c3f0

Browse files
committed
fix: nil config && unit test
1 parent 3a78c21 commit fd9c3f0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

compiler/compiler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ func (c *compiler) BinaryNode(node *ast.BinaryNode) {
446446
c.emit(OpNot)
447447

448448
case "or", "||":
449-
if c.config.DisableSC {
449+
if c.config != nil && c.config.DisableSC {
450450
c.compile(node.Left)
451451
c.derefInNeeded(node.Left)
452452
c.compile(node.Right)
@@ -463,7 +463,7 @@ func (c *compiler) BinaryNode(node *ast.BinaryNode) {
463463
c.patchJump(end)
464464

465465
case "and", "&&":
466-
if c.config.DisableSC {
466+
if c.config != nil && c.config.DisableSC {
467467
c.compile(node.Left)
468468
c.derefInNeeded(node.Left)
469469
c.compile(node.Right)

vm/program.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ func (program *Program) DisassembleWriter(w io.Writer) {
372372
case OpBegin:
373373
code("OpBegin")
374374

375+
case OpAnd:
376+
code("OpAnd")
377+
378+
case OpOr:
379+
code("OpOr")
380+
375381
case OpEnd:
376382
code("OpEnd")
377383

0 commit comments

Comments
 (0)