Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use InstructionSequence#script_lines to get method source #1005

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Sep 16, 2024

It works with both prism and parse.y

Fixes ci failure

irb(main):001* def foo
irb(main):002*   bar
irb(main):003> end
=> :foo
irb(main):004> RubyVM::AbstractSyntaxTree.of(method("foo")).source
cannot get AST for ISEQ compiled by prism (RuntimeError)
irb(main):005> RubyVM::InstructionSequence.of(method("foo")).script_lines
=> ["def foo\n", "  bar\n", "end\n", ""]
irb(main):006> `ruby -v`
=> "ruby 3.4.0dev (2024-09-16T15:53:56Z master 1e52dde82a) +PRISM [x86_64-linux]\n"

@st0012 st0012 merged commit bcfaa72 into ruby:master Sep 16, 2024
30 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Sep 16, 2024
@tompng tompng deleted the source_finder_without_ast branch September 16, 2024 17:52
@st0012 st0012 added the bug Something isn't working label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants