From 8a81aa5c93f36718564e0a4eef62ef08969afc8d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 28 Apr 2020 16:20:50 +0300 Subject: [PATCH] errors: disambiguate between variable and fn source_context --- vlib/v/util/errors.v | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vlib/v/util/errors.v b/vlib/v/util/errors.v index be502b0d9b..f27086526b 100644 --- a/vlib/v/util/errors.v +++ b/vlib/v/util/errors.v @@ -57,7 +57,6 @@ pub fn formatted_error(kind, emsg, filepath string, pos token.Position) string { } } // - mut source_context := '' source := read_file(filepath) or { '' } @@ -71,7 +70,7 @@ pub fn formatted_error(kind, emsg, filepath string, pos token.Position) string { } column := imax(0, pos.pos - p - 1) position := '${path}:${pos.line_nr+1}:${util.imax(1,column+1)}:' - source_context += source_context(source, column, pos).join('\n') + scontext := source_context(source, column, pos).join('\n') final_position := if emanager.support_color { term.bold(position) } else { position } mut final_kind := kind if emanager.support_color { @@ -82,7 +81,7 @@ pub fn formatted_error(kind, emsg, filepath string, pos token.Position) string { } } final_msg := emsg // if emanager.support_color { term.bold(emsg) } else { emsg } - final_context := if source_context.len > 0 { '\n$source_context' } else { '' } + final_context := if scontext.len > 0 { '\n$scontext' } else { '' } // return '$final_position $final_kind $final_msg $final_context'.trim_space() }