Parser - Fixed borrow error
This commit is contained in:
parent
4255fc30d5
commit
fb588e07a2
1 changed files with 2 additions and 2 deletions
|
@ -229,11 +229,11 @@ impl Parser {
|
||||||
let static_token = self.expect(&[TokenType::Static]);
|
let static_token = self.expect(&[TokenType::Static]);
|
||||||
match self.parse_function(FunctionKind::Method)? {
|
match self.parse_function(FunctionKind::Method)? {
|
||||||
StmtNode::FunDecl(d) => {
|
StmtNode::FunDecl(d) => {
|
||||||
if let Some(tok) = static_token {
|
if let Some(tok) = &static_token {
|
||||||
if d.name.lexeme == "init" {
|
if d.name.lexeme == "init" {
|
||||||
return Err(SloxError::with_token(
|
return Err(SloxError::with_token(
|
||||||
ErrorKind::Parse,
|
ErrorKind::Parse,
|
||||||
&tok,
|
tok,
|
||||||
"initializer cannot be declared static".to_owned(),
|
"initializer cannot be declared static".to_owned(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue