The Inbox: System-ct.1515.mcz

[email protected]
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <[email protected]>
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-ct.1515.mcz

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

Name: System-ct.1515
Author: ct
Time: 8 June 2026, 12:06:35.336372 am
UUID: 22db1f22-8c2e-446f-8cf8-50d08ac93a06
Ancestors: System-mt.1513

Fixes ChangeRecord parsing to not blunder into special macro selectors/arguments.

For instance, the following do-it should NOT afterwards break the recent changes list:

(ObjectTracer on: 1) to: 2 do: [:i | Transcript showln: i].

Eliot, could you do a quick review please whether I used the parser API for deoptimization correctly?

=============== Diff against System-mt.1513 ===============

Item was changed:
  ----- Method: ChangeRecord>>messageForDoItExpression: (in category 'private') -----
  messageForDoItExpression: aString
  	"Parse what is expected to be a doit containing either a class definition, a metaclass definition,
  	 or a class initialization, (and maybe one day a reorganization of some sort; they're all doIts),
  	 and answer a MessageSend for the expression. Map global bindings to the names of those bindings.
  			Class definitions start with
  				FooSuperclass blahSubclass: #FooClassName
  			Metaclass definitions start with
  				FooClass class instanceVariableNames:
  			Class initializations look like
  				FooClass initialize"
+ 	| spaceIndex stream parser methodNode resultNode |
- 	| spaceIndex stream methodNode resultNode |
  	(spaceIndex := aString indexOf: Character space) = 0 ifTrue:
  		[^nil].
+ 	parser := Parser new.
+ 	methodNode := [parser
- 	methodNode := [Parser new
  						parse: (stream := aString readStream)
  						class: ((Environment current classNamed: (aString first: spaceIndex - 1)) ifNil: [Object])
  						noPattern: true
  						notifying: self
  						ifFail: [^nil]]
  							on: UndeclaredVariableNotification, Error
  							do: [:ex|
  								 ex class == Error ifTrue: [^nil].
  								 ex resume: false].
  	resultNode := methodNode block statements first.
  	"If the stream is not at the end this is some complex doIt, not one of the sytsem generated ones."
  	^(stream atEnd
  	  and: [resultNode class == ReturnNode
  	  and: [resultNode expr isMessage]]) ifTrue:
+ 		[self messageSendForMessage: resultNode expr parser: parser]!
- 		[self messageSendForMessage: resultNode expr]!

Item was changed:
  ----- Method: ChangeRecord>>messageSendForMessage: (in category 'private') -----
  messageSendForMessage: aMessageNode
+ 	self deprecated.
+ 	^ self messageSendForMessage: aMessageNode parser:
+ 		(Parser new initScopeAndLiteralTables; yourself)!
- 	^(aMessageNode receiver isVariableNode
- 		ifTrue: [aMessageNode receiver key isString
- 					ifTrue: [aMessageNode receiver key]
- 					ifFalse: [aMessageNode receiver key key]] "i.e. aMessageNode receiver key is a variable binding, e.g. #Object=>Object"
- 		ifFalse:
- 			[aMessageNode receiver isMessage
- 				ifTrue: [self messageSendForMessage: aMessageNode receiver]]) ifNotNil:
- 		[:receiverNode| | keywords |
- 		keywords := aMessageNode selector key keywords.
- 		(aMessageNode arguments notEmpty
- 		 and: [keywords size = aMessageNode arguments size]) ifTrue:
- 			[keywords
- 				with: aMessageNode arguments
- 				do: [:keyword :arg| (arg isLeaf or: [keyword = #uses:]) ifFalse: [^nil]]].
- 		MessageSend
- 			receiver: receiverNode
- 			selector: aMessageNode selector key
- 			arguments: (aMessageNode arguments collect:
- 							[:arg|
- 							arg isLeaf
- 								ifTrue: [arg key]
- 								ifFalse: [String streamContents: [:s| arg shortPrintOn: s]]])]!

Item was added:
+ ----- Method: ChangeRecord>>messageSendForMessage:parser: (in category 'private') -----
+ messageSendForMessage: aMessageNode parser: parser
+ 	aMessageNode ensureCanCascade: parser encoder. "deoptimize node to strip off special macros such as #to:[by:]do: with optimized arguments lists"
+ 	^(aMessageNode receiver isVariableNode
+ 		ifTrue: [aMessageNode receiver key isString
+ 					ifTrue: [aMessageNode receiver key]
+ 					ifFalse: [aMessageNode receiver key key]] "i.e. aMessageNode receiver key is a variable binding, e.g. #Object=>Object"
+ 		ifFalse:
+ 			[aMessageNode receiver isMessage
+ 				ifTrue: [self messageSendForMessage: aMessageNode receiver parser: parser]]) ifNotNil:
+ 		[:receiverNode| | keywords |
+ 		keywords := aMessageNode selector key keywords.
+ 		(aMessageNode arguments notEmpty
+ 		 and: [keywords size = aMessageNode arguments size]) ifTrue:
+ 			[keywords
+ 				with: aMessageNode arguments
+ 				do: [:keyword :arg| (arg isLeaf or: [keyword = #uses:]) ifFalse: [^nil]]].
+ 		MessageSend
+ 			receiver: receiverNode
+ 			selector: aMessageNode selector key
+ 			arguments: (aMessageNode arguments collect:
+ 							[:arg|
+ 							arg isLeaf
+ 								ifTrue: [arg key]
+ 								ifFalse: [String streamContents: [:s| arg shortPrintOn: s]]])]!

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.