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

Fix NoMethodError in backend #364

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/iruby/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ def eval_binding
end

def eval(code, store_history)
if Gem::Version.new(IRB::VERSION) < Gem::Version.new('1.13.0')
@irb.context.evaluate(code, 0)
else
@irb.context.evaluate(@irb.build_statement(code), 0)
end
@irb.context.evaluate(parse_code(code), 0)
@irb.context.last_value unless IRuby.silent_assignment && assignment_expression?(code)
end

def parse_code(code)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could be moved down to the private methods.

return code if Gem::Version.new(IRB::VERSION) < Gem::Version.new('1.13.0')
return @irb.parse_input(code) if @irb.respond_to?(:parse_input)
return @irb.build_statement(code) if @irb.respond_to?(:build_statement)
end

def complete(code)
if @completor
# preposing and postposing never used, so they are empty, pass only target as code
Expand Down
Loading