From edb02aec97cdaa939f10f9587204fd2cfd16b137 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 6 Jul 2011 13:41:19 -0600 Subject: [PATCH] slightly faster method sends by using just `object-ref' instead of `object?' plus `object-ref' --- collects/racket/private/class-internal.rkt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/collects/racket/private/class-internal.rkt b/collects/racket/private/class-internal.rkt index 9c370bc30f..239d11374c 100644 --- a/collects/racket/private/class-internal.rkt +++ b/collects/racket/private/class-internal.rkt @@ -3867,16 +3867,16 @@ ;; wrapped one and the original class was a primitive one, then the method ;; will automatically unwrap both the object and any wrapped arguments on entry. (define (find-method/who who in-object name) - (unless (object? in-object) - (obj-error who "target is not an object: ~e for method: ~a" - in-object name)) - (let* ([cls (object-ref in-object)] - [pos (hash-ref (class-method-ht cls) name #f)]) - (if pos - (values (vector-ref (class-methods cls) pos) in-object) - (obj-error who "no such method: ~a~a" - name - (for-class (class-name cls)))))) + (let ([cls (object-ref in-object #f)]) + (if cls + (let ([pos (hash-ref (class-method-ht cls) name #f)]) + (if pos + (values (vector-ref (class-methods cls) pos) in-object) + (obj-error who "no such method: ~a~a" + name + (for-class (class-name cls))))) + (obj-error who "target is not an object: ~e for method: ~a" + in-object name)))) (define-values (make-class-field-accessor make-class-field-mutator) (let ([check-and-get-index