Skip to content

affect the failBlock so it can be return in case of error #19735

Open
stella-pas-rose wants to merge 7 commits into
pharo-project:Pharo14from
stella-pas-rose:19641
Open

affect the failBlock so it can be return in case of error #19735
stella-pas-rose wants to merge 7 commits into
pharo-project:Pharo14from
stella-pas-rose:19641

Conversation

@stella-pas-rose

Copy link
Copy Markdown
Contributor

we applied the suggested correction! :)

nextIntegerBase: aRadix ifFail: aBlock
	"Form an integer with optional sign and following digits from sourceStream."

	| isNeg value |
	failBlock := [ aBlock value ].
	
	isNeg := self peekSignIsMinus.
	value := self nextUnsignedIntegerOrNilBase: aRadix.
	value ifNil: [^aBlock value].
	^isNeg
		ifTrue: [value negated]
		ifFalse: [value]

@Solomanoa

Close #19618

@guillep guillep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Thanks!!

@guillep

guillep commented May 29, 2026

Copy link
Copy Markdown
Member

The doc comments fail with an exception:

Integer class>>#readFrom:ifFail:: Doc comment is not well formed. Content: self readFrom: '\' ifFail: [false] >>> false

Traza de la pila

Error
Integer class>>#readFrom:ifFail:: Doc comment is not well formed. Content: self readFrom: '\' ifFail: [false] >>> false
PharoDocCommentExpression(Object)>>error:
PharoDocCommentExpression>>evaluate
CommentTestCase>>evaluate
CommentTestCase>>testIt
CommentTestCase(TestCase)>>performTest

Comment thread src/NumberParser/Integer.extension.st Outdated
Comment thread src/NumberParser/Integer.extension.st Outdated
Comment thread src/NumberParser/Integer.extension.st
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integer class>>#readFrom:ifFail: throws an error instead of calling the fail block in some cases

3 participants