mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Remove private tags from Ast
This commit is contained in:
parent
67eb4b9faa
commit
1ed9cf551a
16 changed files with 12 additions and 196 deletions
|
@ -189,7 +189,6 @@ pub enum Expr<'a> {
|
|||
|
||||
// Tags
|
||||
GlobalTag(&'a str),
|
||||
PrivateTag(&'a str),
|
||||
|
||||
// Reference to an opaque type, e.g. $Opaq
|
||||
// TODO(opaques): $->@ in the above comment
|
||||
|
@ -446,11 +445,6 @@ pub enum Tag<'a> {
|
|||
args: &'a [Loc<TypeAnnotation<'a>>],
|
||||
},
|
||||
|
||||
Private {
|
||||
name: Loc<&'a str>,
|
||||
args: &'a [Loc<TypeAnnotation<'a>>],
|
||||
},
|
||||
|
||||
// We preserve this for the formatter; canonicalization ignores it.
|
||||
SpaceBefore(&'a Tag<'a>, &'a [CommentOrNewline<'a>]),
|
||||
SpaceAfter(&'a Tag<'a>, &'a [CommentOrNewline<'a>]),
|
||||
|
@ -523,7 +517,6 @@ pub enum Pattern<'a> {
|
|||
Identifier(&'a str),
|
||||
|
||||
GlobalTag(&'a str),
|
||||
PrivateTag(&'a str),
|
||||
|
||||
OpaqueRef(&'a str),
|
||||
|
||||
|
@ -628,7 +621,6 @@ impl<'a> Pattern<'a> {
|
|||
match (self, other) {
|
||||
(Identifier(x), Identifier(y)) => x == y,
|
||||
(GlobalTag(x), GlobalTag(y)) => x == y,
|
||||
(PrivateTag(x), PrivateTag(y)) => x == y,
|
||||
(Apply(constructor_x, args_x), Apply(constructor_y, args_y)) => {
|
||||
let equivalent_args = args_x
|
||||
.iter()
|
||||
|
@ -926,7 +918,7 @@ impl<'a> Expr<'a> {
|
|||
}
|
||||
|
||||
pub fn is_tag(&self) -> bool {
|
||||
matches!(self, Expr::GlobalTag(_) | Expr::PrivateTag(_))
|
||||
matches!(self, Expr::GlobalTag(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1764,7 +1764,6 @@ fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern<
|
|||
}
|
||||
Expr::Underscore(opt_name) => Ok(Pattern::Underscore(opt_name)),
|
||||
Expr::GlobalTag(value) => Ok(Pattern::GlobalTag(value)),
|
||||
Expr::PrivateTag(value) => Ok(Pattern::PrivateTag(value)),
|
||||
Expr::OpaqueRef(value) => Ok(Pattern::OpaqueRef(value)),
|
||||
Expr::Apply(loc_val, loc_args, _) => {
|
||||
let region = loc_val.region;
|
||||
|
|
|
@ -214,16 +214,9 @@ fn tag_type<'a>(min_indent: u32) -> impl Parser<'a, Tag<'a>, ETypeTagUnion<'a>>
|
|||
let (_, args, state) = specialize_ref(ETypeTagUnion::Type, loc_applied_args_e(min_indent))
|
||||
.parse(arena, state)?;
|
||||
|
||||
let result = if name.value.starts_with('@') {
|
||||
Tag::Private {
|
||||
name,
|
||||
args: args.into_bump_slice(),
|
||||
}
|
||||
} else {
|
||||
Tag::Global {
|
||||
name,
|
||||
args: args.into_bump_slice(),
|
||||
}
|
||||
let result = Tag::Global {
|
||||
name,
|
||||
args: args.into_bump_slice(),
|
||||
};
|
||||
|
||||
Ok((MadeProgress, result, state))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue