internal: Restructure some semantics APIs for virtual macro files

This commit is contained in:
Lukas Wirth 2025-05-30 22:02:59 +02:00
parent f0e39c77cc
commit 38bf4b1fe1
12 changed files with 185 additions and 79 deletions

View file

@ -5,6 +5,7 @@
use std::{mem, ops::RangeInclusive};
use parser::T;
use rowan::TextSize;
use crate::{
SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken,
@ -74,6 +75,12 @@ impl Position {
};
Position { repr }
}
pub fn offset(&self) -> TextSize {
match &self.repr {
PositionRepr::FirstChild(node) => node.text_range().start(),
PositionRepr::After(elem) => elem.text_range().end(),
}
}
}
pub fn insert(position: Position, elem: impl Element) {