зеркало из https://github.com/github/ruby.git
ast.c: allocator of Node
* ast.c (Init_ast): undefine allocator of Node, as a method call on an uninitialized Node causes segfault. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
64712906b0
Коммит
002f6ea856
3
ast.c
3
ast.c
|
@ -614,8 +614,7 @@ Init_ast(void)
|
||||||
*/
|
*/
|
||||||
rb_cNode = rb_define_class_under(rb_mAST, "Node", rb_cObject);
|
rb_cNode = rb_define_class_under(rb_mAST, "Node", rb_cObject);
|
||||||
|
|
||||||
rb_define_alloc_func(rb_cNode, rb_ast_node_alloc);
|
rb_undef_alloc_func(rb_cNode);
|
||||||
rb_undef_method(CLASS_OF(rb_cNode), "new");
|
|
||||||
rb_define_singleton_method(rb_mAST, "parse", rb_ast_s_parse, 1);
|
rb_define_singleton_method(rb_mAST, "parse", rb_ast_s_parse, 1);
|
||||||
rb_define_singleton_method(rb_mAST, "parse_file", rb_ast_s_parse_file, 1);
|
rb_define_singleton_method(rb_mAST, "parse_file", rb_ast_s_parse_file, 1);
|
||||||
rb_define_method(rb_cNode, "type", rb_ast_node_type, 0);
|
rb_define_method(rb_cNode, "type", rb_ast_node_type, 0);
|
||||||
|
|
|
@ -129,6 +129,10 @@ class TestAst < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_allocate
|
||||||
|
assert_raise(TypeError) {RubyVM::AST::Node.allocate}
|
||||||
|
end
|
||||||
|
|
||||||
def test_column_with_long_heredoc_identifier
|
def test_column_with_long_heredoc_identifier
|
||||||
term = "A"*257
|
term = "A"*257
|
||||||
ast = RubyVM::AST.parse("<<-#{term}\n""ddddddd\n#{term}\n")
|
ast = RubyVM::AST.parse("<<-#{term}\n""ddddddd\n#{term}\n")
|
||||||
|
|
Загрузка…
Ссылка в новой задаче