From fb588e07a2acf06be09fa4773bcdbaad2c3484a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 12 Jan 2023 08:46:06 +0100 Subject: [PATCH] Parser - Fixed borrow error --- src/parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index f3bee1f..4f615ae 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -229,11 +229,11 @@ impl Parser { let static_token = self.expect(&[TokenType::Static]); match self.parse_function(FunctionKind::Method)? { StmtNode::FunDecl(d) => { - if let Some(tok) = static_token { + if let Some(tok) = &static_token { if d.name.lexeme == "init" { return Err(SloxError::with_token( ErrorKind::Parse, - &tok, + tok, "initializer cannot be declared static".to_owned(), )); }