diff options
author | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-31 05:49:56 +0000 |
---|---|---|
committer | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-31 05:49:56 +0000 |
commit | a97d22a00431112a2b80669269182ec4e58d51aa (patch) | |
tree | 068de8fd034a5f7b8c3832229899253ffbc10e2a /ext/-test- | |
parent | b9212a7771a5e67f3b48bbf4c76cd087a8d87e49 (diff) | |
download | ruby-a97d22a00431112a2b80669269182ec4e58d51aa.tar.gz |
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/-test-')
-rw-r--r-- | ext/-test-/ast/ast.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/ext/-test-/ast/ast.c b/ext/-test-/ast/ast.c index f608af911e..dfb31197ef 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); |