Repository navigation
Commit 39a53bd
Give ntConstant an end position
A constant declaration produced a node with no end position at all, so a
consumer working in line ranges could not tell how far the declaration
reached. That silently truncates any constant whose value spans lines:
const
Banner = 'first part ' +
'second part';
reported only the first line, and a tool slicing that range dropped the
continuation.
ntConstant was built with FStack.Push, so it was a plain TSyntaxNode with
nowhere to record an end. Two changes are needed, because the node the
caller finally sees is not the node that was parsed:
ConstantDeclaration now pushes a compound node and records its end, the
same way TypeDeclaration already does. This gives the intermediate
ConstList an accurate extent.
ConstSection rebuilds each constant from that ConstList, so it also has
to push a compound node and inherit the end from it. The start still
comes from the name, which is what a caller looking for the constant
expects; only the end is new.
TCompoundSyntaxNode.AssignEndPositionFrom is the counterpart to the
existing AssignPositionFrom, for exactly this rebuild case.
Single-line constants keep ending on their own line - the new test asserts
both directions, since an end that ran on to the next declaration would be
no more useful than one that stopped short.
Verified against the existing suite: 42 passing, with the one pre-existing
Serialization.BinaryRoundTrip failure unchanged (line_seq holds a pointer
value that does not survive a round trip, unrelated to this change).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent e89ce1f commit 39a53bd
3 files changed
Lines changed: 49 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
629 | 631 | | |
630 | 632 | | |
631 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
632 | 640 | | |
633 | 641 | | |
634 | 642 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
1198 | | - | |
| 1198 | + | |
| 1199 | + | |
1199 | 1200 | | |
1200 | 1201 | | |
| 1202 | + | |
1201 | 1203 | | |
1202 | 1204 | | |
1203 | 1205 | | |
| |||
1329 | 1331 | | |
1330 | 1332 | | |
1331 | 1333 | | |
1332 | | - | |
| 1334 | + | |
| 1335 | + | |
1333 | 1336 | | |
1334 | 1337 | | |
| 1338 | + | |
| 1339 | + | |
1335 | 1340 | | |
1336 | 1341 | | |
1337 | 1342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
180 | 213 | | |
181 | 214 | | |
182 | 215 | | |
| |||
229 | 262 | | |
230 | 263 | | |
231 | 264 | | |
| 265 | + | |
232 | 266 | | |
233 | 267 | | |
234 | 268 | | |
| |||
0 commit comments