Compare commits
No commits in common. "8690bb71cf6252122e940b35f415aa26e10e6e56" and "c9909dc651b6c9915ea973533301e7b18d03e661" have entirely different histories.
8690bb71cf
...
c9909dc651
@ -1,4 +1,4 @@
|
|||||||
use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr, Type};
|
use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
codegen::{ErrorKind, StackValueKind},
|
codegen::{ErrorKind, StackValueKind},
|
||||||
@ -284,10 +284,7 @@ impl IntrinsicFunction for IntrinsicNullPtr {
|
|||||||
let zero = scope.block.build(Instr::Constant(ConstValue::I8(0))).unwrap();
|
let zero = scope.block.build(Instr::Constant(ConstValue::I8(0))).unwrap();
|
||||||
let instr = scope
|
let instr = scope
|
||||||
.block
|
.block
|
||||||
.build(Instr::IntToPtr(
|
.build(Instr::IntToPtr(zero, self.0.get_type(scope.type_values)))
|
||||||
zero,
|
|
||||||
Type::Ptr(Box::new(self.0.get_type(scope.type_values))),
|
|
||||||
))
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Ok(StackValue(StackValueKind::Literal(instr), self.0.clone()))
|
Ok(StackValue(StackValueKind::Literal(instr), self.0.clone()))
|
||||||
}
|
}
|
||||||
|
@ -194,30 +194,32 @@ impl std::fmt::Display for ReidError {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let module_name = if curr_module != Some(meta.source_module_id) {
|
if curr_module != Some(meta.source_module_id) {
|
||||||
curr_module = Some(meta.source_module_id);
|
curr_module = Some(meta.source_module_id);
|
||||||
if let Some(module) = self.map.module_map.get(&meta.source_module_id) {
|
if let Some(module) = self.map.module_map.get(&meta.source_module_id) {
|
||||||
module.name.clone()
|
writeln!(
|
||||||
|
f,
|
||||||
|
"Errors in module {}:",
|
||||||
|
color_err(format!("{}", module.name))?
|
||||||
|
)?;
|
||||||
} else {
|
} else {
|
||||||
"unknown".to_owned()
|
writeln!(f, "Errors detected: {}", color_err("in general")?)?;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
"unknown".to_owned()
|
|
||||||
};
|
|
||||||
|
|
||||||
writeln!(f, "Errors detected: {}", color_err(format!("{}", module_name))?)?;
|
|
||||||
|
|
||||||
writeln!(f)?;
|
writeln!(f)?;
|
||||||
write!(f, " Error: ")?;
|
write!(f, " Error: ")?;
|
||||||
writeln!(f, "{}", color_err(format!("{}", error))?)?;
|
writeln!(f, "{}", color_err(format!("{}", error))?)?;
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{:>20} {}:{}",
|
"{:>20}{}",
|
||||||
color_warn("At: ")?,
|
color_warn("At: ")?,
|
||||||
module_name,
|
position
|
||||||
position.map(|p| fmt_positions(p)).unwrap_or(String::from("{unknown}")),
|
.map(|p| fmt_positions(p))
|
||||||
|
.unwrap_or(String::from("{unknown}")),
|
||||||
)?;
|
)?;
|
||||||
if let (Some(position), Some(source)) = (position, &module.and_then(|m| m.source.clone())) {
|
if let (Some(position), Some(source)) =
|
||||||
|
(position, &module.and_then(|m| m.source.clone()))
|
||||||
|
{
|
||||||
writeln!(f, "{}", fmt_lines(source, position, 6)?)?;
|
writeln!(f, "{}", fmt_lines(source, position, 6)?)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,9 +286,9 @@ fn fmt_lines(
|
|||||||
|
|
||||||
fn fmt_positions((start, end): (Position, Position)) -> String {
|
fn fmt_positions((start, end): (Position, Position)) -> String {
|
||||||
if start == end {
|
if start == end {
|
||||||
format!("{}:{}", start.1, start.0)
|
format!("ln {}, col {}", start.1, start.0)
|
||||||
} else if start.1 == end.1 {
|
} else if start.1 == end.1 {
|
||||||
format!("{}:{} - {}", start.1, start.0, end.0)
|
format!("ln {}, col {}-{}", start.1, start.0, end.0)
|
||||||
} else {
|
} else {
|
||||||
format!("{}:{} - {}:{}", start.1, start.0, end.1, end.0)
|
format!("{}:{} - {}:{}", start.1, start.0, end.1, end.0)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user