mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
ast.rb: Fix bug for source of multibyte characters
first_column and last_column return byte positions, but existing implementations did not consider multibyte.
This commit is contained in:
parent
d896269068
commit
8ed733f8f2
2 changed files with 10 additions and 2 deletions
4
ast.rb
4
ast.rb
|
@ -265,8 +265,8 @@ module RubyVM::AbstractSyntaxTree
|
|||
lines = script_lines
|
||||
if lines
|
||||
lines = lines[first_lineno - 1 .. last_lineno - 1]
|
||||
lines[-1] = lines[-1][0...last_column]
|
||||
lines[0] = lines[0][first_column..-1]
|
||||
lines[-1] = lines[-1].byteslice(0...last_column)
|
||||
lines[0] = lines[0].byteslice(first_column..-1)
|
||||
lines.join
|
||||
else
|
||||
nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue