aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authoralandonovan <adonovan@google.com>2018-11-02 14:29:51 -0400
committerGitHub <noreply@github.com>2018-11-02 14:29:51 -0400
commit9b055554f3041bf94f47bef9747f9f291b0f7392 (patch)
tree7cf364c5e09dcb9ba85c9a38cb98036eac7fe0fe /internal
parent59a38fdc5279e6aaf1d1b6e651038ad4d46ca602 (diff)
downloadstarlark-go-9b055554f3041bf94f47bef9747f9f291b0f7392.tar.gz
compile: add missing opcodeName[EXCH] (#5)
Also, - make Opcode.String catch future missing entries. - document (*Function).Param.
Diffstat (limited to 'internal')
-rw-r--r--internal/compile/compile.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/compile/compile.go b/internal/compile/compile.go
index 99e9d54..8da415b 100644
--- a/internal/compile/compile.go
+++ b/internal/compile/compile.go
@@ -152,6 +152,7 @@ var opcodeNames = [...]string{
DUP2: "dup2",
DUP: "dup",
EQL: "eql",
+ EXCH: "exch",
FALSE: "false",
FREE: "free",
GE: "ge",
@@ -271,7 +272,9 @@ var stackEffect = [...]int8{
func (op Opcode) String() string {
if op < OpcodeMax {
- return opcodeNames[op]
+ if name := opcodeNames[op]; name != "" {
+ return name
+ }
}
return fmt.Sprintf("illegal op (%d)", op)
}