Structure.st
changeset 1130 daa5e54c1a7d
parent 1129 4951097b5191
child 1131 82b645876f08
--- a/Structure.st	Sun Dec 10 14:08:48 2000 +0100
+++ b/Structure.st	Sun Dec 10 14:18:18 2000 +0100
@@ -1200,16 +1200,16 @@
     sel == #displayString ifTrue:[
        s := WriteStream on:''.
        s nextPutAll:'Structure('.
-        names := self allInstVarNames.
-        names notNil ifTrue:[
-            names keysAndValuesDo:[:idx :nm |
-                s nextPutAll:nm; nextPutAll:'->'.
-                s nextPutAll:(self at:idx) displayString.
-                s space
-            ].
-        ].
-        s nextPutAll:')'.
-        ^ s contents
+       names := self allInstVarNames.
+       names notNil ifTrue:[
+           names keysAndValuesDo:[:idx :nm |
+               s nextPutAll:nm; nextPutAll:'->'.
+               s nextPutAll:(self at:idx) displayString.
+               s space
+           ].
+       ].
+       s nextPutAll:')'.
+       ^ s contents
     ].
 
     sel == #basicInspect ifTrue:[
@@ -1238,7 +1238,19 @@
     ].
 
     (sel == #'=') ifTrue:[
-         ^ super = (args at:1)
+        (args at:1) class == (args at:1) ifFalse:[^ false].    "/ must be another struct
+        names := self allInstVarNames.
+        names notNil ifTrue:[
+            Object errorSignal handle:[:ex |
+                ^ false
+            ] do:[
+                names do:[:slotName |
+                    ((args at:1) perform:slotName asSymbol) = (self perform:slotName asSymbol)
+                    ifFalse:[slotName halt. ^ false]
+                ]
+            ].
+        ].
+        ^ true.
     ].
     (sel == #'~=') ifTrue:[
          ^ super ~= (args at:1)
@@ -1367,6 +1379,6 @@
 !Structure class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Structure.st,v 1.12 2000-12-10 13:08:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Structure.st,v 1.13 2000-12-10 13:18:18 cg Exp $'
 ! !
 Structure initialize!