feat: all function args are now labeled implicitly

This commit is contained in:
rvcas 2022-12-21 19:00:07 -05:00 committed by Lucas
parent 42204d2d71
commit 4c4e454ea3
2 changed files with 20 additions and 10 deletions

View File

@ -514,9 +514,12 @@ pub fn fn_param_parser() -> impl Parser<Token, ast::UntypedArg, Error = ParseErr
name, name,
location: span, location: span,
}), }),
select! {Token::Name {name} => name}.map_with_span(|name, span| ast::ArgName::Named { select! {Token::Name {name} => name}.map_with_span(|name, span| {
ast::ArgName::NamedLabeled {
label: name.clone(),
name, name,
location: span, location: span,
}
}), }),
)) ))
.then(just(Token::Colon).ignore_then(type_parser()).or_not()) .then(just(Token::Colon).ignore_then(type_parser()).or_not())

View File

@ -320,7 +320,8 @@ fn plus_binop() {
code, code,
ast::UntypedDefinition::Fn(Function { ast::UntypedDefinition::Fn(Function {
arguments: vec![ast::Arg { arguments: vec![ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "a".to_string(),
name: "a".to_string(), name: "a".to_string(),
location: Span::new((), 15..16), location: Span::new((), 15..16),
}, },
@ -537,7 +538,8 @@ fn let_bindings() {
code, code,
ast::UntypedDefinition::Fn(Function { ast::UntypedDefinition::Fn(Function {
arguments: vec![ast::Arg { arguments: vec![ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "a".to_string(),
name: "a".to_string(), name: "a".to_string(),
location: Span::new((), 11..12), location: Span::new((), 11..12),
}, },
@ -661,7 +663,8 @@ fn block() {
code, code,
ast::UntypedDefinition::Fn(Function { ast::UntypedDefinition::Fn(Function {
arguments: vec![ast::Arg { arguments: vec![ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "a".to_string(),
name: "a".to_string(), name: "a".to_string(),
location: Span::new((), 12..13), location: Span::new((), 12..13),
}, },
@ -754,7 +757,8 @@ fn when() {
code, code,
ast::UntypedDefinition::Fn(Function { ast::UntypedDefinition::Fn(Function {
arguments: vec![ast::Arg { arguments: vec![ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "a".to_string(),
name: "a".to_string(), name: "a".to_string(),
location: Span::new((), 12..13), location: Span::new((), 12..13),
}, },
@ -982,7 +986,8 @@ fn field_access() {
code, code,
ast::UntypedDefinition::Fn(Function { ast::UntypedDefinition::Fn(Function {
arguments: vec![ast::Arg { arguments: vec![ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "user".to_string(),
name: "user".to_string(), name: "user".to_string(),
location: Span::new((), 8..12), location: Span::new((), 8..12),
}, },
@ -1186,7 +1191,8 @@ fn record_update() {
ast::UntypedDefinition::Fn(Function { ast::UntypedDefinition::Fn(Function {
arguments: vec![ arguments: vec![
ast::Arg { ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "user".to_string(),
name: "user".to_string(), name: "user".to_string(),
location: Span::new((), 15..19), location: Span::new((), 15..19),
}, },
@ -1200,7 +1206,8 @@ fn record_update() {
tipo: (), tipo: (),
}, },
ast::Arg { ast::Arg {
arg_name: ast::ArgName::Named { arg_name: ast::ArgName::NamedLabeled {
label: "name".to_string(),
name: "name".to_string(), name: "name".to_string(),
location: Span::new((), 27..31), location: Span::new((), 27..31),
}, },