Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
If the first of the variable arguments to a vararg function is the javascript value undefined, the function behaves as though it didn't receive any variable arguments at all:
(defn f [& rest] rest) (f 1 2 3) ;; => (1 2 3) ; correct (f 1 js/undefined 3) ;; => (1 nil 3) ; correct (f js/undefined 2 3) ;; => nil ; wrong
Attaching a patch that determines whether varargs were passed to the function by examining arguments.length rather than checking the first argument in the vararg position with goog.isDef(arg).