added #sourceCodeTemplate
authorClaus Gittinger <cg@exept.de>
Fri, 19 Jun 1998 02:14:54 +0200
changeset 3619 85b70481bc54
parent 3618 2ecf31e91023
child 3620 e517c8b18e90
added #sourceCodeTemplate
Behavior.st
--- a/Behavior.st	Fri Jun 19 02:10:24 1998 +0200
+++ b/Behavior.st	Fri Jun 19 02:14:54 1998 +0200
@@ -746,6 +746,45 @@
     "Modified: 23.4.1996 / 15:55:52 / cg"
 ! !
 
+!Behavior methodsFor:'RefactoringBrowser'!
+
+parseTreeFor: aSymbol 
+	^BRParser parseMethod: (self sourceCodeAt: aSymbol)
+		onError: [:aString :pos | ^nil]!
+
+whichClassDefinesClassVar: aString 
+	^self whichClassSatisfies: 
+			[:aClass | 
+			(aClass classVarNames collect: [:each | each asString]) 
+				includes: aString asString]!
+
+whichClassDefinesInstVar: aString 
+	^self whichClassSatisfies: [:aClass | aClass instVarNames includes: aString]!
+
+whichClassSatisfies: aBlock 
+	(aBlock value: self) ifTrue: [^self].
+	^superclass isNil 
+		ifTrue: [nil]
+		ifFalse: [superclass whichClassSatisfies: aBlock]!
+
+whichSelectorsRead: instVarName 
+	"Answer a set of selectors whose methods read the argument, instVarName, 
+	as a named instance variable."
+
+	| instVarIndex |
+	instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new].
+	^methodDict keys select: [:sel | (methodDict at: sel)
+			readsField: instVarIndex]!
+
+whichSelectorsWrite: instVarName 
+	"Answer a set of selectors whose methods write the argument, instVarName, 
+	as a named instance variable."
+
+	| instVarIndex |
+	instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new].
+	^methodDict keys select: [:sel | (methodDict at: sel)
+			writesField: instVarIndex]! !
+
 !Behavior methodsFor:'accessing'!
 
 addSelector:newSelector withLazyMethod:newMethod
@@ -2350,6 +2389,24 @@
     ^ self basicNew:anInteger
 ! !
 
+!Behavior methodsFor:'misc'!
+
+sourceCodeTemplate
+    ^ 'messageSelector and arguments
+    "method comment - purpose of message"
+
+    |temporaries|
+
+    statements
+
+    "
+     example uses
+    "
+'
+
+    "Created: / 19.6.1998 / 02:14:02 / cg"
+! !
+
 !Behavior methodsFor:'private accessing'!
 
 flags:aNumber
@@ -3763,5 +3820,5 @@
 !Behavior class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.129 1998-05-22 11:13:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.130 1998-06-19 00:14:54 cg Exp $'
 ! !