Skip to content

Commit

Permalink
Expand abbreviations in variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
lautis committed Aug 24, 2019
1 parent 4f65798 commit 990a6eb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/uglifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 990a6eb

Please sign in to comment.