mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
typecheck tags with arguments
also fixes an issue where private tags in patterns would not have the @ symbol in their name
This commit is contained in:
parent
98515cdf23
commit
dd240cf53a
7 changed files with 104 additions and 29 deletions
|
@ -1426,7 +1426,17 @@ pub fn record_literal<'a>(min_indent: u16) -> impl Parser<'a, Expr<'a>> {
|
|||
|
||||
/// This is mainly for matching tags in closure params, e.g. \@Foo -> ...
|
||||
fn private_tag<'a>() -> impl Parser<'a, &'a str> {
|
||||
skip_first!(char('@'), global_tag())
|
||||
// TODO should be refactored so the name is not allocated again.
|
||||
map_with_arena!(
|
||||
skip_first!(char('@'), global_tag()),
|
||||
|arena: &'a Bump, name: &'a str| {
|
||||
use bumpalo::collections::string::String;
|
||||
let mut buf = String::with_capacity_in(1 + name.len(), arena);
|
||||
buf.push('@');
|
||||
buf.push_str(name);
|
||||
buf.into_bump_str()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// This is mainly for matching tags in closure params, e.g. \Foo -> ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue