Repository navigation
Implement negative line numbers - #1944
Conversation
|
Looks like I broke JRuby and Truffle. I suppose there's some Java version of varints? I'll have a look. |
All the FFI backend CI jobs failed, including the one using CRuby.
|
Line numbers may be negative, so we need to introduce signed varint, so renaming unsigned ones first avoid confusion.
|
In Loader.java.erb there is |
0222cda to
71f5e64
Compare
|
Alright, I implemented the missing Java part, and also switched to ZigZag endcoding as it's indeed much simpler. CI is now green. Some docs may need updating though? This isn't exactly my forte and I don't know much about prism. |
71f5e64 to
edf9bbd
Compare
Ruby allows for 0 or negative line start, this is often used
with `eval` calls to get a correct offset when prefixing a snippet.
e.g.
```ruby
caller = caller_locations(1, 1).first
class_eval <<~RUBY, caller.path, caller.line - 2
# frozen_string_literal: true
def some_method
#{caller_provided_code_snippet}
end
RUBY
```
edf9bbd to
0d14ed1
Compare
kddnewton
left a comment
There was a problem hiding this comment.
Great work Jean!
We'll also need to update the deserializer for JS, but I'll handle that.
Fix: #1783
Ruby allows for 0 or negative line start, this is often used with
evalcalls to get a correct offset when prefixing a snippet.e.g.
The first commit rename all
varintstuff tovaruintto avoid confusion.The second commit introduce the
varsint(signed) type, and changelineto be signed.