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
#
# 03299 is the last used one
# 03301 is the last used one
#
% \section{Parser messages}
% 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
% 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.
parser_e_no_constructor_in_records=03301_E_Constructors aren't allowed in records
% Constructor declarations aren't allowed in records.
#
# Type Checking
#

View File

@ -389,6 +389,7 @@ const
parser_e_no_record_published=03298;
parser_e_no_destructor_in_records=03299;
parser_e_class_methods_only_static_in_records=03300;
parser_e_no_constructor_in_records=03301;
type_e_mismatch=04000;
type_e_incompatible_types=04001;
type_e_not_equal_types=04002;
@ -874,9 +875,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 58051;
MsgTxtSize = 58098;
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
);

File diff suppressed because it is too large Load Diff

View File

@ -1652,10 +1652,6 @@ implementation
{ constructors }
if (procdefinition.proctypeoption=potype_constructor) then
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 }
if (methodpointer.resultdef.typ=classrefdef) or
(cnf_new_call in callnodeflags) then

View File

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

View File

@ -752,6 +752,8 @@ implementation
end;
_CONSTRUCTOR :
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
Message(parser_w_constructor_should_be_public);