diff --git a/lib/js/runtime.sx b/lib/js/runtime.sx index 080f937a..b8bbf7b8 100644 --- a/lib/js/runtime.sx +++ b/lib/js/runtime.sx @@ -739,12 +739,18 @@ js-get-ctor-proto (fn (ctor) - (let - ((id (js-ctor-id ctor))) - (cond - ((dict-has? __js_proto_table__ id) (get __js_proto_table__ id)) - (else - (let ((p (dict))) (begin (dict-set! __js_proto_table__ id p) p))))))) + (cond + ((and (= (type-of ctor) "dict") (contains? (keys ctor) "prototype")) + (get ctor "prototype")) + (else + (let + ((id (js-ctor-id ctor))) + (cond + ((dict-has? __js_proto_table__ id) (get __js_proto_table__ id)) + (else + (let + ((p (dict))) + (begin (dict-set! __js_proto_table__ id p) p))))))))) (define js-reset-ctor-proto! (fn