mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/irb] Suppress "literal string will be frozen in the future"
warning (https://github.com/ruby/irb/pull/1019) * Suppress "literal string will be frozen in the future" warning Before change: ```console $ ruby -W -I lib -e 'require "irb"; IRB.setup(nil); IRB::Irb.new.build_statement("1 + 2")' /Users/zzz/src/github.com/ruby/irb/lib/irb.rb:1135: warning: literal string will be frozen in the future ``` After change: ```console $ ruby -W -I lib -e 'require "irb"; IRB.setup(nil); IRB::Irb.new.build_statement("1 + 2")' ``` * Making build_statement not modify the given argument Because improves readability and code quality. Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com> --------- https://github.com/ruby/irb/commit/3da04b9786 Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>
This commit is contained in:
parent
09ddfd4d1c
commit
f370a31578
@ -1132,7 +1132,7 @@ module IRB
|
||||
return Statement::EmptyInput.new
|
||||
end
|
||||
|
||||
code.force_encoding(@context.io.encoding)
|
||||
code = code.dup.force_encoding(@context.io.encoding)
|
||||
if (command, arg = @context.parse_command(code))
|
||||
command_class = Command.load_command(command)
|
||||
Statement::Command.new(code, command_class, arg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user