Cleanup unused method vars
authorStefan Vogel <sv@exept.de>
Wed, 28 Feb 2001 14:17:12 +0100
changeset 5818 97c692085370
parent 5817 e588e32724bd
child 5819 b46dd00555c6
Cleanup unused method vars
Method.st
--- a/Method.st	Wed Feb 28 14:15:18 2001 +0100
+++ b/Method.st	Wed Feb 28 14:17:12 2001 +0100
@@ -490,7 +490,7 @@
 source
     "return the sourcestring for the receiver"
 
-    |aStream fileName junk who myClass mgr className|
+    |aStream junk|
 
     "
      if sourcePosition is nonNil, its the fileName and
@@ -500,40 +500,40 @@
     sourcePosition isNil ifTrue:[^ source].
 
     source notNil ifTrue:[
-	LastMethodSources notNil ifTrue:[
-	    junk := LastMethodSources at:self ifAbsent:nil.
-	    junk notNil ifTrue:[
-		^ junk
-	    ]
-	].
-
-	aStream := self sourceStream.
-	aStream notNil ifTrue:[
-	    Stream positionErrorSignal handle:[:ex |
-		^ nil
-	    ] do:[
-		aStream position:sourcePosition abs.
-	    ].
-	    junk := aStream nextChunk.
-
-	    OperatingSystem isMSDOSlike ifTrue:[
-		"
-		 kludge for now - somehow this does not work under win32 (sigh)
-		"
-		aStream close.
-		(LastFileReference at:1) == aStream ifTrue:[
-		    LastFileReference at:1 put:0.
-		    LastSourceFileName := nil.
-		]
-	    ].
-	]
+        LastMethodSources notNil ifTrue:[
+            junk := LastMethodSources at:self ifAbsent:nil.
+            junk notNil ifTrue:[
+                ^ junk
+            ]
+        ].
+
+        aStream := self sourceStream.
+        aStream notNil ifTrue:[
+            Stream positionErrorSignal handle:[:ex |
+                ^ nil
+            ] do:[
+                aStream position:sourcePosition abs.
+            ].
+            junk := aStream nextChunk.
+
+            OperatingSystem isMSDOSlike ifTrue:[
+                "
+                 kludge for now - somehow this does not work under win32 (sigh)
+                "
+                aStream close.
+                (LastFileReference at:1) == aStream ifTrue:[
+                    LastFileReference at:1 put:0.
+                    LastSourceFileName := nil.
+                ]
+            ].
+        ]
     ].
 
     junk notNil ifTrue:[
-	LastMethodSources isNil ifTrue:[
-	    LastMethodSources := CacheDictionary new:20.
-	].
-	LastMethodSources at:self put:junk.
+        LastMethodSources isNil ifTrue:[
+            LastMethodSources := CacheDictionary new:20.
+        ].
+        LastMethodSources at:self put:junk.
     ].
 
     ^ junk
@@ -586,7 +586,7 @@
 sourceStream
     "return an open sourceStream (needs positioning)"
 
-    |aStream fileName junk who myClass mgr className sep dir mod|
+    |aStream fileName who myClass mgr className sep dir mod|
 
     "
      if sourcePosition is nonNil, its the fileName and
@@ -603,24 +603,24 @@
     "/ Neat trick.
 
     LastFileLock critical:[
-	aStream := LastFileReference at:1.
-	LastFileReference at:1 put:0.
-
-	aStream == 0 ifTrue:[
-	    aStream := nil.
-	] ifFalse:[
-	    LastSourceFileName = source ifFalse:[
-		aStream close.
-		aStream := nil.
-	    ]
-	].
-	LastSourceFileName := nil.
+        aStream := LastFileReference at:1.
+        LastFileReference at:1 put:0.
+
+        aStream == 0 ifTrue:[
+            aStream := nil.
+        ] ifFalse:[
+            LastSourceFileName = source ifFalse:[
+                aStream close.
+                aStream := nil.
+            ]
+        ].
+        LastSourceFileName := nil.
     ].
 
     aStream notNil ifTrue:[
-	LastSourceFileName := source.
-	LastFileReference at:1 put:aStream.
-	^ aStream
+        LastSourceFileName := source.
+        LastFileReference at:1 put:aStream.
+        ^ aStream
     ].
 
     "/ a negative sourcePosition indicates
