mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 10:45:08 +02:00
compiler: use current_structdef in more places where current_objectdef was used, change type of current_genericdef and current_specializedef to tabstractrecorddef for future use with generic records
git-svn-id: trunk@16659 -
This commit is contained in:
parent
dc5f5c3f63
commit
ee78cf0f06
@ -225,10 +225,10 @@ implementation
|
||||
i : longint;
|
||||
def : tdef;
|
||||
begin
|
||||
include(current_objectdef.objectoptions,oo_has_virtual);
|
||||
for i:=0 to current_objectdef.symtable.DefList.count-1 do
|
||||
include(current_structdef.objectoptions,oo_has_virtual);
|
||||
for i:=0 to current_structdef.symtable.DefList.count-1 do
|
||||
begin
|
||||
def:=tdef(current_objectdef.symtable.DefList[i]);
|
||||
def:=tdef(current_structdef.symtable.DefList[i]);
|
||||
if assigned(def) and
|
||||
(def.typ=procdef) then
|
||||
begin
|
||||
@ -244,9 +244,9 @@ implementation
|
||||
i : longint;
|
||||
def : tdef;
|
||||
begin
|
||||
for i:=0 to current_objectdef.symtable.DefList.count-1 do
|
||||
for i:=0 to current_structdef.symtable.DefList.count-1 do
|
||||
begin
|
||||
def:=tdef(current_objectdef.symtable.DefList[i]);
|
||||
def:=tdef(current_structdef.symtable.DefList[i]);
|
||||
if assigned(def) and
|
||||
(def.typ=procdef) then
|
||||
begin
|
||||
@ -334,7 +334,7 @@ implementation
|
||||
if (current_objectdef.objecttype in [odt_interfacecom,odt_dispinterface]) and
|
||||
not valid then
|
||||
Message(parser_e_improper_guid_syntax);
|
||||
include(current_objectdef.objectoptions,oo_has_valid_guid);
|
||||
include(current_structdef.objectoptions,oo_has_valid_guid);
|
||||
end
|
||||
else
|
||||
Message(parser_e_illegal_expression);
|
||||
@ -348,14 +348,14 @@ implementation
|
||||
while true do
|
||||
begin
|
||||
if try_to_consume(_ABSTRACT) then
|
||||
include(current_objectdef.objectoptions,oo_is_abstract)
|
||||
include(current_structdef.objectoptions,oo_is_abstract)
|
||||
else
|
||||
if try_to_consume(_SEALED) then
|
||||
include(current_objectdef.objectoptions,oo_is_sealed)
|
||||
include(current_structdef.objectoptions,oo_is_sealed)
|
||||
else
|
||||
break;
|
||||
end;
|
||||
if [oo_is_abstract, oo_is_sealed] * current_objectdef.objectoptions = [oo_is_abstract, oo_is_sealed] then
|
||||
if [oo_is_abstract, oo_is_sealed] * current_structdef.objectoptions = [oo_is_abstract, oo_is_sealed] then
|
||||
Message(parser_e_abstract_and_sealed_conflict);
|
||||
end;
|
||||
end;
|
||||
@ -373,7 +373,7 @@ implementation
|
||||
|
||||
{ reads the parent class }
|
||||
if (token=_LKLAMMER) or
|
||||
is_objccategory(current_objectdef) then
|
||||
is_objccategory(current_structdef) then
|
||||
begin
|
||||
consume(_LKLAMMER);
|
||||
{ use single_type instead of id_type for specialize support }
|
||||
@ -383,7 +383,7 @@ implementation
|
||||
begin
|
||||
if assigned(hdef) then
|
||||
Message1(type_e_class_type_expected,hdef.typename)
|
||||
else if is_objccategory(current_objectdef) then
|
||||
else if is_objccategory(current_structdef) then
|
||||
{ a category must specify the class to extend }
|
||||
Message(type_e_objcclass_type_expected);
|
||||
end
|
||||
@ -426,7 +426,7 @@ implementation
|
||||
begin
|
||||
if is_objcprotocol(childof) then
|
||||
begin
|
||||
if not(oo_is_classhelper in current_objectdef.objectoptions) then
|
||||
if not(oo_is_classhelper in current_structdef.objectoptions) then
|
||||
begin
|
||||
intfchildof:=childof;
|
||||
childof:=nil;
|
||||
@ -499,7 +499,7 @@ implementation
|
||||
end;
|
||||
|
||||
{ remove forward flag, is resolved }
|
||||
exclude(current_objectdef.objectoptions,oo_is_forward);
|
||||
exclude(current_structdef.objectoptions,oo_is_forward);
|
||||
|
||||
if hasparentdefined then
|
||||
begin
|
||||
@ -536,16 +536,16 @@ implementation
|
||||
i : longint;
|
||||
generictype : ttypesym;
|
||||
begin
|
||||
current_objectdef.genericdef:=genericdef;
|
||||
current_structdef.genericdef:=genericdef;
|
||||
if not assigned(genericlist) then
|
||||
exit;
|
||||
for i:=0 to genericlist.count-1 do
|
||||
begin
|
||||
generictype:=ttypesym(genericlist[i]);
|
||||
if generictype.typedef.typ=undefineddef then
|
||||
include(current_objectdef.defoptions,df_generic)
|
||||
include(current_structdef.defoptions,df_generic)
|
||||
else
|
||||
include(current_objectdef.defoptions,df_specialization);
|
||||
include(current_structdef.defoptions,df_specialization);
|
||||
symtablestack.top.insert(generictype);
|
||||
end;
|
||||
end;
|
||||
@ -601,12 +601,12 @@ implementation
|
||||
|
||||
old_parse_generic:=parse_generic;
|
||||
|
||||
parse_generic:=(df_generic in current_objectdef.defoptions);
|
||||
parse_generic:=(df_generic in current_structdef.defoptions);
|
||||
{ in "publishable" classes the default access type is published }
|
||||
if (oo_can_have_published in current_objectdef.objectoptions) then
|
||||
current_objectdef.symtable.currentvisibility:=vis_published
|
||||
if (oo_can_have_published in current_structdef.objectoptions) then
|
||||
current_structdef.symtable.currentvisibility:=vis_published
|
||||
else
|
||||
current_objectdef.symtable.currentvisibility:=vis_public;
|
||||
current_structdef.symtable.currentvisibility:=vis_public;
|
||||
has_destructor:=false;
|
||||
fields_allowed:=true;
|
||||
is_classdef:=false;
|
||||
@ -616,7 +616,7 @@ implementation
|
||||
case token of
|
||||
_TYPE :
|
||||
begin
|
||||
if (([df_generic,df_specialization]*current_objectdef.defoptions)=[]) and
|
||||
if (([df_generic,df_specialization]*current_structdef.defoptions)=[]) and
|
||||
not(current_objectdef.objecttype in [odt_class,odt_object]) then
|
||||
Message(parser_e_type_var_const_only_in_generics_and_classes);
|
||||
consume(_TYPE);
|
||||
@ -624,7 +624,7 @@ implementation
|
||||
end;
|
||||
_VAR :
|
||||
begin
|
||||
if (([df_generic,df_specialization]*current_objectdef.defoptions)=[]) and
|
||||
if (([df_generic,df_specialization]*current_structdef.defoptions)=[]) and
|
||||
not(current_objectdef.objecttype in [odt_class,odt_object]) then
|
||||
Message(parser_e_type_var_const_only_in_generics_and_classes);
|
||||
consume(_VAR);
|
||||
@ -635,7 +635,7 @@ implementation
|
||||
end;
|
||||
_CONST:
|
||||
begin
|
||||
if (([df_generic,df_specialization]*current_objectdef.defoptions)=[]) and
|
||||
if (([df_generic,df_specialization]*current_structdef.defoptions)=[]) and
|
||||
not(current_objectdef.objecttype in [odt_class,odt_object]) then
|
||||
Message(parser_e_type_var_const_only_in_generics_and_classes);
|
||||
consume(_CONST);
|
||||
@ -643,22 +643,22 @@ implementation
|
||||
end;
|
||||
_ID :
|
||||
begin
|
||||
if is_objcprotocol(current_objectdef) and
|
||||
if is_objcprotocol(current_structdef) and
|
||||
((idtoken=_REQUIRED) or
|
||||
(idtoken=_OPTIONAL)) then
|
||||
begin
|
||||
current_objectdef.symtable.currentlyoptional:=(idtoken=_OPTIONAL);
|
||||
current_structdef.symtable.currentlyoptional:=(idtoken=_OPTIONAL);
|
||||
consume(idtoken)
|
||||
end
|
||||
else case idtoken of
|
||||
_PRIVATE :
|
||||
begin
|
||||
if is_interface(current_objectdef) or
|
||||
is_objc_protocol_or_category(current_objectdef) then
|
||||
if is_interface(current_structdef) or
|
||||
is_objc_protocol_or_category(current_structdef) then
|
||||
Message(parser_e_no_access_specifier_in_interfaces);
|
||||
consume(_PRIVATE);
|
||||
current_objectdef.symtable.currentvisibility:=vis_private;
|
||||
include(current_objectdef.objectoptions,oo_has_private);
|
||||
current_structdef.symtable.currentvisibility:=vis_private;
|
||||
include(current_structdef.objectoptions,oo_has_private);
|
||||
fields_allowed:=true;
|
||||
is_classdef:=false;
|
||||
classfields:=false;
|
||||
@ -666,12 +666,12 @@ implementation
|
||||
end;
|
||||
_PROTECTED :
|
||||
begin
|
||||
if is_interface(current_objectdef) or
|
||||
is_objc_protocol_or_category(current_objectdef) then
|
||||
if is_interface(current_structdef) or
|
||||
is_objc_protocol_or_category(current_structdef) then
|
||||
Message(parser_e_no_access_specifier_in_interfaces);
|
||||
consume(_PROTECTED);
|
||||
current_objectdef.symtable.currentvisibility:=vis_protected;
|
||||
include(current_objectdef.objectoptions,oo_has_protected);
|
||||
current_structdef.symtable.currentvisibility:=vis_protected;
|
||||
include(current_structdef.objectoptions,oo_has_protected);
|
||||
fields_allowed:=true;
|
||||
is_classdef:=false;
|
||||
classfields:=false;
|
||||
@ -679,11 +679,11 @@ implementation
|
||||
end;
|
||||
_PUBLIC :
|
||||
begin
|
||||
if is_interface(current_objectdef) or
|
||||
is_objc_protocol_or_category(current_objectdef) then
|
||||
if is_interface(current_structdef) or
|
||||
is_objc_protocol_or_category(current_structdef) then
|
||||
Message(parser_e_no_access_specifier_in_interfaces);
|
||||
consume(_PUBLIC);
|
||||
current_objectdef.symtable.currentvisibility:=vis_public;
|
||||
current_structdef.symtable.currentvisibility:=vis_public;
|
||||
fields_allowed:=true;
|
||||
is_classdef:=false;
|
||||
classfields:=false;
|
||||
@ -694,14 +694,14 @@ implementation
|
||||
{ we've to check for a pushlished section in non- }
|
||||
{ publishable classes later, if a real declaration }
|
||||
{ this is the way, delphi does it }
|
||||
if is_interface(current_objectdef) then
|
||||
if is_interface(current_structdef) then
|
||||
Message(parser_e_no_access_specifier_in_interfaces);
|
||||
{ Objective-C classes do not support "published",
|
||||
as basically everything is published. }
|
||||
if is_objc_class_or_protocol(current_objectdef) then
|
||||
if is_objc_class_or_protocol(current_structdef) then
|
||||
Message(parser_e_no_objc_published);
|
||||
consume(_PUBLISHED);
|
||||
current_objectdef.symtable.currentvisibility:=vis_published;
|
||||
current_structdef.symtable.currentvisibility:=vis_published;
|
||||
fields_allowed:=true;
|
||||
is_classdef:=false;
|
||||
classfields:=false;
|
||||
@ -709,8 +709,8 @@ implementation
|
||||
end;
|
||||
_STRICT :
|
||||
begin
|
||||
if is_interface(current_objectdef) or
|
||||
is_objc_protocol_or_category(current_objectdef) then
|
||||
if is_interface(current_structdef) or
|
||||
is_objc_protocol_or_category(current_structdef) then
|
||||
Message(parser_e_no_access_specifier_in_interfaces);
|
||||
consume(_STRICT);
|
||||
if token=_ID then
|
||||
@ -719,14 +719,14 @@ implementation
|
||||
_PRIVATE:
|
||||
begin
|
||||
consume(_PRIVATE);
|
||||
current_objectdef.symtable.currentvisibility:=vis_strictprivate;
|
||||
include(current_objectdef.objectoptions,oo_has_strictprivate);
|
||||
current_structdef.symtable.currentvisibility:=vis_strictprivate;
|
||||
include(current_structdef.objectoptions,oo_has_strictprivate);
|
||||
end;
|
||||
_PROTECTED:
|
||||
begin
|
||||
consume(_PROTECTED);
|
||||
current_objectdef.symtable.currentvisibility:=vis_strictprotected;
|
||||
include(current_objectdef.objectoptions,oo_has_strictprotected);
|
||||
current_structdef.symtable.currentvisibility:=vis_strictprotected;
|
||||
include(current_structdef.objectoptions,oo_has_strictprotected);
|
||||
end;
|
||||
else
|
||||
message(parser_e_protected_or_private_expected);
|
||||
@ -743,12 +743,12 @@ implementation
|
||||
begin
|
||||
if object_member_blocktype=bt_general then
|
||||
begin
|
||||
if is_interface(current_objectdef) or
|
||||
is_objc_protocol_or_category(current_objectdef) then
|
||||
if is_interface(current_structdef) or
|
||||
is_objc_protocol_or_category(current_structdef) then
|
||||
Message(parser_e_no_vars_in_interfaces);
|
||||
|
||||
if (current_objectdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_objectdef.objectoptions) then
|
||||
if (current_structdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_structdef.objectoptions) then
|
||||
Message(parser_e_cant_have_published);
|
||||
if (not fields_allowed) then
|
||||
Message(parser_e_field_not_allowed_here);
|
||||
@ -784,7 +784,7 @@ implementation
|
||||
if not(token in [_FUNCTION,_PROCEDURE,_PROPERTY,_VAR,_CONSTRUCTOR,_DESTRUCTOR]) then
|
||||
Message(parser_e_procedure_or_function_expected);
|
||||
|
||||
if is_interface(current_objectdef) then
|
||||
if is_interface(current_structdef) then
|
||||
Message(parser_e_no_static_method_in_interfaces)
|
||||
else
|
||||
{ class methods are also allowed for Objective-C protocols }
|
||||
@ -794,13 +794,13 @@ implementation
|
||||
_PROCEDURE,
|
||||
_FUNCTION:
|
||||
begin
|
||||
if (current_objectdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_objectdef.objectoptions) then
|
||||
if (current_structdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_structdef.objectoptions) then
|
||||
Message(parser_e_cant_have_published);
|
||||
|
||||
oldparse_only:=parse_only;
|
||||
parse_only:=true;
|
||||
pd:=parse_proc_dec(is_classdef,current_objectdef);
|
||||
pd:=parse_proc_dec(is_classdef,current_structdef);
|
||||
|
||||
{ this is for error recovery as well as forward }
|
||||
{ interface mappings, i.e. mapping to a method }
|
||||
@ -829,11 +829,11 @@ implementation
|
||||
|
||||
{ add procdef options to objectdef options }
|
||||
if (po_msgint in pd.procoptions) then
|
||||
include(current_objectdef.objectoptions,oo_has_msgint);
|
||||
include(current_structdef.objectoptions,oo_has_msgint);
|
||||
if (po_msgstr in pd.procoptions) then
|
||||
include(current_objectdef.objectoptions,oo_has_msgstr);
|
||||
include(current_structdef.objectoptions,oo_has_msgstr);
|
||||
if (po_virtualmethod in pd.procoptions) then
|
||||
include(current_objectdef.objectoptions,oo_has_virtual);
|
||||
include(current_structdef.objectoptions,oo_has_virtual);
|
||||
|
||||
chkcpp(pd);
|
||||
chkobjc(pd);
|
||||
@ -847,23 +847,23 @@ implementation
|
||||
end;
|
||||
_CONSTRUCTOR :
|
||||
begin
|
||||
if (current_objectdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_objectdef.objectoptions) then
|
||||
if (current_structdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_structdef.objectoptions) then
|
||||
Message(parser_e_cant_have_published);
|
||||
|
||||
if not is_classdef and not(current_objectdef.symtable.currentvisibility in [vis_public,vis_published]) then
|
||||
if not is_classdef and not(current_structdef.symtable.currentvisibility in [vis_public,vis_published]) then
|
||||
Message(parser_w_constructor_should_be_public);
|
||||
|
||||
if is_interface(current_objectdef) then
|
||||
if is_interface(current_structdef) then
|
||||
Message(parser_e_no_con_des_in_interfaces);
|
||||
|
||||
{ Objective-C does not know the concept of a constructor }
|
||||
if is_objc_class_or_protocol(current_objectdef) then
|
||||
if is_objc_class_or_protocol(current_structdef) then
|
||||
Message(parser_e_objc_no_constructor_destructor);
|
||||
|
||||
{ only 1 class constructor is allowed }
|
||||
if is_classdef and (oo_has_class_constructor in current_objectdef.objectoptions) then
|
||||
Message1(parser_e_only_one_class_constructor_allowed, current_objectdef.objrealname^);
|
||||
if is_classdef and (oo_has_class_constructor in current_structdef.objectoptions) then
|
||||
Message1(parser_e_only_one_class_constructor_allowed, current_structdef.objrealname^);
|
||||
|
||||
oldparse_only:=parse_only;
|
||||
parse_only:=true;
|
||||
@ -879,7 +879,7 @@ implementation
|
||||
|
||||
{ add procdef options to objectdef options }
|
||||
if (po_virtualmethod in pd.procoptions) then
|
||||
include(current_objectdef.objectoptions,oo_has_virtual);
|
||||
include(current_structdef.objectoptions,oo_has_virtual);
|
||||
chkcpp(pd);
|
||||
maybe_parse_hint_directives(pd);
|
||||
|
||||
@ -889,8 +889,8 @@ implementation
|
||||
end;
|
||||
_DESTRUCTOR :
|
||||
begin
|
||||
if (current_objectdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_objectdef.objectoptions) then
|
||||
if (current_structdef.symtable.currentvisibility=vis_published) and
|
||||
not(oo_can_have_published in current_structdef.objectoptions) then
|
||||
Message(parser_e_cant_have_published);
|
||||
|
||||
if not is_classdef then
|
||||
@ -899,19 +899,19 @@ implementation
|
||||
else
|
||||
has_destructor:=true;
|
||||
|
||||
if is_interface(current_objectdef) then
|
||||
if is_interface(current_structdef) then
|
||||
Message(parser_e_no_con_des_in_interfaces);
|
||||
|
||||
if not is_classdef and (current_objectdef.symtable.currentvisibility<>vis_public) then
|
||||
if not is_classdef and (current_structdef.symtable.currentvisibility<>vis_public) then
|
||||
Message(parser_w_destructor_should_be_public);
|
||||
|
||||
{ Objective-C does not know the concept of a destructor }
|
||||
if is_objc_class_or_protocol(current_objectdef) then
|
||||
if is_objc_class_or_protocol(current_structdef) then
|
||||
Message(parser_e_objc_no_constructor_destructor);
|
||||
|
||||
{ only 1 class destructor is allowed }
|
||||
if is_classdef and (oo_has_class_destructor in current_objectdef.objectoptions) then
|
||||
Message1(parser_e_only_one_class_destructor_allowed, current_objectdef.objrealname^);
|
||||
if is_classdef and (oo_has_class_destructor in current_structdef.objectoptions) then
|
||||
Message1(parser_e_only_one_class_destructor_allowed, current_structdef.objrealname^);
|
||||
|
||||
oldparse_only:=parse_only;
|
||||
parse_only:=true;
|
||||
@ -927,7 +927,7 @@ implementation
|
||||
|
||||
{ add procdef options to objectdef options }
|
||||
if (po_virtualmethod in pd.procoptions) then
|
||||
include(current_objectdef.objectoptions,oo_has_virtual);
|
||||
include(current_structdef.objectoptions,oo_has_virtual);
|
||||
|
||||
chkcpp(pd);
|
||||
maybe_parse_hint_directives(pd);
|
||||
@ -953,15 +953,15 @@ implementation
|
||||
|
||||
function object_dec(objecttype:tobjecttyp;const n:tidstring;genericdef:tstoreddef;genericlist:TFPObjectList;fd : tobjectdef) : tobjectdef;
|
||||
var
|
||||
old_current_objectdef : tobjectdef;
|
||||
old_current_genericdef : tobjectdef;
|
||||
old_current_specializedef : tobjectdef;
|
||||
old_current_structdef,
|
||||
old_current_genericdef,
|
||||
old_current_specializedef: tabstractrecorddef;
|
||||
begin
|
||||
old_current_objectdef:=current_objectdef;
|
||||
old_current_structdef:=current_structdef;
|
||||
old_current_genericdef:=current_genericdef;
|
||||
old_current_specializedef:=current_specializedef;
|
||||
|
||||
current_objectdef:=nil;
|
||||
current_structdef:=nil;
|
||||
current_genericdef:=nil;
|
||||
current_specializedef:=nil;
|
||||
|
||||
@ -977,11 +977,11 @@ implementation
|
||||
begin
|
||||
Message(parser_e_forward_mismatch);
|
||||
{ recover }
|
||||
current_objectdef:=tobjectdef.create(current_objectdef.objecttype,n,nil);
|
||||
include(current_objectdef.objectoptions,oo_is_forward);
|
||||
current_structdef:=tobjectdef.create(current_objectdef.objecttype,n,nil);
|
||||
include(current_structdef.objectoptions,oo_is_forward);
|
||||
end
|
||||
else
|
||||
current_objectdef:=fd
|
||||
current_structdef:=fd
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -990,20 +990,20 @@ implementation
|
||||
Message(parser_f_no_anonym_objects);
|
||||
|
||||
{ create new class }
|
||||
current_objectdef:=tobjectdef.create(objecttype,n,nil);
|
||||
current_structdef:=tobjectdef.create(objecttype,n,nil);
|
||||
|
||||
{ include always the forward flag, it'll be removed after the parent class have been
|
||||
added. This is to prevent circular childof loops }
|
||||
include(current_objectdef.objectoptions,oo_is_forward);
|
||||
include(current_structdef.objectoptions,oo_is_forward);
|
||||
|
||||
if (cs_compilesystem in current_settings.moduleswitches) then
|
||||
begin
|
||||
case current_objectdef.objecttype of
|
||||
odt_interfacecom :
|
||||
if (current_objectdef.objname^='IUNKNOWN') then
|
||||
if (current_structdef.objname^='IUNKNOWN') then
|
||||
interface_iunknown:=current_objectdef;
|
||||
odt_class :
|
||||
if (current_objectdef.objname^='TOBJECT') then
|
||||
if (current_structdef.objname^='TOBJECT') then
|
||||
class_tobject:=current_objectdef;
|
||||
end;
|
||||
end;
|
||||
@ -1019,16 +1019,16 @@ implementation
|
||||
|
||||
{ usage of specialized type inside its generic template }
|
||||
if assigned(genericdef) then
|
||||
current_specializedef:=current_objectdef
|
||||
current_specializedef:=current_structdef
|
||||
{ reject declaration of generic class inside generic class }
|
||||
else if assigned(genericlist) then
|
||||
current_genericdef:=current_objectdef;
|
||||
current_genericdef:=current_structdef;
|
||||
|
||||
{ set published flag in $M+ mode, it can also be inherited and will
|
||||
be added when the parent class set with tobjectdef.set_parent (PFV) }
|
||||
if (cs_generate_rtti in current_settings.localswitches) and
|
||||
(current_objectdef.objecttype in [odt_interfacecom,odt_class]) then
|
||||
include(current_objectdef.objectoptions,oo_can_have_published);
|
||||
include(current_structdef.objectoptions,oo_can_have_published);
|
||||
|
||||
{ forward def? }
|
||||
if not assigned(fd) and
|
||||
@ -1036,7 +1036,7 @@ implementation
|
||||
begin
|
||||
{ add to the list of definitions to check that the forward
|
||||
is resolved. this is required for delphi mode }
|
||||
current_module.checkforwarddefs.add(current_objectdef);
|
||||
current_module.checkforwarddefs.add(current_structdef);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1044,7 +1044,7 @@ implementation
|
||||
if (objecttype=odt_objccategory) then
|
||||
begin
|
||||
current_objectdef.objecttype:=odt_objcclass;
|
||||
include(current_objectdef.objectoptions,oo_is_classhelper);
|
||||
include(current_structdef.objectoptions,oo_is_classhelper);
|
||||
end;
|
||||
|
||||
{ parse list of options (abstract / sealed) }
|
||||
@ -1056,40 +1056,40 @@ implementation
|
||||
{ parse optional GUID for interfaces }
|
||||
parse_guid;
|
||||
|
||||
symtablestack.push(current_objectdef.symtable);
|
||||
symtablestack.push(current_structdef.symtable);
|
||||
insert_generic_parameter_types(genericdef,genericlist);
|
||||
{ parse and insert object members }
|
||||
parse_object_members;
|
||||
symtablestack.pop(current_objectdef.symtable);
|
||||
symtablestack.pop(current_structdef.symtable);
|
||||
end;
|
||||
|
||||
{ generate vmt space if needed }
|
||||
if not(oo_has_vmt in current_objectdef.objectoptions) and
|
||||
not(oo_is_forward in current_objectdef.objectoptions) and
|
||||
if not(oo_has_vmt in current_structdef.objectoptions) and
|
||||
not(oo_is_forward in current_structdef.objectoptions) and
|
||||
(
|
||||
([oo_has_virtual,oo_has_constructor,oo_has_destructor]*current_objectdef.objectoptions<>[]) or
|
||||
([oo_has_virtual,oo_has_constructor,oo_has_destructor]*current_structdef.objectoptions<>[]) or
|
||||
(current_objectdef.objecttype in [odt_class])
|
||||
) then
|
||||
current_objectdef.insertvmt;
|
||||
|
||||
{ for implemented classes with a vmt check if there is a constructor }
|
||||
if (oo_has_vmt in current_objectdef.objectoptions) and
|
||||
not(oo_is_forward in current_objectdef.objectoptions) and
|
||||
not(oo_has_constructor in current_objectdef.objectoptions) and
|
||||
not is_objc_class_or_protocol(current_objectdef) then
|
||||
Message1(parser_w_virtual_without_constructor,current_objectdef.objrealname^);
|
||||
if (oo_has_vmt in current_structdef.objectoptions) and
|
||||
not(oo_is_forward in current_structdef.objectoptions) and
|
||||
not(oo_has_constructor in current_structdef.objectoptions) and
|
||||
not is_objc_class_or_protocol(current_structdef) then
|
||||
Message1(parser_w_virtual_without_constructor,current_structdef.objrealname^);
|
||||
|
||||
if is_interface(current_objectdef) or
|
||||
is_objcprotocol(current_objectdef) then
|
||||
if is_interface(current_structdef) or
|
||||
is_objcprotocol(current_structdef) then
|
||||
setinterfacemethodoptions
|
||||
else if is_objcclass(current_objectdef) then
|
||||
else if is_objcclass(current_structdef) then
|
||||
setobjcclassmethodoptions;
|
||||
|
||||
{ return defined objectdef }
|
||||
result:=current_objectdef;
|
||||
|
||||
{ restore old state }
|
||||
current_objectdef:=old_current_objectdef;
|
||||
current_structdef:=old_current_structdef;
|
||||
current_genericdef:=old_current_genericdef;
|
||||
current_specializedef:=old_current_specializedef;
|
||||
end;
|
||||
|
@ -802,9 +802,9 @@ implementation
|
||||
popclass : integer;
|
||||
ImplIntf : TImplementedInterface;
|
||||
old_parse_generic : boolean;
|
||||
old_current_structdef: tabstractrecorddef;
|
||||
old_current_structdef,
|
||||
old_current_genericdef,
|
||||
old_current_specializedef : tobjectdef;
|
||||
old_current_specializedef : tabstractrecorddef;
|
||||
lasttoken,lastidtoken: ttoken;
|
||||
|
||||
procedure parse_operator_name;
|
||||
@ -1189,9 +1189,9 @@ implementation
|
||||
var
|
||||
popclass: integer;
|
||||
old_parse_generic: boolean;
|
||||
old_current_structdef: tabstractrecorddef;
|
||||
old_current_structdef,
|
||||
old_current_genericdef,
|
||||
old_current_specializedef: tobjectdef;
|
||||
old_current_specializedef: tabstractrecorddef;
|
||||
begin
|
||||
old_parse_generic:=parse_generic;
|
||||
{ Add ObjectSymtable to be able to find generic type definitions }
|
||||
|
@ -1388,9 +1388,9 @@ implementation
|
||||
old_current_procinfo : tprocinfo;
|
||||
old_block_type : tblock_type;
|
||||
st : TSymtable;
|
||||
old_current_structdef: tabstractrecorddef;
|
||||
old_current_structdef,
|
||||
old_current_genericdef,
|
||||
old_current_specializedef : tobjectdef;
|
||||
old_current_specializedef: tabstractrecorddef;
|
||||
begin
|
||||
old_current_procinfo:=current_procinfo;
|
||||
old_block_type:=block_type;
|
||||
@ -1655,9 +1655,9 @@ implementation
|
||||
|
||||
var
|
||||
old_current_procinfo : tprocinfo;
|
||||
old_current_structdef: tabstractrecorddef;
|
||||
old_current_structdef,
|
||||
old_current_genericdef,
|
||||
old_current_specializedef : tobjectdef;
|
||||
old_current_specializedef: tabstractrecorddef;
|
||||
pdflags : tpdflags;
|
||||
pd,firstpd : tprocdef;
|
||||
s : string;
|
||||
|
@ -643,8 +643,8 @@ interface
|
||||
var
|
||||
current_structdef: tabstractrecorddef; { used for private functions check !! }
|
||||
current_objectdef : tobjectdef absolute current_structdef;
|
||||
current_genericdef : tobjectdef; { used to reject declaration of generic class inside generic class }
|
||||
current_specializedef : tobjectdef; { used to implement usage of generic class in itself }
|
||||
current_genericdef : tabstractrecorddef; { used to reject declaration of generic class inside generic class }
|
||||
current_specializedef : tabstractrecorddef; { used to implement usage of generic class in itself }
|
||||
|
||||
{ default types }
|
||||
generrordef, { error in definition }
|
||||
|
Loading…
Reference in New Issue
Block a user