mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-28 19:23:24 +03:00
rebase
This commit is contained in:
parent
5985d8da41
commit
ee877be2a6
@ -89,4 +89,11 @@ impl SyntaxError {
|
||||
span,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn illegal_self_const(span: &Span) -> Self {
|
||||
Self::new_from_span(
|
||||
"cannot have const self".to_string(),
|
||||
span,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -331,6 +331,9 @@ impl ParserContext {
|
||||
self.expect_ident()?
|
||||
};
|
||||
if name.name.as_ref() == "self" {
|
||||
if let Some(const_) = const_.as_ref() {
|
||||
return Err(SyntaxError::illegal_self_const(&(&name.span + &const_.span)))
|
||||
}
|
||||
if let Some(mutable) = &mutable {
|
||||
name.span = &mutable.span + &name.span;
|
||||
name.name = "mut self".to_string().into();
|
||||
|
Loading…
Reference in New Issue
Block a user