summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-31 05:49:56 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-31 05:49:56 +0000
commita97d22a00431112a2b80669269182ec4e58d51aa (patch)
tree068de8fd034a5f7b8c3832229899253ffbc10e2a /ext
parentb9212a7771a5e67f3b48bbf4c76cd087a8d87e49 (diff)
ast.c: Do not taint TOPLEVEL_BINDING
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/ast/ast.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/ext/-test-/ast/ast.c b/ext/-test-/ast/ast.c
index f608af911e8..dfb31197ef5 100644
--- a/ext/-test-/ast/ast.c
+++ b/ext/-test-/ast/ast.c
@@ -54,15 +54,11 @@ rb_ast_s_parse(VALUE module, VALUE str)
{
VALUE obj;
rb_ast_t *ast = 0;
- rb_binding_t *toplevel_binding;
const VALUE parser = rb_parser_new();
- GetBindingPtr(rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING")),
- toplevel_binding);
-
str = rb_check_string_type(str);
- rb_parser_set_context(parser, &toplevel_binding->block, 1);
+ rb_parser_set_context(parser, NULL, 1);
ast = rb_parser_compile_string_path(parser, rb_str_new_cstr("no file name"), str, 1);
if (!ast->body.root) return Qnil;
@@ -77,18 +73,14 @@ rb_ast_s_parse_file(VALUE module, VALUE path)
{
VALUE obj, f;
rb_ast_t *ast = 0;
- rb_binding_t *toplevel_binding;
rb_encoding *enc = rb_utf8_encoding();
const VALUE parser = rb_parser_new();
- GetBindingPtr(rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING")),
- toplevel_binding);
-
FilePathValue(path);
f = rb_file_open_str(path, "r");
rb_funcall(f, rb_intern("set_encoding"), 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
- rb_parser_set_context(parser, &toplevel_binding->block, 1);
+ rb_parser_set_context(parser, NULL, 1);
ast = rb_parser_compile_file_path(parser, path, f, 1);
rb_io_close(f);