summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-10-04 13:57:14 -0400
committerKevin Newton <[email protected]>2024-10-04 15:04:26 -0400
commit30038656aa3a4931abefd99b8166c26599d168fd ()
tree84ad3eb5e1d838f0a269508058071fd64f7f633c /iseq.c
parentf77517f473c38e3fcef72c23de977a44da881caf (diff)
Fix intermediate array off-by-one error
Co-authored-by: Adam Hess <[email protected]>
Notes: Merged: https://.com/ruby/ruby/pull/11800
-rw-r--r--iseq.c51
1 files changed, 47 insertions, 4 deletions
@@ -1571,6 +1571,48 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
* InstructionSequence.compile_prism(source[, file[, path[, line[, options]]]]) -> iseq
*
* Takes +source+, which can be a string of Ruby code, or an open +File+ object.
@@ -1589,19 +1631,19 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self)
*
* For details regarding valid compile options see ::compile_option=.
*
- * RubyVM::InstructionSequence.compile("a = 1 + 2")
* #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
*
* path = "test.rb"
- * RubyVM::InstructionSequence.compile(File.read(path), path, File.expand_path(path))
* #=> <RubyVM::InstructionSequence:<compiled>@test.rb:1>
*
* file = File.open("test.rb")
- * RubyVM::InstructionSequence.compile(file)
* #=> <RubyVM::InstructionSequence:<compiled>@<compiled>:1>
*
* path = File.expand_path("test.rb")
- * RubyVM::InstructionSequence.compile(File.read(path), path, path)
* #=> <RubyVM::InstructionSequence:<compiled>@/absolute/path/to/test.rb:1>
*
*/
@@ -4283,6 +4325,7 @@ Init_ISeq(void)
(void)iseq_s_load;
rb_define_singleton_method(rb_cISeq, "compile", iseqw_s_compile, -1);
rb_define_singleton_method(rb_cISeq, "compile_prism", iseqw_s_compile_prism, -1);
rb_define_singleton_method(rb_cISeq, "compile_file_prism", iseqw_s_compile_file_prism, -1);
rb_define_singleton_method(rb_cISeq, "new", iseqw_s_compile, -1);