guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 05/08: goops: Fix 'instance?' to work on objects that ar


From: Mark H. Weaver
Subject: [Guile-commits] 05/08: goops: Fix 'instance?' to work on objects that aren't structs.
Date: Mon, 11 Jun 2018 10:22:24 -0400 (EDT)

mhw pushed a commit to branch stable-2.2
in repository guile.

commit ff2adb04cb4be9309abeb3feeee7cad97976fc2d
Author: Mark H Weaver <address@hidden>
Date:   Mon May 28 12:19:41 2018 -0400

    goops: Fix 'instance?' to work on objects that aren't structs.
    
    Fixes <https://bugs.gnu.org/31606>
    Reported by Tommi Höynälänmaa <address@hidden>
    
    * module/oop/goops.scm (instance?): Check that OBJ is a struct
    before applying 'struct-vtable' to it.
---
 module/oop/goops.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/module/oop/goops.scm b/module/oop/goops.scm
index 3c787d7..837a667 100644
--- a/module/oop/goops.scm
+++ b/module/oop/goops.scm
@@ -1,6 +1,7 @@
 ;;;; goops.scm -- The Guile Object-Oriented Programming System
 ;;;;
-;;;; Copyright (C) 1998-2003,2006,2009-2011,2013-2015 Free Software 
Foundation, Inc.
+;;;; Copyright (C) 1998-2003, 2006, 2009-2011, 2013-2015, 2018
+;;;;   Free Software Foundation, Inc.
 ;;;; Copyright (C) 1993-1998 Erick Gallesio - I3S-CNRS/ESSI <address@hidden>
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
@@ -279,7 +280,8 @@
        (class-has-flags? (struct-vtable obj) vtable-flag-goops-slot)))
 
 (define-inlinable (instance? obj)
-  (class-has-flags? (struct-vtable obj) vtable-flag-goops-class))
+  (and (struct? obj)
+       (class-has-flags? (struct-vtable obj) vtable-flag-goops-class)))
 
 (define (class-has-statically-allocated-slots? class)
   (class-has-flags? class vtable-flag-goops-static))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]