aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler.rs8
-rw-r--r--src/error.rs2
2 files changed, 5 insertions, 5 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 {
diff --git a/src/error.rs b/src/error.rs
index 60eea3b..d8d4664 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -67,7 +67,7 @@ impl fmt::Display for Error {
let line = if let Ok(file) = File::open(&self.file) {
io::BufReader::new(file).lines().enumerate()
- .filter(|(n, _)| self.line-2 <= *n + 1 && *n + 1 <= self.line)
+ .filter(|(n, _)| self.line <= *n + 3 && *n + 3 <= self.line + 2)
.fold(String::from("\n"), |a, (n, l)| format!("{} {:3} | {}\n", a, (n + 1).blue(), l.unwrap()))
} else {
String::new()