Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.429.mcz==================== Summary ====================
Name: Compiler-nice.429
Author: nice
Time: 9 May 2020, 12:34:59.991171 am
UUID: 3f35c872-f6c4-45b8-9d7f-785b8f9f70f8
Ancestors: Compiler-nice.428, Compiler-ct.422
Merge Compiler-ct.422 which allow to cancel compilation if an unused variable is detected
=============== Diff against Compiler-nice.428 ===============
Item was changed:
----- Method: Parser>>removeUnusedTemps: (in category 'error correction') -----
removeUnusedTemps: methodNode
"Scan for unused temp names, and prompt the user about the prospect of removing each one found"
| madeChanges tempsMarkHolder unusedTempNames tempMarkHoldersToChange |
madeChanges := false.
tempMarkHoldersToChange := OrderedCollection new.
tempsMarkHolder := self collectTemporaryDeclarationsFrom: methodNode.
unusedTempNames := encoder unusedTempNames select:
[ :temp | (encoder lookupVariable: temp ifAbsent: [ ]) isUndefTemp
+ and: [ self queriedUnusedTemporaries at: temp ifAbsentPut: [
+ (UnusedVariable name: temp) ifNil: [ ^ self fail ]] ]].
- and: [ self queriedUnusedTemporaries at: temp ifAbsentPut: [UnusedVariable name: temp] ]].
tempsMarkHolder do: [ :currentBlock |
tempMarkHoldersToChange add: currentBlock.
unusedTempNames do:
[ :temp |
(self
removeUnusedTemporaryNamed: temp
from: cue requestor text asString
lookingAt: currentBlock
movingTempMarksOf: tempMarkHoldersToChange) ifTrue: [ madeChanges := true ]]].
madeChanges
ifTrue: [ self removeEmptyTempDeclarationsFrom: methodNode.
ReparseAfterSourceEditing signal ]!
Item was changed:
+ ----- Method: UnusedVariable>>openMenuIn: (in category 'handling') -----
- ----- Method: UnusedVariable>>openMenuIn: (in category 'as yet unclassified') -----
openMenuIn: aBlock
self resume: (UIManager default
+ confirm: ('{1} appears to be unused in this method.\Remove it from the code?' withCRs translated
+ format: {name asText allBold})
+ orCancel: [nil]
+ title: 'Unused Variable' translated).!
- confirm: name asText allBold, ' appears to be unused in this method.\Remove it from the code?' withCRs
- title: 'Unused Variable').!