The Inbox: Compiler-ct.422.mcz

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

The Inbox: Compiler-ct.422.mcz

commits-2
Christoph Thiede uploaded a new version of Compiler to project The Inbox:
http://source.squeak.org/inbox/Compiler-ct.422.mcz

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

Name: Compiler-ct.422
Author: ct
Time: 21 March 2020, 11:07:22.79756 pm
UUID: ab5eff73-dbf5-7a4e-96e7-9991c9068f16
Ancestors: Compiler-nice.420

Proposal: Allow to cancel compilation if an unused variable is detected

This way it feels more consistent with UndefinedVariable and UndeclaredVariable.

=============== Diff against Compiler-nice.420 ===============

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').!