Nicolas Cellier uploaded a new version of PackageInfo-Base to project The Trunk:
http://source.squeak.org/trunk/PackageInfo-Base-nice.35.mcz ==================== Summary ==================== Name: PackageInfo-Base-nice.35 Author: nice Time: 27 December 2009, 4:14:08 am UUID: 9d90fe10-b657-4063-8aef-78459cdedca9 Ancestors: PackageInfo-Base-ar.34 Cosmetic: move or remove a few temps inside closures =============== Diff against PackageInfo-Base-ar.34 =============== Item was changed: ----- Method: PackageInfo>>externalTraits (in category 'modifying') ----- externalTraits - | behaviors | - ^ Array streamContents: [:s | + | behaviors | behaviors := self classesAndMetaClasses. Smalltalk allTraits do: [:trait | (behaviors includes: trait) ifFalse: [s nextPut: trait]. (behaviors includes: trait classSide) ifFalse: [s nextPut: trait classSide]]]. ! Item was changed: ----- Method: PackageInfo>>changeRecordForOverriddenMethod: (in category 'testing') ----- changeRecordForOverriddenMethod: aMethodReference + | sourceFilesCopy method position | - | position prevPos prevFileIndex preamble tokens sourceFilesCopy stamp method file methodCategory | method := aMethodReference actualClass compiledMethodAt: aMethodReference methodSymbol. position := method filePosition. sourceFilesCopy := SourceFiles collect: [:x | x isNil ifTrue: [ nil ] ifFalse: [x readOnlyCopy]]. + [ | file prevPos prevFileIndex preamble stamp methodCategory tokens | + method fileIndex == 0 ifTrue: [^ nil]. - [method fileIndex == 0 ifTrue: [^ nil]. file := sourceFilesCopy at: method fileIndex. [position notNil & file notNil] whileTrue: [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]. "Preamble is likely a linked method preamble, if we're in a changes file (not the sources file). Try to parse it for prior source position and file index" prevPos := nil. stamp := ''. (preamble findString: 'methodsFor:' startingAt: 1) > 0 ifTrue: [tokens := Scanner new scanTokens: preamble] ifFalse: [tokens := Array new "ie cant be back ref"]. ((tokens size between: 7 and: 8) and: [(tokens at: tokens size-5) = #methodsFor:]) ifTrue: [(tokens at: tokens size-3) = #stamp: ifTrue: ["New format gives change stamp and unified prior pointer" stamp := tokens at: tokens size-2. prevPos := tokens last. prevFileIndex := sourceFilesCopy fileIndexFromSourcePointer: prevPos. prevPos := sourceFilesCopy filePositionFromSourcePointer: prevPos] ifFalse: ["Old format gives no stamp; prior pointer in two parts" prevPos := tokens at: tokens size-2. prevFileIndex := tokens last]. (prevPos = 0 or: [prevFileIndex = 0]) ifTrue: [prevPos := nil]]. ((tokens size between: 5 and: 6) and: [(tokens at: tokens size-3) = #methodsFor:]) ifTrue: [(tokens at: tokens size-1) = #stamp: ifTrue: ["New format gives change stamp and unified prior pointer" stamp := tokens at: tokens size]]. methodCategory := tokens after: #methodsFor: ifAbsent: ['as yet unclassifed']. (self includesMethodCategory: methodCategory ofClass: aMethodReference actualClass) ifTrue: [methodCategory = (Smalltalk at: #Categorizer ifAbsent: [Smalltalk at: #ClassOrganizer]) default ifTrue: [methodCategory := methodCategory, ' ']. ^ ChangeRecord new file: file position: position type: #method class: aMethodReference classSymbol category: methodCategory meta: aMethodReference classIsMeta stamp: stamp]. position := prevPos. prevPos notNil ifTrue: [file := sourceFilesCopy at: prevFileIndex]]. ^ nil] ensure: [sourceFilesCopy do: [:x | x notNil ifTrue: [x close]]] ! Item was changed: ----- Method: PackageInfo>>externalRefsSelect:thenCollect: (in category 'dependencies') ----- externalRefsSelect: selBlock thenCollect: colBlock + | pkgMethods dependents extMethods otherClasses otherMethods classNames | - | pkgMethods dependents refs extMethods otherClasses otherMethods classNames | classNames := self classes collect: [:c | c name]. extMethods := self extensionMethods collect: [:mr | mr methodSymbol]. otherClasses := self externalClasses difference: self externalSubclasses. otherMethods := otherClasses gather: [:c | c selectors]. pkgMethods := self methods asSet collect: [:mr | mr methodSymbol]. pkgMethods removeAllFoundIn: otherMethods. dependents := Set new. otherClasses do: [:c | c selectorsAndMethodsDo: [:sel :compiled | + | refs | (extMethods includes: sel) ifFalse: [refs := compiled literals select: selBlock thenCollect: colBlock. refs do: [:ea | ((classNames includes: ea) or: [pkgMethods includes: ea]) ifTrue: [dependents add: (self referenceForMethod: sel ofClass: c) -> ea]]]]]. ^ dependents! |
Free forum by Nabble | Edit this page |