diff options
| author | Koichi ITO <koic.ito@gmail.com> | 2024-08-14 11:46:59 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-08-14 16:28:43 +0000 |
| commit | 88954a0e9a199156aadc472c4795133e5ac7651b (patch) | |
| tree | bdda97ffcaf793c6b87ca1ca3dfdf0695dfcfbf0 /test/ruby/test_lambda.rb | |
| parent | 264175dbb9e9f3c6721b1a4e28fd6cc379fda372 (diff) | |
[ruby/prism] Tweak inspect representation of `Prism::Location`
This PR tweaks inspect representation of `Prism::Location`.
## Before
During debugging, the meaning of `@location=https://github.com/ruby/prism/commit/21474836481` was unclear:
```console
$ ruby -Ilib -rprism -e 'p Prism.lex("puts :hi").value.map(&:first)[1]'
#<Prism::Token:0x000000010cd74e40 @source=#<Prism::ASCIISource:0x000000010cb5f808 @source="puts :hi", @start_line=1, @offsets=[0]>,
@type=:SYMBOL_BEGIN, @value=":", @location=https://github.com/ruby/prism/commit/21474836481>
```
## After
This PR clarifies the contents of the location object, aligning with what I think user expects:
```console
$ ruby -Ilib -rprism -e 'p Prism.lex("puts :hi").value.map(&:first)[1]'
#<Prism::Token:0x000000010e174d50 @source=#<Prism::ASCIISource:0x000000010df5efe8 @source="puts :hi", @start_line=1, @offsets=[0]>,
@type=:SYMBOL_BEGIN, @value=":", @location=#<Prism::Location @start_offset=5 @length=1 start_line=1>>
```
Although it is uncertain whether Prism will accept this change in the inspect representation, it is submitted here as a suggestion.
https://github.com/ruby/prism/commit/e7421ce1c5
Diffstat (limited to 'test/ruby/test_lambda.rb')
0 files changed, 0 insertions, 0 deletions
