Project

General

Profile

Bug #11326 ยป struct-ban-attrset-id.patch

jeremyevans0 (Jeremy Evans), 07/05/2019 05:03 PM

View differences:

struct.c
tbl = RHASH_TBL(rest);
for (i=0; i<argc; i++) {
VALUE mem = rb_to_symbol(argv[i]);
if (rb_is_attrset_sym(mem)) {
rb_raise(rb_eArgError, "invalid struct member: %"PRIsVALUE, mem);
}
if (st_insert(tbl, mem, Qtrue)) {
rb_raise(rb_eArgError, "duplicate member: %"PRIsVALUE, mem);
}
test/ruby/test_struct.rb
assert_equal(1, o.a)
end
def test_attrset_id
assert_raise(ArgumentError) { Struct.new(:x=) }
end
def test_members
klass = @Struct.new(:a)
o = klass.new(1)
    (1-1/1)