Skip to content

RFC: Only track byte offsets in codemap and related modules #1612

@kevina

Description

@kevina

I do not believe it is really necessary to keep track of both the character and byte offset in codemap and related modules.

Spans and everything else should be using the byte offsets. The only place where character offsets are likely needed is when reporting per line column offset, in that case it should be fairly easy to convert the byte offset from the start of the line to a character offset.

Removing all character offset tracking will likely simply the code somewhat.

Right now when trying to work with code in codemap I'm never quite sure if the offset is a byte or a character offset. Furthermore, at one point I had one offset in a byte offset and the other in a character offset (which is what prompted me to create this report).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions