aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb.rb
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-06-28 05:43:48 +0900
committergit <svn-admin@ruby-lang.org>2023-06-27 20:43:53 +0000
commit8aedfefb21bb44fb043f29692e807033d26dfda5 (patch)
treec062280095b9b141dc069e572537d71cb55a4793 /lib/irb.rb
parentcaddd0274b6c859ab4a55ae033c4bc69c85a0fa9 (diff)
downloadruby-8aedfefb21bb44fb043f29692e807033d26dfda5.tar.gz
[ruby/irb] Remove keyword exception from Context#evaluate because
the value is always nil (https://github.com/ruby/irb/pull/617) https://github.com/ruby/irb/commit/62691384f8
Diffstat (limited to 'lib/irb.rb')
-rw-r--r--lib/irb.rb23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index e72356b9cc..0e26e7940e 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -506,8 +506,6 @@ module IRB
# Evaluates input for this session.
def eval_input
- exc = nil
-
@scanner.set_prompt do
|ltype, indent, continue, line_no|
if ltype
@@ -567,18 +565,18 @@ module IRB
is_assignment = assignment_expression?(line)
if IRB.conf[:MEASURE] && !IRB.conf[:MEASURE_CALLBACKS].empty?
result = nil
- last_proc = proc{ result = evaluate_line(line, line_no, exception: exc) }
+ last_proc = proc{ result = evaluate_line(line, line_no) }
IRB.conf[:MEASURE_CALLBACKS].inject(last_proc) { |chain, item|
_name, callback, arg = item
proc {
- callback.(@context, line, line_no, arg, exception: exc) do
+ callback.(@context, line, line_no, arg) do
chain.call
end
}
}.call
@context.set_last_value(result)
else
- evaluate_line(line, line_no, exception: exc)
+ evaluate_line(line, line_no)
end
if @context.echo?
if is_assignment
@@ -589,22 +587,17 @@ module IRB
output_value
end
end
- rescue Interrupt => exc
rescue SystemExit, SignalException
raise
- rescue Exception => exc
- else
- exc = nil
- next
+ rescue Interrupt, Exception => exc
+ handle_exception(exc)
+ @context.workspace.local_variable_set(:_, exc)
end
- handle_exception(exc)
- @context.workspace.local_variable_set(:_, exc)
- exc = nil
end
end
end
- def evaluate_line(line, line_no, exception: nil)
+ def evaluate_line(line, line_no)
# Transform a non-identifier alias (@, $) or keywords (next, break)
command, args = line.split(/\s/, 2)
if original = @context.command_aliases[command.to_sym]
@@ -618,7 +611,7 @@ module IRB
line = "#{command} #{command_class.transform_args(args)}"
end
- @context.evaluate(line, line_no, exception: exception)
+ @context.evaluate(line, line_no)
end
def convert_invalid_byte_sequence(str, enc)