diff options
Diffstat (limited to 'ext/rubyvm')
| -rw-r--r-- | ext/rubyvm/depend | 2 | ||||
| -rw-r--r-- | ext/rubyvm/extconf.rb | 1 | ||||
| -rw-r--r-- | ext/rubyvm/lib/forwardable/impl.rb | 16 |
3 files changed, 19 insertions, 0 deletions
diff --git a/ext/rubyvm/depend b/ext/rubyvm/depend new file mode 100644 index 0000000000..0301ce074c --- /dev/null +++ b/ext/rubyvm/depend @@ -0,0 +1,2 @@ +# AUTOGENERATED DEPENDENCIES START +# AUTOGENERATED DEPENDENCIES END diff --git a/ext/rubyvm/extconf.rb b/ext/rubyvm/extconf.rb new file mode 100644 index 0000000000..8c40f58e2b --- /dev/null +++ b/ext/rubyvm/extconf.rb @@ -0,0 +1 @@ +create_makefile("rubyvm") diff --git a/ext/rubyvm/lib/forwardable/impl.rb b/ext/rubyvm/lib/forwardable/impl.rb new file mode 100644 index 0000000000..e9bde2f299 --- /dev/null +++ b/ext/rubyvm/lib/forwardable/impl.rb @@ -0,0 +1,16 @@ +# :stopdoc: +module Forwardable + def self._valid_method?(method) + iseq = RubyVM::InstructionSequence.compile("().#{method}", nil, nil, 0, false) + rescue SyntaxError + false + else + iseq.to_a.dig(-1, 1, 1, :mid) == method.to_sym + end + + def self._compile_method(src, file, line) + RubyVM::InstructionSequence.compile(src, file, file, line, + trace_instruction: false) + .eval + end +end |
