The Trunk: Tools-mt.897.mcz

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

The Trunk: Tools-mt.897.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.897.mcz

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

Name: Tools-mt.897
Author: mt
Time: 1 October 2019, 3:31:51.626118 pm
UUID: 8929b94e-60de-a34e-b620-554025bf28e3
Ancestors: Tools-mt.896

Fixes another tool-update bug.

=============== Diff against Tools-mt.896 ===============

Item was changed:
  ----- Method: Browser>>compileMessage:notifying: (in category 'code pane') -----
  compileMessage: aText notifying: aController
  "Compile the code that was accepted by the user, placing the compiled method into an appropriate message category.  Return true if the compilation succeeded, else false."
  | fallBackCategoryName originalSelectorName result fallBackMethodName |
  self selectedMessageCategoryName = ClassOrganizer allCategory
  ifTrue:
  [ "User tried to save a method while the ALL category was selected"
  fallBackCategoryName := selectedMessageCategoryName.
  fallBackMethodName := selectedMessageName.
  editSelection == #newMessage
  ifTrue:
  [ "Select the 'as yet unclassified' category"
  selectedMessageCategoryName := nil.
  (result := self defineMessageFrom: aText notifying: aController)
  ifNil:
  ["Compilation failure:  reselect the original category & method"
  selectedMessageCategoryName := fallBackCategoryName.
  selectedMessageName := fallBackMethodName]
  ifNotNil:
  [self setSelector: result]]
  ifFalse:
  [originalSelectorName := self selectedMessageName.
  self setOriginalCategoryIndexForCurrentMethod.
  selectedMessageName := fallBackMethodName := originalSelectorName.
  (result := self defineMessageFrom: aText notifying: aController)
  ifNotNil:
  [self setSelector: result]
  ifNil:
  [ "Compilation failure:  reselect the original category & method"
  selectedMessageCategoryName := fallBackCategoryName.
  selectedMessageName := fallBackMethodName.
  ^ result notNil]].
  self changed: #messageCategoryList.
+ self changed: #messageList.
  ^ result notNil]
  ifFalse:
  [ "User tried to save a method while the ALL category was NOT selected"
  ^ (self defineMessageFrom: aText notifying: aController) notNil]!

Item was changed:
  ----- Method: Browser>>defineMessageFrom:notifying: (in category 'message functions') -----
  defineMessageFrom: aString notifying: aController
  "Compile the expressions in aString. Notify aController if a syntax error occurs. Install the compiled method in the selected class classified under  the currently selected message category name. Answer the selector obtained if compilation succeeds, nil otherwise."
  | selectedMessageName selector category oldMessageList selectedClassOrMetaClass |
  selectedMessageName := self selectedMessageName.
  oldMessageList := self messageList.
  selectedClassOrMetaClass := self selectedClassOrMetaClass.
  contents := nil.
  selector := (selectedClassOrMetaClass newParser parseSelector: aString).
  (self metaClassIndicated
  and: [(selectedClassOrMetaClass includesSelector: selector) not
  and: [Metaclass isScarySelector: selector]])
  ifTrue: ["A frist-time definition overlaps the protocol of Metaclasses"
  (self confirm: ((selector , ' is used in the existing class system.
  Overriding it could cause serious problems.
  Is this really what you want to do?') asText makeBoldFrom: 1 to: selector size))
  ifFalse: [^nil]].
  category := selectedMessageName
  ifNil: [ self selectedMessageCategoryName ]
  ifNotNil: [ (selectedClassOrMetaClass >> selectedMessageName) methodReference ifNotNil: [ : ref | ref category ]].
  selector := selectedClassOrMetaClass
  compile: aString
  classified: category
  notifying: aController.
  selector == nil ifTrue: [^ nil].
  contents := aString copy.
+ self changed: #messageList. "Because we have code-dependent list formatting by now such as #isDeprecated."
  selector ~~ selectedMessageName
  ifTrue:
  [category = ClassOrganizer nullCategory
  ifTrue: [self changed: #classSelectionChanged.
  self changed: #classList.
  self messageCategoryListIndex: 1].
  self setClassOrganizer.  "In case organization not cached"
  (oldMessageList includes: selector)
  ifFalse: [self changed: #messageList].
  self messageListIndex: (self messageList indexOf: selector)].
  ^ selector!