aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2019-01-01 12:22:42 -1000
committeralandonovan <adonovan@google.com>2019-01-01 17:22:42 -0500
commit70a4f43bd14540d466ebd8601bbcd358d47ef7af (patch)
treeb62c9e1dddb0e0c49d6bc404ebd98f047e9d9573 /internal
parent783d9fbf8af9196568fdcb7564efe31f41671e55 (diff)
downloadstarlark-go-70a4f43bd14540d466ebd8601bbcd358d47ef7af.tar.gz
resolve: check number of args (#82)
The compiler currently uses an encoding that limits calls to 255 positional and 255 keyword arguments. There's no graceful way to return an error during compilation. Check the number of args during resolution as well, when we can return an error gracefully.
Diffstat (limited to 'internal')
-rw-r--r--internal/compile/compile.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/compile/compile.go b/internal/compile/compile.go
index c184e64..300d196 100644
--- a/internal/compile/compile.go
+++ b/internal/compile/compile.go
@@ -1599,7 +1599,8 @@ func (fcomp *fcomp) args(call *syntax.CallExpr) (op Opcode, arg uint32) {
// TODO(adonovan): avoid this with a more flexible encoding.
if p >= 256 || n >= 256 {
- log.Fatalf("%s: compiler error: too many arguments in call", call.Lparen)
+ // resolve already checked this; should be unreachable
+ panic("too many arguments in call")
}
return CALL + Opcode(callmode), uint32(p<<8 | n)