aboutsummaryrefslogtreecommitdiffstats
path: root/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 7a037d173b..7e7ec9e38f 100644
--- a/ast.c
+++ b/ast.c
@@ -184,6 +184,8 @@ node_find(VALUE self, const int node_id)
return Qnil;
}
+extern VALUE rb_e_script;
+
static VALUE
script_lines(VALUE path)
{
@@ -223,6 +225,9 @@ rb_ast_s_of(VALUE module, VALUE body)
if (!NIL_P(lines = script_lines(path))) {
node = rb_ast_parse_array(lines);
}
+ else if (RSTRING_LEN(path) == 2 && memcmp(RSTRING_PTR(path), "-e", 2) == 0) {
+ node = rb_ast_parse_str(rb_e_script);
+ }
else {
node = rb_ast_parse_file(path);
}