aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp
diff options
context:
space:
mode:
authorKenneth Bell <[email protected]>2023-09-12 16:46:48 +0100
committerAyke <[email protected]>2023-09-21 01:18:05 +0200
commitadadbadec30b59f857ce48d7de547c0315d53356 (patch)
tree25c74116be8000e02d89a743d7b7639a77c65af4 /interp
parent58fafaeb5ce3ae0cdf0399dab392d24c2322b435 (diff)
downloadtinygo-adadbadec30b59f857ce48d7de547c0315d53356.tar.gz
tinygo-adadbadec30b59f857ce48d7de547c0315d53356.zip
interp: improve unknown opcode handling
Diffstat (limited to 'interp')
-rw-r--r--interp/compiler.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/interp/compiler.go b/interp/compiler.go
index f0a096862..37faaae54 100644
--- a/interp/compiler.go
+++ b/interp/compiler.go
@@ -49,7 +49,10 @@ func (inst *instruction) String() string {
operands[i] = op.String()
}
- name := instructionNameMap[inst.opcode]
+ name := ""
+ if int(inst.opcode) < len(instructionNameMap) {
+ name = instructionNameMap[inst.opcode]
+ }
if name == "" {
name = "<unknown op>"
}