[squeak-dev] The Trunk: Compiler-ct.474.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Apr 30 17:53:07 UTC 2022


Christoph Thiede uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ct.474.mcz

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

Name: Compiler-ct.474
Author: ct
Time: 30 April 2022, 7:53:05.514971 pm
UUID: 7061d536-1604-0243-a378-f51ae046ff87
Ancestors: Compiler-ul.473

Fixes a parser bug during removal of empty temp declarations. Complements Tests-ct.485.

=============== Diff against Compiler-ul.473 ===============

Item was changed:
  ----- Method: Parser>>removeEmptyTempDeclarationsFrom: (in category 'error correction') -----
  removeEmptyTempDeclarationsFrom: methodNode
  
  	| sourceCode madeChanges tempsMarkHolder |
  	sourceCode := cue requestor text asString.
  	tempsMarkHolder := self collectTemporaryDeclarationsFrom: methodNode.
  	madeChanges := false.
  	tempsMarkHolder do: [ :currentBlock | | tempsMarkChar0 tempsMarkChar1 tempsMarkChar2 end start |
  		tempsMarkChar0 := (sourceCode at: currentBlock tempsMark).
  		tempsMarkChar1 := (sourceCode at: currentBlock tempsMark - 1).
+ 		tempsMarkChar2 := (sourceCode at: currentBlock tempsMark - 2 ifAbsent: []).
- 		tempsMarkChar2 := (sourceCode at: currentBlock tempsMark - 2).
  		(tempsMarkChar0 == $| and: [ tempsMarkChar1 == $| ])
  			ifTrue: 
  				[ end := currentBlock tempsMark. 
  				start := end - 1].
  		(tempsMarkChar0 == $| and: [ tempsMarkChar1 == $  and: [ tempsMarkChar2 == $| ] ])
  			ifTrue: 
  				[ end := currentBlock tempsMark. 
  				start := end - 2].
  		
  		(start notNil and: [ end notNil ]) ifTrue: [
  			| lineStart lineEnd |
  			lineStart := 1 + (sourceCode 
  				lastIndexOf: Character cr 
  				startingAt: start - 1).
  			lineEnd := sourceCode 
  				indexOf: Character cr
  				startingAt: end + 1
  				ifAbsent: [ sourceCode size ].
  			((sourceCode indexOfAnyOf: CharacterSet nonSeparators startingAt: lineStart) >= start 
  				and: [ (sourceCode indexOfAnyOf: CharacterSet nonSeparators startingAt: end + 1) > lineEnd ]) ifTrue: [
  					start := lineStart.
  					end := lineEnd ].
  			cue requestor correctFrom: start to: end with: ''.
  			madeChanges := true.
  			currentBlock tempsMark: nil ] ].
  	madeChanges ifTrue: [ReparseAfterSourceEditing signal]!



More information about the Squeak-dev mailing list