@@ -631,34 +631,34 @@
     "/ and having a clue for which file is meant later.
 
     sourcePosition < 0 ifTrue:[
-	aStream := source asFilename readStream.
-	aStream notNil ifTrue:[
-	    LastSourceFileName := source.
-	    LastFileReference at:1 put:aStream.
-	    ^ aStream
-	].
-
-	fileName := Smalltalk getSourceFileName:source.
-	fileName notNil ifTrue:[
-	    aStream := fileName asFilename readStream.
-	    aStream notNil ifTrue:[
-		LastSourceFileName := source.
-		LastFileReference at:1 put:aStream.
-		^ aStream
-	    ].
-	].
+        aStream := source asFilename readStream.
+        aStream notNil ifTrue:[
+            LastSourceFileName := source.
+            LastFileReference at:1 put:aStream.
+            ^ aStream
+        ].
+
+        fileName := Smalltalk getSourceFileName:source.
+        fileName notNil ifTrue:[
+            aStream := fileName asFilename readStream.
+            aStream notNil ifTrue:[
+                LastSourceFileName := source.
+                LastFileReference at:1 put:aStream.
+                ^ aStream
+            ].
+        ].
     ].
 
     "/
     "/ if there is no SourceManager, look in local standard places first
     "/
     (mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[
-	aStream := self localSourceStream.
-	aStream notNil ifTrue:[
-	    LastSourceFileName := source.
-	    LastFileReference at:1 put:aStream.
-	    ^ aStream
-	].
+        aStream := self localSourceStream.
+        aStream notNil ifTrue:[
+            LastSourceFileName := source.
+            LastFileReference at:1 put:aStream.
+            ^ aStream
+        ].
     ].
 
     "/
@@ -666,31 +666,31 @@
     "/
     who := self who.
     who notNil ifTrue:[
-	myClass := who methodClass.
-
-	(package notNil and:[package ~= myClass package]) ifTrue:[
-	    mgr notNil ifTrue:[
-		"/ try to get the source using my package information ...
-		sep := package indexOfAny:'/\:'.
-		sep ~~ 0 ifTrue:[
-		    mod := package copyTo:sep - 1.
-		    dir := package copyFrom:sep + 1.
-		    aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true.
-		    aStream notNil ifTrue:[
-			LastSourceFileName := source.
-			LastFileReference at:1 put:aStream.
-			^ aStream
-		    ].
-		].
-	    ].
-	].
-
-	aStream := myClass sourceStreamFor:source.
-	aStream notNil ifTrue:[
-	    LastSourceFileName := source.
-	    LastFileReference at:1 put:aStream.
-	    ^ aStream
-	].
+        myClass := who methodClass.
+
+        (package notNil and:[package ~= myClass package]) ifTrue:[
+            mgr notNil ifTrue:[
+                "/ try to get the source using my package information ...
+                sep := package indexOfAny:'/\:'.
+                sep ~~ 0 ifTrue:[
+                    mod := package copyTo:sep - 1.
+                    dir := package copyFrom:sep + 1.
+                    aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true.
+                    aStream notNil ifTrue:[
+                        LastSourceFileName := source.
+                        LastFileReference at:1 put:aStream.
+                        ^ aStream
+                    ].
+                ].
+            ].
+        ].
+
+        aStream := myClass sourceStreamFor:source.
+        aStream notNil ifTrue:[
+            LastSourceFileName := source.
+            LastFileReference at:1 put:aStream.
+            ^ aStream
+        ].
     ].
 
     "/
@@ -698,46 +698,46 @@
     "/ (if there is a source-code manager - otherwise, we already did that)
     "/
     mgr notNil ifTrue:[
-	aStream := self localSourceStream.
-	aStream notNil ifTrue:[
-	    LastSourceFileName := source.
-	    LastFileReference at:1 put:aStream.
-	    ^ aStream
-	].
+        aStream := self localSourceStream.
+        aStream notNil ifTrue:[
+            LastSourceFileName := source.
+            LastFileReference at:1 put:aStream.
+            ^ aStream
+        ].
     ].
 
     "/
     "/ final chance: try current directory
     "/
     aStream isNil ifTrue:[
-	aStream := source asFilename readStream.
-	aStream notNil ifTrue:[
-	    LastSourceFileName := source.
-	    LastFileReference at:1 put:aStream.
-	    ^ aStream
-	].
+        aStream := source asFilename readStream.
+        aStream notNil ifTrue:[
+            LastSourceFileName := source.
+            LastFileReference at:1 put:aStream.
+            ^ aStream
+        ].
     ].
 
     (who isNil and:[source notNil]) ifTrue:[
-	"/
-	"/ mhmh - seems to be a method which used to be in some
-	"/ class, but has been overwritten by another or removed.
-	"/ (i.e. it has no containing class anyMore)
-	"/ try to guess the class from the sourceFileName.
-	"/ and retry.
-	"/
-	className := Smalltalk classNameForFile:source.
-	className knownAsSymbol ifTrue:[
-	    myClass := Smalltalk at:className asSymbol ifAbsent:nil.
-	    myClass notNil ifTrue:[
-		aStream := myClass sourceStreamFor:source.
-		aStream notNil ifTrue:[
-		    LastSourceFileName := source.
-		    LastFileReference at:1 put:aStream.
-		    ^ aStream
-		].
-	    ]
-	]
+        "/
+        "/ mhmh - seems to be a method which used to be in some
+        "/ class, but has been overwritten by another or removed.
+        "/ (i.e. it has no containing class anyMore)
+        "/ try to guess the class from the sourceFileName.
+        "/ and retry.
+        "/
+        className := Smalltalk classNameForFile:source.
+        className knownAsSymbol ifTrue:[
+            myClass := Smalltalk at:className asSymbol ifAbsent:nil.
+            myClass notNil ifTrue:[
+                aStream := myClass sourceStreamFor:source.
+                aStream notNil ifTrue:[
+                    LastSourceFileName := source.
+                    LastFileReference at:1 put:aStream.
+                    ^ aStream
+                ].
+            ]
+        ]
     ].                
 
     ^ nil
@@ -2340,32 +2340,8 @@
     "return the methods resource spec; either nil, a single symbol
      or a collection of symbols."
 
-    |src parser|
-
     self hasResource ifFalse:[^ nil].
     ^ self parseResources.
-
-"/    src := self source.
-"/    src isNil ifTrue:[
-"/        ^ nil "/ actually: dont know
-"/    ].
-"/
-"/    (src findString:'resource:') == 0 ifTrue:[
-"/        ^ nil "/ actually: error
-"/    ].
-"/    "/ no need to parse all - only interested in resource-info
-"/    parser := Parser parseMethodArgAndVarSpecificationSilent:src in:nil.
-"/"/    parser := Parser
-"/"/                    parseMethod:src 
-"/"/                    in:nil 
-"/"/                    ignoreErrors:true 
-"/"/                    ignoreWarnings:true.
-"/    parser isNil ifTrue:[
-"/        ^ nil "/ actually error
-"/    ].
-"/    ^ parser primitiveResources.
-"/
-"/    "Created: / 26.10.1997 / 16:23:18 / cg"
 !
 
 selector
@@ -2824,6 +2800,6 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.221 2000-12-19 16:20:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.222 2001-02-28 13:17:12 stefan Exp $'
 ! !
 Method initialize!