Remove write_token_error_context (#417)

This commit is contained in:
Casey Rodarmor 2019-04-19 04:07:29 -07:00 committed by GitHub
parent 9c82a1e329
commit fce4c232d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,17 +4,6 @@ use brev::OutputError;
use crate::misc::{maybe_s, ticks, write_error_context, And, Or, Tick}; use crate::misc::{maybe_s, ticks, write_error_context, And, Or, Tick};
fn write_token_error_context(f: &mut Formatter, token: &Token) -> Result<(), fmt::Error> {
write_error_context(
f,
token.text,
token.offset,
token.line,
token.column,
token.lexeme().len(),
)
}
#[derive(Debug)] #[derive(Debug)]
pub enum RuntimeError<'a> { pub enum RuntimeError<'a> {
ArgumentCountMismatch { ArgumentCountMismatch {
@ -400,7 +389,14 @@ impl<'a> Display for RuntimeError<'a> {
write!(f, "{}", message.suffix())?; write!(f, "{}", message.suffix())?;
if let Some(token) = error_token { if let Some(token) = error_token {
write_token_error_context(f, token)?; write_error_context(
f,
token.text,
token.offset,
token.line,
token.column,
token.lexeme().len(),
)?;
} }
Ok(()) Ok(())