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}; return if $seen_class{$name};
$seen_class{$name}++; $seen_class{$name}++;
my $rtti_name = $type->getAttribute('original-name') || my $rtti_name;
$type->getAttribute('type-name'); if ($type->getAttribute('ld:meta') eq 'class-type') {
$rtti_name = $type->getAttribute('original-name') ||
my $has_rtti = $parent; $type->getAttribute('type-name') ||
if (!$parent and $type->getAttribute('ld:meta') eq 'class-type') { $name;
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 $rbparent = ($parent ? rb_ucase($parent) : 'MemHack::Compound'); my $rbparent = ($parent ? rb_ucase($parent) : 'MemHack::Compound');
@ -189,7 +182,7 @@ sub render_global_class {
indent_rb { indent_rb {
my $sz = query_cpp("sizeof($cppns)"); my $sz = query_cpp("sizeof($cppns)");
push @lines_rb, "sizeof $sz"; 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"); render_struct_fields($type, "$cppns");
}; };
push @lines_rb, "end\n"; push @lines_rb, "end\n";