Object.st
changeset 357 82091a50055d
parent 356 6c5ce0e1e7a8
child 359 b8df66983eff
--- a/Object.st	Wed May 24 14:44:58 1995 +0200
+++ b/Object.st	Tue Jun 06 05:56:11 1995 +0200
@@ -30,7 +30,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Object.st,v 1.50 1995-05-24 12:43:25 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Object.st,v 1.51 1995-06-06 03:54:57 claus Exp $
 '!
 
 !Object class methodsFor:'documentation'!
@@ -51,7 +51,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Object.st,v 1.50 1995-05-24 12:43:25 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Object.st,v 1.51 1995-06-06 03:54:57 claus Exp $
 "
 !
 
@@ -2245,8 +2245,18 @@
 
     if (__isSmallInteger(index)) {
 	myClass = __Class(self);
+	idx = _intVal(index) - 1;
+	/*
+	 * do not allow return of non-object fields.
+	 * if subclass did not make privisions for that,
+	 * we wont do so here ...
+	 */
+	if (((INT)(_ClassInstPtr(myClass)->c_flags) & _MASKSMALLINT(NONOBJECT_INSTS))) {
+	    if (idx == 0) {
+		RETURN ( nil )
+	    }
+	}
 	ninstvars = _intVal(_ClassInstPtr(myClass)->c_ninstvars);
-	idx = _intVal(index) - 1;
 	if ((idx >= 0) && (idx < ninstvars)) {
 	    RETURN ( _InstPtr(self)->i_instvars[idx] );
 	}
@@ -2271,8 +2281,18 @@
 
     if (__isSmallInteger(index)) {
 	myClass = __Class(self);
+	idx = _intVal(index) - 1;
 	ninstvars = _intVal(_ClassInstPtr(myClass)->c_ninstvars);
-	idx = _intVal(index) - 1;
+	/*
+	 * do not allow setting of non-object fields.
+	 * if subclass did not make privisions for that,
+	 * we wont do so here ...
+	 */
+	if (((INT)(_ClassInstPtr(myClass)->c_flags) & _MASKSMALLINT(NONOBJECT_INSTS))) {
+	    if (idx == 0) {
+		RETURN ( nil )
+	    }
+	}
 	if ((idx >= 0) && (idx < ninstvars)) {
 	    _InstPtr(self)->i_instvars[idx] = value;
 	    __STORE(self, value);