WIP: optimizations for linux

This commit is contained in:
2026-02-03 00:16:31 +01:00
parent 4235862d86
commit c283887ada
11 changed files with 64 additions and 54 deletions

View File

@@ -106,7 +106,7 @@ fn compile(tokens: &[Token], dict: &Dictionary) -> Result<Vec<Op>, String> {
match &tokens[i] {
Token::Int(n, span) => {
let key = n.to_string();
if let Some(body) = dict.lock().unwrap().get(&key).cloned() {
if let Some(body) = dict.lock().get(&key).cloned() {
ops.extend(body);
} else {
ops.push(Op::PushInt(*n, Some(*span)));
@@ -114,7 +114,7 @@ fn compile(tokens: &[Token], dict: &Dictionary) -> Result<Vec<Op>, String> {
}
Token::Float(f, span) => {
let key = f.to_string();
if let Some(body) = dict.lock().unwrap().get(&key).cloned() {
if let Some(body) = dict.lock().get(&key).cloned() {
ops.extend(body);
} else {
ops.push(Op::PushFloat(*f, Some(*span)));
@@ -137,7 +137,7 @@ fn compile(tokens: &[Token], dict: &Dictionary) -> Result<Vec<Op>, String> {
} else if word == ":" {
let (consumed, name, body) = compile_colon_def(&tokens[i + 1..], dict)?;
i += consumed;
dict.lock().unwrap().insert(name, body);
dict.lock().insert(name, body);
} else if word == ";" {
return Err("unexpected ;".into());
} else if word == "if" {