Fix SyntaxError visualize order: message first location later

This commit is contained in:
Jeong YunWon 2020-05-13 01:46:37 +09:00
parent 0d139f9942
commit 3f1b9c6096

View file

@ -125,7 +125,7 @@ impl fmt::Display for CompileError {
if self.location.column() > 0 {
if let Some(line) = statement.lines().nth(self.location.row() - 1) {
// visualize the error, when location and statement are provided
return write!(f, "\n{}\n{}", line, self.location.visualize(&error_desc));
return write!(f, "{}", self.location.visualize(line, &error_desc));
}
}
}