Introduce SyntaxErrorKind and TextRange in SyntaxError
This commit is contained in:
@@ -165,19 +165,19 @@ fn merge_errors(
|
||||
) -> Vec<SyntaxError> {
|
||||
let mut res = Vec::new();
|
||||
for e in old_errors {
|
||||
if e.offset <= old_node.range().start() {
|
||||
if e.range.start() <= old_node.range().start() {
|
||||
res.push(e)
|
||||
} else if e.offset >= old_node.range().end() {
|
||||
} else if e.range.start() >= old_node.range().end() {
|
||||
res.push(SyntaxError {
|
||||
msg: e.msg,
|
||||
offset: e.offset + TextUnit::of_str(&edit.insert) - edit.delete.len(),
|
||||
kind: e.kind,
|
||||
range: e.range + TextUnit::of_str(&edit.insert) - edit.delete.len(),
|
||||
})
|
||||
}
|
||||
}
|
||||
for e in new_errors {
|
||||
res.push(SyntaxError {
|
||||
msg: e.msg,
|
||||
offset: e.offset + old_node.range().start(),
|
||||
kind: e.kind,
|
||||
range: e.range + old_node.range().start(),
|
||||
})
|
||||
}
|
||||
res
|
||||
|
||||
Reference in New Issue
Block a user