From 990a6ebce7bf8d0ed5b582c0fec4159a17c9f3eb Mon Sep 17 00:00:00 2001 From: Ville Lautanala Date: Sat, 24 Aug 2019 12:06:27 +0300 Subject: [PATCH] Expand abbreviations in variable names --- lib/uglifier.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/uglifier.rb b/lib/uglifier.rb index 2334a58..acb6e32 100644 --- a/lib/uglifier.rb +++ b/lib/uglifier.rb @@ -234,14 +234,14 @@ def error_context_lines @options.fetch(:error_context_lines, DEFAULTS[:error_context_lines]).to_i end - def error_context_format_options(low, high, line_index, col) + def error_context_format_options(low, high, line_index, column) line_width = high.to_s.size { :line_index => line_index, :base_index => low, :line_width => line_width, :line_format => "\e[36m%#{line_width + 1}d\e[0m ", # cyan - :col => col + :col => column } end @@ -262,14 +262,14 @@ def format_lines(lines, options) end end - def context_lines_message(source, line_no, col) - line_index = line_no - 1 + def context_lines_message(source, line_number, column) + line_index = line_number - 1 lines = source.split("\n") - base_index = [line_index - error_context_lines, 0].max - high_no = [line_no + error_context_lines, lines.size].min - options = error_context_format_options(base_index, high_no, line_index, col) - context_lines = lines[base_index...high_no] + first_line = [line_index - error_context_lines, 0].max + last_line = [line_number + error_context_lines, lines.size].min + options = error_context_format_options(first_line, last_line, line_index, column) + context_lines = lines[first_line...last_line] "--\n#{format_lines(context_lines, options).join("\n")}\n==" end