token,scanner,parser,checker,cgen: add file_idx to token.Pos#25429
Conversation
|
Occasionally, I encountered issues where error or warning messages pointed to incorrect code locations. I believe this happens because the I will make a note of these cases next time for testing purposes. |
The screenshot is from the #fast channel in the V discord server, but you can run something locally, that shows a similar result with: (executed on the branch that has the changes) |
|
I suspect, that the slowdown is caused mainly by the increased size of the Pos struct, since it is used a lot in practically every AST node. If the new file index is encoded in the high 16 bits of the |
…lang#25429)" (performance degraded, without an immediate clear benefit) This reverts commit d948bf1.


The original
token.Posdoes not include file name information.This PR adds a
file_idxfield totoken.Pos, allowing us to identify which source file each token belongs to.