Fixed warnings

This commit is contained in:
Michael Schimmel
2026-02-17 11:33:32 +01:00
parent b19fd4b097
commit 2c612adc49
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use crate::ast::nodes::{Node, UntypedKind}; use crate::ast::nodes::{Node, UntypedKind};
use crate::ast::compiler::bound_nodes::{BoundKind, Address}; use crate::ast::compiler::bound_nodes::{BoundKind, Address};
use crate::ast::types::{Value, Identity}; use crate::ast::types::Identity;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
struct CompilerScope { struct CompilerScope {
@@ -185,18 +185,15 @@ impl Binder {
} }
// 2. Try enclosing scopes (capture chain) // 2. Try enclosing scopes (capture chain)
let mut captured_addr: Option<Address> = None;
// Walk backwards from parent of current function up to root (0) // Walk backwards from parent of current function up to root (0)
// We look for where the variable is DEFINED. // We look for where the variable is DEFINED.
for i in (0..current_fn_idx).rev() { for i in (0..current_fn_idx).rev() {
let func = &self.functions[i]; let func = &self.functions[i];
if let Some(slot) = func.scope.resolve(name) { if let Some(slot) = func.scope.resolve(name) {
// Found definition! It's a Local variable in function 'i'. // Found definition! It's a Local variable in function 'i'.
captured_addr = Some(Address::Local(slot)); let mut addr = Address::Local(slot);
// Now we must propagate this capture down through all functions from i+1 to current. // Now we must propagate this capture down through all functions from i+1 to current.
let mut addr = captured_addr.unwrap();
for k in (i + 1)..=current_fn_idx { for k in (i + 1)..=current_fn_idx {
addr = Address::Upvalue(self.functions[k].add_upvalue(addr)); addr = Address::Upvalue(self.functions[k].add_upvalue(addr));
} }
+1 -1
View File
@@ -1,6 +1,6 @@
use std::sync::Arc; use std::sync::Arc;
use crate::ast::types::Value; use crate::ast::types::Value;
use crate::ast::nodes::{Node, CustomNode}; use crate::ast::nodes::Node;
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum Address { pub enum Address {