* don't generate typed constant initializers for interfaces (since they

can't have class constructors)

git-svn-id: branches/jvmbackend@18478 -
This commit is contained in:
Jonas Maebe 2011-08-20 08:03:14 +00:00
parent 5b915178fa
commit 2964ea3e9b
2 changed files with 12 additions and 1 deletions

View File

@ -1387,7 +1387,8 @@ implementation
if is_javaclass(current_structdef) then
maybe_add_public_default_java_constructor(tobjectdef(current_structdef));
{ need method to hold the initialization code for typed constants? }
if target_info.system in systems_typed_constants_node_init then
if (target_info.system in systems_typed_constants_node_init) and
not is_any_interface_kind(current_structdef) then
add_typedconst_init_routine(current_structdef);
end;

View File

@ -838,6 +838,7 @@ interface
{ should be in the types unit, but the types unit uses the node stuff :( }
function is_interfacecom(def: tdef): boolean;
function is_interfacecom_or_dispinterface(def: tdef): boolean;
function is_any_interface_kind(def: tdef): boolean;
function is_interfacecorba(def: tdef): boolean;
function is_interface(def: tdef): boolean;
function is_dispinterface(def: tdef): boolean;
@ -5907,6 +5908,15 @@ implementation
(tobjectdef(def).objecttype in [odt_interfacecom,odt_dispinterface]);
end;
function is_any_interface_kind(def: tdef): boolean;
begin
result:=
assigned(def) and
(def.typ=objectdef) and
((tobjectdef(def).objecttype in [odt_interfacecom,odt_dispinterface,odt_interfacecorba,odt_interfacejava,odt_objcprotocol]) or
is_objccategory(def));
end;
function is_interfacecorba(def: tdef): boolean;
begin
is_interfacecorba:=