'From Squeak3.1alpha of 4 February 2001 [latest update: #3714] on 24 February 2001 at 6:38:07 pm'! "Change Set: StampFix-ar Date: 24 February 2001 Author: Andreas Raab Fixes #timeStampForMethod: which could fail when running in a securityChecksEnabled environment."! !Utilities class methodsFor: 'miscellaneous' stamp: 'ar 2/22/2001 19:53'! timeStampForMethod: method "Answer the authoring time-stamp for the given method, retrieved from the sources or changes file. Answer the empty string if no time stamp is available." | position file preamble stamp tokens tokenCount | method fileIndex == 0 ifTrue: [^ String new]. "no source pointer for this method" position _ method filePosition. file _ SourceFiles at: method fileIndex. file ifNil: [^ String new]. "sources file not available" "file does not exist happens in secure mode" file _ [file readOnlyCopy] on: FileDoesNotExistException do:[:ex| ex return: nil]. file ifNil: [^ String new]. file position: (0 max: position - 150). "Skip back to before the preamble" [file position < (position - 1)] "then pick it up from the front" whileTrue: [preamble _ file nextChunk]. stamp _ String new. tokens _ (preamble findString: 'methodsFor:' startingAt: 1) > 0 ifTrue: [Scanner new scanTokens: preamble] ifFalse: [Array new "ie cant be back ref"]. (((tokenCount _ tokens size) between: 7 and: 8) and: [(tokens at: tokenCount - 5) = #methodsFor:]) ifTrue: [(tokens at: tokenCount - 3) = #stamp: ifTrue: ["New format gives change stamp and unified prior pointer" stamp _ tokens at: tokenCount - 2]]. ((tokenCount between: 5 and: 6) and: [(tokens at: tokenCount - 3) = #methodsFor:]) ifTrue: [(tokens at: tokenCount - 1) = #stamp: ifTrue: ["New format gives change stamp and unified prior pointer" stamp _ tokens at: tokenCount]]. file close. ^ stamp! !