Method.st
changeset 13381 e16cafbd22bd
parent 13189 96fe3d9e3f3a
child 13390 3bee59036719
equal deleted inserted replaced
13380:27e3cfa617a4 13381:e16cafbd22bd
   511      if sourcePosition is nonNil, its the fileName and
   511      if sourcePosition is nonNil, its the fileName and
   512      abs(sourcePosition) is the offset.
   512      abs(sourcePosition) is the offset.
   513      Otherwise, source is the real source
   513      Otherwise, source is the real source
   514     "
   514     "
   515     sourcePosition isNil ifTrue:[^ source].
   515     sourcePosition isNil ifTrue:[^ source].
   516 
   516     source isNil ifTrue:[^ nil].
   517     source notNil ifTrue:[
   517 
   518         self class lastMethodSourcesLock critical:[
   518     self class lastMethodSourcesLock critical:[
   519             LastMethodSources notNil ifTrue:[
   519         LastMethodSources notNil ifTrue:[
   520                 chunk := LastMethodSources at:self ifAbsent:nil.
   520             chunk := LastMethodSources at:self ifAbsent:nil.
   521             ].
       
   522         ].
   521         ].
   523         chunk notNil ifTrue:[
   522     ].
   524             ^ chunk
   523     chunk notNil ifTrue:[
   525         ].
   524         ^ chunk
   526 
   525     ].
   527         LastFileLock critical:[
   526 
       
   527     LastFileLock 
       
   528         critical:[
   528             "have to protect sourceStream from being closed as a side effect
   529             "have to protect sourceStream from being closed as a side effect
   529              of some other process fetching some the source from a different source file"
   530              of some other process fetching some the source from a different source file"
   530 
   531 
   531             sourceStream := self sourceStreamUsingCache:true.
   532             sourceStream := self sourceStreamUsingCache:true.
   532             sourceStream notNil ifTrue:[
   533             sourceStream notNil ifTrue:[
   538                     ('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR.
   539                     ('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR.
   539                     sourceStream := self rawSourceStreamUsingCache:true.
   540                     sourceStream := self rawSourceStreamUsingCache:true.
   540                     ex restart.
   541                     ex restart.
   541                 ].
   542                 ].
   542             ].
   543             ].
   543         ] timeoutMs:100 ifBlocking:[
   544         ] 
       
   545         timeoutMs:100 
       
   546         ifBlocking:[
   544             "take care if LastFileLock is not available - maybe we are
   547             "take care if LastFileLock is not available - maybe we are
   545              called by a debugger while someone holds the lock.
   548              called by a debugger while someone holds the lock.
   546              Use uncached source streams"
   549              Use uncached source streams"
   547             sourceStream := self sourceStreamUsingCache:false.
   550             sourceStream := self sourceStreamUsingCache:false.
   548             sourceStream notNil ifTrue:[
   551             sourceStream notNil ifTrue:[
   556                     sourceStream := self rawSourceStreamUsingCache:false.
   559                     sourceStream := self rawSourceStreamUsingCache:false.
   557                     ex restart.
   560                     ex restart.
   558                 ].
   561                 ].
   559             ].
   562             ].
   560         ].
   563         ].
   561     ].
       
   562 
   564 
   563     "Cache the source of recently used methods"
   565     "Cache the source of recently used methods"
   564     chunk notNil ifTrue:[
   566     chunk notNil ifTrue:[
   565         UserPreferences current keepMethodSourceCode ifTrue:[
   567         UserPreferences current keepMethodSourceCode ifTrue:[
   566             source := chunk.
   568             source := chunk.
   579     ].
   581     ].
   580 
   582 
   581     ^ chunk
   583     ^ chunk
   582 
   584 
   583     "Modified: / 07-01-1997 / 16:20:09 / stefan"
   585     "Modified: / 07-01-1997 / 16:20:09 / stefan"
   584     "Modified: / 28-11-2006 / 11:49:25 / cg"
       
   585 !
   586 !
   586 
   587 
   587 source:aString
   588 source:aString
   588     "set the methods sourcestring"
   589     "set the methods sourcestring"
   589 
   590 
  3042 ! !
  3043 ! !
  3043 
  3044 
  3044 !Method class methodsFor:'documentation'!
  3045 !Method class methodsFor:'documentation'!
  3045 
  3046 
  3046 version
  3047 version
  3047     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.355 2010-12-23 15:16:43 cg Exp $'
  3048     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.356 2011-05-31 14:05:51 cg Exp $'
  3048 !
  3049 !
  3049 
  3050 
  3050 version_CVS
  3051 version_CVS
  3051     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.355 2010-12-23 15:16:43 cg Exp $'
  3052     ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.356 2011-05-31 14:05:51 cg Exp $'
  3052 ! !
  3053 ! !
  3053 
  3054 
  3054 Method initialize!
  3055 Method initialize!