summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2019-05-27 11:05:51 +0900
committerNobuyoshi Nakada <[email protected]>2019-05-27 11:05:51 +0900
commit0aa9b003de353e690f31ba59ca0a2db1df51b8bf (patch)
treec1e073fe1a01afb234e4ff3a19fba0a15b876cc5 /lib/irb/context.rb
parent9840f52c77a928479919e539d2e47ce36b5ede49 (diff)
context.rb: hide wrapping lines
* lib/irb/context.rb (IRB::Context#evaluate): separate the code from wrapping lines to propagate the given exception, not to show the wrapping lines when SyntaxError.
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r--lib/irb/context.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 571df2c21a..b7b2230856 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -397,7 +397,8 @@ module IRB
def evaluate(line, line_no, exception: nil) # :nodoc:
@line_no = line_no
if exception
- line = "begin ::Kernel.raise _; rescue _.class; #{line}; end"
+ line_no -= 1
+ line = "begin ::Kernel.raise _; rescue _.class\n#{line}\n""end"
@workspace.local_variable_set(:_, exception)
end
set_last_value(@workspace.evaluate(self, line, irb_path, line_no))