[squeak-dev] The Trunk: ShoutCore-nice.7.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 27 02:54:36 UTC 2009


Nicolas Cellier uploaded a new version of ShoutCore to project The Trunk:
http://source.squeak.org/trunk/ShoutCore-nice.7.mcz

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

Name: ShoutCore-nice.7
Author: nice
Time: 27 December 2009, 3:54:30 am
UUID: e3fe3d71-edd9-4897-9dbc-8adda78f2560
Ancestors: ShoutCore-nice.6

Cosmetic: move or remove a few temps inside closures

=============== Diff against ShoutCore-nice.6 ===============

Item was changed:
  ----- Method: SHTextStylerST80>>replaceStringForRangesWithType:with:in: (in category 'private') -----
  replaceStringForRangesWithType: aSymbol with: aString in: aText 
  	"Answer aText if no replacements, or a copy of aText with 
  	each range with a type of aSymbol replaced by aString"
+ 	| answer toReplace adjustSourceMap increaseInLength |
- 	| answer toReplace increaseInLength start end thisIncrease first last newFirst newLast
- 	adjustSourceMap |
  	
  	toReplace := (self rangesIn: aText setWorkspace: false) 
  		select: [:each | each type = aSymbol].
  	toReplace isEmpty ifTrue: [^aText].
  	answer := aText copy.
  	increaseInLength := 0.
  	adjustSourceMap := sourceMap notNil and:[sourceMap ~~ processedSourceMap].
  	(toReplace asSortedCollection: [:a :b | a start <= b start]) 
+ 		do: [:each | | end start thisIncrease | 
- 		do: [:each | 
  			start := each start + increaseInLength.
  			end := each end + increaseInLength.
  			answer 	replaceFrom: start to: end with: aString.
  			thisIncrease := aString size - each length.
  			increaseInLength := increaseInLength + thisIncrease.
  			adjustSourceMap ifTrue:[
+ 				sourceMap do:[:assoc | | first newFirst last newLast |
- 				sourceMap do:[:assoc |
  					first := newFirst := assoc value first.
  					last := newLast := assoc value last.
  					first > start ifTrue:[newFirst := first + thisIncrease].
  					last > start ifTrue:[newLast := last + thisIncrease].
  					(first ~= newFirst or:[last ~= newLast])
  						ifTrue:[assoc value: (newFirst to: newLast)]]]].
  	adjustSourceMap ifTrue:[processedSourceMap := sourceMap]. 
  	^answer!

Item was changed:
  ----- Method: SHParserST80>>parseKeyword (in category 'parse') -----
  parseKeyword 
+     | keyword rangeIndices |
-     | keyword rangeIndices type |
      self parseBinary.
  	keyword := ''.
  	rangeIndices := #().
  	[
      		[self isKeyword]
          		whileTrue: [
  				keyword := keyword, currentToken. 
  				self rangeType: #keyword.
  				"remember where this keyword token is in ranges"
  				rangeIndices := rangeIndices copyWith: ranges size.
  				self scanNext.
  				self parseTerm.
  				self parseBinary ]
+ 	] ensure: [ | type |
- 	] ensure: [
  		"do this in an ensure so that it happens even if the errorBlock evaluates before getting here"
  		"patch up the keyword tokens, so that incomplete and undefined ones look different"
  		(keyword isEmpty or:[Symbol hasInterned: keyword ifTrue: [:sym | ]])
  			ifFalse:[
  				type := (Symbol thatStartsCaseSensitive: keyword skipping: nil) isNil
  					ifTrue: [#undefinedKeyword]
  					ifFalse:[#incompleteKeyword].
  				rangeIndices do: [:i | (ranges at: i) type: type]]]!

Item was changed:
  ----- Method: SHTextStylerST80 class>>initialTextAttributesForPixelHeight: (in category 'style table') -----
  initialTextAttributesForPixelHeight: aNumber
+ 	| d |
- 	| d element color  textStyleName  pixelHeight emphasis font textStyle attrArray |
  	 
  	d := IdentityDictionary new.
+ 	self styleTable do: [:each | | textStyle element emphasis font pixelHeight attrArray color textStyleName |
- 	self styleTable do: [:each |
  		element := each first.
  		color := each at: 2 ifAbsent:[nil].
  		color:=color ifNotNil: [Color colorFrom: color].
  		emphasis := each at: 3 ifAbsent:[nil].
  		textStyleName := each at: 4 ifAbsent: [nil].
  		pixelHeight := each at: 5 ifAbsent: [aNumber].	
  		textStyleName ifNil:[pixelHeight := nil].	
  		textStyle := TextStyle named: textStyleName.
  		font := textStyle ifNotNil:[pixelHeight ifNotNil:[textStyle fontOfSize: pixelHeight]].
  		attrArray := self attributeArrayForColor: color emphasis: emphasis font: font.
  		attrArray notEmpty 
  			ifTrue:[
  				d at: element put: attrArray]].
  	^d	
  	!




More information about the Squeak-dev mailing list