[squeak-dev] The Trunk: System-dtl.968.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Oct 14 18:45:49 UTC 2017


David T. Lewis uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-dtl.968.mcz

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

Name: System-dtl.968
Author: dtl
Time: 14 October 2017, 2:45:35.676806 pm
UUID: 764236d5-e9b8-4e24-9b9c-fa609210822a
Ancestors: System-hjh.967

Use a pragma rather than #flag: to identify senders of methods dispatched through #dispatchTo:addPrefixAndSend:withArguments:
Inspired by System-bf.966

=============== Diff against System-hjh.967 ===============

Item was added:
+ ----- Method: Project class>>baseSelectors (in category 'dispatching') -----
+ baseSelectors
+ 	"The list of known base selectors that may be dispatched to project specific
+ 	implementations. For example, #OpenLabel:in: will be dispatched to #mvcOpenLabel:in:
+ 	for its MVC specific implementation. Add new base selectors here if additional methods
+ 	are added as targets of the dispatchTo:addPrefixAndSend:withArguments: mechanism."
+ 
+ 	^ {
+ 		#StartUpLeftFlush .
+ 		#StartUpWithCaption:icon:at:allowKeyboard: .
+ 		#OpenLabel:in: .
+ 		#Open: .
+ 		#Open .
+ 		#OpenOn:context:label:contents:fullView: .
+ 		#ResumeProcess:
+ 		}
+ !

Item was added:
+ ----- Method: Project class>>dispatchSelectors (in category 'dispatching') -----
+ dispatchSelectors
+ 	"All known targets of the dispatch mechanism"
+ 
+ 	"Project dispatchSelectors"
+ 
+ 	| selectors dispatchPrefixes |
+ 	selectors := OrderedCollection new.
+ 	dispatchPrefixes := Set withAll: (Project allSubclasses collect: [ :e | e basicNew selectorPrefixForDispatch ]).
+ 	self baseSelectors do: [ :base |
+ 		dispatchPrefixes do: [ :prefix |
+ 			selectors add: (prefix, base) asSymbol ] ].
+ 	^ selectors
+ 
+ !

Item was added:
+ ----- Method: Project class>>isDispatchSelector: (in category 'dispatching') -----
+ isDispatchSelector: aSelector
+ 	"In support of package modularity, some method selectors are generated based
+ 	on project type and dispatched to the appropriate implementation for that project.
+ 	For methods with these selectors, let dispatchTo:addPrefixAndSend:withArguments:
+ 	be found as a sender."
+ 
+ 	^ self dispatchSelectors includes: aSelector.
+ !

Item was changed:
  ----- Method: Project>>dispatchTo:addPrefixAndSend:withArguments: (in category 'dispatching') -----
  dispatchTo: requestor addPrefixAndSend: baseSelector withArguments: arguments
  	"Sender wants to perform a method with dependencies on the type of project.
  	Dispatch to an appropriate method for the current project.
+ 
+ 	If additional base selectors are added for dispatching, the list of base selectors
+ 	in Project class>>baseSelectors should be updated.
  	
  	This method is a workaround for lack of proper ToolBuilder support in the sender,
  	and should be eliminated when possible (dtl Feb 2010)"
  
+ 	<hasLiteralTest: #isDispatchSelector:>
  	| selector |
- 	"Flag target selectors to help identify senders"
- 	true ifFalse: [
- 		self flag: #mvcOpenLabel:in: .
- 		self flag: #morphicOpenLabel:in: .
- 		self flag: #mvcStartUpLeftFlush .
- 		self flag: #morphicStartUpLeftFlush .
- 		self flag: #mvcStartUpWithCaption:icon:at:allowKeyboard: .
- 		self flag: #morphicStartUpWithCaption:icon:at:allowKeyboard: .
- 		self flag: #mvcOpen: .
- 		self flag: #morphicOpen: .
- 		self flag: #mvcOpen .
- 		self flag: #morphicOpen .
- 		self flag: #mvcOpenOn:context:label:contents:fullView: .
- 		self flag: #morphicOpenOn:context:label:contents:fullView: .
- 		self flag: #mvcResumeProcess: .
- 		self flag: #morphicResumeProcess:
- 	].
  	selector := (self selectorPrefixForDispatch, baseSelector) asSymbol.
  	^ requestor perform: selector withArguments: arguments!



More information about the Squeak-dev mailing list