[squeak-dev] The Inbox: Kernel-ct.1278.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 1 18:18:11 UTC 2019


A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1278.mcz

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

Name: Kernel-ct.1278
Author: ct
Time: 1 November 2019, 7:18:08.038562 pm
UUID: 1b93aa78-abca-b441-b409-9b58f1b2d2bf
Ancestors: Kernel-nice.1277

Fix a bug in #valueSupplyingAnswers:. If the pattern is not a regex, a RegexSyntaxError may be raised.

"Now works:"
[self inform: 'Hello world']
	valueSupplyingAnswers: #(('*foo*' nil))

=============== Diff against Kernel-nice.1277 ===============

Item was changed:
  ----- Method: BlockClosure>>valueSupplyingAnswers: (in category 'evaluating') -----
  valueSupplyingAnswers: aListOfPairs
  	"evaluate the block using a list of questions / answers that might be called upon to
  	automatically respond to Object>>confirm: or FillInTheBlank requests"
  
  	^self
  		on: ProvideAnswerNotification
  		do: [ :notification |
  			| caption |
  			caption := notification messageText withSeparatorsCompacted. "to remove new lines"
  			aListOfPairs
  				detect:  [ :each |
  					caption = each first
  						or: [ (caption includesSubstring: each first caseSensitive: false)
  						or: [ (each first match: caption)
  						or: [ (caption respondsTo: #matchesRegex:) 
+ 							and: [ [caption matchesRegex: each first] on: RegexSyntaxError do: [false] ] ] ] ] ]
- 							and: [ caption matchesRegex: each first ] ] ] ] ]
  				ifFound: [ :answer | notification resume: answer second ]
  				ifNone: [
  					(ProvideAnswerNotification signal: notification messageText)
  						ifNil: [ notification resume ]
  						ifNotNil: [ :outerAnswer | notification resume: outerAnswer ] ] ]!



More information about the Squeak-dev mailing list