The Inbox: Monticello-jr.726.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Monticello-jr.726.mcz

commits-2
A new version of Monticello was added to project The Inbox:
http://source.squeak.org/inbox/Monticello-jr.726.mcz

==================== Summary ====================

Name: Monticello-jr.726
Author: jr
Time: 28 June 2020, 10:07:19.980052 pm
UUID: e8c6b590-8826-0144-a535-13cfa140b5dd
Ancestors: Monticello-mt.725

Fix wrong traitCompositions in packages loaded from source.st

As of Collections-ul.900, ReadStream>>match: does not alter the Stream position if the search sequence was not found. Failure to find the search sequence is indicated via the return value, but it was not checked in classDefinitionFrom:.

The error could trigger load failures after loading Monticello-jr.720, in which the trait composition became relevant beyond just creating the class.

The error did not surface for .mcz version files that contain a correct snapshot.bin file, which allows to forego the reading of the source.st file.

There are versions out there without the snapshot.bin file. INIFile-jf.3.mcz as served by Squeaksource is such a version at the moment.

=============== Diff against Monticello-mt.725 ===============

Item was changed:
  ----- Method: MCStReader>>classDefinitionFrom: (in category 'converting') -----
  classDefinitionFrom: aPseudoClass
+ | tokens definitionStream hasTraitComposition traitCompositionString lastIndex hasClassTraitComposition classTraitCompositionString typeOfSubclass className |
- | tokens traitCompositionString lastIndex classTraitCompositionString typeOfSubclass className |
  tokens := Scanner new scanTokens: aPseudoClass definition.
+ definitionStream := ReadStream on: aPseudoClass definition.
+ hasTraitComposition := definitionStream match: 'uses:'.
+ traitCompositionString := hasTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
+ definitionStream := ReadStream on: aPseudoClass metaClass definition asString.
+ hasClassTraitComposition := definitionStream match: 'uses:'.
+ classTraitCompositionString := hasClassTraitComposition ifTrue: [(definitionStream upToAll: 'instanceVariableNames:') withBlanksTrimmed] ifFalse: ['{}'].
- traitCompositionString := ((ReadStream on: aPseudoClass definition)
- match: 'uses:';
- upToAll: 'instanceVariableNames:') withBlanksTrimmed.
- classTraitCompositionString := ((ReadStream on: aPseudoClass metaClass definition asString)
- match: 'uses:';
- upToAll: 'instanceVariableNames:') withBlanksTrimmed.
- traitCompositionString isEmpty ifTrue: [traitCompositionString := '{}'].
- classTraitCompositionString isEmpty ifTrue: [classTraitCompositionString := '{}'].
  lastIndex := tokens size.
 
  className := tokens at: 3.
  typeOfSubclass := self typeOfSubclass: (tokens at: 2).
  "Compiled code classes are special cases of the #bytes class type"
  (#bytes == typeOfSubclass and: [self compiledCodeClassNames includes: className])
  ifTrue: [typeOfSubclass := #compiledMethod].
 
  ^ MCClassDefinition
  name: className
  superclassName: (tokens at: 1)
  traitComposition: traitCompositionString
  classTraitComposition: classTraitCompositionString
  category: (tokens at: lastIndex)
  instVarNames: ((tokens at: lastIndex - 6) findTokens: ' ')
  classVarNames: ((tokens at: lastIndex - 4) findTokens: ' ')
  poolDictionaryNames: ((tokens at: lastIndex - 2) findTokens: ' ')
  classInstVarNames: (self classInstVarNamesFor: aPseudoClass)
  type: typeOfSubclass
  comment: (self commentFor: aPseudoClass)
  commentStamp: (self commentStampFor: aPseudoClass)!