#readsFields: and #writesField: for st80 compatibility
authorClaus Gittinger <cg@exept.de>
Sun, 27 Aug 2000 16:48:50 +0200
changeset 5564 0f513f04c50f
parent 5563 e65efbf51900
child 5565 a815d6b86ace
#readsFields: and #writesField: for st80 compatibility
Method.st
--- a/Method.st	Wed Aug 23 12:32:28 2000 +0200
+++ b/Method.st	Sun Aug 27 16:48:50 2000 +0200
@@ -2241,6 +2241,17 @@
     "Modified: 7.11.1996 / 19:06:22 / cg"
 !
 
+readsField:instVarIndex
+    "return true, if the instvar at instVarIndex is read by the receiver.
+     Uses parser (for now); could look at bytecode as well here..."
+
+    |varName readInstVars|
+
+    varName := (self mclass allInstVarNames) at:instVarIndex.
+    readInstVars := self parse:#'parseMethodSilent:' return:#readInstVars or:#().
+    ^ readInstVars includes:varName.
+!
+
 resourceType
     "ST-80 compatibility:
      return the methods first resource specs key; either nil, 
@@ -2538,6 +2549,17 @@
 	m originalMethod == self ifTrue:[^ m].
     ].
     ^ nil
+!
+
+writesField:instVarIndex
+    "return true, if the instvar at instVarIndex is written (modified) by the receiver.
+     Uses parser (for now); could look at bytecode as well here..."
+
+    |varName modifiedInstVars|
+
+    varName := (self mclass allInstVarNames) at:instVarIndex.
+    modifiedInstVars := self parse:#'parseMethodSilent:' return:#modifiedInstVars or:#().
+    ^ modifiedInstVars includes:varName.
 ! !
 
 !Method methodsFor:'trap methods'!
@@ -2724,6 +2746,6 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.203 2000-08-22 22:16:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.204 2000-08-27 14:48:50 cg Exp $'
 ! !
 Method initialize!