summaryrefslogtreecommitdiff
path: root/ext/psych
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2023-01-11 11:00:58 +0100
committergit <svn-admin@ruby-lang.org>2023-01-11 10:08:13 +0000
commit3161fd437210588ef7ce41d614ab317de11d2ec1 (patch)
treedcc6e78bb8d71edb9658a010d322abbcf1b86419 /ext/psych
parente85ef212de98c817154ab62ae2d03508c512107e (diff)
downloadruby-3161fd437210588ef7ce41d614ab317de11d2ec1.tar.gz
[ruby/psych] Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate. https://github.com/ruby/psych/commit/38871ad4e5
Diffstat (limited to 'ext/psych')
-rw-r--r--ext/psych/lib/psych/class_loader.rb2
-rw-r--r--ext/psych/lib/psych/tree_builder.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb
index c2e4ea4c93..50efc35ee2 100644
--- a/ext/psych/lib/psych/class_loader.rb
+++ b/ext/psych/lib/psych/class_loader.rb
@@ -35,7 +35,7 @@ module Psych
constants.each do |const|
konst = const_get const
- class_eval <<~RUBY
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
def #{const.to_s.downcase}
load #{konst.inspect}
end
diff --git a/ext/psych/lib/psych/tree_builder.rb b/ext/psych/lib/psych/tree_builder.rb
index 414ca02bf7..83115bd721 100644
--- a/ext/psych/lib/psych/tree_builder.rb
+++ b/ext/psych/lib/psych/tree_builder.rb
@@ -41,7 +41,7 @@ module Psych
Sequence
Mapping
}.each do |node|
- class_eval %{
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
def start_#{node.downcase}(anchor, tag, implicit, style)
n = Nodes::#{node}.new(anchor, tag, implicit, style)
set_start_location(n)
@@ -54,7 +54,7 @@ module Psych
set_end_location(n)
n
end
- }
+ RUBY
end
###