Skip to content

Commit

Permalink
Make sourcepos! work in static contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
SamWilsn committed Nov 29, 2024
1 parent 7a1bdfa commit 73925f5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,19 @@ fn asssert_node_eq<'a>(node: &'a AstNode<'a>, location: &[usize], expected: &Nod

macro_rules! sourcepos {
(($spsl:literal:$spsc:literal-$spel:literal:$spec:literal)) => {
($spsl, $spsc, $spel, $spec).into()
$crate::nodes::Sourcepos {
start: $crate::nodes::LineColumn {
line: $spsl,
column: $spsc,
},
end: $crate::nodes::LineColumn {
line: $spel,
column: $spec,
},
}
};
((XXX)) => {
(0, 1, 0, 1).into()
$crate::tests::sourcepos!((0:1-0:1))
};
}

Expand Down

0 comments on commit 73925f5

Please sign in to comment.