codegen: all class-type have a vtable

develop
jj 2012-04-27 14:13:44 +02:00
parent 551df9bb73
commit 22628fe9bb
1 changed files with 6 additions and 13 deletions

@ -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";