Skip to content

Include start offset in Comment #4069

@overlookmotel

Description

@overlookmotel

#4045 replaced TriviasMap with a sorted Vec (bravo @lucab!)

After that change, there's no need to use a Vec<(u32, Comment)> - can change it to Vec<Comment> and move start field into Comment itself. Or, probably even better, make it struct Comment { span: Span, kind: CommentKind } to match AST nodes.

This would feel more natural to me - start was only external to Comment previously as it was key for the map.

Side note: I'm not sure if SortedComments should be a boxed slice rather than a Vec. Possible that some transforms may want to add/remove comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-astArea - ASTC-cleanupCategory - technical debt or refactoring. Solution not expected to change behaviorgood first issueExperience Level - Good for newcomers

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions