From 22628fe9bb4681891075e7ded6763366ce6f717b Mon Sep 17 00:00:00 2001 From: jj Date: Fri, 27 Apr 2012 14:13:44 +0200 Subject: [PATCH] codegen: all class-type have a vtable --- plugins/ruby/codegen.pl | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/plugins/ruby/codegen.pl b/plugins/ruby/codegen.pl index 55985fc0b..7165e57bb 100755 --- a/plugins/ruby/codegen.pl +++ b/plugins/ruby/codegen.pl @@ -164,18 +164,11 @@ sub render_global_class { return if $seen_class{$name}; $seen_class{$name}++; - my $rtti_name = $type->getAttribute('original-name') || - $type->getAttribute('type-name'); - - my $has_rtti = $parent; - if (!$parent and $type->getAttribute('ld:meta') eq 'class-type') { - for my $anytypename (keys %global_types) { - my $anytype = $global_types{$anytypename}; - if ($anytype->getAttribute('ld:meta') eq 'class-type') { - my $anyparent = $anytype->getAttribute('inherits-from'); - $has_rtti = 1 if ($anyparent and $anyparent eq $name); - } - } + my $rtti_name; + if ($type->getAttribute('ld:meta') eq 'class-type') { + $rtti_name = $type->getAttribute('original-name') || + $type->getAttribute('type-name') || + $name; } my $rbparent = ($parent ? rb_ucase($parent) : 'MemHack::Compound'); @@ -189,7 +182,7 @@ sub render_global_class { indent_rb { my $sz = query_cpp("sizeof($cppns)"); push @lines_rb, "sizeof $sz"; - push @lines_rb, "rtti_classname :$rtti_name" if $has_rtti; + push @lines_rb, "rtti_classname :$rtti_name" if $rtti_name; render_struct_fields($type, "$cppns"); }; push @lines_rb, "end\n";