WIP parse statements correctly

This commit is contained in:
Luke Boswell 2024-04-01 13:18:40 +11:00
parent 997284e113
commit ba22527e29
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
5 changed files with 147 additions and 92 deletions

View file

@ -661,7 +661,7 @@ impl<'a> Defs<'a> {
self.push_def_help(tag, region, spaces_before, spaces_after)
}
// Find the first definition that is a Apply Suffixed
// Find the first definition that is suffixed
// We need the tag_index so we can use it to remove the value
// We need the value index to know if it is the first
pub fn search_suffixed_defs(&self) -> Option<(usize, usize)> {
@ -669,6 +669,12 @@ impl<'a> Defs<'a> {
if let Err(value_index) = tag.split() {
let index = value_index.index();
// a statement e.g. `Stdout.line! "hello world"`
if let ValueDef::Stmt(_) = &self.value_defs[index] {
return Some((tag_index, index));
}
// a definition with a suffixed expression e.g. `args = Arg.list!`
if let ValueDef::Body(_, loc_expr) = &self.value_defs[index] {
if is_loc_expr_suffixed(**loc_expr) {
return Some((tag_index, index));