Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISeq#compile should accept IOs (like Ripper does today) #136

wants to merge 2 commits into from
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+12 −2
Diff settings


Just for now

10 iseq.c
@@ -580,11 +580,19 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE li
if ((state = EXEC_TAG()) == 0) {
int ln = NUM2INT(line);
const char *fn = StringValueCStr(file);
NODE *node = parse_string(StringValue(src), fn, ln);
NODE *node;
rb_compile_option_t option;

make_compile_option(&option, opt);

if (BUILTIN_TYPE(src) == T_FILE)
node = rb_compile_file(fn, src, ln);
node = parse_string(StringValue(src), fn, ln);

if (!node)

if (base_block && base_block->iseq) {
iseqval = rb_iseq_new_with_opt(node, base_block->iseq->location.label,
file, absolute_path, line, base_block->iseq->self,
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <assert.h>

#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))

@@ -5494,6 +5495,7 @@ rb_compile_file(const char *f, VALUE file, int start)
VALUE volatile vparser = rb_parser_new();

assert(BUILTIN_TYPE(file) == T_FILE); /* Not sure if we can call rb_raise() here. */
return rb_parser_compile_file(vparser, f, file, start);

@@ -11089,7 +11091,7 @@ ripper_initialize(int argc, VALUE *argv, VALUE self)

TypedData_Get_Struct(self, struct parser_params, &parser_data_type, parser);
rb_scan_args(argc, argv, "12", &src, &fname, &lineno);
if (rb_obj_respond_to(src, ripper_id_gets, 0)) {
if (BUILTIN_TYPE(src) == T_FILE) {
parser->parser_lex_gets = ripper_lex_get_generic;
else {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.