Skip to content

Fix setCurrent and add tests#1109

Merged
Ducasse merged 2 commits into
pillar-markup:devfrom
AntoineUsal:CounterLine
Jun 25, 2026
Merged

Fix setCurrent and add tests#1109
Ducasse merged 2 commits into
pillar-markup:devfrom
AntoineUsal:CounterLine

Conversation

@AntoineUsal

Copy link
Copy Markdown
Collaborator

Fix #1108

@AntoineUsal AntoineUsal requested a review from Ducasse June 19, 2026 08:40
parser := MicParser new.
secondaryRoot := MicSecondaryRootBlock new.

parser instVarNamed: 'currentLineNumber' put: 15.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not reflective access to instanceVariable.
Better define a setter and use it.

Comment thread src/Microdown/MicParser.class.st Outdated
the parent of an item list is the list and this is the list that is parent of environment."
current := aBlock
current := aBlock.
aBlock isSecondaryRoot ifTrue: [ currentLineNumber := 1 ]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You do not need this test.
Remember Do not ask, tell

so here we should simply do
aBlock incrementLineNumberOf: self

And on

RootBlokc >> incrementLineNumber: aParser
    aParser currentLineNumber := 1
MicElement >> incrementLineNumber: aParser
  ^ self 

@Ducasse

Ducasse commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Ok I will integrated it but this is wrong because the lines after <inputFile...> are wrong.

@Ducasse Ducasse merged commit cf69908 into pillar-markup:dev Jun 25, 2026
4 checks passed
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.

Line counter doesn't reset on MicSecondaryRoot

2 participants