[Pkg] The Trunk: Compiler-ul.221.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 15 15:00:44 UTC 2011
Levente Uzonyi uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ul.221.mcz
==================== Summary ====================
Name: Compiler-ul.221
Author: ul
Time: 15 November 2011, 3:52:35.902 pm
UUID: e7d854de-d6b7-da44-986c-0764cb7841f4
Ancestors: Compiler-ul.220
Don't leave an empty line after removing all unused temporary declarations.
=============== Diff against Compiler-ul.220 ===============
Item was changed:
----- Method: Parser>>removeEmptyTempDeclarationsFrom: (in category 'error correction') -----
removeEmptyTempDeclarationsFrom: methodNode
| sourceCode madeChanges tempsMarkHolder |
sourceCode := 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).
tempsMarkChar0 = $| & tempsMarkChar1 = $|
ifTrue:
[ end := currentBlock tempsMark.
start := end - 1].
tempsMarkChar0 = $| & tempsMarkChar1 = $ & tempsMarkChar2 = $|
ifTrue:
[ end := currentBlock tempsMark.
start := end - 2].
+ start notNil & end notNil ifTrue: [
+ | lineStart lineEnd |
+ lineStart := 1 + (sourceCode
+ lastIndexOf: Character cr
+ startingAt: start - 1
+ ifAbsent: [ 0 ]).
+ 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 ].
+ requestor correctFrom: start to: end with: ''.
+ madeChanges := true.
+ currentBlock tempsMark: nil ] ].
- start notNil & end notNil
- ifTrue:
- [requestor correctFrom: start to: end with: ''.
- madeChanges := true.
- currentBlock tempsMark: nil]].
madeChanges ifTrue: [ReparseAfterSourceEditing signal]!
More information about the Packages
mailing list