|
@@ -573,7 +573,6 @@ implementation
|
|
|
|
|
|
var
|
|
|
pd : tprocdef;
|
|
|
- has_destructor,
|
|
|
oldparse_only: boolean;
|
|
|
member_blocktype : tblock_type;
|
|
|
fields_allowed, is_classdef, classfields: boolean;
|
|
@@ -585,7 +584,6 @@ implementation
|
|
|
|
|
|
current_structdef.symtable.currentvisibility:=vis_public;
|
|
|
testcurobject:=1;
|
|
|
- has_destructor:=false;
|
|
|
fields_allowed:=true;
|
|
|
is_classdef:=false;
|
|
|
classfields:=false;
|
|
@@ -617,6 +615,7 @@ implementation
|
|
|
begin
|
|
|
consume(_PRIVATE);
|
|
|
current_structdef.symtable.currentvisibility:=vis_private;
|
|
|
+ include(current_structdef.objectoptions,oo_has_private);
|
|
|
fields_allowed:=true;
|
|
|
is_classdef:=false;
|
|
|
classfields:=false;
|
|
@@ -626,6 +625,7 @@ implementation
|
|
|
begin
|
|
|
consume(_PROTECTED);
|
|
|
current_structdef.symtable.currentvisibility:=vis_protected;
|
|
|
+ include(current_structdef.objectoptions,oo_has_protected);
|
|
|
fields_allowed:=true;
|
|
|
is_classdef:=false;
|
|
|
classfields:=false;
|
|
@@ -660,11 +660,13 @@ implementation
|
|
|
begin
|
|
|
consume(_PRIVATE);
|
|
|
current_structdef.symtable.currentvisibility:=vis_strictprivate;
|
|
|
+ include(current_structdef.objectoptions,oo_has_strictprivate);
|
|
|
end;
|
|
|
_PROTECTED:
|
|
|
begin
|
|
|
consume(_PROTECTED);
|
|
|
current_structdef.symtable.currentvisibility:=vis_strictprotected;
|
|
|
+ include(current_structdef.objectoptions,oo_has_strictprotected);
|
|
|
end;
|
|
|
else
|
|
|
message(parser_e_protected_or_private_expected);
|
|
@@ -742,43 +744,31 @@ implementation
|
|
|
fields_allowed:=false;
|
|
|
is_classdef:=false;
|
|
|
end;
|
|
|
-{ todo: constructor
|
|
|
_CONSTRUCTOR :
|
|
|
begin
|
|
|
- if (current_objectdef.symtable.currentvisibility=vis_published) and
|
|
|
- not(oo_can_have_published in current_objectdef.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 (current_structdef.symtable.currentvisibility <> vis_public) then
|
|
|
Message(parser_w_constructor_should_be_public);
|
|
|
|
|
|
- if is_interface(current_objectdef) 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
|
|
|
- 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;
|
|
|
if is_classdef then
|
|
|
pd:=class_constructor_head
|
|
|
else
|
|
|
- pd:=constructor_head;
|
|
|
- parse_object_proc_directives(pd);
|
|
|
+ begin
|
|
|
+ pd:=constructor_head;
|
|
|
+ { raise internal error for now - constructor is not implemented yet }
|
|
|
+ internalerror(201012110);
|
|
|
+ end;
|
|
|
+ parse_record_proc_directives(pd);
|
|
|
handle_calling_convention(pd);
|
|
|
|
|
|
{ add definition to procsym }
|
|
|
proc_add_definition(pd);
|
|
|
|
|
|
- { add procdef options to objectdef options }
|
|
|
- if (po_virtualmethod in pd.procoptions) then
|
|
|
- include(current_objectdef.objectoptions,oo_has_virtual);
|
|
|
- chkcpp(pd);
|
|
|
maybe_parse_hint_directives(pd);
|
|
|
|
|
|
parse_only:=oldparse_only;
|
|
@@ -787,29 +777,12 @@ implementation
|
|
|
end;
|
|
|
_DESTRUCTOR :
|
|
|
begin
|
|
|
- if (current_objectdef.symtable.currentvisibility=vis_published) and
|
|
|
- not(oo_can_have_published in current_objectdef.objectoptions) then
|
|
|
- Message(parser_e_cant_have_published);
|
|
|
-
|
|
|
if not is_classdef then
|
|
|
- if has_destructor then
|
|
|
- Message(parser_n_only_one_destructor)
|
|
|
- else
|
|
|
- has_destructor:=true;
|
|
|
-
|
|
|
- if is_interface(current_objectdef) then
|
|
|
- Message(parser_e_no_con_des_in_interfaces);
|
|
|
-
|
|
|
- if not is_classdef and (current_objectdef.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
|
|
|
- Message(parser_e_objc_no_constructor_destructor);
|
|
|
+ Message(parser_e_no_destructor_in_records);
|
|
|
|
|
|
{ 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;
|
|
@@ -817,24 +790,18 @@ implementation
|
|
|
pd:=class_destructor_head
|
|
|
else
|
|
|
pd:=destructor_head;
|
|
|
- parse_object_proc_directives(pd);
|
|
|
+ parse_record_proc_directives(pd);
|
|
|
handle_calling_convention(pd);
|
|
|
|
|
|
{ add definition to procsym }
|
|
|
proc_add_definition(pd);
|
|
|
|
|
|
- { add procdef options to objectdef options }
|
|
|
- if (po_virtualmethod in pd.procoptions) then
|
|
|
- include(current_objectdef.objectoptions,oo_has_virtual);
|
|
|
-
|
|
|
- chkcpp(pd);
|
|
|
maybe_parse_hint_directives(pd);
|
|
|
|
|
|
parse_only:=oldparse_only;
|
|
|
fields_allowed:=false;
|
|
|
is_classdef:=false;
|
|
|
end;
|
|
|
-}
|
|
|
_END :
|
|
|
begin
|
|
|
consume(_END);
|