Procházet zdrojové kódy

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

git-svn-id: branches/paul/extended_records@16568 -
paul před 14 roky
rodič
revize
742b0bb686
6 změnil soubory, kde provedl 299 přidání a 300 odebrání
  1. 3 1
      compiler/msg/errore.msg
  2. 3 2
      compiler/msgidx.inc
  3. 290 289
      compiler/msgtxt.inc
  4. 0 4
      compiler/ncal.pas
  5. 1 4
      compiler/pdecsub.pas
  6. 2 0
      compiler/ptype.pas

+ 3 - 1
compiler/msg/errore.msg

@@ -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
 #

+ 3 - 2
compiler/msgidx.inc

@@ -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
   );

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 290 - 289
compiler/msgtxt.inc


+ 0 - 4
compiler/ncal.pas

@@ -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

+ 1 - 4
compiler/pdecsub.pas

@@ -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;

+ 2 - 0
compiler/ptype.pas

@@ -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);
 

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů