diff options
author | alpaca-tc <alpaca-tc@alpaca.tc> | 2023-11-04 23:04:51 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-11-05 00:54:22 +0900 |
commit | 8ed733f8f22cdc56a9d2694078871cfc401cb029 (patch) | |
tree | 7b22b0e20ef70f5bf4bfa7aef69deb10d3a53a31 /ast.rb | |
parent | d896269068355ba9ab90ee464150ef4fe76313b5 (diff) | |
download | ruby-8ed733f8f22cdc56a9d2694078871cfc401cb029.tar.gz |
ast.rb: Fix bug for source of multibyte characters
first_column and last_column return byte positions, but existing implementations
did not consider multibyte.
Diffstat (limited to 'ast.rb')
-rw-r--r-- | ast.rb | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 |