remove suffixed from Ident::Access and cleanup

This commit is contained in:
Luke Boswell 2024-04-28 08:41:39 +10:00
parent 20f277c132
commit 74e531b994
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
4 changed files with 4 additions and 98 deletions

View file

@ -12,7 +12,6 @@ use crate::string_literal::StrLikeLiteral;
use bumpalo::collections::string::String;
use bumpalo::collections::Vec;
use bumpalo::Bump;
use roc_error_macros::internal_error;
use roc_region::all::{Loc, Region};
/// Different patterns are supported in different circumstances.
@ -50,14 +49,6 @@ pub fn loc_pattern_help<'a>() -> impl Parser<'a, Loc<Pattern<'a>>, EPattern<'a>>
let pattern_state = state.clone();
// Return early with the suffixed statement
// match pattern.value {
// Pattern::Identifier { .. } if suffixed > 0 => {
// return Ok((MadeProgress, pattern, pattern_state))
// }
// _ => {}
// }
let (pattern_spaces, state) =
match space0_e(EPattern::AsKeyword).parse(arena, state, min_indent) {
Err(_) => return Ok((MadeProgress, pattern, pattern_state)),
@ -393,42 +384,6 @@ fn loc_ident_pattern_help<'a>(
Ok((MadeProgress, loc_pat, state))
}
}
// Parse a statement that begins with a suffixed identifier, e.g. `Stdout.line! "Hello"`
Ident::Access {
module_name,
parts,
suffixed,
..
} if suffixed > 0 => {
if module_name.is_empty() && parts.len() == 1 {
if let Accessor::RecordField(var) = &parts[0] {
Ok((
MadeProgress,
Loc {
region: loc_ident.region,
value: Pattern::Identifier { ident: var },
},
state,
))
} else {
internal_error!("unexpected suffixed TupleIndex");
}
} else if let Accessor::RecordField(var) = &parts[0] {
return Ok((
MadeProgress,
Loc {
region: loc_ident.region,
value: Pattern::QualifiedIdentifier {
module_name,
ident: var,
},
},
state,
));
} else {
internal_error!("unexpected suffixed TupleIndex");
}
}
Ident::Access {
module_name, parts, ..
} => {