diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb.rb | 8 | ||||
-rw-r--r-- | lib/irb/ruby-lex.rb | 12 | ||||
-rw-r--r-- | lib/irb/slex.rb | 4 |
3 files changed, 14 insertions, 10 deletions
diff --git a/lib/irb.rb b/lib/irb.rb index 0d0f6f4136..1e59d6f669 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -141,10 +141,10 @@ module IRB end end - @scanner.each_top_level_statement do - |line, line_no| + @scanner.each_top_level_statement do |line, line_no| signal_status(:IN_EVAL) do begin + line.untaint @context.evaluate(line, line_no) output_value if @context.echo? rescue StandardError, ScriptError, Abort @@ -180,6 +180,10 @@ module IRB end print "Maybe IRB bug!!\n" if irb_bug end + if $SAFE > 2 + warn "Error: irb does not work for $SAFE level higher than 2" + exit 1 + end end end end diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 26b0b3b7c2..8d5cb47580 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -69,12 +69,12 @@ class RubyLex # io functions def set_input(io, p = nil) @io = io - if p.kind_of?(Proc) + if p.respond_to?(:call) @input = p elsif iterator? - @input = proc + @input = Block.new else - @input = proc{@io.gets} + @input = Block.new{@io.gets} end end @@ -183,11 +183,11 @@ class RubyLex end private :buf_input - def set_prompt(p = proc) - if p.kind_of?(Proc) + def set_prompt(p = Block.new) + if p.respond_to?(:call) @prompt = p else - @prompt = proc{print p} + @prompt = Block.new{print p} end end diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb index 1cf23255ad..5dc496d893 100644 --- a/lib/irb/slex.rb +++ b/lib/irb/slex.rb @@ -33,13 +33,13 @@ class SLex def def_rule(token, preproc = nil, postproc = nil) # print node.inspect, "\n" if SLex.debug? - postproc = proc if iterator? + postproc = Block.new if iterator? node = create(token, preproc, postproc) end def def_rules(*tokens) if iterator? - p = proc + p = Block.new end for token in tokens def_rule(token, nil, p) |