diff --git a/BUGS b/BUGS index 90fba29..d6bdc48 100644 --- a/BUGS +++ b/BUGS @@ -13,8 +13,6 @@ 1) parses parameters -> produces sig 2) compiles optional parameter init forms in contour with sig -* Replacing methods doesn't seem to work. - * SETQ doesn't check whether binding exists. * Printing of strings is broken. diff --git a/lisp/test-boot.lisp b/lisp/test-boot.lisp index 8943da4..ca0965b 100644 --- a/lisp/test-boot.lisp +++ b/lisp/test-boot.lisp @@ -201,4 +201,13 @@ (assert (= 1 (if-option (x (some 1)) x 2))) (assert (= nil (if-option (x none) x))) +;;; Methods + +;; Redefining methods +(defclass test-x) +(defmethod test-m ((x test-x)) "x") +(assert (= "x" (test-m (make test-x)))) +(defmethod test-m ((x test-x)) "y") +(assert (= "y" (test-m (make test-x)))) + (provide "test-boot") diff --git a/runtime.js b/runtime.js index 94a6ae5..4b840ad 100644 --- a/runtime.js +++ b/runtime.js @@ -689,7 +689,7 @@ function lisp_make_method_entry(method, specializers) function lisp_bif_put_method(_key_, generic, specializers, method) { - for (var i = 0, len = generic.method_entries; i < len; i++) { + for (var i = 0, len = generic.method_entries.length; i < len; i++) { var me = generic.method_entries[i]; if (lisp_lists_equal(me.specializers, specializers)) { me.method = method;