aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-02-22 21:19:17 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-02-22 21:19:17 +0100
commit40f2c2cabfdfbace9bc9116be7228b2db9348c13 (patch)
tree25b0f9394899c04864861db4b53f2b7f6fbe20ff /src
parenta4113803a4c5aee84987487065b429bbad8d4813 (diff)
downloadsylt-40f2c2cabfdfbace9bc9116be7228b2db9348c13.tar.gz
fix another bug??
Diffstat (limited to 'src')
-rw-r--r--src/compiler.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler.rs b/src/compiler.rs
index b3150ba..89ef9e0 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -322,7 +322,7 @@ macro_rules! push_scope {
errors.push((
e,
var.line,
- format!("Usage of undefined value: '{}'.", var.name),)
+ format!("Variable is unused: '{}'.", var.name),)
);
}
if var.captured {
@@ -853,7 +853,8 @@ impl Compiler {
expect!(self, Token::Colon, "Expected ':' after parameter name.");
if let Ok(typ) = self.parse_type() {
args.push(typ.clone());
- let var = Variable::new(&name, true, typ);
+ let mut var = Variable::new(&name, true, typ);
+ var.read = true;
if let Ok(slot) = self.define(var) {
self.stack_mut()[slot].active = true;
}
@@ -959,7 +960,9 @@ impl Compiler {
}
}
_ => {
- if !parse_branch!(self, block, self.call(block)) {
+ if matches!(self.peek(), Token::Bang | Token::LeftParen) {
+ self.call(block)
+ } else {
return;
}
}