aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-01-29 20:28:05 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-01-29 20:28:05 +0100
commit28b84aca844222c3dcccc3ef4b32bac6571ea881 (patch)
treef2244b9ac843740390c6f8211fd39e49023fd4e6 /src/compiler.rs
parent5df50ecccae28fc41461637b7bde1cdb383da30e (diff)
downloadsylt-28b84aca844222c3dcccc3ef4b32bac6571ea881.tar.gz
λ-names
Diffstat (limited to 'src/compiler.rs')
-rw-r--r--src/compiler.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler.rs b/src/compiler.rs
index 83dca4a..3c5498e 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -1,4 +1,4 @@
-use std::path::{Path, PathBuf};
+use std::{borrow::Cow, path::{Path, PathBuf}};
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::HashMap;
@@ -560,14 +560,14 @@ impl Compiler {
let top = self.stack().len() - 1;
let name = if !self.stack()[top].active {
self.stack_mut()[top].active = true;
- &self.stack()[top].name
+ Cow::Borrowed(&self.stack()[top].name)
} else {
- "anonumus function"
+ Cow::Owned(format!("λ {}@{:03}", self.current_file.display(), self.line()))
};
let mut args = Vec::new();
let mut return_type = Type::Void;
- let mut function_block = Block::new(name, &self.current_file, self.line());
+ let mut function_block = Block::new(&name, &self.current_file, self.line());
let _ret = push_frame!(self, function_block, {
loop {