133 - handle missing args without error

This commit is contained in:
Kartik K. Agaram 2014-10-12 10:17:46 -07:00
parent 29bb9841e5
commit 3245570bc7
2 changed files with 17 additions and 2 deletions

3
mu.arc
View File

@ -397,7 +397,8 @@
(do1 caller-arg-idx.context
(++ caller-arg-idx.context)))
(trace "arg" arg " " idx " " caller-args.context)
(m caller-args.context.idx))
(if (len> caller-args.context idx)
(m caller-args.context.idx)))
type
(ty (caller-args.context arg.0))
otype

View File

@ -776,7 +776,21 @@
(prn "F - 'arg' with index can access function call arguments out of order"))
;? (quit)
; todo: test that too few args throws an error
(reset)
(new-trace "new-fn-arg-missing")
(add-fns
'((test1
((4 integer) <- arg)
((5 integer) <- arg))
(main
(test1 (1 literal))
)))
(run 'main)
;? (prn memory*)
(if (~iso memory* (obj 4 1))
(prn "F - missing 'arg' doesn't cause error"))
;? (quit)
; how should errors be handled? will be unclear until we support concurrency and routine trees.
(reset)