compiler: partly revert r16560 and disable (at least temporary) constructors in records

git-svn-id: branches/paul/extended_records@16568 -
This commit is contained in:
paul 2010-12-16 03:37:16 +00:00
parent 8c56269076
commit 742b0bb686
6 changed files with 331 additions and 330 deletions

View File

@ -368,7 +368,7 @@ scanner_w_illegal_warn_identifier=02087_W_Illegal identifier "$1" for $WARN dire
# #
# Parser # Parser
# #
# 03299 is the last used one # 03301 is the last used one
# #
% \section{Parser messages} % \section{Parser messages}
% This section lists all parser messages. The parser takes care of the % This section lists all parser messages. The parser takes care of the
@ -1348,6 +1348,8 @@ parser_e_no_destructor_in_records=03299_E_Destructors aren't allowed in records
parser_e_class_methods_only_static_in_records=03300_E_Class methods must be static in records parser_e_class_methods_only_static_in_records=03300_E_Class methods must be static in records
% Class methods declarations aren't allowed in records without static modifier. % Class methods declarations aren't allowed in records without static modifier.
% Records have no inheritance and therefore non static class methods have no sence for them. % Records have no inheritance and therefore non static class methods have no sence for them.
parser_e_no_constructor_in_records=03301_E_Constructors aren't allowed in records
% Constructor declarations aren't allowed in records.
# #
# Type Checking # Type Checking
# #

View File

@ -389,6 +389,7 @@ const
parser_e_no_record_published=03298; parser_e_no_record_published=03298;
parser_e_no_destructor_in_records=03299; parser_e_no_destructor_in_records=03299;
parser_e_class_methods_only_static_in_records=03300; parser_e_class_methods_only_static_in_records=03300;
parser_e_no_constructor_in_records=03301;
type_e_mismatch=04000; type_e_mismatch=04000;
type_e_incompatible_types=04001; type_e_incompatible_types=04001;
type_e_not_equal_types=04002; type_e_not_equal_types=04002;
@ -874,9 +875,9 @@ const
option_info=11024; option_info=11024;
option_help_pages=11025; option_help_pages=11025;
MsgTxtSize = 58051; MsgTxtSize = 58098;
MsgIdxMax : array[1..20] of longint=( MsgIdxMax : array[1..20] of longint=(
24,88,301,97,82,54,111,22,202,63, 24,88,302,97,82,54,111,22,202,63,
49,20,1,1,1,1,1,1,1,1 49,20,1,1,1,1,1,1,1,1
); );

File diff suppressed because it is too large Load Diff

View File

@ -1652,10 +1652,6 @@ implementation
{ constructors } { constructors }
if (procdefinition.proctypeoption=potype_constructor) then if (procdefinition.proctypeoption=potype_constructor) then
begin begin
{ for records self in constructor maps to result }
if (tprocdef(procdefinition).struct.typ=recorddef) then
selftree:=funcretnode.getcopy
else
{ push 0 as self when allocation is needed } { push 0 as self when allocation is needed }
if (methodpointer.resultdef.typ=classrefdef) or if (methodpointer.resultdef.typ=classrefdef) or
(cnf_new_call in callnodeflags) then (cnf_new_call in callnodeflags) then

View File

@ -314,10 +314,7 @@ implementation
vsp:=vs_var; vsp:=vs_var;
hdef:=tprocdef(pd).struct; hdef:=tprocdef(pd).struct;
end; end;
if is_record(tprocdef(pd).struct) and (pd.proctypeoption=potype_constructor) then vs:=tparavarsym.create('$self',paranr_self,vsp,hdef,[vo_is_self,vo_is_hidden_para]);
vs:=tparavarsym.create('$self',paranr_self,vs_value,hdef,[vo_is_self,vo_is_hidden_para,vo_is_funcret])
else
vs:=tparavarsym.create('$self',paranr_self,vsp,hdef,[vo_is_self,vo_is_hidden_para]);
pd.parast.insert(vs); pd.parast.insert(vs);
current_tokenpos:=storepos; current_tokenpos:=storepos;

View File

@ -752,6 +752,8 @@ implementation
end; end;
_CONSTRUCTOR : _CONSTRUCTOR :
begin begin
if not is_classdef then
Message(parser_e_no_constructor_in_records);
if not is_classdef and (current_structdef.symtable.currentvisibility <> vis_public) then if not is_classdef and (current_structdef.symtable.currentvisibility <> vis_public) then
Message(parser_w_constructor_should_be_public); Message(parser_w_constructor_should_be_public);