소스 검색

* remove ttype
* rename old ttype variables *type to *def
* rename resulttypepass to pass_typecheck
* rename pass_2 to pass_generate_code

git-svn-id: trunk@5077 -

peter 19 년 전
부모
커밋
3078a1927f
100개의 변경된 파일3574개의 추가작업 그리고 3588개의 파일을 삭제
  1. 1 1
      compiler/aasmtai.pas
  2. 4 4
      compiler/aggas.pas
  3. 5 5
      compiler/alpha/cpupara.pas
  4. 4 4
      compiler/alpha/radirect.pas
  5. 11 11
      compiler/arm/cpupara.pas
  6. 11 11
      compiler/arm/narmadd.pas
  7. 27 27
      compiler/arm/narmcnv.pas
  8. 4 4
      compiler/arm/narmcon.pas
  9. 7 7
      compiler/arm/narminl.pas
  10. 3 3
      compiler/arm/narmmat.pas
  11. 44 44
      compiler/browcol.pas
  12. 10 10
      compiler/browlog.pas
  13. 3 3
      compiler/cgobj.pas
  14. 2 2
      compiler/dbgbase.pas
  15. 37 37
      compiler/dbgdwarf.pas
  16. 68 68
      compiler/dbgstabs.pas
  17. 55 55
      compiler/defcmp.pas
  18. 48 48
      compiler/defutil.pas
  19. 67 67
      compiler/htypechk.pas
  20. 1 1
      compiler/i386/aopt386.pas
  21. 1 1
      compiler/i386/cgcpu.pas
  22. 11 11
      compiler/i386/cpupara.pas
  23. 10 10
      compiler/i386/daopt386.pas
  24. 8 8
      compiler/i386/n386add.pas
  25. 7 7
      compiler/i386/n386mat.pas
  26. 10 10
      compiler/i386/n386mem.pas
  27. 2 2
      compiler/i386/n386set.pas
  28. 1 1
      compiler/m68k/cgcpu.pas
  29. 7 7
      compiler/m68k/cpupara.pas
  30. 9 9
      compiler/m68k/n68kadd.pas
  31. 12 12
      compiler/m68k/n68kcnv.pas
  32. 12 12
      compiler/m68k/n68kmat.pas
  33. 1 1
      compiler/m68k/ra68kmot.pas
  34. 187 187
      compiler/nadd.pas
  35. 70 69
      compiler/nbas.pas
  36. 160 160
      compiler/ncal.pas
  37. 22 22
      compiler/ncgadd.pas
  38. 27 27
      compiler/ncgbas.pas
  39. 39 39
      compiler/ncgcal.pas
  40. 34 34
      compiler/ncgcnv.pas
  41. 25 25
      compiler/ncgcon.pas
  42. 27 27
      compiler/ncgflw.pas
  43. 27 27
      compiler/ncginl.pas
  44. 48 48
      compiler/ncgld.pas
  45. 31 31
      compiler/ncgmat.pas
  46. 82 82
      compiler/ncgmem.pas
  47. 13 13
      compiler/ncgopt.pas
  48. 16 16
      compiler/ncgset.pas
  49. 52 52
      compiler/ncgutil.pas
  50. 219 218
      compiler/ncnv.pas
  51. 105 101
      compiler/ncon.pas
  52. 100 100
      compiler/nflw.pas
  53. 188 188
      compiler/ninl.pas
  54. 145 144
      compiler/nld.pas
  55. 88 88
      compiler/nmat.pas
  56. 103 103
      compiler/nmem.pas
  57. 7 7
      compiler/nobj.pas
  58. 34 33
      compiler/node.pas
  59. 28 28
      compiler/nopt.pas
  60. 47 47
      compiler/nset.pas
  61. 23 23
      compiler/nutils.pas
  62. 3 3
      compiler/optcse.pas
  63. 2 2
      compiler/opttail.pas
  64. 1 1
      compiler/paramgr.pas
  65. 20 20
      compiler/pass_1.pas
  66. 1 1
      compiler/pass_2.pas
  67. 63 63
      compiler/pdecl.pas
  68. 29 30
      compiler/pdecobj.pas
  69. 85 90
      compiler/pdecsub.pas
  70. 102 104
      compiler/pdecvar.pas
  71. 155 164
      compiler/pexpr.pas
  72. 51 51
      compiler/pinline.pas
  73. 1 1
      compiler/pmodules.pas
  74. 14 14
      compiler/powerpc/cpupara.pas
  75. 28 28
      compiler/powerpc/nppcadd.pas
  76. 18 18
      compiler/powerpc/nppccnv.pas
  77. 1 1
      compiler/powerpc/nppcinl.pas
  78. 33 33
      compiler/powerpc/nppcmat.pas
  79. 4 4
      compiler/powerpc/nppcset.pas
  80. 12 12
      compiler/powerpc64/cpupara.pas
  81. 16 16
      compiler/powerpc64/nppcadd.pas
  82. 10 10
      compiler/powerpc64/nppccnv.pas
  83. 1 1
      compiler/powerpc64/nppcinl.pas
  84. 3 3
      compiler/powerpc64/nppcld.pas
  85. 30 30
      compiler/powerpc64/nppcmat.pas
  86. 2 2
      compiler/powerpc64/nppcset.pas
  87. 20 20
      compiler/ppcgen/ngppcadd.pas
  88. 54 54
      compiler/pstatmnt.pas
  89. 23 23
      compiler/psub.pas
  90. 70 74
      compiler/psystem.pas
  91. 76 76
      compiler/ptconst.pas
  92. 116 116
      compiler/ptype.pas
  93. 2 2
      compiler/raatt.pas
  94. 43 44
      compiler/rautils.pas
  95. 13 13
      compiler/regvars.pas
  96. 7 7
      compiler/scanner.pas
  97. 1 1
      compiler/sparc/cgcpu.pas
  98. 7 7
      compiler/sparc/cpupara.pas
  99. 5 5
      compiler/sparc/ncpuadd.pas
  100. 2 2
      compiler/sparc/ncpucall.pas

+ 1 - 1
compiler/aasmtai.pas

@@ -189,7 +189,7 @@ interface
           top_ref    : (ref:preference);
           top_const  : (val:aint);
           top_bool   : (b:boolean);
-          { local varsym that will be inserted in pass_2 }
+          { local varsym that will be inserted in pass_generate_code }
           top_local  : (localoper:plocaloper);
       {$ifdef arm}
           top_regset : (regset:^tcpuregisterset);

+ 4 - 4
compiler/aggas.pas

@@ -398,7 +398,7 @@ implementation
       ch       : char;
       hp       : tai;
       hp1      : tailineinfo;
-      consttype : taiconst_type;
+      constdef : taiconst_type;
       s,t      : string;
       i,pos,l  : longint;
       InlineLevel : longint;
@@ -614,8 +614,8 @@ implementation
 
            ait_const:
              begin
-               consttype:=tai_const(hp).consttype;
-               case consttype of
+               constdef:=tai_const(hp).consttype;
+               case constdef of
 {$ifndef cpu64bit}
                  aitconst_128bit :
                     begin
@@ -699,7 +699,7 @@ implementation
                               (l>line_length) or
                               (hp.next=nil) or
                               (tai(hp.next).typ<>ait_const) or
-                              (tai_const(hp.next).consttype<>consttype) or
+                              (tai_const(hp.next).consttype<>constdef) or
                               assigned(tai_const(hp.next).sym) then
                              break;
                            hp:=tai(hp.next);

+ 5 - 5
compiler/alpha/cpupara.pas

@@ -134,9 +134,9 @@ unit cpupara;
          // nextmmreg:=R_M1;
          stack_offset:=0;
          { pointer for structured results ? }
-         if not is_void(p.rettype.def) then
+         if not is_void(p.returndef) then
            begin
-              if not(ret_in_reg(p.rettype.def)) then
+              if not(ret_in_reg(p.returndef)) then
                 inc(nextintreg);
            end;
 
@@ -248,13 +248,13 @@ unit cpupara;
 
     function talphaparamanager.getfuncretparaloc(p : tabstractprocdef) : tparalocation;
       begin
-         case p.rettype.def.deftype of
+         case p.returndef.deftype of
             orddef,
             enumdef:
               begin
                 getfuncretparaloc.loc:=LOC_REGISTER;
                 getfuncretparaloc.register:=R_3;
-                getfuncretparaloc.size:=def_cgsize(p.rettype.def);
+                getfuncretparaloc.size:=def_cgsize(p.returndef);
                 if getfuncretparaloc.size in [OS_S64,OS_64] then
                   getfuncretparaloc.register64.reghi:=R_4;
               end;
@@ -262,7 +262,7 @@ unit cpupara;
               begin
                 getfuncretparaloc.loc:=LOC_FPUREGISTER;
                 getfuncretparaloc.register:=R_F1;
-                getfuncretparaloc.size:=def_cgsize(p.rettype.def);
+                getfuncretparaloc.size:=def_cgsize(p.returndef);
               end;
             pointerdef,
             formaldef,

+ 4 - 4
compiler/alpha/radirect.pas

@@ -88,10 +88,10 @@ interface
        ende:=false;
        s:='';
        if assigned(aktprocdef.funcretsym) and
-          is_fpu(aktprocdef.rettype.def) then
+          is_fpu(aktprocdef.returndef) then
          tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_initialised;
        { !!!!!
-       if (not is_void(aktprocdef.rettype.def)) then
+       if (not is_void(aktprocdef.returndef)) then
          retstr:=upper(tostr(procinfo^.return_offset)+'('+gas_reg2str[procinfo^.framepointer]+')')
        else
        }
@@ -146,7 +146,7 @@ interface
                                 { char ?                                   }
                                 { !!!
                                 if (s[length(s)]='%') and
-                                   ret_in_acc(aktprocdef.rettype.def) and
+                                   ret_in_acc(aktprocdef.returndef) and
                                    ((pos('AX',upper(hs))>0) or
                                    (pos('AL',upper(hs))>0)) then
                                   tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_initialised;
@@ -247,7 +247,7 @@ interface
                                                  end
                                                else if upper(hs)='__RESULT' then
                                                  begin
-                                                    if (not is_void(aktprocdef.rettype.def)) then
+                                                    if (not is_void(aktprocdef.returndef)) then
                                                       hs:=retstr
                                                     else
                                                       Message(asmr_e_void_function);

+ 11 - 11
compiler/arm/cpupara.pas

@@ -235,7 +235,7 @@ unit cpupara;
             { currently only support C-style array of const,
               there should be no location assigned to the vararg array itself }
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
-               is_array_of_const(hp.vartype.def) then
+               is_array_of_const(hp.vardef) then
               begin
                 paraloc:=hp.paraloc[side].add_location;
                 { hack: the paraloc must be valid, but is not actually used }
@@ -245,11 +245,11 @@ unit cpupara;
                 break;
               end;
 
-            if push_addr_param(hp.varspez,hp.vartype.def,p.proccalloption) then
+            if push_addr_param(hp.varspez,hp.vardef,p.proccalloption) then
               paracgsize:=OS_ADDR
             else
               begin
-                paracgsize:=def_cgSize(hp.vartype.def);
+                paracgsize:=def_cgSize(hp.vardef);
                 if paracgsize=OS_NO then
                   paracgsize:=OS_ADDR;
               end;
@@ -260,12 +260,12 @@ unit cpupara;
 
              if (hp.varspez in [vs_var,vs_out]) then
                begin
-                 paradef:=voidpointertype.def;
+                 paradef:=voidpointertype;
                  loc:=LOC_REGISTER;
                end
              else
                begin
-                 paradef:=hp.vartype.def;
+                 paradef:=hp.vardef;
                  loc:=getparaloc(p.proccalloption,paradef);
                end;
 
@@ -355,7 +355,7 @@ unit cpupara;
                              paraloc^.loc:=LOC_REFERENCE;
                              paraloc^.reference.index:=NR_STACK_POINTER_REG;
                              paraloc^.reference.offset:=stack_offset;
-                             inc(stack_offset,hp.vartype.def.size);
+                             inc(stack_offset,hp.vardef.size);
                           end;
                       end;
                     else
@@ -372,7 +372,7 @@ unit cpupara;
                  dec(paralen,tcgsize2size[paraloc^.size]);
                end;
              { hack to swap doubles in int registers }
-             if is_double(hp.vartype.def) and (paracgsize=OS_64) and
+             if is_double(hp.vardef) and (paracgsize=OS_64) and
                (hp.paraloc[side].location^.loc=LOC_REGISTER) then
                begin
                  paraloc:=hp.paraloc[side].location;
@@ -403,20 +403,20 @@ unit cpupara;
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         p.funcretloc[side].size:=retcgsize;
 
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             exit;
           end;
 
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or (cs_fp_emulation in aktmoduleswitches) then
               begin
@@ -448,7 +448,7 @@ unit cpupara;
               end;
           end
           { Return in register? }
-        else if not ret_in_param(p.rettype.def,p.proccalloption) then
+        else if not ret_in_param(p.returndef,p.proccalloption) then
           begin
             if retcgsize in [OS_64,OS_S64] then
               begin

+ 11 - 11
compiler/arm/narmadd.pas

@@ -151,7 +151,7 @@ interface
               location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
               location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER));
 
-              location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+              location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
               if left.location.loc<>LOC_CFPUREGISTER then
                 location.register:=left.location.register
               else
@@ -159,7 +159,7 @@ interface
 
               current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op,
                  location.register,left.location.register,right.location.register),
-                 cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
+                 cgsize2fpuoppostfix[def_cgsize(resultdef)]));
 
               location.loc:=LOC_FPUREGISTER;
             end;
@@ -189,11 +189,11 @@ interface
         if nodetype in [equaln,unequaln] then
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF,
              left.location.register,right.location.register),
-             cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
+             cgsize2fpuoppostfix[def_cgsize(resultdef)]))
         else
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE,
              left.location.register,right.location.register),
-             cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
+             cgsize2fpuoppostfix[def_cgsize(resultdef)]));
 
         location_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(false);
@@ -249,8 +249,8 @@ interface
         pass_left_right;
         force_reg_left_right(false,false);
 
-        unsigned:=not(is_signed(left.resulttype.def)) or
-                  not(is_signed(right.resulttype.def));
+        unsigned:=not(is_signed(left.resultdef)) or
+                  not(is_signed(right.resultdef));
 
         { operation requiring proper N, Z and C flags ? }
         if unsigned or (nodetype in [equaln,unequaln]) then
@@ -308,9 +308,9 @@ interface
         { handling boolean expressions }
         if not(assigned(result)) and
            (
-             not(is_boolean(left.resulttype.def)) or
-             not(is_boolean(right.resulttype.def)) or
-             is_dynamic_array(left.resulttype.def)
+             not(is_boolean(left.resultdef)) or
+             not(is_boolean(right.resultdef)) or
+             is_dynamic_array(left.resultdef)
            ) then
           expectloc:=LOC_FLAGS;
       end;
@@ -325,8 +325,8 @@ interface
         pass_left_right;
         force_reg_left_right(true,true);
 
-        unsigned:=not(is_signed(left.resulttype.def)) or
-                  not(is_signed(right.resulttype.def));
+        unsigned:=not(is_signed(left.resultdef)) or
+                  not(is_signed(right.resultdef));
 
         if right.location.loc = LOC_CONSTANT then
           begin

+ 27 - 27
compiler/arm/narmcnv.pas

@@ -81,14 +81,14 @@ implementation
             if target_info.system in system_wince then
               begin
                 { converting a 64bit integer to a float requires a helper }
-                if is_64bitint(left.resulttype.def) or
-                  is_currency(left.resulttype.def) then
+                if is_64bitint(left.resultdef) or
+                  is_currency(left.resultdef) then
                   begin
                     { hack to avoid double division by 10000, as it's
-                      already done by resulttypepass.resulttype_int_to_real }
-                    if is_currency(left.resulttype.def) then
-                      left.resulttype := s64inttype;
-                    if is_signed(left.resulttype.def) then
+                      already done by typecheckpass.resultdef_int_to_real }
+                    if is_currency(left.resultdef) then
+                      left.resultdef := s64inttype;
+                    if is_signed(left.resultdef) then
                       fname:='I64TOD'
                     else
                       fname:='UI64TOD';
@@ -96,7 +96,7 @@ implementation
                 else
                   { other integers are supposed to be 32 bit }
                   begin
-                    if is_signed(left.resulttype.def) then
+                    if is_signed(left.resultdef) then
                       fname:='ITOD'
                     else
                       fname:='UTOD';
@@ -111,14 +111,14 @@ implementation
             else
               begin
                 { converting a 64bit integer to a float requires a helper }
-                if is_64bitint(left.resulttype.def) or
-                  is_currency(left.resulttype.def) then
+                if is_64bitint(left.resultdef) or
+                  is_currency(left.resultdef) then
                   begin
                     { hack to avoid double division by 10000, as it's
-                      already done by resulttypepass.resulttype_int_to_real }
-                    if is_currency(left.resulttype.def) then
-                      left.resulttype := s64inttype;
-                    if is_signed(left.resulttype.def) then
+                      already done by typecheckpass.resultdef_int_to_real }
+                    if is_currency(left.resultdef) then
+                      left.resultdef := s64inttype;
+                    if is_signed(left.resultdef) then
                       fname:='int64_to_'
                     else
                       { we can't do better currently }
@@ -127,19 +127,19 @@ implementation
                 else
                   { other integers are supposed to be 32 bit }
                   begin
-                    if is_signed(left.resulttype.def) then
+                    if is_signed(left.resultdef) then
                       fname:='int32_to_'
                     else
                       { we can't do better currently }
                       fname:='int32_to_';
                     firstpass(left);
                   end;
-                if tfloatdef(resulttype.def).typ=s64real then
+                if tfloatdef(resultdef).typ=s64real then
                   fname:=fname+'float64'
                 else
                   fname:=fname+'float32';
                 result:=ctypeconvnode.create_internal(ccallnode.createintern(fname,ccallparanode.create(
-                  left,nil)),resulttype);
+                  left,nil)),resultdef);
                 left:=nil;
                 firstpass(result);
                 exit;
@@ -148,14 +148,14 @@ implementation
         else
           begin
             { converting a 64bit integer to a float requires a helper }
-            if is_64bitint(left.resulttype.def) or
-              is_currency(left.resulttype.def) then
+            if is_64bitint(left.resultdef) or
+              is_currency(left.resultdef) then
               begin
                 { hack to avoid double division by 10000, as it's
-                  already done by resulttypepass.resulttype_int_to_real }
-                if is_currency(left.resulttype.def) then
-                  left.resulttype := s64inttype;
-                if is_signed(left.resulttype.def) then
+                  already done by typecheckpass.resultdef_int_to_real }
+                if is_currency(left.resultdef) then
+                  left.resultdef := s64inttype;
+                if is_signed(left.resultdef) then
                   fname := 'fpc_int64_to_double'
                 else
                   fname := 'fpc_qword_to_double';
@@ -168,7 +168,7 @@ implementation
             else
               { other integers are supposed to be 32 bit }
               begin
-                if is_signed(left.resulttype.def) then
+                if is_signed(left.resultdef) then
                   inserttypeconv(left,s32inttype)
                 else
                   inserttypeconv(left,u32inttype);
@@ -186,11 +186,11 @@ implementation
       var
         instr : taicpu;
       begin
-        location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
         location_force_reg(current_asmdata.CurrAsmList,left.location,OS_32,true);
         location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
         instr:=taicpu.op_reg_reg(A_FLT,location.register,left.location.register);
-        instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resulttype.def)];
+        instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resultdef)];
         current_asmdata.CurrAsmList.concat(instr);
       end;
 
@@ -212,7 +212,7 @@ implementation
          { byte(boolean) or word(wordbool) or longint(longbool) must
            be accepted for var parameters                            }
          if (nf_explicit in flags) and
-            (left.resulttype.def.size=resulttype.def.size) and
+            (left.resultdef.size=resultdef.size) and
             (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
            begin
               location_copy(location,left.location);
@@ -284,7 +284,7 @@ implementation
               internalerror(200311301);
          end;
          { load flags to register }
-         location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
+         location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
          location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
          cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,location.register);
          current_procinfo.CurrTrueLabel:=oldTrueLabel;

+ 4 - 4
compiler/arm/narmcon.pas

@@ -30,7 +30,7 @@ interface
 
     type
       tarmrealconstnode = class(tcgrealconstnode)
-        procedure pass_2;override;
+        procedure pass_generate_code;override;
       end;
 
   implementation
@@ -50,7 +50,7 @@ interface
                            TARMREALCONSTNODE
 *****************************************************************************}
 
-    procedure tarmrealconstnode.pass_2;
+    procedure tarmrealconstnode.pass_generate_code;
       { I suppose the parser/pass_1 must make sure the generated real  }
       { constants are actually supported by the target processor? (JM) }
       const
@@ -63,9 +63,9 @@ interface
          hiloswapped : boolean;
 
       begin
-        location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
+        location_reset(location,LOC_CREFERENCE,def_cgsize(resultdef));
         lastlabel:=nil;
-        realait:=floattype2ait[tfloatdef(resulttype.def).typ];
+        realait:=floattype2ait[tfloatdef(resultdef).typ];
         hiloswapped:=aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11];
         { const already used ? }
         if not assigned(lab_real) then

+ 7 - 7
compiler/arm/narminl.pas

@@ -165,21 +165,21 @@ implementation
     procedure tarminlinenode.second_abs_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,location.register),get_fpu_postfix(resultdef)));
       end;
 
 
     procedure tarminlinenode.second_sqr_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_MUF,location.register,left.location.register,left.location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_MUF,location.register,left.location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
 
 
     procedure tarminlinenode.second_sqrt_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,location.register),get_fpu_postfix(resultdef)));
       end;
 
 
@@ -187,27 +187,27 @@ implementation
     procedure tarminlinenode.second_arctan_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ATN,location.register,location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ATN,location.register,location.register),get_fpu_postfix(resultdef)));
       end;
 
 
     procedure tarminlinenode.second_ln_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_LGN,location.register,location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_LGN,location.register,location.register),get_fpu_postfix(resultdef)));
       end;
 
     procedure tarminlinenode.second_cos_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_COS,location.register,location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_COS,location.register,location.register),get_fpu_postfix(resultdef)));
       end;
 
 
     procedure tarminlinenode.second_sin_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SIN,location.register,location.register),get_fpu_postfix(resulttype.def)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SIN,location.register,location.register),get_fpu_postfix(resultdef)));
       end;
     }
 

+ 3 - 3
compiler/arm/narmmat.pas

@@ -88,7 +88,7 @@ implementation
                 end;
               LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE :
                 begin
-                  location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true);
+                  location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,left.location.register,0));
                   location_reset(location,LOC_FLAGS,OS_NO);
                   location.resflags:=F_EQ;
@@ -106,12 +106,12 @@ implementation
     procedure tarmunaryminusnode.second_float;
       begin
         secondpass(left);
-        location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
         location_force_fpureg(current_asmdata.CurrAsmList,left.location,false);
         location:=left.location;
         current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSF,
           location.register,left.location.register,0),
-          cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
+          cgsize2fpuoppostfix[def_cgsize(resultdef)]));
       end;
 
 

+ 44 - 44
compiler/browcol.pas

@@ -1191,8 +1191,8 @@ end;
   var Name: string;
   begin
     Name:='array ['+IntToStr(def.lowrange)+'..'+IntToStr(def.highrange)+'] of ';
-    if assigned(def.elementtype.def) then
-      Name:=Name+GetDefinitionStr(def.elementtype.def);
+    if assigned(def.elementdef) then
+      Name:=Name+GetDefinitionStr(def.elementdef);
     GetArrayDefStr:=Name;
   end;
   function GetFileDefStr(def: tfiledef): string;
@@ -1202,7 +1202,7 @@ end;
     case def.filetyp of
       ft_text    : Name:='text';
       ft_untyped : Name:='file';
-      ft_typed   : Name:='file of '+GetDefinitionStr(def.typedfiletype.def);
+      ft_typed   : Name:='file of '+GetDefinitionStr(def.typedfiledef);
     end;
     GetFileDefStr:=Name;
   end;
@@ -1230,8 +1230,8 @@ end;
   var OK: boolean;
   begin
     OK:=false;
-    if assigned(def.rettype.def) then
-      if UpcaseStr(GetDefinitionStr(def.rettype.def))<>'VOID' then
+    if assigned(def.returndef) then
+      if UpcaseStr(GetDefinitionStr(def.returndef))<>'VOID' then
         OK:=true;
     retdefassigned:=OK;
   end;
@@ -1256,8 +1256,8 @@ end;
          vs_Const : CurName:=CurName+'const ';
          vs_Var   : CurName:=CurName+'var ';
        end;
-       if assigned(dc.vartype.def) then
-         CurName:=CurName+GetDefinitionStr(dc.vartype.def);
+       if assigned(dc.vardef) then
+         CurName:=CurName+GetDefinitionStr(dc.vardef);
        Name:=CurName+Name;
        Inc(Count);
      end;
@@ -1269,7 +1269,7 @@ end;
     Name:=GetAbsProcParmDefStr(def);
     if Name<>'' then Name:='('+Name+')';
     if retdefassigned(def) then
-      Name:='function'+Name+': '+GetDefinitionStr(def.rettype.def)
+      Name:='function'+Name+': '+GetDefinitionStr(def.returndef)
     else
       Name:='procedure'+Name;
     GetAbsProcDefStr:=Name;
@@ -1310,12 +1310,12 @@ end;
       varset   : Name:='varset';
     end;
     Name:=Name+' of ';
-    Name:=Name+GetDefinitionStr(def.elementtype.def);
+    Name:=Name+GetDefinitionStr(def.elementdef);
     GetSetDefStr:=Name;
   end;
   function GetPointerDefStr(def: tpointerdef): string;
   begin
-    GetPointerDefStr:='^'+GetDefinitionStr(def.pointertype.def);
+    GetPointerDefStr:='^'+GetDefinitionStr(def.pointeddef);
   end;
   function GetDefinitionStr(def: tdef): string;
   var Name: string;
@@ -1372,14 +1372,14 @@ end;
     case sym.consttyp of
       constord :
         begin
-          if sym.consttype.def.deftype=enumdef then
-            Name:=sym.consttype.def.typesym.name+'('+IntToStr(sym.value.valueord)+')'
+          if sym.constdef.deftype=enumdef then
+            Name:=sym.constdef.typesym.name+'('+IntToStr(sym.value.valueord)+')'
           else
-            if is_boolean(sym.consttype.def) then
+            if is_boolean(sym.constdef) then
               Name:='Longbool('+IntToStr(sym.value.valueord)+')'
           else
-            if is_char(sym.consttype.def) or
-               is_widechar(sym.consttype.def) then
+            if is_char(sym.constdef) or
+               is_widechar(sym.constdef) then
               Name:=''''+chr(sym.value.valueord)+''''
           else
             Name:=IntToStr(sym.value.valueord);
@@ -1434,18 +1434,18 @@ end;
           paravarsym :
              with tabstractvarsym(sym) do
              begin
-               if assigned(vartype.def) then
-                 if assigned(vartype.def.typesym) then
-                   SetVType(Symbol,vartype.def.typesym.name)
+               if assigned(vardef) then
+                 if assigned(vardef.typesym) then
+                   SetVType(Symbol,vardef.typesym.name)
                  else
-                   SetVType(Symbol,GetDefinitionStr(vartype.def));
-               ProcessDefIfStruct(vartype.def);
-               if assigned(vartype.def) then
-                 if (vartype.def.deftype=pointerdef) and
-                    assigned(tpointerdef(vartype.def).pointertype.def) then
+                   SetVType(Symbol,GetDefinitionStr(vardef));
+               ProcessDefIfStruct(vardef);
+               if assigned(vardef) then
+                 if (vardef.deftype=pointerdef) and
+                    assigned(tpointerdef(vardef).pointeddef) then
                  begin
                    Symbol^.Flags:=(Symbol^.Flags or sfPointer);
-                   Symbol^.RelatedTypeID:=Ptrint(tpointerdef(vartype.def).pointertype.def);
+                   Symbol^.RelatedTypeID:=Ptrint(tpointerdef(vardef).pointeddef);
                  end;
                if typ=fieldvarsym then
                  MemInfo.Addr:=tfieldvarsym(sym).fieldoffset
@@ -1456,9 +1456,9 @@ end;
                    else
                      MemInfo.Addr:=0;
                  end;
-               if assigned(vartype.def) and (vartype.def.deftype=arraydef) then
+               if assigned(vardef) and (vardef.deftype=arraydef) then
                  begin
-                   if tarraydef(vartype.def).highrange<tarraydef(vartype.def).lowrange then
+                   if tarraydef(vardef).highrange<tarraydef(vardef).lowrange then
                      MemInfo.Size:=-1
                    else
                      MemInfo.Size:=getsize;
@@ -1466,15 +1466,15 @@ end;
                else
                  MemInfo.Size:=getsize;
                { this is not completely correct... }
-               MemInfo.PushSize:=paramanager.push_size(varspez,vartype.def,pocall_default);
+               MemInfo.PushSize:=paramanager.push_size(varspez,vardef,pocall_default);
                Symbol^.SetMemInfo(MemInfo);
              end;
           fieldvarsym :
              with tfieldvarsym(sym) do
              begin
-               if assigned(vartype.def) and (vartype.def.deftype=arraydef) then
+               if assigned(vardef) and (vardef.deftype=arraydef) then
                  begin
-                   if tarraydef(vartype.def).highrange<tarraydef(vartype.def).lowrange then
+                   if tarraydef(vardef).highrange<tarraydef(vardef).lowrange then
                      MemInfo.Size:=-1
                    else
                      MemInfo.Size:=getsize;
@@ -1526,45 +1526,45 @@ end;
           typesym :
             begin
             with ttypesym(sym) do
-              if assigned(restype.def) then
+              if assigned(typedef) then
                begin
-                Symbol^.TypeID:=Ptrint(restype.def);
-                case restype.def.deftype of
+                Symbol^.TypeID:=Ptrint(typedef);
+                case typedef.deftype of
                   arraydef :
-                    SetDType(Symbol,GetArrayDefStr(tarraydef(restype.def)));
+                    SetDType(Symbol,GetArrayDefStr(tarraydef(typedef)));
                   enumdef :
-                    SetDType(Symbol,GetEnumDefStr(tenumdef(restype.def)));
+                    SetDType(Symbol,GetEnumDefStr(tenumdef(typedef)));
                   procdef :
-                    SetDType(Symbol,GetProcDefStr(tprocdef(restype.def)));
+                    SetDType(Symbol,GetProcDefStr(tprocdef(typedef)));
                   procvardef :
-                    SetDType(Symbol,GetProcVarDefStr(tprocvardef(restype.def)));
+                    SetDType(Symbol,GetProcVarDefStr(tprocvardef(typedef)));
                   objectdef :
-                    with tobjectdef(restype.def) do
+                    with tobjectdef(typedef) do
                     begin
                       ObjDef:=childof;
                       if ObjDef<>nil then
                         Symbol^.RelatedTypeID:=Ptrint(ObjDef);{TypeNames^.Add(S);}
                       Symbol^.Flags:=(Symbol^.Flags or sfObject);
-                      if tobjectdef(restype.def).objecttype=odt_class then
+                      if tobjectdef(typedef).objecttype=odt_class then
                         Symbol^.Flags:=(Symbol^.Flags or sfClass);
-                      ProcessSymTable(Symbol,Symbol^.Items,tobjectdef(restype.def).symtable);
+                      ProcessSymTable(Symbol,Symbol^.Items,tobjectdef(typedef).symtable);
                     end;
                   recorddef :
                     begin
                       Symbol^.Flags:=(Symbol^.Flags or sfRecord);
-                      ProcessSymTable(Symbol,Symbol^.Items,trecorddef(restype.def).symtable);
+                      ProcessSymTable(Symbol,Symbol^.Items,trecorddef(typedef).symtable);
                     end;
                   pointerdef :
                     begin
                       Symbol^.Flags:=(Symbol^.Flags or sfPointer);
-                      Symbol^.RelatedTypeID:=Ptrint(tpointerdef(restype.def).pointertype.def);{TypeNames^.Add(S);}
-                      SetDType(Symbol,GetPointerDefStr(tpointerdef(restype.def)));
+                      Symbol^.RelatedTypeID:=Ptrint(tpointerdef(typedef).pointeddef);{TypeNames^.Add(S);}
+                      SetDType(Symbol,GetPointerDefStr(tpointerdef(typedef)));
                     end;
 
                   filedef :
-                    SetDType(Symbol,GetFileDefStr(tfiledef(restype.def)));
+                    SetDType(Symbol,GetFileDefStr(tfiledef(typedef)));
                   setdef :
-                    SetDType(Symbol,GetSetDefStr(tsetdef(restype.def)));
+                    SetDType(Symbol,GetSetDefStr(tsetdef(typedef)));
                 end;
                end;
             end;

+ 10 - 10
compiler/browlog.pas

@@ -339,12 +339,12 @@ implementation
               case sym.typ of
                 typesym :
                   begin
-                     if ttypesym(sym).restype.def.deftype in [recorddef,objectdef] then
+                     if ttypesym(sym).typedef.deftype in [recorddef,objectdef] then
                        begin
-                          if ttypesym(sym).restype.def.deftype=recorddef then
-                            symt:=trecorddef(ttypesym(sym).restype.def).symtable
+                          if ttypesym(sym).typedef.deftype=recorddef then
+                            symt:=trecorddef(ttypesym(sym).typedef).symtable
                           else
-                            symt:=tobjectdef(ttypesym(sym).restype.def).symtable;
+                            symt:=tobjectdef(ttypesym(sym).typedef).symtable;
                           sym:=tstoredsym(symt.search(ss));
                           if sym=nil then
                             sym:=tstoredsym(symt.search(upper(ss)));
@@ -355,9 +355,9 @@ implementation
                 paravarsym,
                 fieldvarsym :
                   begin
-                     if tabstractvarsym(sym).vartype.def.deftype in [recorddef,objectdef] then
+                     if tabstractvarsym(sym).vardef.deftype in [recorddef,objectdef] then
                        begin
-                          symt:=tabstractvarsym(sym).vartype.def.getsymtable(gs_record);
+                          symt:=tabstractvarsym(sym).vardef.getsymtable(gs_record);
                           sym:=tstoredsym(symt.search(ss));
                           if sym=nil then
                             sym:=tstoredsym(symt.search(upper(ss)));
@@ -453,10 +453,10 @@ implementation
               case hp.typ of
                 typesym :
                   begin
-                    if (ttypesym(hp).restype.def.deftype=recorddef) then
-                      writesymtable(trecorddef(ttypesym(hp).restype.def).symtable);
-                    if (ttypesym(hp).restype.def.deftype=objectdef) then
-                      writesymtable(tobjectdef(ttypesym(hp).restype.def).symtable);
+                    if (ttypesym(hp).typedef.deftype=recorddef) then
+                      writesymtable(trecorddef(ttypesym(hp).typedef).symtable);
+                    if (ttypesym(hp).typedef.deftype=objectdef) then
+                      writesymtable(tobjectdef(ttypesym(hp).typedef).symtable);
                   end;
                 procsym :
                     Tprocsym(hp).foreach_procdef_static(@writelocalsymtables,nil);

+ 3 - 3
compiler/cgobj.pas

@@ -2611,7 +2611,7 @@ implementation
 
     procedure tcg.g_rangecheck(list: TAsmList; const l:tlocation;fromdef,todef: tdef);
     { generate range checking code for the value at location p. The type     }
-    { type used is checked against todefs ranges. fromdef (p.resulttype.def) }
+    { type used is checked against todefs ranges. fromdef (p.resultdef) }
     { is the original type used at that location. When both defs are equal   }
     { the check is also insert (needed for succ,pref,inc,dec)                }
       const
@@ -2642,10 +2642,10 @@ implementation
         getrange(todef,lto,hto);
         from_signed := is_signed(fromdef);
         to_signed := is_signed(todef);
-        { check the rangetype of the array, not the array itself }
+        { check the rangedef of the array, not the array itself }
         { (only change now, since getrange needs the arraydef)   }
         if (todef.deftype = arraydef) then
-          todef := tarraydef(todef).rangetype.def;
+          todef := tarraydef(todef).rangedef;
         { no range check if from and to are equal and are both longint/dword }
         { no range check if from and to are equal and are both longint/dword }
         { (if we have a 32bit processor) or int64/qword, since such          }

+ 2 - 2
compiler/dbgbase.pas

@@ -108,7 +108,7 @@ implementation
       begin
         if (Tsym(p).typ=fieldvarsym) and
            not(sp_static in Tsym(p).symoptions) then
-          insertdef(TAsmList(arg),tfieldvarsym(p).vartype.def);
+          insertdef(TAsmList(arg),tfieldvarsym(p).vardef);
       end;
 
 
@@ -119,7 +119,7 @@ implementation
         if tsym(p).typ=procsym then
           begin
             pd:=tprocsym(p).first_procdef;
-            insertdef(TAsmList(arg),pd.rettype.def);
+            insertdef(TAsmList(arg),pd.returndef);
           end;
       end;
 

+ 37 - 37
compiler/dbgdwarf.pas

@@ -1158,7 +1158,7 @@ end;
             DW_AT_byte_size,DW_FORM_udata,size,
             DW_AT_stride_size,DW_FORM_udata,elesize
             ]);
-        append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementtype.def));
+        append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementdef));
         if is_dynamic_array(def) then
           begin
             { !!! FIXME !!! }
@@ -1177,7 +1177,7 @@ end;
               DW_AT_lower_bound,DW_FORM_udata,0,
               DW_AT_upper_bound,DW_FORM_udata,0
               ]);
-            append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.rangetype.def));
+            append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.rangedef));
             finish_entry;
           end
         else
@@ -1188,7 +1188,7 @@ end;
               DW_AT_lower_bound,DW_FORM_sdata,def.lowrange,
               DW_AT_upper_bound,DW_FORM_sdata,def.highrange
               ]);
-            append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.rangetype.def));
+            append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.rangedef));
             finish_entry;
           end;
         finish_children;
@@ -1216,7 +1216,7 @@ end;
       begin
         append_entry(DW_TAG_pointer_type,false,[]);
         if not(is_voidpointer(def)) then
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.pointertype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.pointeddef));
         finish_entry;
       end;
 
@@ -1249,7 +1249,7 @@ end;
                 ]);
               current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst)));
               current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(0));
-              append_labelentry_ref(DW_AT_type,def_dwarf_lab(u8inttype.def));
+              append_labelentry_ref(DW_AT_type,def_dwarf_lab(u8inttype));
               finish_entry;
 
               { string data entry }
@@ -1270,22 +1270,22 @@ end;
                 DW_AT_byte_size,DW_FORM_udata,def.size,
                 DW_AT_stride_size,DW_FORM_udata,1*8
                 ]);
-              append_labelentry_ref(DW_AT_type,def_dwarf_lab(cchartype.def));
+              append_labelentry_ref(DW_AT_type,def_dwarf_lab(cchartype));
               finish_entry;
               append_entry(DW_TAG_subrange_type,false,[
                 DW_AT_lower_bound,DW_FORM_udata,0,
                 DW_AT_upper_bound,DW_FORM_udata,slen
                 ]);
-              append_labelentry_ref(DW_AT_type,def_dwarf_lab(u8inttype.def));
+              append_labelentry_ref(DW_AT_type,def_dwarf_lab(u8inttype));
               finish_entry;
               finish_children;
             end;
           st_longstring:
             begin
             {
-              charst:=def_stab_number(cchartype.def);
-              bytest:=def_stab_number(u8inttype.def);
-              longst:=def_stab_number(u32inttype.def);
+              charst:=def_stab_number(cchartype);
+              bytest:=def_stab_number(u8inttype);
+              longst:=def_stab_number(u32inttype);
               result:=def_stabstr_evaluate(def,'s$1length:$2,0,32;dummy:$6,32,8;st:ar$2;1;$3;$4,40,$5;;',
                           [tostr(def.len+5),longst,tostr(def.len),charst,tostr(def.len*8),bytest]);
             }
@@ -1294,14 +1294,14 @@ end;
            begin
              { looks like a pchar }
              append_entry(DW_TAG_pointer_type,false,[]);
-             append_labelentry_ref(DW_AT_type,def_dwarf_lab(cchartype.def));
+             append_labelentry_ref(DW_AT_type,def_dwarf_lab(cchartype));
              finish_entry;
            end;
          st_widestring:
            begin
              { looks like a pwidechar }
              append_entry(DW_TAG_pointer_type,false,[]);
-             append_labelentry_ref(DW_AT_type,def_dwarf_lab(cwidechartype.def));
+             append_labelentry_ref(DW_AT_type,def_dwarf_lab(cwidechartype));
              finish_entry;
            end;
         end;
@@ -1322,8 +1322,8 @@ end;
             append_entry(DW_TAG_subroutine_type,true,[
               DW_AT_prototyped,DW_FORM_flag,true
             ]);
-          if not(is_void(tprocvardef(def).rettype.def)) then
-            append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocvardef(def).rettype.def));
+          if not(is_void(tprocvardef(def).returndef)) then
+            append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocvardef(def).returndef));
           finish_entry;
 
           { write parameters }
@@ -1332,7 +1332,7 @@ end;
               append_entry(DW_TAG_formal_parameter,false,[
                 DW_AT_name,DW_FORM_string,symname(tsym(def.paras[i]))+#0
               ]);
-              append_labelentry_ref(DW_AT_type,def_dwarf_lab(tparavarsym(def.paras[i]).vartype.def));
+              append_labelentry_ref(DW_AT_type,def_dwarf_lab(tparavarsym(def.paras[i]).vardef));
               finish_entry;
             end;
 
@@ -1423,7 +1423,7 @@ end;
           variantdef :
             appenddef_variant(tvariantdef(def));
           classrefdef :
-            appenddef_pointer(tpointerdef(pvmttype.def));
+            appenddef_pointer(tpointerdef(pvmttype));
           setdef :
             appenddef_set(tsetdef(def));
           formaldef :
@@ -1507,8 +1507,8 @@ end;
             { append block data }
             { current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(dwarf_reg(pd.))); }
 
-            if not(is_void(tprocdef(pd).rettype.def)) then
-              append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocdef(pd).rettype.def));
+            if not(is_void(tprocdef(pd).returndef)) then
+              append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocdef(pd).returndef));
 
             { mark end of procedure }
             current_asmdata.getlabel(procendlabel,alt_dbgtype);
@@ -1524,16 +1524,16 @@ end;
                 if tabstractnormalvarsym(pd.funcretsym).localloc.loc=LOC_REFERENCE then
                   begin
 {$warning Need to add gdb support for ret in param register calling}
-                    if paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
+                    if paramanager.ret_in_param(pd.returndef,pd.proccalloption) then
                       hs:='X*'
                     else
                       hs:='X';
                     templist.concat(Tai_stab.create(stab_stabs,strpnew(
-                       '"'+pd.procsym.name+':'+hs+def_stab_number(pd.rettype.def)+'",'+
+                       '"'+pd.procsym.name+':'+hs+def_stab_number(pd.returndef)+'",'+
                        tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset))));
                     if (m_result in aktmodeswitches) then
                       templist.concat(Tai_stab.create(stab_stabs,strpnew(
-                         '"RESULT:'+hs+def_stab_number(pd.rettype.def)+'",'+
+                         '"RESULT:'+hs+def_stab_number(pd.returndef)+'",'+
                          tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset))));
                   end;
               end;
@@ -1647,7 +1647,7 @@ end;
             ]);
           { append block data }
           current_asmdata.asmlists[al_dwarf_info].concatlist(templist);
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vardef));
 
           templist.free;
 
@@ -1666,7 +1666,7 @@ end;
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst)));
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(sym.fieldoffset));
 
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vardef));
           finish_entry;
         end;
 
@@ -1675,9 +1675,9 @@ end;
           append_entry(DW_TAG_constant,false,[
             DW_AT_name,DW_FORM_string,symname(sym)+#0
             ]);
-          { for string constants, consttype isn't set because they have no real type }
+          { for string constants, constdef isn't set because they have no real type }
           if not(sym.consttyp in [conststring,constresourcestring]) then
-            append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.consttype.def));
+            append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.constdef));
           current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_AT_const_value)));
           case sym.consttyp of
             conststring:
@@ -1730,7 +1730,7 @@ end;
             constreal:
               begin
                 current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_block1)));
-                case tfloatdef(sym.consttype.def).typ of
+                case tfloatdef(sym.constdef).typ of
                   s32real:
                     begin
                       current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4));
@@ -1773,7 +1773,7 @@ end;
           { append block data }
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(3));
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.createname(sym.mangledname,0));
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.typedconsttype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.typedconstdef));
 
           finish_entry;
         end;
@@ -1803,13 +1803,13 @@ end;
           append_entry(DW_TAG_typedef,false,[
             DW_AT_name,DW_FORM_string,symname(sym)+#0
           ]);
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.restype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.typedef));
           finish_entry;
 
           { Moved fom append sym, do we need this (MWE)
           { For object types write also the symtable entries }
-          if (sym.typ=typesym) and (ttypesym(sym).restype.def.deftype=objectdef) then
-            write_symtable_syms(list,tobjectdef(ttypesym(sym).restype.def).symtable);
+          if (sym.typ=typesym) and (ttypesym(sym).typedef.deftype=objectdef) then
+            write_symtable_syms(list,tobjectdef(ttypesym(sym).typedef).symtable);
           }
         end;
 
@@ -1871,7 +1871,7 @@ end;
             ]);
           { append block data }
           current_asmdata.asmlists[al_dwarf_info].concatlist(templist);
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vardef));
 
           templist.free;
 
@@ -2160,10 +2160,10 @@ end;
         deftowritelist:=TFPObjectList.create(false);
 
         { not exported (FK)
-        filerecdef:=gettypedef('FILEREC');
-        textrecdef:=gettypedef('TEXTREC');
+        filerecdef:=getderefdef('FILEREC');
+        textrecdef:=getderefdef('TEXTREC');
         }
-        vardatadef:=trecorddef(search_system_type('TVARDATA').restype.def);
+        vardatadef:=trecorddef(search_system_type('TVARDATA').typedef);
 
         { write start labels }
         current_asmdata.asmlists[al_dwarf_info].concat(tai_section.create(sec_debug_info,'',0));
@@ -2568,7 +2568,7 @@ end;
             DW_AT_byte_size,DW_FORM_data2,def.size
             ]);
         if tfiledef(def).filetyp=ft_typed then
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(tfiledef(def).typedfiletype.def));
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(tfiledef(def).typedfiledef));
         finish_entry;
       end;
 
@@ -2686,8 +2686,8 @@ end;
           append_entry(DW_TAG_set_type,false,[
             DW_AT_byte_size,DW_FORM_data2,def.size
             ]);
-        if assigned(tsetdef(def).elementtype.def) then
-          append_labelentry_ref(DW_AT_type,def_dwarf_lab(tsetdef(def).elementtype.def));
+        if assigned(tsetdef(def).elementdef) then
+          append_labelentry_ref(DW_AT_type,def_dwarf_lab(tsetdef(def).elementdef));
         finish_entry;
       end;
 

+ 68 - 68
compiler/dbgstabs.pas

@@ -327,12 +327,12 @@ implementation
               spec:='/0'
             else
               spec:='';
-            varsize:=tfieldvarsym(p).vartype.def.size;
+            varsize:=tfieldvarsym(p).vardef.size;
             { open arrays made overflows !! }
             if varsize>$fffffff then
               varsize:=$fffffff;
             newrec:=def_stabstr_evaluate(nil,'$1:$2,$3,$4;',[p.name,
-                                     spec+def_stab_number(tfieldvarsym(p).vartype.def),
+                                     spec+def_stab_number(tfieldvarsym(p).vardef),
                                      tostr(tfieldvarsym(p).fieldoffset*8),tostr(varsize*8)]);
             if state^.stabsize+strlen(newrec)>=state^.staballoc-256 then
               begin
@@ -343,7 +343,7 @@ implementation
             inc(state^.stabsize,strlen(newrec));
             strdispose(newrec);
             {This should be used for case !!}
-            inc(state^.recoffset,Tfieldvarsym(p).vartype.def.size);
+            inc(state^.recoffset,Tfieldvarsym(p).vardef.size);
           end;
       end;
 
@@ -387,7 +387,7 @@ implementation
             for i:=0 to pd.paras.count-1 do
               begin
                 parasym:=tparavarsym(pd.paras[i]);
-                if Parasym.vartype.def.deftype = formaldef then
+                if Parasym.vardef.deftype = formaldef then
                   begin
                     case Parasym.varspez of
                       vs_var :
@@ -402,10 +402,10 @@ implementation
                   begin
                     { if the arg definition is like (v: ^byte;..
                     there is no sym attached to data !!! }
-                    if assigned(Parasym.vartype.def.typesym) then
+                    if assigned(Parasym.vardef.typesym) then
                       begin
-                        arglength := length(Parasym.vartype.def.typesym.name);
-                        argnames := argnames + tostr(arglength)+Parasym.vartype.def.typesym.name;
+                        arglength := length(Parasym.vardef.typesym.name);
+                        argnames := argnames + tostr(arglength)+Parasym.vardef.typesym.name;
                       end
                     else
                       argnames:=argnames+'11unnamedtype';
@@ -420,7 +420,7 @@ implementation
            else
              sp:='2';
            newrec:=def_stabstr_evaluate(nil,'$1::$2=##$3;:$4;$5A$6;',[p.name,def_stab_number(pd),
-                                    def_stab_number(pd.rettype.def),argnames,sp,
+                                    def_stab_number(pd.returndef),argnames,sp,
                                     virtualind]);
            { get spare place for a string at the end }
            olds:=state^.stabsize;
@@ -452,29 +452,29 @@ implementation
                   slen:=def.len;
                   if slen=0 then
                     slen:=255;
-                  charst:=def_stab_number(cchartype.def);
-                  bytest:=def_stab_number(u8inttype.def);
+                  charst:=def_stab_number(cchartype);
+                  bytest:=def_stab_number(u8inttype);
                   result:=def_stabstr_evaluate(def,'s$1length:$2,0,8;st:ar$2;1;$3;$4,8,$5;;',
                               [tostr(slen+1),bytest,tostr(slen),charst,tostr(slen*8)]);
                 end;
               st_longstring:
                 begin
-                  charst:=def_stab_number(cchartype.def);
-                  bytest:=def_stab_number(u8inttype.def);
-                  longst:=def_stab_number(u32inttype.def);
+                  charst:=def_stab_number(cchartype);
+                  bytest:=def_stab_number(u8inttype);
+                  longst:=def_stab_number(u32inttype);
                   result:=def_stabstr_evaluate(def,'s$1length:$2,0,32;dummy:$6,32,8;st:ar$2;1;$3;$4,40,$5;;',
                               [tostr(def.len+5),longst,tostr(def.len),charst,tostr(def.len*8),bytest]);
                end;
              st_ansistring:
                begin
                  { looks like a pchar }
-                 charst:=def_stab_number(cchartype.def);
+                 charst:=def_stab_number(cchartype);
                  result:=strpnew('*'+charst);
                end;
              st_widestring:
                begin
                  { looks like a pwidechar }
-                 charst:=def_stab_number(cwidechartype.def);
+                 charst:=def_stab_number(cwidechartype);
                  result:=strpnew('*'+charst);
                end;
             end;
@@ -558,7 +558,7 @@ implementation
                     result:=strpnew('-32;');
                   s64bit :
                     result:=strpnew('-31;');
-                  {u32bit : result:=def_stab_number(s32inttype.def)+';0;-1;'); }
+                  {u32bit : result:=def_stab_number(s32inttype)+';0;-1;'); }
                   else
                     result:=def_stabstr_evaluate(def,'r${numberstring};$1;$2;',[tostr(longint(def.low)),tostr(longint(def.high))]);
                 end;
@@ -571,10 +571,10 @@ implementation
               s32real,
               s64real,
               s80real:
-                result:=def_stabstr_evaluate(def,'r$1;${savesize};0;',[def_stab_number(s32inttype.def)]);
+                result:=def_stabstr_evaluate(def,'r$1;${savesize};0;',[def_stab_number(s32inttype)]);
               s64currency,
               s64comp:
-                result:=def_stabstr_evaluate(def,'r$1;-${savesize};0;',[def_stab_number(s32inttype.def)]);
+                result:=def_stabstr_evaluate(def,'r$1;-${savesize};0;',[def_stab_number(s32inttype)]);
               else
                 internalerror(200509261);
             end;
@@ -585,16 +585,16 @@ implementation
 {$ifdef cpu64bit}
             result:=def_stabstr_evaluate(def,'s${savesize}HANDLE:$1,0,32;MODE:$1,32,32;RECSIZE:$2,64,64;'+
                                      '_PRIVATE:ar$1;1;64;$3,128,256;USERDATA:ar$1;1;16;$3,384,128;'+
-                                     'NAME:ar$1;0;255;$4,512,2048;;',[def_stab_number(s32inttype.def),
-                                     def_stab_number(s64inttype.def),
-                                     def_stab_number(u8inttype.def),
-                                     def_stab_number(cchartype.def)]);
+                                     'NAME:ar$1;0;255;$4,512,2048;;',[def_stab_number(s32inttype),
+                                     def_stab_number(s64inttype),
+                                     def_stab_number(u8inttype),
+                                     def_stab_number(cchartype)]);
 {$else cpu64bit}
             result:=def_stabstr_evaluate(def,'s${savesize}HANDLE:$1,0,32;MODE:$1,32,32;RECSIZE:$1,64,32;'+
                                      '_PRIVATE:ar$1;1;32;$3,96,256;USERDATA:ar$1;1;16;$2,352,128;'+
-                                     'NAME:ar$1;0;255;$3,480,2048;;',[def_stab_number(s32inttype.def),
-                                     def_stab_number(u8inttype.def),
-                                     def_stab_number(cchartype.def)]);
+                                     'NAME:ar$1;0;255;$3,480,2048;;',[def_stab_number(s32inttype),
+                                     def_stab_number(u8inttype),
+                                     def_stab_number(cchartype)]);
 {$endif cpu64bit}
           end;
 
@@ -624,7 +624,7 @@ implementation
             stabsstr:=def.mangledname;
             getmem(p,length(stabsstr)+255);
             strpcopy(p,'"'+obj+':'+RType
-                  +def_stab_number(def.rettype.def)+info+'",'+tostr(n_function)
+                  +def_stab_number(def.returndef)+info+'",'+tostr(n_function)
                   +',0,'+
                   tostr(def.fileinfo.line)
                   +',');
@@ -679,7 +679,7 @@ implementation
             if (oo_has_vmt in def.objectoptions) then
               if not assigned(def.childof) or not(oo_has_vmt in def.childof.objectoptions) then
                  begin
-                    ts:='$vf'+def_stab_classnumber(def)+':'+def_stab_number(vmtarraytype.def)+','+tostr(def.vmt_offset*8)+';';
+                    ts:='$vf'+def_stab_classnumber(def)+':'+def_stab_number(vmtarraytype)+','+tostr(def.vmt_offset*8)+';';
                     strpcopy(state.stabstring+state.stabsize,ts);
                     inc(state.stabsize,length(ts));
                  end;
@@ -718,29 +718,29 @@ implementation
           variantdef :
             result:=def_stabstr_evaluate(def,'formal${numberstring};',[]);
           pointerdef :
-            result:=strpnew('*'+def_stab_number(tpointerdef(def).pointertype.def));
+            result:=strpnew('*'+def_stab_number(tpointerdef(def).pointeddef));
           classrefdef :
-            result:=strpnew(def_stab_number(pvmttype.def));
+            result:=strpnew(def_stab_number(pvmttype));
           setdef :
-            result:=def_stabstr_evaluate(def,'@s$1;S$2',[tostr(def.size*8),def_stab_number(tsetdef(def).elementtype.def)]);
+            result:=def_stabstr_evaluate(def,'@s$1;S$2',[tostr(def.size*8),def_stab_number(tsetdef(def).elementdef)]);
           formaldef :
             result:=def_stabstr_evaluate(def,'formal${numberstring};',[]);
           arraydef :
             if not is_packed_array(def) then
-              result:=def_stabstr_evaluate(def,'ar$1;$2;$3;$4',[def_stab_number(tarraydef(def).rangetype.def),
-                 tostr(tarraydef(def).lowrange),tostr(tarraydef(def).highrange),def_stab_number(tarraydef(def).elementtype.def)])
+              result:=def_stabstr_evaluate(def,'ar$1;$2;$3;$4',[def_stab_number(tarraydef(def).rangedef),
+                 tostr(tarraydef(def).lowrange),tostr(tarraydef(def).highrange),def_stab_number(tarraydef(def).elementdef)])
             else
               // will only show highrange-lowrange+1 bits in gdb
               result:=def_stabstr_evaluate(def,'@s$1;@S;S$2',
-                [tostr(TConstExprInt(tarraydef(def).elepackedbitsize) * tarraydef(def).elecount),def_stabstr_evaluate(tarraydef(def).rangetype.def,'r${numberstring};$1;$2;',
+                [tostr(TConstExprInt(tarraydef(def).elepackedbitsize) * tarraydef(def).elecount),def_stabstr_evaluate(tarraydef(def).rangedef,'r${numberstring};$1;$2;',
                   [tostr(tarraydef(def).lowrange),tostr(tarraydef(def).highrange)
                 ])]);
 // the @P seems to be ignored by gdb
-//              result:=def_stabstr_evaluate(def,'ar$1;$2;$3;$4;@P;',[def_stab_number(tarraydef(def).rangetype.def),tostr(tarraydef(def).lowrange),tostr(tarraydef(def).highrange),def_stab_number(tarraydef(def).elementtype.def)]);
+//              result:=def_stabstr_evaluate(def,'ar$1;$2;$3;$4;@P;',[def_stab_number(tarraydef(def).rangedef),tostr(tarraydef(def).lowrange),tostr(tarraydef(def).highrange),def_stab_number(tarraydef(def).elementdef)]);
           procdef :
             result:=procdef_stabstr(tprocdef(def));
           procvardef :
-            result:=strpnew('*f'+def_stab_number(tprocvardef(def).rettype.def));
+            result:=strpnew('*f'+def_stab_number(tprocvardef(def).returndef));
           objectdef :
             result:=objectdef_stabstr(tobjectdef(def));
           undefineddef :
@@ -811,37 +811,37 @@ implementation
           stringdef :
             begin
               if tstringdef(def).string_typ=st_widestring then
-                insertdef(list,cwidechartype.def)
+                insertdef(list,cwidechartype)
               else
                 begin
-                  insertdef(list,cchartype.def);
-                  insertdef(list,u8inttype.def);
+                  insertdef(list,cchartype);
+                  insertdef(list,u8inttype);
                 end;
             end;
           floatdef :
-            insertdef(list,s32inttype.def);
+            insertdef(list,s32inttype);
           filedef :
             begin
-              insertdef(list,s32inttype.def);
+              insertdef(list,s32inttype);
 {$ifdef cpu64bit}
-              insertdef(list,s64inttype.def);
+              insertdef(list,s64inttype);
 {$endif cpu64bit}
-              insertdef(list,u8inttype.def);
-              insertdef(list,cchartype.def);
+              insertdef(list,u8inttype);
+              insertdef(list,cchartype);
             end;
           classrefdef :
-            insertdef(list,pvmttype.def);
+            insertdef(list,pvmttype);
           pointerdef :
-            insertdef(list,tpointerdef(def).pointertype.def);
+            insertdef(list,tpointerdef(def).pointeddef);
           setdef :
-            insertdef(list,tsetdef(def).elementtype.def);
+            insertdef(list,tsetdef(def).elementdef);
           procvardef,
           procdef :
-            insertdef(list,tabstractprocdef(def).rettype.def);
+            insertdef(list,tabstractprocdef(def).returndef);
           arraydef :
             begin
-              insertdef(list,tarraydef(def).rangetype.def);
-              insertdef(list,tarraydef(def).elementtype.def);
+              insertdef(list,tarraydef(def).rangedef);
+              insertdef(list,tarraydef(def).elementdef);
             end;
           recorddef :
             trecorddef(def).symtable.foreach(@field_write_defs,list);
@@ -850,7 +850,7 @@ implementation
               insertdef(list,tenumdef(def).basedef);
           objectdef :
             begin
-              insertdef(list,vmtarraytype.def);
+              insertdef(list,vmtarraytype);
               { first the parents }
               anc:=tobjectdef(def);
               while assigned(anc.childof) do
@@ -886,7 +886,7 @@ implementation
                  assigned(def.owner) and
                  assigned(def.owner.name) then
                 list.concat(Tai_stab.create(stab_stabs,strpnew('"vmt_'+def.owner.name^+tobjectdef(def).name+':S'+
-                       def_stab_number(vmttype.def)+'",'+tostr(N_STSYM)+',0,0,'+tobjectdef(def).vmt_mangledname)));
+                       def_stab_number(vmttype)+'",'+tostr(N_STSYM)+',0,0,'+tobjectdef(def).vmt_mangledname)));
             end;
           procdef :
             begin
@@ -960,16 +960,16 @@ implementation
                 if tabstractnormalvarsym(pd.funcretsym).localloc.loc=LOC_REFERENCE then
                   begin
     {$warning Need to add gdb support for ret in param register calling}
-                    if paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
+                    if paramanager.ret_in_param(pd.returndef,pd.proccalloption) then
                       hs:='X*'
                     else
                       hs:='X';
                     templist.concat(Tai_stab.create(stab_stabs,strpnew(
-                       '"'+pd.procsym.name+':'+hs+def_stab_number(pd.rettype.def)+'",'+
+                       '"'+pd.procsym.name+':'+hs+def_stab_number(pd.returndef)+'",'+
                        tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset))));
                     if (m_result in aktmodeswitches) then
                       templist.concat(Tai_stab.create(stab_stabs,strpnew(
-                         '"RESULT:'+hs+def_stab_number(pd.rettype.def)+'",'+
+                         '"RESULT:'+hs+def_stab_number(pd.returndef)+'",'+
                          tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset))));
                   end;
               end;
@@ -1078,7 +1078,7 @@ implementation
             if (sym.owner.symtabletype=objectsymtable) and
                (sp_static in sym.symoptions) then
               result:=sym_stabstr_evaluate(sym,'"${ownername}__${name}:S$1",${N_LCSYM},0,${line},${mangledname}',
-                  [def_stab_number(sym.vartype.def)]);
+                  [def_stab_number(sym.vardef)]);
           end;
 
         function globalvarsym_stabstr(sym:tglobalvarsym):Pchar;
@@ -1092,7 +1092,7 @@ implementation
               can't generate stabs for them }
             if vo_is_external in sym.varoptions then
               exit;
-            st:=def_stab_number(sym.vartype.def);
+            st:=def_stab_number(sym.vardef);
             case sym.localloc.loc of
               LOC_REGISTER,
               LOC_CREGISTER,
@@ -1133,7 +1133,7 @@ implementation
             if (sym.owner.symtabletype=localsymtable) and (sym.refs=0) then
               exit;
 
-            st:=def_stab_number(sym.vartype.def);
+            st:=def_stab_number(sym.vardef);
             case sym.localloc.loc of
               LOC_REGISTER,
               LOC_CREGISTER,
@@ -1181,10 +1181,10 @@ implementation
                   begin
                     if (sym.localloc.loc=LOC_REFERENCE) then
                       result:=sym_stabstr_evaluate(sym,'"pvmt:p$1",${N_TSYM},0,0,$2',
-                        [def_stab_number(pvmttype.def),tostr(sym.localloc.reference.offset)]);
+                        [def_stab_number(pvmttype),tostr(sym.localloc.reference.offset)]);
       (*            else
                       result:=sym_stabstr_evaluate(sym,'"pvmt:r$1",${N_RSYM},0,0,$2',
-                        [def_stab_number(pvmttype.def),tostr(regstabs_table[regidx])]) *)
+                        [def_stab_number(pvmttype),tostr(regstabs_table[regidx])]) *)
                     end
                 else
                   begin
@@ -1202,11 +1202,11 @@ implementation
               end
             else
               begin
-                st:=def_stab_number(sym.vartype.def);
+                st:=def_stab_number(sym.vardef);
 
-                if paramanager.push_addr_param(sym.varspez,sym.vartype.def,tprocdef(sym.owner.defowner).proccalloption) and
+                if paramanager.push_addr_param(sym.varspez,sym.vardef,tprocdef(sym.owner.defowner).proccalloption) and
                    not(vo_has_local_copy in sym.varoptions) and
-                   not is_open_string(sym.vartype.def) then
+                   not is_open_string(sym.vardef) then
                   st := 'v'+st { should be 'i' but 'i' doesn't work }
                 else
                   st := 'p'+st;
@@ -1276,13 +1276,13 @@ implementation
             stabchar : string[2];
           begin
             result:=nil;
-            if not assigned(sym.restype.def) then
+            if not assigned(sym.typedef) then
               internalerror(200509262);
-            if sym.restype.def.deftype in tagtypes then
+            if sym.typedef.deftype in tagtypes then
               stabchar:='Tt'
             else
               stabchar:='t';
-            result:=sym_stabstr_evaluate(sym,'"${name}:$1$2",${N_LSYM},0,${line},0',[stabchar,def_stab_number(sym.restype.def)]);
+            result:=sym_stabstr_evaluate(sym,'"${name}:$1$2",${N_LSYM},0,${line},0',[stabchar,def_stab_number(sym.typedef)]);
           end;
 
         function procsym_stabstr(sym:tprocsym) : pchar;
@@ -1311,7 +1311,7 @@ implementation
             stabstr:=paravarsym_stabstr(tparavarsym(sym));
           typedconstsym :
             stabstr:=sym_stabstr_evaluate(sym,'"${name}:S$1",${N_STSYM},0,${line},${mangledname}',
-                [def_stab_number(ttypedconstsym(sym).typedconsttype.def)]);
+                [def_stab_number(ttypedconstsym(sym).typedconstdef)]);
           constsym :
             stabstr:=constsym_stabstr(tconstsym(sym));
           typesym :
@@ -1322,8 +1322,8 @@ implementation
         if stabstr<>nil then
           list.concat(Tai_stab.create(stab_stabs,stabstr));
         { For object types write also the symtable entries }
-        if (sym.typ=typesym) and (ttypesym(sym).restype.def.deftype=objectdef) then
-          write_symtable_syms(list,tobjectdef(ttypesym(sym).restype.def).symtable);
+        if (sym.typ=typesym) and (ttypesym(sym).typedef.deftype=objectdef) then
+          write_symtable_syms(list,tobjectdef(ttypesym(sym).typedef).symtable);
         sym.isdbgwritten:=true;
       end;
 

+ 55 - 55
compiler/defcmp.pas

@@ -491,13 +491,13 @@ implementation
                          ([m_tp7,m_delphi] * aktmodeswitches = [])) and
                         (is_integer(def_from) or
                          (is_currency(def_from) and
-                          (s64currencytype.def.deftype = floatdef))) then
+                          (s64currencytype.deftype = floatdef))) then
                        begin
                          doconv:=tc_int_2_real;
                          eq:=te_convert_l1;
                        end
                      else if is_currency(def_from)
-                             { and (s64currencytype.def.deftype = orddef)) } then
+                             { and (s64currencytype.deftype = orddef)) } then
                        begin
                          { prefer conversion to orddef in this case, unless    }
                          { the orddef < currency (then it will get convert l3, }
@@ -598,8 +598,8 @@ implementation
                  the extra check for deftyp is needed because equal defs can also return
                  true if the def types are not the same, for example with dynarray to pointer. }
                if is_open_array(def_to) and
-                  (def_from.deftype=tarraydef(def_to).elementtype.def.deftype) and
-                  equal_defs(def_from,tarraydef(def_to).elementtype.def) then
+                  (def_from.deftype=tarraydef(def_to).elementdef.deftype) and
+                  equal_defs(def_from,tarraydef(def_to).elementdef) then
                 begin
                   doconv:=tc_equal;
                   eq:=te_convert_l1;
@@ -628,7 +628,7 @@ implementation
                         { to dynamic array }
                         else if is_dynamic_array(def_to) then
                          begin
-                           if equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                           if equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
                              begin
                                { dynamic array -> dynamic array }
                                if is_dynamic_array(def_from) then
@@ -650,15 +650,15 @@ implementation
                             { array constructor -> open array }
                             if is_array_constructor(def_from) then
                              begin
-                               if is_void(tarraydef(def_from).elementtype.def) then
+                               if is_void(tarraydef(def_from).elementdef) then
                                 begin
                                   doconv:=tc_equal;
                                   eq:=te_convert_l1;
                                 end
                                else
                                 begin
-                                  subeq:=compare_defs_ext(tarraydef(def_from).elementtype.def,
-                                                       tarraydef(def_to).elementtype.def,
+                                  subeq:=compare_defs_ext(tarraydef(def_from).elementdef,
+                                                       tarraydef(def_to).elementdef,
                                                        arrayconstructorn,hct,hpd,[cdo_check_operator]);
                                   if (subeq>=te_equal) then
                                     begin
@@ -676,7 +676,7 @@ implementation
                             else
                              { dynamic array -> open array }
                              if is_dynamic_array(def_from) and
-                                equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                                equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
                                begin
                                  doconv:=tc_dynarray_2_openarray;
                                  eq:=te_convert_l2;
@@ -684,12 +684,12 @@ implementation
                             else
                              { open array -> open array }
                              if is_open_array(def_from) and
-                                equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                                equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
                                eq:=te_equal
                             else
                              { array -> open array }
                              if not(cdo_parameter in cdoptions) and
-                                equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                                equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
                                eq:=te_equal;
                           end
                         else
@@ -703,7 +703,7 @@ implementation
                              end
                             else
                              { array of tvarrec -> array of const }
-                             if equal_defs(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
+                             if equal_defs(tarraydef(def_to).elementdef,tarraydef(def_from).elementdef) then
                               begin
                                 doconv:=tc_equal;
                                 eq:=te_convert_l1;
@@ -724,7 +724,7 @@ implementation
                             { open array -> array }
                             if not(cdo_parameter in cdoptions) and
                                is_open_array(def_from) and
-                               equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                               equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
                               begin
                                 eq:=te_equal
                               end
@@ -734,8 +734,8 @@ implementation
                                 not(m_delphi in aktmodeswitches) and
                                 (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and
                                 (tarraydef(def_from).highrange=tarraydef(def_to).highrange) and
-                                equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) and
-                                equal_defs(tarraydef(def_from).rangetype.def,tarraydef(def_to).rangetype.def) then
+                                equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) and
+                                equal_defs(tarraydef(def_from).rangedef,tarraydef(def_to).rangedef) then
                               begin
                                 eq:=te_equal
                               end;
@@ -753,7 +753,7 @@ implementation
                          end
                         else
                          if is_zero_based_array(def_to) and
-                            equal_defs(tpointerdef(def_from).pointertype.def,tarraydef(def_to).elementtype.def) then
+                            equal_defs(tpointerdef(def_from).pointeddef,tarraydef(def_to).elementdef) then
                           begin
                             doconv:=tc_pointer_2_array;
                             eq:=te_convert_l1;
@@ -763,8 +763,8 @@ implementation
                       begin
                         { string to char array }
                         if (not is_special_array(def_to)) and
-                           (is_char(tarraydef(def_to).elementtype.def)or
-                            is_widechar(tarraydef(def_to).elementtype.def)) then
+                           (is_char(tarraydef(def_to).elementdef)or
+                            is_widechar(tarraydef(def_to).elementdef)) then
                          begin
                            doconv:=tc_string_2_chararray;
                            eq:=te_convert_l1;
@@ -783,7 +783,7 @@ implementation
                       begin
                         { tvarrec -> array of const }
                          if is_array_of_const(def_to) and
-                            equal_defs(def_from,tarraydef(def_to).elementtype.def) then
+                            equal_defs(def_from,tarraydef(def_to).elementdef) then
                           begin
                             doconv:=tc_equal;
                             eq:=te_convert_l1;
@@ -913,7 +913,7 @@ implementation
                       { chararray to pointer }
                       if (is_zero_based_array(def_from) or
                           is_open_array(def_from)) and
-                          equal_defs(tarraydef(def_from).elementtype.def,tpointerdef(def_to).pointertype.def) then
+                          equal_defs(tarraydef(def_from).elementdef,tpointerdef(def_to).pointeddef) then
                         begin
                           doconv:=tc_array_2_pointer;
                           { don't prefer the pchar overload when a constant
@@ -941,24 +941,24 @@ implementation
                      else
                       { the types can be forward type, handle before normal type check !! }
                       if assigned(def_to.typesym) and
-                         (tpointerdef(def_to).pointertype.def.deftype=forwarddef) then
+                         (tpointerdef(def_to).pointeddef.deftype=forwarddef) then
                        begin
                          if (def_from.typesym=def_to.typesym) then
                           eq:=te_equal
                        end
                      else
                       { same types }
-                      if equal_defs(tpointerdef(def_from).pointertype.def,tpointerdef(def_to).pointertype.def) then
+                      if equal_defs(tpointerdef(def_from).pointeddef,tpointerdef(def_to).pointeddef) then
                        begin
                          eq:=te_equal
                        end
                      else
                       { child class pointer can be assigned to anchestor pointers }
                       if (
-                          (tpointerdef(def_from).pointertype.def.deftype=objectdef) and
-                          (tpointerdef(def_to).pointertype.def.deftype=objectdef) and
-                          tobjectdef(tpointerdef(def_from).pointertype.def).is_related(
-                            tobjectdef(tpointerdef(def_to).pointertype.def))
+                          (tpointerdef(def_from).pointeddef.deftype=objectdef) and
+                          (tpointerdef(def_to).pointeddef.deftype=objectdef) and
+                          tobjectdef(tpointerdef(def_from).pointeddef).is_related(
+                            tobjectdef(tpointerdef(def_to).pointeddef))
                          ) then
                        begin
                          doconv:=tc_equal;
@@ -966,7 +966,7 @@ implementation
                        end
                      else
                       { all pointers can be assigned to void-pointer }
-                      if is_void(tpointerdef(def_to).pointertype.def) then
+                      if is_void(tpointerdef(def_to).pointeddef) then
                        begin
                          doconv:=tc_equal;
                          { give pwidechar,pchar a penalty so it prefers
@@ -979,10 +979,10 @@ implementation
                        end
                      else
                       { all pointers can be assigned from void-pointer }
-                      if is_void(tpointerdef(def_from).pointertype.def) or
+                      if is_void(tpointerdef(def_from).pointeddef) or
                       { all pointers can be assigned from void-pointer or formaldef pointer, check
                         tw3777.pp if you change this }
-                        (tpointerdef(def_from).pointertype.def.deftype=formaldef) then
+                        (tpointerdef(def_from).pointeddef.deftype=formaldef) then
                        begin
                          doconv:=tc_equal;
                          { give pwidechar a penalty so it prefers
@@ -997,7 +997,7 @@ implementation
                    begin
                      { procedure variable can be assigned to an void pointer,
                        this not allowed for methodpointers }
-                     if (is_void(tpointerdef(def_to).pointertype.def) or
+                     if (is_void(tpointerdef(def_to).pointeddef) or
                          (m_mac_procvar in aktmodeswitches)) and
                         tprocvardef(def_from).is_addressonly then
                       begin
@@ -1026,8 +1026,8 @@ implementation
                          is_class_or_interface(def_from) or
                          (def_from.deftype=classrefdef)
                         ) and
-                        (tpointerdef(def_to).pointertype.def.deftype=orddef) and
-                        (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
+                        (tpointerdef(def_to).pointeddef.deftype=orddef) and
+                        (torddef(tpointerdef(def_to).pointeddef).typ=uvoid) then
                        begin
                          doconv:=tc_equal;
                          eq:=te_convert_l2;
@@ -1041,11 +1041,11 @@ implementation
                case def_from.deftype of
                  setdef :
                    begin
-                     if assigned(tsetdef(def_from).elementtype.def) and
-                        assigned(tsetdef(def_to).elementtype.def) then
+                     if assigned(tsetdef(def_from).elementdef) and
+                        assigned(tsetdef(def_to).elementdef) then
                       begin
                         { sets with the same element base type are equal }
-                        if is_subequal(tsetdef(def_from).elementtype.def,tsetdef(def_to).elementtype.def) then
+                        if is_subequal(tsetdef(def_from).elementdef,tsetdef(def_to).elementdef) then
                          eq:=te_equal;
                       end
                      else
@@ -1098,7 +1098,7 @@ implementation
                       { for example delphi allows the assignement from pointers }
                       { to procedure variables                                  }
                       if (m_pointer_2_procedure in aktmodeswitches) and
-                         is_void(tpointerdef(def_from).pointertype.def) and
+                         is_void(tpointerdef(def_from).pointeddef) and
                          tprocvardef(def_to).is_addressonly then
                        begin
                          doconv:=tc_equal;
@@ -1185,7 +1185,7 @@ implementation
              begin
                { similar to pointerdef wrt forwards }
                if assigned(def_to.typesym) and
-                  (tclassrefdef(def_to).pointertype.def.deftype=forwarddef) then
+                  (tclassrefdef(def_to).pointeddef.deftype=forwarddef) then
                  begin
                    if (def_from.typesym=def_to.typesym) then
                     eq:=te_equal;
@@ -1194,7 +1194,7 @@ implementation
                 { class reference types }
                 if (def_from.deftype=classrefdef) then
                  begin
-                   if equal_defs(tclassrefdef(def_from).pointertype.def,tclassrefdef(def_to).pointertype.def) then
+                   if equal_defs(tclassrefdef(def_from).pointeddef,tclassrefdef(def_to).pointeddef) then
                     begin
                       eq:=te_equal;
                     end
@@ -1202,8 +1202,8 @@ implementation
                     begin
                       doconv:=tc_equal;
                       if (cdo_explicit in cdoptions) or
-                         tobjectdef(tclassrefdef(def_from).pointertype.def).is_related(
-                           tobjectdef(tclassrefdef(def_to).pointertype.def)) then
+                         tobjectdef(tclassrefdef(def_from).pointeddef).is_related(
+                           tobjectdef(tclassrefdef(def_to).pointeddef)) then
                         eq:=te_convert_l1;
                     end;
                  end
@@ -1231,20 +1231,20 @@ implementation
                    begin
                      if
                         (
-                         (tfiledef(def_from).typedfiletype.def=nil) and
-                         (tfiledef(def_to).typedfiletype.def=nil)
+                         (tfiledef(def_from).typedfiledef=nil) and
+                         (tfiledef(def_to).typedfiledef=nil)
                         ) or
                         (
-                         (tfiledef(def_from).typedfiletype.def<>nil) and
-                         (tfiledef(def_to).typedfiletype.def<>nil) and
-                         equal_defs(tfiledef(def_from).typedfiletype.def,tfiledef(def_to).typedfiletype.def)
+                         (tfiledef(def_from).typedfiledef<>nil) and
+                         (tfiledef(def_to).typedfiledef<>nil) and
+                         equal_defs(tfiledef(def_from).typedfiledef,tfiledef(def_to).typedfiledef)
                         ) or
                         (
                          (tfiledef(def_from).filetyp = ft_typed) and
                          (tfiledef(def_to).filetyp = ft_typed) and
                          (
-                          (tfiledef(def_from).typedfiletype.def = tdef(voidtype.def)) or
-                          (tfiledef(def_to).typedfiletype.def = tdef(voidtype.def))
+                          (tfiledef(def_from).typedfiledef = tdef(voidtype)) or
+                          (tfiledef(def_to).typedfiledef = tdef(voidtype))
                          )
                         ) then
                       begin
@@ -1414,8 +1414,8 @@ implementation
              currpara2:=tparavarsym(para2[i2]);
 
              { Unique types must match exact }
-             if ((df_unique in currpara1.vartype.def.defoptions) or (df_unique in currpara2.vartype.def.defoptions)) and
-                (currpara1.vartype.def<>currpara2.vartype.def) then
+             if ((df_unique in currpara1.vardef.defoptions) or (df_unique in currpara2.vardef.defoptions)) and
+                (currpara1.vardef<>currpara2.vardef) then
                exit;
 
              { Handle hidden parameters separately, because self is
@@ -1432,7 +1432,7 @@ implementation
                  begin
                    if (currpara1.varspez<>currpara2.varspez) then
                     exit;
-                   eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                   eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                         convtype,hpd,cdoptions);
                  end;
               end
@@ -1447,28 +1447,28 @@ implementation
                             (currpara2.varspez in [vs_var,vs_out]))
                           ) then
                          exit;
-                       eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                       eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                             convtype,hpd,cdoptions);
                     end;
                   cp_all :
                     begin
                        if (currpara1.varspez<>currpara2.varspez) then
                          exit;
-                       eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                       eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                             convtype,hpd,cdoptions);
                     end;
                   cp_procvar :
                     begin
                        if (currpara1.varspez<>currpara2.varspez) then
                          exit;
-                       eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                       eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                             convtype,hpd,cdoptions);
                        { Parameters must be at least equal otherwise the are incompatible }
                        if (eq<te_equal) then
                          eq:=te_incompatible;
                     end;
                   else
-                    eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                    eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                          convtype,hpd,cdoptions);
                  end;
                end;
@@ -1527,7 +1527,7 @@ implementation
            exclude(po_comp,po_varargs);
          if (def1.proccalloption=def2.proccalloption) and
             ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) and
-            equal_defs(def1.rettype.def,def2.rettype.def) then
+            equal_defs(def1.returndef,def2.returndef) then
           begin
             { return equal type based on the parameters, but a proc->procvar
               is never exact, so map an exact match of the parameters to

+ 48 - 48
compiler/defutil.pas

@@ -52,9 +52,9 @@ interface
     {# Returns basetype of the specified integer range }
     function range_to_basetype(l,h:TConstExprInt):tbasetype;
 
-    procedure range_to_type(l,h:TConstExprInt;var tt:ttype);
+    procedure range_to_type(l,h:TConstExprInt;var def:tdef);
 
-    procedure int_to_type(v:TConstExprInt;var tt:ttype);
+    procedure int_to_type(v:TConstExprInt;var def:tdef);
 
     {# Returns true, if definition defines an integer type }
     function is_integer(def : tdef) : boolean;
@@ -245,13 +245,13 @@ implementation
     { returns true, if def is a currency type }
     function is_currency(def : tdef) : boolean;
       begin
-         case s64currencytype.def.deftype of
+         case s64currencytype.deftype of
            orddef :
              result:=(def.deftype=orddef) and
-                     (torddef(s64currencytype.def).typ=torddef(def).typ);
+                     (torddef(s64currencytype).typ=torddef(def).typ);
            floatdef :
              result:=(def.deftype=floatdef) and
-                     (tfloatdef(s64currencytype.def).typ=tfloatdef(def).typ);
+                     (tfloatdef(s64currencytype).typ=tfloatdef(def).typ);
            else
              internalerror(200304222);
          end;
@@ -309,29 +309,29 @@ implementation
       end;
 
 
-    procedure range_to_type(l,h:TConstExprInt;var tt:ttype);
+    procedure range_to_type(l,h:TConstExprInt;var def:tdef);
       begin
         { prefer signed over unsigned }
         if (l>=-128) and (h<=127) then
-         tt:=s8inttype
+         def:=s8inttype
         else if (l>=0) and (h<=255) then
-         tt:=u8inttype
+         def:=u8inttype
         else if (l>=-32768) and (h<=32767) then
-         tt:=s16inttype
+         def:=s16inttype
         else if (l>=0) and (h<=65535) then
-         tt:=u16inttype
+         def:=u16inttype
         else if (l>=low(longint)) and (h<=high(longint)) then
-         tt:=s32inttype
+         def:=s32inttype
         else if (l>=low(cardinal)) and (h<=high(cardinal)) then
-         tt:=u32inttype
+         def:=u32inttype
         else
-         tt:=s64inttype;
+         def:=s64inttype;
       end;
 
 
-    procedure int_to_type(v:TConstExprInt;var tt:ttype);
+    procedure int_to_type(v:TConstExprInt;var def:tdef);
       begin
-        range_to_type(v,v,tt);
+        range_to_type(v,v,def);
       end;
 
 
@@ -440,7 +440,7 @@ implementation
            enumdef :
              is_signed:=tenumdef(def).min < 0;
            arraydef :
-             is_signed:=is_signed(tarraydef(def).rangetype.def);
+             is_signed:=is_signed(tarraydef(def).rangedef);
            else
              is_signed:=false;
          end;
@@ -518,7 +518,7 @@ implementation
          { check for s32inttype is needed, because for u32bit the high
            range is also -1 ! (PFV) }
          result:=(p.deftype=arraydef) and
-                 (tarraydef(p).rangetype.def=s32inttype.def) and
+                 (tarraydef(p).rangedef=s32inttype) and
                  (tarraydef(p).lowrange=0) and
                  (tarraydef(p).highrange=-1) and
                  ((tarraydef(p).arrayoptions * [ado_IsVariant,ado_IsArrayOfConst,ado_IsConstructor,ado_IsDynamicArray])=[]);
@@ -608,7 +608,7 @@ implementation
     function is_chararray(p : tdef) : boolean;
       begin
         is_chararray:=(p.deftype=arraydef) and
-                      is_char(tarraydef(p).elementtype.def) and
+                      is_char(tarraydef(p).elementdef) and
                       not(is_special_array(p));
       end;
 
@@ -616,7 +616,7 @@ implementation
     function is_widechararray(p : tdef) : boolean;
       begin
         is_widechararray:=(p.deftype=arraydef) and
-                          is_widechar(tarraydef(p).elementtype.def) and
+                          is_widechar(tarraydef(p).elementdef) and
                           not(is_special_array(p));
       end;
 
@@ -625,32 +625,32 @@ implementation
     function is_open_chararray(p : tdef) : boolean;
       begin
         is_open_chararray:= is_open_array(p) and
-                            is_char(tarraydef(p).elementtype.def);
+                            is_char(tarraydef(p).elementdef);
       end;
 
     { true if p is a open wide char array def }
     function is_open_widechararray(p : tdef) : boolean;
       begin
         is_open_widechararray:= is_open_array(p) and
-                                is_widechar(tarraydef(p).elementtype.def);
+                                is_widechar(tarraydef(p).elementdef);
       end;
 
     { true if p is a pchar def }
     function is_pchar(p : tdef) : boolean;
       begin
         is_pchar:=(p.deftype=pointerdef) and
-                  (is_char(tpointerdef(p).pointertype.def) or
-                   (is_zero_based_array(tpointerdef(p).pointertype.def) and
-                    is_chararray(tpointerdef(p).pointertype.def)));
+                  (is_char(tpointerdef(p).pointeddef) or
+                   (is_zero_based_array(tpointerdef(p).pointeddef) and
+                    is_chararray(tpointerdef(p).pointeddef)));
       end;
 
     { true if p is a pchar def }
     function is_pwidechar(p : tdef) : boolean;
       begin
         is_pwidechar:=(p.deftype=pointerdef) and
-                      (is_widechar(tpointerdef(p).pointertype.def) or
-                       (is_zero_based_array(tpointerdef(p).pointertype.def) and
-                        is_widechararray(tpointerdef(p).pointertype.def)));
+                      (is_widechar(tpointerdef(p).pointeddef) or
+                       (is_zero_based_array(tpointerdef(p).pointeddef) and
+                        is_widechararray(tpointerdef(p).pointeddef)));
       end;
 
 
@@ -658,8 +658,8 @@ implementation
     function is_voidpointer(p : tdef) : boolean;
       begin
         is_voidpointer:=(p.deftype=pointerdef) and
-                        (tpointerdef(p).pointertype.def.deftype=orddef) and
-                        (torddef(tpointerdef(p).pointertype.def).typ=uvoid);
+                        (tpointerdef(p).pointeddef.deftype=orddef) and
+                        (torddef(tpointerdef(p).pointeddef).typ=uvoid);
       end;
 
 
@@ -790,13 +790,13 @@ implementation
          mmx_type:=mmxno;
          if is_mmx_able_array(p) then
            begin
-              if tarraydef(p).elementtype.def.deftype=floatdef then
-                case tfloatdef(tarraydef(p).elementtype.def).typ of
+              if tarraydef(p).elementdef.deftype=floatdef then
+                case tfloatdef(tarraydef(p).elementdef).typ of
                   s32real:
                     mmx_type:=mmxsingle;
                 end
               else
-                case torddef(tarraydef(p).elementtype.def).typ of
+                case torddef(tarraydef(p).elementdef).typ of
                    u8bit:
                      mmx_type:=mmxu8bit;
                    s8bit:
@@ -818,7 +818,7 @@ implementation
       begin
         result:=(p.deftype=arraydef) and
                 not(is_special_array(p)) and
-                (tarraydef(p).elementtype.def.deftype=floatdef) and (tfloatdef(tarraydef(p).elementtype.def).typ in [s32real,s64real]);
+                (tarraydef(p).elementdef.deftype=floatdef) and (tfloatdef(tarraydef(p).elementdef).typ in [s32real,s64real]);
       end;
 
 
@@ -828,20 +828,20 @@ implementation
 {$ifdef x86}
         result:= is_vector(p) and
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=3) and
-                   (tfloatdef(tarraydef(p).elementtype.def).typ=s32real)
+                   (tfloatdef(tarraydef(p).elementdef).typ=s32real)
                   )
                  ) or
 
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=1) and
-                   (tfloatdef(tarraydef(p).elementtype.def).typ=s64real)
+                   (tfloatdef(tarraydef(p).elementdef).typ=s64real)
                   )
                  );
 {$else x86}
@@ -859,29 +859,29 @@ implementation
                 not(is_special_array(p)) and
                 (
                  (
-                  (tarraydef(p).elementtype.def.deftype=orddef) and
+                  (tarraydef(p).elementdef.deftype=orddef) and
                   (
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=1) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u32bit,s32bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u32bit,s32bit])
                    )
                    or
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=3) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u16bit,s16bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u16bit,s16bit])
                    )
                   )
                  )
                  or
                 (
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=1) and
-                   (tfloatdef(tarraydef(p).elementtype.def).typ=s32real)
+                   (tfloatdef(tarraydef(p).elementdef).typ=s32real)
                   )
                  )
                 )
@@ -892,34 +892,34 @@ implementation
               is_mmx_able_array:=(p.deftype=arraydef) and
                 (
                  (
-                  (tarraydef(p).elementtype.def.deftype=orddef) and
+                  (tarraydef(p).elementdef.deftype=orddef) and
                   (
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=1) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u32bit,s32bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u32bit,s32bit])
                    )
                    or
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=3) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u16bit,s16bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u16bit,s16bit])
                    )
                    or
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=7) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u8bit,s8bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u8bit,s8bit])
                    )
                   )
                  )
                  or
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=1) and
-                   (tfloatdef(tarraydef(p).elementtype.def).typ=s32real)
+                   (tfloatdef(tarraydef(p).elementdef).typ=s32real)
                   )
                  )
                 );

+ 67 - 67
compiler/htypechk.pas

@@ -362,11 +362,11 @@ implementation
         result:=false;
         case pf.parast.symindex.count of
           1 : begin
-                ld:=tparavarsym(pf.parast.symindex.first).vartype.def;
+                ld:=tparavarsym(pf.parast.symindex.first).vardef;
                 { assignment is a special case }
                 if optoken=_ASSIGNMENT then
                   begin
-                    eq:=compare_defs_ext(ld,pf.rettype.def,nothingn,conv,pd,[cdo_explicit]);
+                    eq:=compare_defs_ext(ld,pf.returndef,nothingn,conv,pd,[cdo_explicit]);
                     result:=(eq=te_incompatible);
                   end
                 else
@@ -385,8 +385,8 @@ implementation
                 for i:=1 to tok2nodes do
                   if tok2node[i].tok=optoken then
                     begin
-                      ld:=tparavarsym(pf.parast.symindex.first).vartype.def;
-                      rd:=tparavarsym(pf.parast.symindex.first.indexnext).vartype.def;
+                      ld:=tparavarsym(pf.parast.symindex.first).vardef;
+                      rd:=tparavarsym(pf.parast.symindex.first.indexnext).vardef;
                       result:=
                         tok2node[i].op_overloading_supported and
                         isbinaryoperatoroverloadable(tok2node[i].nod,ld,nothingn,rd,nothingn);
@@ -410,7 +410,7 @@ implementation
         operpd:=nil;
 
         { load easier access variables }
-        ld:=tunarynode(t).left.resulttype.def;
+        ld:=tunarynode(t).left.resultdef;
         if not isunaryoperatoroverloadable(t.nodetype,ld) then
           exit;
 
@@ -484,7 +484,7 @@ implementation
         t:=ccallnode.create(ppn,Tprocsym(operpd.procsym),nil,nil,[]);
 
         { we already know the procdef to use, so it can
-          skip the overload choosing in callnode.det_resulttype }
+          skip the overload choosing in callnode.pass_typecheck }
         tcallnode(t).procdefinition:=operpd;
       end;
 
@@ -502,8 +502,8 @@ implementation
         isbinaryoverloaded:=false;
         operpd:=nil;
         { load easier access variables }
-        ld:=tbinarynode(t).left.resulttype.def;
-        rd:=tbinarynode(t).right.resulttype.def;
+        ld:=tbinarynode(t).left.resultdef;
+        rd:=tbinarynode(t).right.resultdef;
         if not isbinaryoperatoroverloadable(t.nodetype,ld,tbinarynode(t).left.nodetype,rd,tbinarynode(t).right.nodetype) then
           exit;
 
@@ -630,7 +630,7 @@ implementation
         ht:=ccallnode.create(ppn,Tprocsym(operpd.procsym),nil,nil,[]);
 
         { we already know the procdef to use, so it can
-          skip the overload choosing in callnode.det_resulttype }
+          skip the overload choosing in callnode.pass_typecheck }
         tcallnode(ht).procdefinition:=operpd;
 
         if t.nodetype=unequaln then
@@ -650,7 +650,7 @@ implementation
              subscriptn:
                make_not_regable_intern(tsubscriptnode(p).left,how,true);
             typeconvn :
-               if (ttypeconvnode(p).resulttype.def.deftype = recorddef) then
+               if (ttypeconvnode(p).resultdef.deftype = recorddef) then
                  make_not_regable_intern(ttypeconvnode(p).left,how,false)
                else
                  make_not_regable_intern(ttypeconvnode(p).left,how,records_only);
@@ -658,7 +658,7 @@ implementation
               if (tloadnode(p).symtableentry.typ in [globalvarsym,localvarsym,paravarsym]) and
                  (tabstractvarsym(tloadnode(p).symtableentry).varregable <> vr_none) and
                  ((not records_only) or
-                  (tabstractvarsym(tloadnode(p).symtableentry).vartype.def.deftype = recorddef)) then
+                  (tabstractvarsym(tloadnode(p).symtableentry).vardef.deftype = recorddef)) then
                 if (tloadnode(p).symtableentry.typ = paravarsym) then
                   tabstractvarsym(tloadnode(p).symtableentry).varregable:=how
                 else
@@ -666,7 +666,7 @@ implementation
             temprefn :
               if (ttemprefnode(p).tempinfo^.may_be_in_reg) and
                  ((not records_only) or
-                  (ttemprefnode(p).tempinfo^.restype.def.deftype = recorddef)) then
+                  (ttemprefnode(p).tempinfo^.typedef.deftype = recorddef)) then
                 ttemprefnode(p).tempinfo^.may_be_in_reg:=false;
          end;
       end;
@@ -745,7 +745,7 @@ implementation
         if ((m_tp_procvar in aktmodeswitches) or
             (m_mac_procvar in aktmodeswitches)) and
            (p.nodetype=typeconvn) and
-           is_voidpointer(p.resulttype.def) then
+           is_voidpointer(p.resultdef) then
           p:=tunarynode(p).left;
         result:=(p.nodetype=typeconvn) and
                 (ttypeconvnode(p).convtype=tc_proc_2_procvar);
@@ -799,7 +799,7 @@ implementation
                end;
              subscriptn :
                begin
-                 if is_class_or_interface(tunarynode(p).left.resulttype.def) then
+                 if is_class_or_interface(tunarynode(p).left.resultdef) then
                    newstate := vs_read;
                  p:=tunarynode(p).left;
                end;
@@ -807,7 +807,7 @@ implementation
                begin
                  set_varstate(tbinarynode(p).right,vs_read,[vsf_must_be_valid]);
                  if (newstate in [vs_read,vs_readwritten]) or
-                    not(tunarynode(p).left.resulttype.def.deftype in [stringdef,arraydef]) then
+                    not(tunarynode(p).left.resultdef.deftype in [stringdef,arraydef]) then
                    include(varstateflags,vsf_must_be_valid)
                  else if (newstate = vs_written) then
                    exclude(varstateflags,vsf_must_be_valid);
@@ -923,7 +923,7 @@ implementation
         gotstring:=false;
         hp:=p;
         if not(valid_void in opts) and
-           is_void(hp.resulttype.def) then
+           is_void(hp.resultdef) then
          begin
            if report_errors then
              CGMessagePos(hp.fileinfo,errmsg);
@@ -937,11 +937,11 @@ implementation
               if (hp.nodetype=calln) then
                 begin
                   { check return type }
-                  case hp.resulttype.def.deftype of
+                  case hp.resultdef.deftype of
                     pointerdef :
                       gotpointer:=true;
                     objectdef :
-                      gotclass:=is_class_or_interface(hp.resulttype.def);
+                      gotclass:=is_class_or_interface(hp.resultdef);
                     recorddef :
                       gotrecord:=true;
                     classrefdef :
@@ -1016,8 +1016,8 @@ implementation
                    - from void
                    - from/to open array
                    - typecast from pointer to array }
-                 fromdef:=ttypeconvnode(hp).left.resulttype.def;
-                 todef:=hp.resulttype.def;
+                 fromdef:=ttypeconvnode(hp).left.resultdef;
+                 todef:=hp.resultdef;
                  if not((nf_absolute in ttypeconvnode(hp).flags) or
                         (fromdef.deftype=formaldef) or
                         is_void(fromdef) or
@@ -1045,18 +1045,18 @@ implementation
                        CGMessagePos(hp.fileinfo,errmsg);
                      exit;
                    end;
-                 case hp.resulttype.def.deftype of
+                 case hp.resultdef.deftype of
                    pointerdef :
                      gotpointer:=true;
                    objectdef :
-                     gotclass:=is_class_or_interface(hp.resulttype.def);
+                     gotclass:=is_class_or_interface(hp.resultdef);
                    classrefdef :
                      gotclass:=true;
                    arraydef :
                      begin
                        { pointer -> array conversion is done then we need to see it
                          as a deref, because a ^ is then not required anymore }
-                       if (ttypeconvnode(hp).left.resulttype.def.deftype=pointerdef) then
+                       if (ttypeconvnode(hp).left.resultdef.deftype=pointerdef) then
                         gotderef:=true;
                      end;
                  end;
@@ -1067,9 +1067,9 @@ implementation
                  if { only check for first (= outermost) vec node }
                     not gotvec and
                     not(valid_packed in opts) and
-                    (tvecnode(hp).left.resulttype.def.deftype = arraydef) and
-                    (ado_IsBitPacked in tarraydef(tvecnode(hp).left.resulttype.def).arrayoptions) and
-                    (tarraydef(tvecnode(hp).left.resulttype.def).elepackedbitsize mod 8 <> 0) then
+                    (tvecnode(hp).left.resultdef.deftype = arraydef) and
+                    (ado_IsBitPacked in tarraydef(tvecnode(hp).left.resultdef).arrayoptions) and
+                    (tarraydef(tvecnode(hp).left.resultdef).elepackedbitsize mod 8 <> 0) then
                    begin
                      if report_errors then
                        if (valid_property in opts) then
@@ -1080,7 +1080,7 @@ implementation
                    end;
                  gotvec:=true;
                  { accesses to dyn. arrays override read only access in delphi }
-                 if (m_delphi in aktmodeswitches) and is_dynamic_array(tunarynode(hp).left.resulttype.def) then
+                 if (m_delphi in aktmodeswitches) and is_dynamic_array(tunarynode(hp).left.resultdef) then
                    gotdynarray:=true;
                  hp:=tunarynode(hp).left;
                end;
@@ -1101,7 +1101,7 @@ implementation
                  { only check first (= outermost) subscriptn }
                  if not gotsubscript and
                     not(valid_packed in opts) and
-                    is_packed_record_or_object(tsubscriptnode(hp).left.resulttype.def) then
+                    is_packed_record_or_object(tsubscriptnode(hp).left.resultdef) then
                    begin
                      if report_errors then
                        if (valid_property in opts) then
@@ -1123,7 +1123,7 @@ implementation
                  { a class/interface access is an implicit }
                  { dereferencing                           }
                  hp:=tsubscriptnode(hp).left;
-                 if is_class_or_interface(hp.resulttype.def) then
+                 if is_class_or_interface(hp.resultdef) then
                    gotderef:=true;
                end;
              muln,
@@ -1137,8 +1137,8 @@ implementation
                begin
                  { Allow operators on a pointer, or an integer
                    and a pointer typecast and deref has been found }
-                 if ((hp.resulttype.def.deftype=pointerdef) or
-                     (is_integer(hp.resulttype.def) and gotpointer)) and
+                 if ((hp.resultdef.deftype=pointerdef) or
+                     (is_integer(hp.resultdef) and gotpointer)) and
                     gotderef then
                   result:=true
                  else
@@ -1147,7 +1147,7 @@ implementation
                    if (m_delphi in aktmodeswitches) and
                       ((valid_addr in opts) or
                        (valid_const in opts)) and
-                      (hp.resulttype.def.deftype=stringdef) then
+                      (hp.resultdef.deftype=stringdef) then
                      result:=true
                  else
                   if report_errors then
@@ -1177,12 +1177,12 @@ implementation
              calln :
                begin
                  { check return type }
-                 case hp.resulttype.def.deftype of
+                 case hp.resultdef.deftype of
                    arraydef :
                      begin
                        { dynamic arrays are allowed when there is also a
                          vec node }
-                       if is_dynamic_array(hp.resulttype.def) and
+                       if is_dynamic_array(hp.resultdef) and
                           gotvec then
                         begin
                           gotderef:=true;
@@ -1192,7 +1192,7 @@ implementation
                    pointerdef :
                      gotpointer:=true;
                    objectdef :
-                     gotclass:=is_class_or_interface(hp.resulttype.def);
+                     gotclass:=is_class_or_interface(hp.resultdef);
                    recorddef, { handle record like class it needs a subscription }
                    classrefdef :
                      gotclass:=true;
@@ -1211,7 +1211,7 @@ implementation
                    delphi only }
                    if (m_delphi in aktmodeswitches) and
                       (valid_addr in opts) and
-                      (hp.resulttype.def.deftype=stringdef) then
+                      (hp.resultdef.deftype=stringdef) then
                      result:=true
                  else
                    if ([valid_const,valid_addr] * opts = [valid_const]) then
@@ -1338,7 +1338,7 @@ implementation
 
     function  valid_for_formal_const(p : tnode; report_errors: boolean) : boolean;
       begin
-        valid_for_formal_const:=(p.resulttype.def.deftype=formaldef) or
+        valid_for_formal_const:=(p.resultdef.deftype=formaldef) or
           valid_for_assign(p,[valid_void,valid_const],report_errors);
       end;
 
@@ -1385,10 +1385,10 @@ implementation
               if is_open_array(def_to) then
                 begin
                   if is_dynamic_array(def_from) and
-                     equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
+                     equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) then
                     eq:=te_convert_l2
                   else
-                    if equal_defs(def_from,tarraydef(def_to).elementtype.def) then
+                    if equal_defs(def_from,tarraydef(def_to).elementdef) then
                       eq:=te_convert_l2;
                 end;
             end;
@@ -1449,19 +1449,19 @@ implementation
               { to support ansi/long/wide strings in a proper way }
               { string and string[10] are assumed as equal }
               { when searching the correct overloaded procedure   }
-              if (p.resulttype.def.deftype=stringdef) and
-                 (tstringdef(def_to).string_typ=tstringdef(p.resulttype.def).string_typ) then
+              if (p.resultdef.deftype=stringdef) and
+                 (tstringdef(def_to).string_typ=tstringdef(p.resultdef).string_typ) then
                 eq:=te_equal
               else
               { Passing a constant char to ansistring or shortstring or
                 a widechar to widestring then handle it as equal. }
                if (p.left.nodetype=ordconstn) and
                   (
-                   is_char(p.resulttype.def) and
+                   is_char(p.resultdef) and
                    (is_shortstring(def_to) or is_ansistring(def_to))
                   ) or
                   (
-                   is_widechar(p.resulttype.def) and
+                   is_widechar(p.resultdef) and
                    is_widestring(def_to)
                   ) then
                 eq:=te_equal
@@ -1469,9 +1469,9 @@ implementation
           setdef :
             begin
               { set can also be a not yet converted array constructor }
-              if (p.resulttype.def.deftype=arraydef) and
-                 is_array_constructor(p.resulttype.def) and
-                 not is_variant_array(p.resulttype.def) then
+              if (p.resultdef.deftype=arraydef) and
+                 is_array_constructor(p.resultdef) and
+                 not is_variant_array(p.resultdef) then
                 eq:=te_equal;
             end;
           procvardef :
@@ -1686,7 +1686,7 @@ implementation
         FParalength:=0;
         while assigned(pt) do
          begin
-           if pt.resulttype.def.deftype=variantdef then
+           if pt.resultdef.deftype=variantdef then
              FAllowVariant:=true;
            inc(FParalength);
            pt:=tcallparanode(pt.right);
@@ -1812,7 +1812,7 @@ implementation
            begin
              if result<>'' then
               result:=','+result;
-             result:=p.resulttype.def.typename+result;
+             result:=p.resultdef.typename+result;
              p:=tcallparanode(p.right);
            end;
         end;
@@ -1845,7 +1845,7 @@ implementation
                begin
                  currpara:=tparavarsym(hp^.data.paras[i]);
                  if not(vo_is_hidden_para in currpara.varoptions) then
-                   Comment(lvl,'    - '+currpara.vartype.def.typename+' : '+EqualTypeName[currpara.eqval]);
+                   Comment(lvl,'    - '+currpara.vardef.typename+' : '+EqualTypeName[currpara.eqval]);
                end;
             end;
            hp:=hp^.next;
@@ -1897,8 +1897,8 @@ implementation
               releasecurrpt:=false;
               { retrieve current parameter definitions to compares }
               eq:=te_incompatible;
-              def_from:=currpt.resulttype.def;
-              def_to:=currpara.vartype.def;
+              def_from:=currpt.resultdef;
+              def_to:=currpara.vardef;
               if not(assigned(def_from)) then
                internalerror(200212091);
               if not(
@@ -1910,14 +1910,14 @@ implementation
 
               { Convert tp procvars when not expecting a procvar }
               if (def_to.deftype<>procvardef) and
-                 (currpt.left.resulttype.def.deftype=procvardef) then
+                 (currpt.left.resultdef.deftype=procvardef) then
                 begin
                   releasecurrpt:=true;
                   currpt:=tcallparanode(pt.getcopy);
                   if maybe_call_procvar(currpt.left,true) then
                     begin
-                      currpt.resulttype:=currpt.left.resulttype;
-                      def_from:=currpt.left.resulttype.def;
+                      currpt.resultdef:=currpt.left.resultdef;
+                      def_from:=currpt.left.resultdef;
                     end;
                 end;
 
@@ -1927,14 +1927,14 @@ implementation
                temporary returned the first procdef (PFV) }
              if (def_to.deftype=procvardef) and
                 (currpt.left.nodetype=loadn) and
-                (currpt.left.resulttype.def.deftype=procdef) then
+                (currpt.left.resultdef.deftype=procdef) then
                begin
                  pdtemp:=tprocsym(Tloadnode(currpt.left).symtableentry).search_procdef_byprocvardef(Tprocvardef(def_to));
                  if assigned(pdtemp) then
                    begin
                      tloadnode(currpt.left).setprocdef(pdtemp);
-                     currpt.resulttype:=currpt.left.resulttype;
-                     def_from:=currpt.left.resulttype.def;
+                     currpt.resultdef:=currpt.left.resultdef;
+                     def_from:=currpt.left.resultdef;
                    end;
                end;
 
@@ -2041,7 +2041,7 @@ implementation
                         eq:=te_incompatible;
                         { var_para_allowed will return te_equal and te_convert_l1 to
                           make a difference for best matching }
-                        var_para_allowed(eq,currpt.resulttype.def,currpara.vartype.def)
+                        var_para_allowed(eq,currpt.resultdef,currpara.vardef)
                       end
                     else
                       para_allowed(eq,currpt,def_to);
@@ -2276,18 +2276,18 @@ implementation
         if wrongpara.varspez in [vs_var,vs_out] then
           begin
             { Maybe passing the correct type but passing a const to var parameter }
-            if (compare_defs(pt.resulttype.def,wrongpara.vartype.def,pt.nodetype)<>te_incompatible) and
+            if (compare_defs(pt.resultdef,wrongpara.vardef,pt.nodetype)<>te_incompatible) and
                not valid_for_var(pt.left,true) then
               CGMessagePos(pt.left.fileinfo,type_e_variable_id_expected)
             else
               CGMessagePos3(pt.left.fileinfo,parser_e_call_by_ref_without_typeconv,tostr(hp^.wrongparanr),
-                FullTypeName(pt.left.resulttype.def,wrongpara.vartype.def),
-                FullTypeName(wrongpara.vartype.def,pt.left.resulttype.def))
+                FullTypeName(pt.left.resultdef,wrongpara.vardef),
+                FullTypeName(wrongpara.vardef,pt.left.resultdef))
           end
         else
           CGMessagePos3(pt.left.fileinfo,type_e_wrong_parameter_type,tostr(hp^.wrongparanr),
-            FullTypeName(pt.left.resulttype.def,wrongpara.vartype.def),
-            FullTypeName(wrongpara.vartype.def,pt.left.resulttype.def));
+            FullTypeName(pt.left.resultdef,wrongpara.vardef),
+            FullTypeName(wrongpara.vardef,pt.left.resultdef));
       end;
 
 
@@ -2312,12 +2312,12 @@ implementation
         if assigned(destdef) and
           (destdef.deftype in [enumdef,orddef,floatdef]) and
           not is_boolean(destdef) and
-          assigned(source.resulttype.def) and
-          (source.resulttype.def.deftype in [enumdef,orddef,floatdef]) and
-          not is_boolean(source.resulttype.def) and
+          assigned(source.resultdef) and
+          (source.resultdef.deftype in [enumdef,orddef,floatdef]) and
+          not is_boolean(source.resultdef) and
           not is_constrealnode(source) then
          begin
-           if (destdef.size < source.resulttype.def.size) then
+           if (destdef.size < source.resultdef.size) then
              begin
                if (cs_check_range in aktlocalswitches) then
                  MessagePos(location,type_w_smaller_possible_range_check)

+ 1 - 1
compiler/i386/aopt386.pas

@@ -74,7 +74,7 @@ Begin
         { Data flow analyzer }
          If (cs_opt_asmcse in aktoptimizerswitches) Then
            begin
-             if dfa.pass_2 then
+             if dfa.pass_generate_code then
               { common subexpression elimination }
                changed := CSE(asmL, blockStart, blockEnd, pass) or changed;
            end;

+ 1 - 1
compiler/i386/cgcpu.pas

@@ -309,7 +309,7 @@ unit cgcpu;
                 (not use_fixed_stack)  then
          begin
            { complex return values are removed from stack in C code PM }
-           if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,
+           if paramanager.ret_in_param(current_procinfo.procdef.returndef,
                                        current_procinfo.procdef.proccalloption) then
              list.concat(Taicpu.Op_const(A_RET,S_W,sizeof(aint)))
            else

+ 11 - 11
compiler/i386/cpupara.pas

@@ -319,17 +319,17 @@ unit cpupara;
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             exit;
           end;
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -337,7 +337,7 @@ unit cpupara;
           end
         else
          { Return in register? }
-         if not ret_in_param(p.rettype.def,p.proccalloption) then
+         if not ret_in_param(p.returndef,p.proccalloption) then
           begin
             if retcgsize in [OS_64,OS_S64] then
              begin
@@ -402,7 +402,7 @@ unit cpupara;
         for i:=0 to paras.count-1 do
           begin
             hp:=tparavarsym(paras[i]);
-            pushaddr:=push_addr_param(hp.varspez,hp.vartype.def,p.proccalloption);
+            pushaddr:=push_addr_param(hp.varspez,hp.vardef,p.proccalloption);
             if pushaddr then
               begin
                 paralen:=sizeof(aint);
@@ -410,7 +410,7 @@ unit cpupara;
               end
             else
               begin
-                paralen:=push_size(hp.varspez,hp.vartype.def,p.proccalloption);
+                paralen:=push_size(hp.varspez,hp.vardef,p.proccalloption);
                 { darwin/x86 requires that parameters < sizeof(aint) are sign/ }
                 { zero extended to sizeof(aint)                                }
                 if (target_info.system = system_i386_darwin) and
@@ -422,7 +422,7 @@ unit cpupara;
                     paracgsize:=OS_INT;
                   end
                 else
-                  paracgsize:=def_cgsize(hp.vartype.def);
+                  paracgsize:=def_cgsize(hp.vardef);
               end;
             hp.paraloc[side].reset;
             hp.paraloc[side].size:=paracgsize;
@@ -509,7 +509,7 @@ unit cpupara;
         for i:=0 to paras.count-1 do
           begin
             hp:=tparavarsym(paras[i]);
-            pushaddr:=push_addr_param(hp.varspez,hp.vartype.def,p.proccalloption);
+            pushaddr:=push_addr_param(hp.varspez,hp.vardef,p.proccalloption);
             if pushaddr then
               begin
                 paralen:=sizeof(aint);
@@ -517,8 +517,8 @@ unit cpupara;
               end
             else
               begin
-                paralen:=push_size(hp.varspez,hp.vartype.def,p.proccalloption);
-                paracgsize:=def_cgsize(hp.vartype.def);
+                paralen:=push_size(hp.varspez,hp.vardef,p.proccalloption);
+                paracgsize:=def_cgsize(hp.vardef);
               end;
             hp.paraloc[side].reset;
             hp.paraloc[side].size:=paracgsize;
@@ -537,7 +537,7 @@ unit cpupara;
             if (parareg<=high(parasupregs)) and
                (paralen<=sizeof(aint)) and
                (
-                not(hp.vartype.def.deftype in [floatdef,recorddef,arraydef]) or
+                not(hp.vardef.deftype in [floatdef,recorddef,arraydef]) or
                 pushaddr
                ) then
               begin

+ 10 - 10
compiler/i386/daopt386.pas

@@ -211,7 +211,7 @@ type
     constructor create(_list: TAsmList); virtual;
 
     function pass_1(_blockstart: tai): tai;
-    function pass_2: boolean;
+    function pass_generate_code: boolean;
     procedure clear;
 
     function getlabelwithsym(sym: tasmlabel): tai;
@@ -403,18 +403,18 @@ procedure RemoveLastDeallocForFuncRes(asml: TAsmList; p: tai);
   end;
 
 begin
-    case current_procinfo.procdef.rettype.def.deftype of
+    case current_procinfo.procdef.returndef.deftype of
       arraydef,recorddef,pointerdef,
          stringdef,enumdef,procdef,objectdef,errordef,
          filedef,setdef,procvardef,
          classrefdef,forwarddef:
         DoRemoveLastDeallocForFuncRes(asml,RS_EAX);
       orddef:
-        if current_procinfo.procdef.rettype.def.size <> 0 then
+        if current_procinfo.procdef.returndef.size <> 0 then
           begin
             DoRemoveLastDeallocForFuncRes(asml,RS_EAX);
             { for int64/qword }
-            if current_procinfo.procdef.rettype.def.size = 8 then
+            if current_procinfo.procdef.returndef.size = 8 then
               DoRemoveLastDeallocForFuncRes(asml,RS_EDX);
           end;
     end;
@@ -425,18 +425,18 @@ var
   regCounter: TSuperRegister;
 begin
   regs := [];
-  case current_procinfo.procdef.rettype.def.deftype of
+  case current_procinfo.procdef.returndef.deftype of
     arraydef,recorddef,pointerdef,
        stringdef,enumdef,procdef,objectdef,errordef,
        filedef,setdef,procvardef,
        classrefdef,forwarddef:
      regs := [RS_EAX];
     orddef:
-      if current_procinfo.procdef.rettype.def.size <> 0 then
+      if current_procinfo.procdef.returndef.size <> 0 then
         begin
           regs := [RS_EAX];
           { for int64/qword }
-          if current_procinfo.procdef.rettype.def.size = 8 then
+          if current_procinfo.procdef.returndef.size = 8 then
             regs := regs + [RS_EDX];
         end;
   end;
@@ -2772,15 +2772,15 @@ begin
 end;
 
 
-function tdfaobj.pass_2: boolean;
+function tdfaobj.pass_generate_code: boolean;
 begin
   if initdfapass2 then
     begin
       dodfapass2;
-      pass_2 := true
+      pass_generate_code := true
     end
   else
-    pass_2 := false;
+    pass_generate_code := false;
 end;
 
 {$ifopt r+}

+ 8 - 8
compiler/i386/n386add.pas

@@ -69,10 +69,10 @@ interface
         op2:=A_NONE;
         mboverflow:=false;
         opsize:=S_L;
-        unsigned:=((left.resulttype.def.deftype=orddef) and
-                   (torddef(left.resulttype.def).typ=u64bit)) or
-                  ((right.resulttype.def.deftype=orddef) and
-                   (torddef(right.resulttype.def).typ=u64bit));
+        unsigned:=((left.resultdef.deftype=orddef) and
+                   (torddef(left.resultdef).typ=u64bit)) or
+                  ((right.resultdef.deftype=orddef) and
+                   (torddef(right.resultdef).typ=u64bit));
         case nodetype of
           addn :
             begin
@@ -261,10 +261,10 @@ interface
 
         pass_left_right;
 
-        unsigned:=((left.resulttype.def.deftype=orddef) and
-                   (torddef(left.resulttype.def).typ=u64bit)) or
-                  ((right.resulttype.def.deftype=orddef) and
-                   (torddef(right.resulttype.def).typ=u64bit));
+        unsigned:=((left.resultdef.deftype=orddef) and
+                   (torddef(left.resultdef).typ=u64bit)) or
+                  ((right.resultdef.deftype=orddef) and
+                   (torddef(right.resultdef).typ=u64bit));
 
         { left and right no register?  }
         { then one must be demanded    }

+ 7 - 7
compiler/i386/n386mat.pas

@@ -30,7 +30,7 @@ interface
 
     type
       ti386moddivnode = class(tmoddivnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
       ti386shlshrnode = class(tcgshlshrnode)
@@ -72,7 +72,7 @@ implementation
       end;
 
 
-   procedure ti386moddivnode.pass_2;
+   procedure ti386moddivnode.pass_generate_code;
       var
         hreg1,hreg2:Tregister;
         power:longint;
@@ -89,7 +89,7 @@ implementation
         if codegenerror then
           exit;
 
-        if is_64bitint(resulttype.def) then
+        if is_64bitint(resultdef) then
           { should be handled in pass_1 (JM) }
           internalerror(200109052);
         { put numerator in register }
@@ -104,7 +104,7 @@ implementation
                 { for signed numbers, the numerator must be adjusted before the
                   shift instruction, but not wih unsigned numbers! Otherwise,
                   "Cardinal($ffffffff) div 16" overflows! (JM) }
-                if is_signed(left.resulttype.def) Then
+                if is_signed(left.resultdef) Then
                   begin
                     if (aktoptimizecputype <> cpu_386) and
                        not(cs_opt_size in aktoptimizerswitches) then
@@ -143,7 +143,7 @@ implementation
               end
             else
               begin
-                if is_signed(left.resulttype.def) then
+                if is_signed(left.resultdef) then
                   begin
                     e:=tordconstnode(right).value;
                     d:=abs(e);
@@ -318,13 +318,13 @@ implementation
             emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX);
             cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX);
             {Sign extension depends on the left type.}
-            if torddef(left.resulttype.def).typ=u32bit then
+            if torddef(left.resultdef).typ=u32bit then
               emit_reg_reg(A_XOR,S_L,NR_EDX,NR_EDX)
             else
               emit_none(A_CDQ,S_NO);
 
             {Division depends on the right type.}
-            if Torddef(right.resulttype.def).typ=u32bit then
+            if Torddef(right.resultdef).typ=u32bit then
               op:=A_DIV
             else
               op:=A_IDIV;

+ 10 - 10
compiler/i386/n386mem.pas

@@ -32,16 +32,16 @@ interface
 
     type
        ti386addrnode = class(tcgaddrnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        ti386derefnode = class(tcgderefnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        ti386vecnode = class(tcgvecnode)
           procedure update_reference_reg_mul(reg:tregister;l:aint);override;
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
 implementation
@@ -58,10 +58,10 @@ implementation
                              TI386ADDRNODE
 *****************************************************************************}
 
-    procedure ti386addrnode.pass_2;
+    procedure ti386addrnode.pass_generate_code;
 
       begin
-        inherited pass_2;
+        inherited pass_generate_code;
         { for use of other segments, not used }
         {if left.location.reference.segment<>NR_NO then
           location.segment:=left.location.reference.segment;}
@@ -72,10 +72,10 @@ implementation
                            TI386DEREFNODE
 *****************************************************************************}
 
-    procedure ti386derefnode.pass_2;
+    procedure ti386derefnode.pass_generate_code;
       begin
-         inherited pass_2;
-         if tpointerdef(left.resulttype.def).is_far then
+         inherited pass_generate_code;
+         if tpointerdef(left.resultdef).is_far then
            location.reference.segment:=NR_FS;
       end;
 
@@ -125,9 +125,9 @@ implementation
        end;
 
 
-    procedure ti386vecnode.pass_2;
+    procedure ti386vecnode.pass_generate_code;
       begin
-        inherited pass_2;
+        inherited pass_generate_code;
         if nf_memseg in flags then
           location.reference.segment:=NR_FS;
       end;

+ 2 - 2
compiler/i386/n386set.pas

@@ -137,7 +137,7 @@ implementation
              if assigned(t^.less) then
                genitem(t^.less);
              { need we to test the first value }
-             if first and (t^._low>get_min_value(left.resulttype.def)) then
+             if first and (t^._low>get_min_value(left.resultdef)) then
                begin
                  cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(t^._low),hregister,elselabel);
                end;
@@ -161,7 +161,7 @@ implementation
                   if first then
                     begin
                        { have we to ajust the first value ? }
-                       if (t^._low>get_min_value(left.resulttype.def)) then
+                       if (t^._low>get_min_value(left.resultdef)) then
                          cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low), hregister);
                     end
                   else

+ 1 - 1
compiler/m68k/cgcpu.pas

@@ -1053,7 +1053,7 @@ unit cgcpu;
          if current_procinfo.procdef.proccalloption in clearstack_pocalls then
            begin
              { complex return values are removed from stack in C code PM }
-             if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
+             if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption) then
                list.concat(taicpu.op_const(A_RTD,S_NO,4))
              else
                list.concat(taicpu.op_none(A_RTS,S_NO));

+ 7 - 7
compiler/m68k/cpupara.pas

@@ -188,7 +188,7 @@ unit cpupara;
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
 
@@ -202,13 +202,13 @@ unit cpupara;
          end;
 
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             exit;
           end;
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -216,7 +216,7 @@ unit cpupara;
           end
         else
          { Return in register? }
-         if not ret_in_param(p.rettype.def,p.proccalloption) then
+         if not ret_in_param(p.returndef,p.proccalloption) then
           begin
             if retcgsize in [OS_64,OS_S64] then
              begin
@@ -288,7 +288,7 @@ unit cpupara;
         for i:=0 to p.paras.count-1 do
           begin
             hp:=tparavarsym(paras[i]);
-	    paradef:=hp.vartype.def;
+	    paradef:=hp.vardef;
 	
 	    { syscall for AmigaOS can have already a paraloc set }
             if (vo_has_explicit_paraloc in hp.varoptions) then
@@ -316,7 +316,7 @@ unit cpupara;
                is_open_array(paradef) or
                is_array_of_const(paradef) then
               begin
-                paradef:=voidpointertype.def;
+                paradef:=voidpointertype;
                 loc:=LOC_REGISTER;
                 paracgsize := OS_ADDR;
                 paralen := tcgsize2size[OS_ADDR];
@@ -489,7 +489,7 @@ unit cpupara;
               p.paraloc[callerside].alignment:=4;
               paraloc:=p.paraloc[callerside].add_location;
               paraloc^.loc:=LOC_REGISTER;
-              paraloc^.size:=def_cgsize(p.vartype.def);
+              paraloc^.size:=def_cgsize(p.vardef);
               { pattern is always uppercase'd }
               if s='D0' then
                 paraloc^.register:=NR_D0

+ 9 - 9
compiler/m68k/n68kadd.pas

@@ -146,7 +146,7 @@ implementation
         // initialize de result
         if not cmpop then
           begin
-            location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+            location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
             if left.location.loc = LOC_FPUREGISTER then
               location.register := left.location.register
             else if right.location.loc = LOC_FPUREGISTER then
@@ -197,11 +197,11 @@ implementation
         if nodetype in [equaln,unequaln] then
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF,
              left.location.register,right.location.register),
-             cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
+             cgsize2fpuoppostfix[def_cgsize(resultdef)]))
         else
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE,
              left.location.register,right.location.register),
-             cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
+             cgsize2fpuoppostfix[def_cgsize(resultdef)]));
 
         location_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(false);
@@ -288,8 +288,8 @@ implementation
        force_reg_left_right(true, false);
 
        { determine if the comparison will be unsigned }
-       unsigned:=not(is_signed(left.resulttype.def)) or
-                   not(is_signed(right.resulttype.def));
+       unsigned:=not(is_signed(left.resultdef)) or
+                   not(is_signed(right.resultdef));
 
         // get the constant on the right if there is one
         if (left.location.loc = LOC_CONSTANT) then
@@ -358,12 +358,12 @@ implementation
         otl,ofl : tasmlabel;
       begin
 //        writeln('second_cmpboolean');
-        if (torddef(left.resulttype.def).typ=bool8bit) or
-           (torddef(right.resulttype.def).typ=bool8bit) then
+        if (torddef(left.resultdef).typ=bool8bit) or
+           (torddef(right.resultdef).typ=bool8bit) then
          cgsize:=OS_8
         else
-          if (torddef(left.resulttype.def).typ=bool16bit) or
-             (torddef(right.resulttype.def).typ=bool16bit) then
+          if (torddef(left.resultdef).typ=bool16bit) or
+             (torddef(right.resultdef).typ=bool16bit) then
            cgsize:=OS_16
         else
            cgsize:=OS_32;

+ 12 - 12
compiler/m68k/n68kcnv.pas

@@ -34,7 +34,7 @@ interface
           function first_int_to_real: tnode; override;
           procedure second_int_to_real;override;
           procedure second_int_to_bool;override;
-//          procedure pass_2;override;
+//          procedure pass_generate_code;override;
        end;
 
 implementation
@@ -68,9 +68,9 @@ implementation
           end
         else
         { converting a 64bit integer to a float requires a helper }
-        if is_64bitint(left.resulttype.def) then
+        if is_64bitint(left.resultdef) then
           begin
-            if is_signed(left.resulttype.def) then
+            if is_signed(left.resultdef) then
               fname := 'fpc_int64_to_double'
             else
               fname := 'fpc_qword_to_double';
@@ -83,7 +83,7 @@ implementation
         else
           { other integers are supposed to be 32 bit }
           begin
-            if is_signed(left.resulttype.def) then
+            if is_signed(left.resultdef) then
               inserttypeconv(left,s32inttype)
             else
               { the fpu always considers 32-bit values as signed
@@ -124,11 +124,11 @@ implementation
         opsize : tcgsize;
       begin
         scratch_used := false;
-        location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
-        signed := is_signed(left.resulttype.def);
-        opsize := def_cgsize(left.resulttype.def);
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
+        signed := is_signed(left.resultdef);
+        opsize := def_cgsize(left.resultdef);
         { has to be handled by a helper }
-        if is_64bitint(left.resulttype.def) then
+        if is_64bitint(left.resultdef) then
           internalerror(200110011);
         { has to be handled by a helper }
         if not signed then
@@ -164,14 +164,14 @@ implementation
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { be accepted for var parameters                            }
          if (nf_explicit in flags) and
-            (left.resulttype.def.size=resulttype.def.size) and
+            (left.resultdef.size=resultdef.size) and
             (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
            begin
               location_copy(location,left.location);
               exit;
            end;
-         location_reset(location,LOC_REGISTER,def_cgsize(left.resulttype.def));
-         opsize := def_cgsize(left.resulttype.def);
+         location_reset(location,LOC_REGISTER,def_cgsize(left.resultdef));
+         opsize := def_cgsize(left.resultdef);
          case left.location.loc of
             LOC_CREFERENCE,LOC_REFERENCE :
               begin
@@ -214,7 +214,7 @@ implementation
       end;
 
 {
-    procedure tm68ktypeconvnode.pass_2;
+    procedure tm68ktypeconvnode.pass_generate_code;
 {$ifdef TESTOBJEXT2}
       var
          r : preference;

+ 12 - 12
compiler/m68k/n68kmat.pas

@@ -32,7 +32,7 @@ interface
 
 
       tm68knotnode = class(tnotnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
       tm68kmoddivnode = class(tcgmoddivnode)
@@ -41,7 +41,7 @@ interface
       end;
 
       tm68kshlshrnode = class(tshlshrnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
          { everything will be handled in pass_2 }
          function first_shlshr64bitint: tnode; override;
       end;
@@ -65,13 +65,13 @@ implementation
                                TM68KNOTNODE
 *****************************************************************************}
 
-    procedure tm68knotnode.pass_2;
+    procedure tm68knotnode.pass_generate_code;
       var
          hl : tasmlabel;
          opsize : tcgsize;
       begin
-         opsize:=def_cgsize(resulttype.def);
-         if is_boolean(resulttype.def) then
+         opsize:=def_cgsize(resultdef);
+         if is_boolean(resultdef) then
           begin
             { the second pass could change the location of left }
             { if it is a register variable, so we've to do      }
@@ -104,7 +104,7 @@ implementation
               LOC_REFERENCE,
               LOC_CREFERENCE :
                 begin
-                  location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(resulttype.def),true);
+                  location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(resultdef),true);
                   current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,tcgsize2opsize[opsize],left.location.register));
 //                  location_release(current_asmdata.CurrAsmList,left.location);
                   location_reset(location,LOC_FLAGS,OS_NO);
@@ -114,7 +114,7 @@ implementation
                 internalerror(200203224);
             end;
           end
-         else if is_64bitint(left.resulttype.def) then
+         else if is_64bitint(left.resultdef) then
            begin
               secondpass(left);
               location_copy(location,left.location);
@@ -125,7 +125,7 @@ implementation
          else
           begin
              secondpass(left);
-             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false);
+             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false);
              location_copy(location,left.location);
              if location.loc=LOC_CREGISTER then
               location.register := cg.getintregister(current_asmdata.CurrAsmList,opsize);
@@ -261,7 +261,7 @@ implementation
 
 
 {$WARNING FIX ME!!! shlshrnode needs review}
-    procedure tm68kshlshrnode.pass_2;
+    procedure tm68kshlshrnode.pass_generate_code;
       var
         hregister,resultreg,hregister1,
         hreg64hi,hreg64lo : tregister;
@@ -270,7 +270,7 @@ implementation
       begin
         secondpass(left);
         secondpass(right);
-        if is_64bit(left.resulttype.def) then
+        if is_64bit(left.resultdef) then
           begin
             location_reset(location,LOC_REGISTER,OS_64);
 
@@ -321,7 +321,7 @@ implementation
         else
           begin
             { load left operators in a register }
-            location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true);
+            location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
             location_copy(location,left.location);
             resultreg := location.register;
             hregister1 := location.register;
@@ -345,7 +345,7 @@ implementation
             else
               begin
                 { load shift count in a register if necessary }
-                location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true);
+                location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resultdef),true);
                 cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,OS_32,right.location.register,hregister1,resultreg);
               end;
           end;

+ 1 - 1
compiler/m68k/ra68kmot.pas

@@ -710,7 +710,7 @@ const
                                end;
                              typesym :
                                begin
-                                 if not(ttypesym(sym).restype.def.deftype in [recorddef,objectdef]) then
+                                 if not(ttypesym(sym).typedef.deftype in [recorddef,objectdef]) then
                                       Message(asmr_e_wrong_sym_type);
                                end;
                              else

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 187 - 187
compiler/nadd.pas


+ 70 - 69
compiler/nbas.pas

@@ -36,14 +36,14 @@ interface
        tnothingnode = class(tnode)
           constructor create;virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        end;
        tnothingnodeclass = class of tnothingnode;
 
        terrornode = class(tnode)
           constructor create;virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           procedure mark_write;override;
        end;
        terrornodeclass = class of terrornode;
@@ -61,9 +61,9 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
        tasmnodeclass = class of tasmnode;
@@ -71,7 +71,7 @@ interface
        tstatementnode = class(tbinarynode)
           constructor create(l,r : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           procedure printnodetree(var t:text);override;
        end;
        tstatementnodeclass = class of tstatementnode;
@@ -80,7 +80,7 @@ interface
           constructor create(l : tnode);virtual;
           destructor destroy; override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
 {$ifdef state_tracking}
           function track_state_pass(exec_known:boolean):boolean;override;
 {$endif state_tracking}
@@ -97,7 +97,8 @@ interface
          { set to the copy of a tempcreate pnode (if it gets copied) so that the }
          { refs and deletenode can hook to this copy once they get copied too    }
          hookoncopy                 : ptempinfo;
-         restype                    : ttype;
+         typedef                    : tdef;
+         typedefderef               : tderef;
          temptype                   : ttemptype;
          owner                      : ttempcreatenode;
          may_be_in_reg              : boolean;
@@ -118,14 +119,14 @@ interface
           { where the node that receives the temp becomes responsible for       }
           { freeing it. In this last case, you must use only one reference      }
           { to it and *not* generate a ttempdeletenode                          }
-          constructor create(const _restype: ttype; _size: aint; _temptype: ttemptype;allowreg:boolean); virtual;
+          constructor create(_typedef: tdef; _size: aint; _temptype: ttemptype;allowreg:boolean); virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy: tnode; override;
+          function dogetcopy: tnode; override;
           function pass_1 : tnode; override;
-          function det_resulttype: tnode; override;
+          function pass_typecheck: tnode; override;
           function docompare(p: tnode): boolean; override;
           procedure printnodedata(var t:text);override;
         end;
@@ -139,10 +140,10 @@ interface
           constructor create_offset(const temp: ttempcreatenode;aoffset:longint);
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function _getcopy: tnode; override;
+          function dogetcopy: tnode; override;
           procedure derefnode;override;
           function pass_1 : tnode; override;
-          function det_resulttype : tnode; override;
+          function pass_typecheck : tnode; override;
           procedure mark_write;override;
           function docompare(p: tnode): boolean; override;
           procedure printnodedata(var t:text);override;
@@ -162,10 +163,10 @@ interface
           constructor create_normal_temp(const temp: ttempcreatenode);
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function _getcopy: tnode; override;
+          function dogetcopy: tnode; override;
           procedure derefnode;override;
           function pass_1: tnode; override;
-          function det_resulttype: tnode; override;
+          function pass_typecheck: tnode; override;
           function docompare(p: tnode): boolean; override;
           destructor destroy; override;
           procedure printnodedata(var t:text);override;
@@ -244,10 +245,10 @@ implementation
       end;
 
 
-    function tnothingnode.det_resulttype:tnode;
+    function tnothingnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
       end;
 
 
@@ -269,12 +270,12 @@ implementation
       end;
 
 
-    function terrornode.det_resulttype:tnode;
+    function terrornode.pass_typecheck:tnode;
       begin
          result:=nil;
          include(flags,nf_error);
          codegenerror:=true;
-         resulttype:=generrortype;
+         resultdef:=generrordef;
       end;
 
 
@@ -300,28 +301,28 @@ implementation
          inherited create(statementn,l,r);
       end;
 
-    function tstatementnode.det_resulttype:tnode;
+    function tstatementnode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
 
          { left is the statement itself calln assignn or a complex one }
-         resulttypepass(left);
+         typecheckpass(left);
          if (not (cs_extsyntax in aktmoduleswitches)) and
-            assigned(left.resulttype.def) and
+            assigned(left.resultdef) and
             not((left.nodetype=calln) and
                 { don't complain when funcretrefnode is set, because then the
                   value is already used. And also not for constructors }
                 (assigned(tcallnode(left).funcretnode) or
                  (tcallnode(left).procdefinition.proctypeoption=potype_constructor))) and
-            not(is_void(left.resulttype.def)) then
+            not(is_void(left.resultdef)) then
            CGMessage(parser_e_illegal_expression);
          if codegenerror then
            exit;
 
          { right is the next statement in the list }
          if assigned(right) then
-           resulttypepass(right);
+           typecheckpass(right);
          if codegenerror then
            exit;
       end;
@@ -380,12 +381,12 @@ implementation
         inherited destroy;
       end;
 
-    function tblocknode.det_resulttype:tnode;
+    function tblocknode.pass_typecheck:tnode;
       var
          hp : tstatementnode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
 
          hp:=tstatementnode(left);
          while assigned(hp) do
@@ -393,21 +394,21 @@ implementation
               if assigned(hp.left) then
                 begin
                    codegenerror:=false;
-                   resulttypepass(hp.left);
+                   typecheckpass(hp.left);
                    if not(codegenerror) and
                       not(cs_extsyntax in aktmoduleswitches) and
                       (hp.left.nodetype=calln) and
-                      not(is_void(hp.left.resulttype.def)) and
+                      not(is_void(hp.left.resultdef)) and
                       not(cnf_return_value_used in tcallnode(hp.left).callnodeflags) and
                       not((tcallnode(hp.left).procdefinition.proctypeoption=potype_constructor) and
                           assigned(tprocdef(tcallnode(hp.left).procdefinition)._class) and
                           is_object(tprocdef(tcallnode(hp.left).procdefinition)._class)) then
                      CGMessagePos(hp.left.fileinfo,parser_e_illegal_expression);
-                   { the resulttype of the block is the last type that is
+                   { the resultdef of the block is the last type that is
                      returned. Normally this is a voidtype. But when the
                      compiler inserts a block of multiple statements then the
                      last entry can return a value }
-                   resulttype:=hp.left.resulttype;
+                   resultdef:=hp.left.resultdef;
                 end;
               hp:=tstatementnode(hp.right);
            end;
@@ -577,11 +578,11 @@ implementation
       end;
 
 
-    function tasmnode._getcopy: tnode;
+    function tasmnode.dogetcopy: tnode;
       var
         n: tasmnode;
       begin
-        n := tasmnode(inherited _getcopy);
+        n := tasmnode(inherited dogetcopy);
         if assigned(p_asm) then
           begin
             n.p_asm:=TAsmList.create;
@@ -593,10 +594,10 @@ implementation
       end;
 
 
-    function tasmnode.det_resulttype:tnode;
+    function tasmnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
         if not(nf_get_asm_position in flags) then
           include(current_procinfo.flags,pi_has_assembler_block);
       end;
@@ -620,40 +621,40 @@ implementation
                           TEMPCREATENODE
 *****************************************************************************}
 
-    constructor ttempcreatenode.create(const _restype: ttype; _size: aint; _temptype: ttemptype;allowreg:boolean);
+    constructor ttempcreatenode.create(_typedef:tdef; _size: aint; _temptype: ttemptype;allowreg:boolean);
       begin
         inherited create(tempcreaten);
         size := _size;
         new(tempinfo);
         fillchar(tempinfo^,sizeof(tempinfo^),0);
-        tempinfo^.restype := _restype;
+        tempinfo^.typedef := _typedef;
         tempinfo^.temptype := _temptype;
         tempinfo^.owner:=self;
         tempinfo^.may_be_in_reg:=
           allowreg and
           { temp must fit a single register }
-          (tstoreddef(_restype.def).is_fpuregable or
-           (tstoreddef(_restype.def).is_intregable and
+          (tstoreddef(_typedef).is_fpuregable or
+           (tstoreddef(_typedef).is_intregable and
             (_size<=TCGSize2Size[OS_64]))) and
           { size of register operations must be known }
-          (def_cgsize(_restype.def)<>OS_NO) and
+          (def_cgsize(_typedef)<>OS_NO) and
           { no init/final needed }
-          not (_restype.def.needs_inittable) and
-          ((_restype.def.deftype <> pointerdef) or
-           (not tpointerdef(_restype.def).pointertype.def.needs_inittable));
+          not (_typedef.needs_inittable) and
+          ((_typedef.deftype <> pointerdef) or
+           (not tpointerdef(_typedef).pointeddef.needs_inittable));
       end;
 
-    function ttempcreatenode._getcopy: tnode;
+    function ttempcreatenode.dogetcopy: tnode;
       var
         n: ttempcreatenode;
       begin
-        n := ttempcreatenode(inherited _getcopy);
+        n := ttempcreatenode(inherited dogetcopy);
         n.size := size;
 
         new(n.tempinfo);
         fillchar(n.tempinfo^,sizeof(n.tempinfo^),0);
         n.tempinfo^.owner:=n;
-        n.tempinfo^.restype := tempinfo^.restype;
+        n.tempinfo^.typedef := tempinfo^.typedef;
         n.tempinfo^.temptype := tempinfo^.temptype;
 
         { when the tempinfo has already a hookoncopy then it is not
@@ -679,7 +680,7 @@ implementation
         new(tempinfo);
         fillchar(tempinfo^,sizeof(tempinfo^),0);
         tempinfo^.may_be_in_reg:=boolean(ppufile.getbyte);
-        ppufile.gettype(tempinfo^.restype);
+        ppufile.getderef(tempinfo^.typedefderef);
         tempinfo^.temptype := ttemptype(ppufile.getbyte);
         tempinfo^.owner:=self;
       end;
@@ -690,20 +691,20 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putlongint(size);
         ppufile.putbyte(byte(tempinfo^.may_be_in_reg));
-        ppufile.puttype(tempinfo^.restype);
+        ppufile.putderef(tempinfo^.typedefderef);
         ppufile.putbyte(byte(tempinfo^.temptype));
       end;
 
 
     procedure ttempcreatenode.buildderefimpl;
       begin
-        tempinfo^.restype.buildderef;
+        tempinfo^.typedefderef.build(tempinfo^.typedef);
       end;
 
 
     procedure ttempcreatenode.derefimpl;
       begin
-        tempinfo^.restype.resolve;
+        tempinfo^.typedef:=tdef(tempinfo^.typedefderef.resolve);
       end;
 
 
@@ -711,16 +712,16 @@ implementation
       begin
          result := nil;
          expectloc:=LOC_VOID;
-         if (tempinfo^.restype.def.needs_inittable) then
+         if (tempinfo^.typedef.needs_inittable) then
            include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
 
 
-    function ttempcreatenode.det_resulttype: tnode;
+    function ttempcreatenode.pass_typecheck: tnode;
       begin
         result := nil;
-        { a tempcreatenode doesn't have a resulttype, only temprefnodes do }
-        resulttype := voidtype;
+        { a tempcreatenode doesn't have a resultdef, only temprefnodes do }
+        resultdef := voidtype;
       end;
 
 
@@ -730,14 +731,14 @@ implementation
           inherited docompare(p) and
           (ttempcreatenode(p).size = size) and
           (ttempcreatenode(p).tempinfo^.may_be_in_reg = tempinfo^.may_be_in_reg) and
-          equal_defs(ttempcreatenode(p).tempinfo^.restype.def,tempinfo^.restype.def);
+          equal_defs(ttempcreatenode(p).tempinfo^.typedef,tempinfo^.typedef);
       end;
 
 
     procedure ttempcreatenode.printnodedata(var t:text);
       begin
         inherited printnodedata(t);
-        writeln(t,printnodeindention,'size = ',size,', temprestype = "',tempinfo^.restype.def.gettypename,'", tempinfo = $',hexstr(ptruint(tempinfo),sizeof(ptruint)*2));
+        writeln(t,printnodeindention,'size = ',size,', temptypedef = "',tempinfo^.typedef.GetTypeName,'", tempinfo = $',hexstr(ptruint(tempinfo),sizeof(ptruint)*2));
       end;
 
 
@@ -760,11 +761,11 @@ implementation
       end;
 
 
-    function ttemprefnode._getcopy: tnode;
+    function ttemprefnode.dogetcopy: tnode;
       var
         n: ttemprefnode;
       begin
-        n := ttemprefnode(inherited _getcopy);
+        n := ttemprefnode(inherited dogetcopy);
         n.offset := offset;
 
         if assigned(tempinfo^.hookoncopy) then
@@ -824,10 +825,10 @@ implementation
     function ttemprefnode.pass_1 : tnode;
       begin
         expectloc := LOC_REFERENCE;
-        if not tempinfo^.restype.def.needs_inittable and
+        if not tempinfo^.typedef.needs_inittable and
            tempinfo^.may_be_in_reg then
           begin
-            if tempinfo^.restype.def.deftype=floatdef then
+            if tempinfo^.typedef.deftype=floatdef then
               begin
                 if (tempinfo^.temptype = tt_persistent) then
                   expectloc := LOC_CFPUREGISTER
@@ -845,13 +846,13 @@ implementation
         result := nil;
       end;
 
-    function ttemprefnode.det_resulttype: tnode;
+    function ttemprefnode.pass_typecheck: tnode;
       begin
-        { check if the temp is already resulttype passed }
-        if not assigned(tempinfo^.restype.def) then
+        { check if the temp is already resultdef passed }
+        if not assigned(tempinfo^.typedef) then
           internalerror(200108233);
         result := nil;
-        resulttype := tempinfo^.restype;
+        resultdef := tempinfo^.typedef;
       end;
 
     function ttemprefnode.docompare(p: tnode): boolean;
@@ -871,7 +872,7 @@ implementation
     procedure ttemprefnode.printnodedata(var t:text);
       begin
         inherited printnodedata(t);
-        writeln(t,printnodeindention,'temprestype = "',tempinfo^.restype.def.gettypename,'", tempinfo = $',hexstr(ptruint(tempinfo),sizeof(ptruint)*2));
+        writeln(t,printnodeindention,'temptypedef = "',tempinfo^.typedef.GetTypeName,'", tempinfo = $',hexstr(ptruint(tempinfo),sizeof(ptruint)*2));
       end;
 
 
@@ -897,11 +898,11 @@ implementation
       end;
 
 
-    function ttempdeletenode._getcopy: tnode;
+    function ttempdeletenode.dogetcopy: tnode;
       var
         n: ttempdeletenode;
       begin
-        n := ttempdeletenode(inherited _getcopy);
+        n := ttempdeletenode(inherited dogetcopy);
         n.release_to_normal := release_to_normal;
 
         if assigned(tempinfo^.hookoncopy) then
@@ -959,10 +960,10 @@ implementation
          result := nil;
       end;
 
-    function ttempdeletenode.det_resulttype: tnode;
+    function ttempdeletenode.pass_typecheck: tnode;
       begin
         result := nil;
-        resulttype := voidtype;
+        resultdef := voidtype;
       end;
 
     function ttempdeletenode.docompare(p: tnode): boolean;
@@ -980,7 +981,7 @@ implementation
     procedure ttempdeletenode.printnodedata(var t:text);
       begin
         inherited printnodedata(t);
-        writeln(t,printnodeindention,'release_to_normal: ',release_to_normal,', temprestype = "',tempinfo^.restype.def.gettypename,'", tempinfo = $',hexstr(ptruint(tempinfo),sizeof(ptruint)*2));
+        writeln(t,printnodeindention,'release_to_normal: ',release_to_normal,', temptypedef = "',tempinfo^.typedef.GetTypeName,'", tempinfo = $',hexstr(ptruint(tempinfo),sizeof(ptruint)*2));
       end;
 
 begin

+ 160 - 160
compiler/ncal.pas

@@ -37,7 +37,7 @@ interface
 
     type
        tcallnodeflag = (
-         cnf_restypeset,
+         cnf_typedefset,
          cnf_return_value_used,
          cnf_inherited,
          cnf_anon_inherited,
@@ -92,10 +92,10 @@ interface
           { that return their result in a parameter                      }
           property funcretnode: tnode read _funcretnode write setfuncretnode;
 
-          { separately specified resulttype for some compilerprocs (e.g. }
-          { you can't have a function with an "array of char" resulttype }
+          { separately specified resultdef for some compilerprocs (e.g. }
+          { you can't have a function with an "array of char" resultdef }
           { the RTL) (JM)                                                }
-          restype: ttype;
+          typedef: tdef;
           callnodeflags : tcallnodeflags;
 
           { only the processor specific nodes need to override this }
@@ -103,14 +103,14 @@ interface
           constructor create(l:tnode; v : tprocsym;st : tsymtable; mp: tnode; callflags:tcallnodeflags);virtual;
           constructor create_procvar(l,r:tnode);
           constructor createintern(const name: string; params: tnode);
-          constructor createinternres(const name: string; params: tnode; const res: ttype);
+          constructor createinternres(const name: string; params: tnode; res:tdef);
           constructor createinternreturn(const name: string; params: tnode; returnnode : tnode);
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function  _getcopy : tnode;override;
+          function  dogetcopy : tnode;override;
           { Goes through all symbols in a class and subclasses and calls
             verify abstract for each .
           }
@@ -121,7 +121,7 @@ interface
           procedure verifyabstract(p : tnamedindexitem;arg:pointer);
           procedure insertintolist(l : tnodelist);override;
           function  pass_1 : tnode;override;
-          function  det_resulttype:tnode;override;
+          function  pass_typecheck:tnode;override;
        {$ifdef state_tracking}
           function track_state_pass(exec_known:boolean):boolean;override;
        {$endif state_tracking}
@@ -154,7 +154,7 @@ interface
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           procedure insertintolist(l : tnodelist);override;
           procedure get_paratype;
           procedure insert_typeconv(do_count : boolean);
@@ -229,7 +229,7 @@ type
         hp,
         loadp,
         refp  : tnode;
-        htype : ttype;
+        hdef : tdef;
         ptemp : ttempcreatenode;
         usederef : boolean;
         usevoidpointer : boolean;
@@ -261,26 +261,26 @@ type
                 newdonestatement:=laststatement(aktcallnode.methodpointerdone);
               end;
             { temp create }
-            usederef:=(p.resulttype.def.deftype in [arraydef,recorddef]) or
-                      is_shortstring(p.resulttype.def) or
-                      is_object(p.resulttype.def);
+            usederef:=(p.resultdef.deftype in [arraydef,recorddef]) or
+                      is_shortstring(p.resultdef) or
+                      is_object(p.resultdef);
             { avoid refcount increase }
-            usevoidpointer:=is_interface(p.resulttype.def);
+            usevoidpointer:=is_interface(p.resultdef);
 
             if usederef then
-              htype.setdef(tpointerdef.create(p.resulttype))
+              hdef:=tpointerdef.create(p.resultdef)
             else
-              htype:=p.resulttype;
+              hdef:=p.resultdef;
 
             if usevoidpointer then
               begin
-                ptemp:=ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent,true);
+                ptemp:=ctempcreatenode.create(voidpointertype,voidpointertype.size,tt_persistent,true);
                 loadp := ctypeconvnode.create_internal(p,voidpointertype);
-                refp:=ctypeconvnode.create_internal(ctemprefnode.create(ptemp),htype);
+                refp:=ctypeconvnode.create_internal(ctemprefnode.create(ptemp),hdef);
               end
             else
               begin
-                ptemp:=ctempcreatenode.create(htype,htype.def.size,tt_persistent,true);
+                ptemp:=ctempcreatenode.create(hdef,hdef.size,tt_persistent,true);
                 if usederef then
                   begin
                     loadp:=caddrnode.create_internal(p);
@@ -310,13 +310,13 @@ type
             addstatement(newdonestatement,ctempdeletenode.create_normal_temp(ptemp));
             if usevoidpointer then
               addstatement(newdonestatement,ctypeconvnode.create_internal(
-                ctemprefnode.create(ptemp),htype))
+                ctemprefnode.create(ptemp),hdef))
             else
               addstatement(newdonestatement,ctemprefnode.create(ptemp));
-            { call resulttypepass for new nodes }
-            resulttypepass(p);
-            resulttypepass(aktcallnode.methodpointerinit);
-            resulttypepass(aktcallnode.methodpointerdone);
+            { call typecheckpass for new nodes }
+            typecheckpass(p);
+            typecheckpass(aktcallnode.methodpointerinit);
+            typecheckpass(aktcallnode.methodpointerdone);
           end;
       end;
 
@@ -336,7 +336,7 @@ type
         len:=-1;
         loadconst:=true;
         hightree:=nil;
-        case p.resulttype.def.deftype of
+        case p.resultdef.deftype of
           arraydef :
             begin
               if (paradef.deftype<>arraydef) then
@@ -350,7 +350,7 @@ type
                 end
               else
               { handle special case of passing an single array to an array of array }
-              if compare_defs(tarraydef(paradef).elementtype.def,p.resulttype.def,nothingn)>=te_equal then
+              if compare_defs(tarraydef(paradef).elementdef,p.resultdef,nothingn)>=te_equal then
                 len:=0
               else
                 begin
@@ -371,7 +371,7 @@ type
                         Tcallparanode(tinlinenode(temp).left).left:=nil;
                         temp.free;
 
-                        resulttypepass(hightree);
+                        typecheckpass(hightree);
                       end
                   else if (p.nodetype=vecn) and (Tvecnode(p).right.nodetype=rangen) then
                     begin
@@ -383,7 +383,7 @@ type
                         end;
                       {In the procedure the array range is 0..(upper_bound-lower_bound).}
                       hightree:=caddnode.create(subn,r,l);
-                      resulttypepass(gen_high_tree);
+                      typecheckpass(gen_high_tree);
 
                       {Replace the rangnode in the tree by its lower_bound, and
                        dispose the rangenode.}
@@ -395,18 +395,18 @@ type
                           right:=nil;
                         end;
                       temp.free;
-                      {Tree changed from p[l..h] to p[l], recalculate resulttype.}
-                      p.resulttype.def:=nil;
-                      resulttypepass(p);
+                      {Tree changed from p[l..h] to p[l], recalculate resultdef.}
+                      p.resultdef:=nil;
+                      typecheckpass(p);
                     end
                   else
                     begin
                       maybe_load_para_in_temp(p);
                       hightree:=geninlinenode(in_high_x,false,p.getcopy);
-                      resulttypepass(hightree);
+                      typecheckpass(hightree);
                       { only substract low(array) if it's <> 0 }
                       temp:=geninlinenode(in_low_x,false,p.getcopy);
-                      resulttypepass(temp);
+                      typecheckpass(temp);
                       if (temp.nodetype <> ordconstn) or
                          (tordconstnode(temp).value <> 0) then
                         hightree := caddnode.create(subn,hightree,temp)
@@ -508,13 +508,13 @@ type
       end;
 
 
-    function tcallparanode._getcopy : tnode;
+    function tcallparanode.dogetcopy : tnode;
 
       var
          n : tcallparanode;
 
       begin
-         n:=tcallparanode(inherited _getcopy);
+         n:=tcallparanode(inherited dogetcopy);
          n.callparaflags:=callparaflags;
          n.parasym:=parasym;
          result:=n;
@@ -535,19 +535,19 @@ type
           tcallparanode(right).get_paratype;
          old_array_constructor:=allow_array_constructor;
          allow_array_constructor:=true;
-         resulttypepass(left);
+         typecheckpass(left);
          allow_array_constructor:=old_array_constructor;
          if codegenerror then
-          resulttype:=generrortype
+          resultdef:=generrordef
          else
-          resulttype:=left.resulttype;
+          resultdef:=left.resultdef;
          dec(parsing_para_level);
       end;
 
 
     procedure tcallparanode.insert_typeconv(do_count : boolean);
       var
-        oldtype  : ttype;
+        olddef  : tdef;
         hp       : tnode;
 {$ifdef extdebug}
         store_count_ref : boolean;
@@ -562,28 +562,28 @@ type
              count_ref:=true;
            end;
 {$endif def extdebug}
-         { Be sure to have the resulttype }
-         if not assigned(left.resulttype.def) then
-           resulttypepass(left);
+         { Be sure to have the resultdef }
+         if not assigned(left.resultdef) then
+           typecheckpass(left);
 
          if (left.nodetype<>nothingn) then
            begin
              { Convert tp procvars, this is needs to be done
                here to make the change permanent. in the overload
                choosing the changes are only made temporary }
-             if (left.resulttype.def.deftype=procvardef) and
-                (parasym.vartype.def.deftype<>procvardef) then
+             if (left.resultdef.deftype=procvardef) and
+                (parasym.vardef.deftype<>procvardef) then
                begin
                  if maybe_call_procvar(left,true) then
-                   resulttype:=left.resulttype;
+                   resultdef:=left.resultdef;
                end;
 
              { Remove implicitly inserted typecast to pointer for
                @procvar in macpas }
              if (m_mac_procvar in aktmodeswitches) and
-                (parasym.vartype.def.deftype=procvardef) and
+                (parasym.vardef.deftype=procvardef) and
                 (left.nodetype=typeconvn) and
-                is_voidpointer(left.resulttype.def) and
+                is_voidpointer(left.resultdef) and
                 (ttypeconvnode(left).left.nodetype=typeconvn) and
                 (ttypeconvnode(ttypeconvnode(left).left).convtype=tc_proc_2_procvar) then
                begin
@@ -594,7 +594,7 @@ type
                end;
 
              { Handle varargs and hidden paras directly, no typeconvs or }
-             { typechecking needed                                       }
+             { pass_typechecking needed                                       }
              if (cpf_varargs_para in callparaflags) then
                begin
                  { this should only happen vor C varargs                    }
@@ -602,16 +602,16 @@ type
                  { tarrayconstructornode.insert_typeconvs                   }
                  set_varstate(left,vs_read,[vsf_must_be_valid]);
                  insert_varargstypeconv(left,true);
-                 resulttype:=left.resulttype;
+                 resultdef:=left.resultdef;
                  { also update parasym type to get the correct parameter location
                    for the new types }
-                 parasym.vartype:=left.resulttype;
+                 parasym.vardef:=left.resultdef;
                end
              else
               if (vo_is_hidden_para in parasym.varoptions) then
                begin
                  set_varstate(left,vs_read,[vsf_must_be_valid]);
-                 resulttype:=left.resulttype;
+                 resultdef:=left.resultdef;
                end
              else
                begin
@@ -620,15 +620,15 @@ type
                    it here before the arrayconstructor node breaks the tree
                    with its conversions of enum->ord }
                  if (left.nodetype=arrayconstructorn) and
-                    (parasym.vartype.def.deftype=setdef) then
-                   inserttypeconv(left,parasym.vartype);
+                    (parasym.vardef.deftype=setdef) then
+                   inserttypeconv(left,parasym.vardef);
 
                  { set some settings needed for arrayconstructor }
-                 if is_array_constructor(left.resulttype.def) then
+                 if is_array_constructor(left.resultdef) then
                   begin
                     if left.nodetype<>arrayconstructorn then
                       internalerror(200504041);
-                    if is_array_of_const(parasym.vartype.def) then
+                    if is_array_of_const(parasym.vardef) then
                      begin
                        { force variant array }
                        include(left.flags,nf_forcevaria);
@@ -638,32 +638,32 @@ type
                        include(left.flags,nf_novariaallowed);
                        { now that the resultting type is know we can insert the required
                          typeconvs for the array constructor }
-                       if parasym.vartype.def.deftype=arraydef then
-                         tarrayconstructornode(left).force_type(tarraydef(parasym.vartype.def).elementtype);
+                       if parasym.vardef.deftype=arraydef then
+                         tarrayconstructornode(left).force_type(tarraydef(parasym.vardef).elementdef);
                      end;
                   end;
 
                  { check if local proc/func is assigned to procvar }
-                 if left.resulttype.def.deftype=procvardef then
-                   test_local_to_procvar(tprocvardef(left.resulttype.def),parasym.vartype.def);
+                 if left.resultdef.deftype=procvardef then
+                   test_local_to_procvar(tprocvardef(left.resultdef),parasym.vardef);
 
                  { test conversions }
-                 if not(is_shortstring(left.resulttype.def) and
-                        is_shortstring(parasym.vartype.def)) and
-                    (parasym.vartype.def.deftype<>formaldef) then
+                 if not(is_shortstring(left.resultdef) and
+                        is_shortstring(parasym.vardef)) and
+                    (parasym.vardef.deftype<>formaldef) then
                    begin
                       { Process open parameters }
-                      if paramanager.push_high_param(parasym.varspez,parasym.vartype.def,aktcallnode.procdefinition.proccalloption) then
+                      if paramanager.push_high_param(parasym.varspez,parasym.vardef,aktcallnode.procdefinition.proccalloption) then
                        begin
                          { insert type conv but hold the ranges of the array }
-                         oldtype:=left.resulttype;
-                         inserttypeconv(left,parasym.vartype);
-                         left.resulttype:=oldtype;
+                         olddef:=left.resultdef;
+                         inserttypeconv(left,parasym.vardef);
+                         left.resultdef:=olddef;
                        end
                       else
                        begin
-                         check_ranges(left.fileinfo,left,parasym.vartype.def);
-                         inserttypeconv(left,parasym.vartype);
+                         check_ranges(left.fileinfo,left,parasym.vardef);
+                         inserttypeconv(left,parasym.vardef);
                        end;
                       if codegenerror then
                         begin
@@ -674,24 +674,24 @@ type
 
                  { check var strings }
                  if (cs_strict_var_strings in aktlocalswitches) and
-                    is_shortstring(left.resulttype.def) and
-                    is_shortstring(parasym.vartype.def) and
+                    is_shortstring(left.resultdef) and
+                    is_shortstring(parasym.vardef) and
                     (parasym.varspez in [vs_out,vs_var]) and
-                    not(is_open_string(parasym.vartype.def)) and
-                    not(equal_defs(left.resulttype.def,parasym.vartype.def)) then
+                    not(is_open_string(parasym.vardef)) and
+                    not(equal_defs(left.resultdef,parasym.vardef)) then
                    begin
                      aktfilepos:=left.fileinfo;
                      CGMessage(type_e_strict_var_string_violation);
                    end;
 
                  { Handle formal parameters separate }
-                 if (parasym.vartype.def.deftype=formaldef) then
+                 if (parasym.vardef.deftype=formaldef) then
                    begin
                      { load procvar if a procedure is passed }
                      if ((m_tp_procvar in aktmodeswitches) or
                          (m_mac_procvar in aktmodeswitches)) and
                         (left.nodetype=calln) and
-                        (is_void(left.resulttype.def)) then
+                        (is_void(left.resultdef)) then
                        load_procvar_from_calln(left);
 
                      case parasym.varspez of
@@ -724,9 +724,9 @@ type
                  if (
                      not(
                          (vo_is_hidden_para in parasym.varoptions) and
-                         (left.resulttype.def.deftype in [pointerdef,classrefdef])
+                         (left.resultdef.deftype in [pointerdef,classrefdef])
                         ) and
-                     paramanager.push_addr_param(parasym.varspez,parasym.vartype.def,
+                     paramanager.push_addr_param(parasym.varspez,parasym.vardef,
                          aktcallnode.procdefinition.proccalloption) and
                      not(
                          (left.nodetype=loadn) and
@@ -747,7 +747,7 @@ type
                     end;
                   end;
                  { must only be done after typeconv PM }
-                 resulttype:=parasym.vartype;
+                 resultdef:=parasym.vardef;
                end;
             end;
 
@@ -791,7 +791,7 @@ type
 
     procedure tcallparanode.firstcallparan;
       begin
-        if not assigned(left.resulttype.def) then
+        if not assigned(left.resultdef) then
           get_paratype;
         det_registers;
       end;
@@ -863,15 +863,15 @@ type
        end;
 
 
-    constructor tcallnode.createinternres(const name: string; params: tnode; const res: ttype);
+    constructor tcallnode.createinternres(const name: string; params: tnode; res:tdef);
       begin
         createintern(name,params);
-        restype := res;
-        include(callnodeflags,cnf_restypeset);
-        { both the normal and specified resulttype either have to be returned via a }
+        typedef := res;
+        include(callnodeflags,cnf_typedefset);
+        { both the normal and specified resultdef either have to be returned via a }
         { parameter or not, but no mixing (JM)                                      }
-        if paramanager.ret_in_param(restype.def,symtableprocentry.first_procdef.proccalloption) xor
-           paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
+        if paramanager.ret_in_param(typedef,symtableprocentry.first_procdef.proccalloption) xor
+           paramanager.ret_in_param(symtableprocentry.first_procdef.returndef,symtableprocentry.first_procdef.proccalloption) then
           internalerror(200108291);
       end;
 
@@ -880,7 +880,7 @@ type
       begin
         createintern(name,params);
         _funcretnode:=returnnode;
-        if not paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
+        if not paramanager.ret_in_param(symtableprocentry.first_procdef.returndef,symtableprocentry.first_procdef.proccalloption) then
           internalerror(200204247);
       end;
 
@@ -892,14 +892,14 @@ type
         if assigned(_funcretnode) then
           _funcretnode.free;
         _funcretnode := returnnode;
-        { if the resulttype pass hasn't occurred yet, that one will do }
+        { if the resultdef pass hasn't occurred yet, that one will do }
         { everything                                                   }
-        if assigned(resulttype.def) then
+        if assigned(resultdef) then
           begin
             { these are returned as values, but we can optimize their loading }
             { as well                                                         }
-            if is_ansistring(resulttype.def) or
-               is_widestring(resulttype.def) then
+            if is_ansistring(resultdef) or
+               is_widestring(resultdef) then
               exit;
             para := tcallparanode(left);
             while assigned(para) do
@@ -1011,7 +1011,7 @@ type
       end;
 
 
-    function tcallnode._getcopy : tnode;
+    function tcallnode.dogetcopy : tnode;
       var
         n : tcallnode;
         i : integer;
@@ -1023,33 +1023,33 @@ type
           the can reference methodpointer }
         oldleft:=left;
         left:=nil;
-        n:=tcallnode(inherited _getcopy);
+        n:=tcallnode(inherited dogetcopy);
         left:=oldleft;
         n.symtableprocentry:=symtableprocentry;
         n.symtableproc:=symtableproc;
         n.procdefinition:=procdefinition;
-        n.restype := restype;
+        n.typedef := typedef;
         n.callnodeflags := callnodeflags;
         if assigned(methodpointerinit) then
-         n.methodpointerinit:=tblocknode(methodpointerinit._getcopy)
+         n.methodpointerinit:=tblocknode(methodpointerinit.dogetcopy)
         else
          n.methodpointerinit:=nil;
         { methodpointerinit is copied, now references to the temp will also be copied
           correctly. We can now copy the parameters and methodpointer }
         if assigned(left) then
-         n.left:=left._getcopy
+         n.left:=left.dogetcopy
         else
          n.left:=nil;
         if assigned(methodpointer) then
-         n.methodpointer:=methodpointer._getcopy
+         n.methodpointer:=methodpointer.dogetcopy
         else
          n.methodpointer:=nil;
         if assigned(methodpointerdone) then
-         n.methodpointerdone:=tblocknode(methodpointerdone._getcopy)
+         n.methodpointerdone:=tblocknode(methodpointerdone.dogetcopy)
         else
          n.methodpointerdone:=nil;
         if assigned(_funcretnode) then
-         n._funcretnode:=_funcretnode._getcopy
+         n._funcretnode:=_funcretnode.dogetcopy
         else
          n._funcretnode:=nil;
 
@@ -1059,7 +1059,7 @@ type
            for i:=0 to varargsparas.count-1 do
              begin
                hp:=tparavarsym(varargsparas[i]);
-               hpn:=tparavarsym.create(hp.realname,hp.paranr,hp.varspez,hp.vartype,[]);
+               hpn:=tparavarsym.create(hp.realname,hp.paranr,hp.varspez,hp.vardef,[]);
                n.varargsparas.add(hpn);
              end;
          end
@@ -1083,7 +1083,7 @@ type
         oldleft:=tcallparanode(left);
         if oldleft.left.nodetype<>arrayconstructorn then
           begin
-            CGMessage1(type_e_wrong_type_in_array_constructor,oldleft.left.resulttype.def.typename);
+            CGMessage1(type_e_wrong_type_in_array_constructor,oldleft.left.resultdef.typename);
             exit;
           end;
         include(callnodeflags,cnf_uses_varargs);
@@ -1097,8 +1097,8 @@ type
             while assigned(hp) do
               begin
                 left:=ccallparanode.create(hp.left,left);
-                { set callparanode resulttype and flags }
-                left.resulttype:=hp.left.resulttype;
+                { set callparanode resultdef and flags }
+                left.resultdef:=hp.left.resultdef;
                 include(tcallparanode(left).callparaflags,cpf_varargs_para);
                 hp.left:=nil;
                 hp:=tarrayconstructornode(hp.right);
@@ -1154,13 +1154,13 @@ type
         }
         if assigned(methodpointer) then
           begin
-            if (methodpointer.resulttype.def.deftype = objectdef) then
-              objectdf:=tobjectdef(methodpointer.resulttype.def)
+            if (methodpointer.resultdef.deftype = objectdef) then
+              objectdf:=tobjectdef(methodpointer.resultdef)
             else
-              if (methodpointer.resulttype.def.deftype = classrefdef) and
-                 (tclassrefdef(methodpointer.resulttype.def).pointertype.def.deftype = objectdef) and
+              if (methodpointer.resultdef.deftype = classrefdef) and
+                 (tclassrefdef(methodpointer.resultdef).pointeddef.deftype = objectdef) and
                  (methodpointer.nodetype in [typen,loadvmtaddrn]) then
-                objectdf:=tobjectdef(tclassrefdef(methodpointer.resulttype.def).pointertype.def);
+                objectdf:=tobjectdef(tclassrefdef(methodpointer.resultdef).pointeddef);
           end;
         if not assigned(objectdf) then
           exit;
@@ -1211,7 +1211,7 @@ type
         hsym : tfieldvarsym;
       begin
         { find self field in methodpointer record }
-        hsym:=tfieldvarsym(trecorddef(methodpointertype.def).symtable.search('self'));
+        hsym:=tfieldvarsym(trecorddef(methodpointertype).symtable.search('self'));
         if not assigned(hsym) then
           internalerror(200305251);
         { Load tmehodpointer(right).self }
@@ -1235,7 +1235,7 @@ type
           if (procdefinition.proctypeoption=potype_constructor) then
             begin
               { push 0 as self when allocation is needed }
-              if (methodpointer.resulttype.def.deftype=classrefdef) or
+              if (methodpointer.resultdef.deftype=classrefdef) or
                  (cnf_new_call in callnodeflags) then
                 selftree:=cpointerconstnode.create(0,voidpointertype)
               else
@@ -1259,7 +1259,7 @@ type
                     need to check for typen, because that will always get the
                     loadvmtaddrnode added }
                   selftree:=methodpointer.getcopy;
-                  if methodpointer.resulttype.def.deftype<>classrefdef then
+                  if methodpointer.resultdef.deftype<>classrefdef then
                     selftree:=cloadvmtaddrnode.create(selftree);
                 end
               else
@@ -1286,9 +1286,9 @@ type
 
         { Handle classes and legacy objects separate to make it
           more maintainable }
-        if (methodpointer.resulttype.def.deftype=classrefdef) then
+        if (methodpointer.resultdef.deftype=classrefdef) then
           begin
-            if not is_class(tclassrefdef(methodpointer.resulttype.def).pointertype.def) then
+            if not is_class(tclassrefdef(methodpointer.resultdef).pointeddef) then
               internalerror(200501041);
 
             { constructor call via classreference => allocate memory }
@@ -1307,7 +1307,7 @@ type
           end
         else
         { Class style objects }
-         if is_class(methodpointer.resulttype.def) then
+         if is_class(methodpointer.resultdef) then
           begin
             { inherited call, no create/destroy }
             if (cnf_inherited in callnodeflags) then
@@ -1361,7 +1361,7 @@ type
           begin
             { constructor with extended syntax called from new }
             if (cnf_new_call in callnodeflags) then
-                vmttree:=cloadvmtaddrnode.create(ctypenode.create(methodpointer.resulttype))
+                vmttree:=cloadvmtaddrnode.create(ctypenode.create(methodpointer.resultdef))
             else
               { destructor with extended syntax called from dispose }
               if (cnf_dispose_call in callnodeflags) then
@@ -1390,7 +1390,7 @@ type
                    if (methodpointer.nodetype=typen) then
                      vmttree:=cpointerconstnode.create(0,voidpointertype)
                    else
-                     vmttree:=cloadvmtaddrnode.create(ctypenode.create(methodpointer.resulttype))
+                     vmttree:=cloadvmtaddrnode.create(ctypenode.create(methodpointer.resultdef))
                  end
                else
                  vmttree:=cpointerconstnode.create(0,voidpointertype);
@@ -1451,9 +1451,9 @@ type
                  else
                   begin
                     hiddentree:=internalstatements(newstatement);
-                    { need to use resulttype instead of procdefinition.rettype,
+                    { need to use resultdef instead of procdefinition.returndef,
                       because they can be different }
-                    temp:=ctempcreatenode.create(resulttype,resulttype.def.size,tt_persistent,false);
+                    temp:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,false);
                     addstatement(newstatement,temp);
                     addstatement(newstatement,ctempdeletenode.create_normal_temp(temp));
                     addstatement(newstatement,ctemprefnode.create(temp));
@@ -1466,7 +1466,7 @@ type
                      (i=0) then
                     internalerror(200304082);
                   { we need the information of the previous parameter }
-                  hiddentree:=gen_high_tree(pt.left,tparavarsym(procdefinition.paras[i-1]).vartype.def);
+                  hiddentree:=gen_high_tree(pt.left,tparavarsym(procdefinition.paras[i-1]).vardef);
                 end
               else
                if vo_is_self in currpara.varoptions then
@@ -1532,7 +1532,7 @@ type
               begin
                 if cpf_varargs_para in pt.callparaflags then
                   begin
-                    varargspara:=tparavarsym.create('va'+tostr(i),i,vs_value,pt.resulttype,[]);
+                    varargspara:=tparavarsym.create('va'+tostr(i),i,vs_value,pt.resultdef,[]);
                     dec(i);
                     { varargspara is left-right, use insert
                       instead of concat }
@@ -1546,7 +1546,7 @@ type
       end;
 
 
-    function tcallnode.det_resulttype:tnode;
+    function tcallnode.pass_typecheck:tnode;
       var
         candidates : tcallcandidates;
         oldcallnode : tcallnode;
@@ -1585,7 +1585,7 @@ type
 
          if assigned(methodpointer) then
            begin
-             resulttypepass(methodpointer);
+             typecheckpass(methodpointer);
              maybe_load_para_in_temp(methodpointer);
            end;
 
@@ -1593,11 +1593,11 @@ type
          if assigned(right) then
            begin
               set_varstate(right,vs_read,[vsf_must_be_valid]);
-              resulttypepass(right);
+              typecheckpass(right);
               if codegenerror then
                exit;
 
-              procdefinition:=tabstractprocdef(right.resulttype.def);
+              procdefinition:=tabstractprocdef(right.resultdef);
 
               { Compare parameters from right to left }
               paraidx:=procdefinition.Paras.count-1;
@@ -1688,7 +1688,7 @@ type
                               hpt:=cloadnode.create(tprocsym(symtableprocentry),symtableproc);
                               if assigned(methodpointer) then
                                 tloadnode(hpt).set_mp(get_load_methodpointer);
-                              resulttypepass(hpt);
+                              typecheckpass(hpt);
                               result:=hpt;
                             end
                           else
@@ -1831,15 +1831,15 @@ type
            end;
 
          { ensure that the result type is set }
-         if not(cnf_restypeset in callnodeflags) then
+         if not(cnf_typedefset in callnodeflags) then
           begin
             { constructors return their current class type, not the type where the
               constructor is declared, this can be different because of inheritance }
             if (procdefinition.proctypeoption=potype_constructor) and
                assigned(methodpointer) and
-               assigned(methodpointer.resulttype.def) and
-               (methodpointer.resulttype.def.deftype=classrefdef) then
-              resulttype:=tclassrefdef(methodpointer.resulttype.def).pointertype
+               assigned(methodpointer.resultdef) and
+               (methodpointer.resultdef.deftype=classrefdef) then
+              resultdef:=tclassrefdef(methodpointer.resultdef).pointeddef
             else
             { Member call to a (inherited) constructor from the class, the return
               value is always self, so we change it to voidtype to generate an
@@ -1849,14 +1849,14 @@ type
                  is_class(tprocdef(procdefinition)._class) and
                  assigned(methodpointer) and
                  (nf_is_self in methodpointer.flags) then
-                resulttype:=voidtype
+                resultdef:=voidtype
             else
-              resulttype:=procdefinition.rettype;
+              resultdef:=procdefinition.returndef;
            end
          else
-           resulttype:=restype;
+           resultdef:=typedef;
 
-         {if resulttype.def.needs_inittable then
+         {if resultdef.needs_inittable then
            include(current_procinfo.flags,pi_needs_implicit_finally);}
 
          if assigned(methodpointer) then
@@ -1879,7 +1879,7 @@ type
             { con- and destructors need a pointer to the vmt }
             if (cnf_inherited in callnodeflags) and
                (procdefinition.proctypeoption in [potype_constructor,potype_destructor]) and
-               is_object(methodpointer.resulttype.def) and
+               is_object(methodpointer.resultdef) and
                not(current_procinfo.procdef.proctypeoption in [potype_constructor,potype_destructor]) then
              CGMessage(cg_w_member_cd_call_from_method);
 
@@ -1901,10 +1901,10 @@ type
                if (procdefinition.proctypeoption=potype_constructor) or
                   ((hpt.nodetype=loadn) and
                    (
-                    (methodpointer.resulttype.def.deftype=classrefdef) or
+                    (methodpointer.resultdef.deftype=classrefdef) or
                     (
-                     (methodpointer.resulttype.def.deftype=objectdef) and
-                     not(oo_has_virtual in tobjectdef(methodpointer.resulttype.def).objectoptions)
+                     (methodpointer.resultdef.deftype=objectdef) and
+                     not(oo_has_virtual in tobjectdef(methodpointer.resultdef).objectoptions)
                     )
                    )
                   ) then
@@ -1942,7 +1942,7 @@ type
 
          { Change loading of array of const to varargs }
          if assigned(left) and
-            is_array_of_const(tparavarsym(procdefinition.paras[procdefinition.paras.count-1]).vartype.def) and
+            is_array_of_const(tparavarsym(procdefinition.paras[procdefinition.paras.count-1]).vardef) and
             (procdefinition.proccalloption in [pocall_cppdecl,pocall_cdecl]) then
            convert_carg_array_of_const;
 
@@ -2053,7 +2053,7 @@ type
                     begin
                       n.free;
                       n := paras.left.getcopy;
-                      resulttypepass(n);
+                      typecheckpass(n);
                       result := fen_true;
                     end;
                 end;
@@ -2068,7 +2068,7 @@ type
                   temp := tnode(inlinelocals[tloadnode(n).symtableentry.indexnr]).getcopy;
                   n.free;
                   n := temp;
-                  resulttypepass(n);
+                  typecheckpass(n);
                   result := fen_true;
                 end;
             end;
@@ -2106,7 +2106,7 @@ type
           end
         else
           begin
-            tempnode := ctempcreatenode.create(tabstractvarsym(p).vartype,tabstractvarsym(p).vartype.def.size,tt_persistent,tabstractvarsym(p).is_regvar(false));
+            tempnode := ctempcreatenode.create(tabstractvarsym(p).vardef,tabstractvarsym(p).vardef.size,tt_persistent,tabstractvarsym(p).is_regvar(false));
             addstatement(tempinfo^.createstatement,tempnode);
             if assigned(tlocalvarsym(p).defaultconstsym) then
               begin
@@ -2182,7 +2182,7 @@ type
                   ((tparavarsym(para.parasym).varregable in [vr_none,vr_addr]) and
                    not(para.left.expectloc in [LOC_REFERENCE,LOC_CREFERENCE]))  or
                   { we can't assign to formaldef temps }
-                  ((para.parasym.vartype.def.deftype<>formaldef) and
+                  ((para.parasym.vardef.deftype<>formaldef) and
                    (
                     { if paracomplexity > 1, we normally take the address of   }
                     { the parameter expression, store it in a temp and         }
@@ -2206,7 +2206,7 @@ type
                       { variable would be passed by value normally, or if   }
                       { there is such a variable somewhere in an expression }
                        ((para.parasym.varspez = vs_const) and
-                        (not paramanager.push_addr_param(vs_const,para.parasym.vartype.def,procdefinition.proccalloption) or
+                        (not paramanager.push_addr_param(vs_const,para.parasym.vardef,procdefinition.proccalloption) or
                          (paracomplexity > 1)))) and
                      { however, if we pass a global variable, an object field or}
                      { an expression containing a pointer dereference as        }
@@ -2238,7 +2238,7 @@ type
                      ((para.parasym.varstate = vs_readwritten) or
                       { call-by-reference const's may need to be passed by }
                       { reference to function called in the inlined code   }
-                      (paramanager.push_addr_param(vs_const,para.parasym.vartype.def,procdefinition.proccalloption) and
+                      (paramanager.push_addr_param(vs_const,para.parasym.vardef,procdefinition.proccalloption) and
                        (not valid_for_addr(para.left,false) or
                         is_constnode(para.left)))))
                    )
@@ -2276,7 +2276,7 @@ type
                       end;
 {$endif reuse_existing_para_temp}
 
-                    tempnode := ctempcreatenode.create(para.parasym.vartype,para.parasym.vartype.def.size,tt_persistent,tparavarsym(para.parasym).is_regvar(false));
+                    tempnode := ctempcreatenode.create(para.parasym.vardef,para.parasym.vardef.size,tt_persistent,tparavarsym(para.parasym).is_regvar(false));
                     addstatement(createstatement,tempnode);
                     { assign the value of the parameter to the temp, except in case of the function result }
                     { (in that case, para.left is a block containing the creation of a new temp, while we  }
@@ -2304,11 +2304,11 @@ type
                 { temp                                                        }
                 else if (paracomplexity > 1) then
                   begin
-                    tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent,tparavarsym(para.parasym).is_regvar(true));
+                    tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.size,tt_persistent,tparavarsym(para.parasym).is_regvar(true));
                     addstatement(createstatement,tempnode);
                     addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                       caddrnode.create_internal(para.left)));
-                    para.left := ctypeconvnode.create_internal(cderefnode.create(ctemprefnode.create(tempnode)),para.left.resulttype);
+                    para.left := ctypeconvnode.create_internal(cderefnode.create(ctemprefnode.create(tempnode)),para.left.resultdef);
                     addstatement(deletestatement,ctempdeletenode.create(tempnode));
                   end;
               end;
@@ -2482,22 +2482,22 @@ type
            include(current_procinfo.flags,pi_do_call);
 
          { implicit finally needed ? }
-         if resulttype.def.needs_inittable and
-            not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
+         if resultdef.needs_inittable and
+            not paramanager.ret_in_param(resultdef,procdefinition.proccalloption) and
             not assigned(funcretnode) then
            include(current_procinfo.flags,pi_needs_implicit_finally);
 
          { get a register for the return value }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
            begin
-              if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
+              if paramanager.ret_in_param(resultdef,procdefinition.proccalloption) then
                begin
                  expectloc:=LOC_REFERENCE;
                end
              else
              { ansi/widestrings must be registered, so we can dispose them }
-              if is_ansistring(resulttype.def) or
-                 is_widestring(resulttype.def) then
+              if is_ansistring(resultdef) or
+                 is_widestring(resultdef) then
                begin
                  expectloc:=LOC_REFERENCE;
                  registersint:=1;
@@ -2506,7 +2506,7 @@ type
              { we have only to handle the result if it is used }
               if (cnf_return_value_used in callnodeflags) then
                begin
-                 case resulttype.def.deftype of
+                 case resultdef.deftype of
                    enumdef,
                    orddef :
                      begin
@@ -2518,7 +2518,7 @@ type
                        else
                         begin
                           expectloc:=LOC_REGISTER;
-                          if is_64bit(resulttype.def) then
+                          if is_64bit(resultdef) then
                             registersint:=2
                           else
                             registersint:=1;
@@ -2533,7 +2533,7 @@ type
                        else
 {$endif cpufpemu}
 {$ifdef m68k}
-                        if (tfloatdef(resulttype.def).typ=s32real) then
+                        if (tfloatdef(resultdef).typ=s32real) then
                          registersint:=1
                        else
 {$endif m68k}
@@ -2544,7 +2544,7 @@ type
                        expectloc:=procdefinition.funcretloc[callerside].loc;
                        if (expectloc = LOC_REGISTER) then
 {$ifndef cpu64bit}
-                         if (resulttype.def.size > sizeof(aint)) then
+                         if (resultdef.size > sizeof(aint)) then
                            registersint:=2
                          else
 {$endif cpu64bit}
@@ -2617,8 +2617,8 @@ type
             begin
                 if left.track_state_pass(exec_known) then
                     begin
-                        left.resulttype.def:=nil;
-                        do_resulttypepass(left);
+                        left.resultdef:=nil;
+                        do_typecheckpass(left);
                     end;
                 value:=aktstate.find_fact(hp.left);
                 if value<>nil then
@@ -2626,7 +2626,7 @@ type
                         track_state_pass:=true;
                         hp.left.destroy;
                         hp.left:=value.getcopy;
-                        do_resulttypepass(hp.left);
+                        do_typecheckpass(hp.left);
                     end;
                 hp:=Tcallparanode(hp.right);
             end;
@@ -2679,9 +2679,9 @@ type
           (symtableprocentry = tcallnode(p).symtableprocentry) and
           (procdefinition = tcallnode(p).procdefinition) and
           (methodpointer.isequal(tcallnode(p).methodpointer)) and
-          (((cnf_restypeset in callnodeflags) and (cnf_restypeset in tcallnode(p).callnodeflags) and
-            (equal_defs(restype.def,tcallnode(p).restype.def))) or
-           (not(cnf_restypeset in callnodeflags) and not(cnf_restypeset in tcallnode(p).callnodeflags)));
+          (((cnf_typedefset in callnodeflags) and (cnf_typedefset in tcallnode(p).callnodeflags) and
+            (equal_defs(typedef,tcallnode(p).typedef))) or
+           (not(cnf_typedefset in callnodeflags) and not(cnf_typedefset in tcallnode(p).callnodeflags)));
       end;
 
 

+ 22 - 22
compiler/ncgadd.pas

@@ -31,7 +31,7 @@ interface
     type
        tcgaddnode = class(taddnode)
 {          function pass_1: tnode; override;}
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
          protected
           { call secondpass for both left and right }
           procedure pass_left_right;
@@ -106,7 +106,7 @@ interface
           end;
         secondpass(left);
         if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
-          location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(resulttype.def),false);
+          location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(resultdef),false);
         if isjump then
           begin
             current_procinfo.CurrTrueLabel:=otl;
@@ -128,7 +128,7 @@ interface
           end;
         secondpass(right);
         if right.location.loc in [LOC_FLAGS,LOC_JUMP] then
-          location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(resulttype.def),false);
+          location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(resultdef),false);
         if isjump then
           begin
             current_procinfo.CurrTrueLabel:=otl;
@@ -150,7 +150,7 @@ interface
 
     procedure tcgaddnode.set_result_location_reg;
       begin
-        location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
+        location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
 {$ifdef x86}
         if left.location.loc=LOC_REGISTER then
           begin
@@ -232,10 +232,10 @@ interface
     procedure tcgaddnode.second_opsmallset;
       begin
         { when a setdef is passed, it has to be a smallset }
-        if ((left.resulttype.def.deftype=setdef) and
-            (tsetdef(left.resulttype.def).settype<>smallset)) or
-           ((right.resulttype.def.deftype=setdef) and
-            (tsetdef(right.resulttype.def).settype<>smallset)) then
+        if ((left.resultdef.deftype=setdef) and
+            (tsetdef(left.resultdef).settype<>smallset)) or
+           ((right.resultdef.deftype=setdef) and
+            (tsetdef(right.resultdef).settype<>smallset)) then
           internalerror(200203301);
 
         if nodetype in [equaln,unequaln,gtn,gten,lten,ltn] then
@@ -589,7 +589,7 @@ interface
 
         { emit overflow check if enabled }
         if checkoverflow then
-           cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,ResultType.Def,ovloc);
+           cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,resultdef,ovloc);
       end;
 
 
@@ -645,8 +645,8 @@ interface
         set_result_location_reg;
 
         { determine if the comparison will be unsigned }
-        unsigned:=not(is_signed(left.resulttype.def)) or
-                    not(is_signed(right.resulttype.def));
+        unsigned:=not(is_signed(left.resultdef)) or
+                    not(is_signed(right.resultdef));
 
         { assume no overflow checking is require }
         checkoverflow := false;
@@ -722,7 +722,7 @@ interface
 
         { emit overflow check if required }
         if checkoverflow then
-          cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,ResultType.Def,ovloc);
+          cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,resultdef,ovloc);
       end;
 
 
@@ -733,20 +733,20 @@ interface
 
 
 {*****************************************************************************
-                                pass_2
+                                pass_generate_code;
 *****************************************************************************}
 
-    procedure tcgaddnode.pass_2;
+    procedure tcgaddnode.pass_generate_code;
       begin
-        case left.resulttype.def.deftype of
+        case left.resultdef.deftype of
           orddef :
             begin
               { handling boolean expressions }
-              if is_boolean(left.resulttype.def) and
-                 is_boolean(right.resulttype.def) then
+              if is_boolean(left.resultdef) and
+                 is_boolean(right.resultdef) then
                 second_opboolean
               { 64bit operations }
-              else if is_64bit(left.resulttype.def) then
+              else if is_64bit(left.resultdef) then
                 second_op64bit
               else
                 second_opordinal;
@@ -759,7 +759,7 @@ interface
             begin
               {Normalsets are already handled in pass1 if mmx
                should not be used.}
-              if (tsetdef(left.resulttype.def).settype<>smallset) then
+              if (tsetdef(left.resultdef).settype<>smallset) then
                 begin
 {$ifdef SUPPORT_MMX}
                 {$ifdef i386}
@@ -776,15 +776,15 @@ interface
           arraydef :
             begin
               { support dynarr=nil }
-              if is_dynamic_array(left.resulttype.def) then
+              if is_dynamic_array(left.resultdef) then
                 second_opordinal
               else
                 if (cs_support_vectors in aktglobalswitches) and
-                   is_vector(left.resulttype.def) then
+                   is_vector(left.resultdef) then
                   second_opvector
 {$ifdef SUPPORT_MMX}
               else
-                if is_mmx_able_array(left.resulttype.def) then
+                if is_mmx_able_array(left.resultdef) then
                   second_opmmx
 {$endif SUPPORT_MMX}
               else

+ 27 - 27
compiler/ncgbas.pas

@@ -31,27 +31,27 @@ interface
 
     type
        tcgnothingnode = class(tnothingnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgasmnode = class(tasmnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgstatementnode = class(tstatementnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgblocknode = class(tblocknode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgtempcreatenode = class(ttempcreatenode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgtemprefnode = class(ttemprefnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
           { Changes the location of this temp to ref. Useful when assigning }
           { another temp to this one. The current location will be freed.   }
           { Can only be called in pass 2 (since earlier, the temp location  }
@@ -60,7 +60,7 @@ interface
        end;
 
        tcgtempdeletenode = class(ttempdeletenode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
   implementation
@@ -80,7 +80,7 @@ interface
                                  TNOTHING
 *****************************************************************************}
 
-    procedure tcgnothingnode.pass_2;
+    procedure tcgnothingnode.pass_generate_code;
       begin
          location_reset(location,LOC_VOID,OS_NO);
 
@@ -92,7 +92,7 @@ interface
                                TSTATEMENTNODE
 *****************************************************************************}
 
-    procedure tcgstatementnode.pass_2;
+    procedure tcgstatementnode.pass_generate_code;
       var
          hp : tstatementnode;
       begin
@@ -116,7 +116,7 @@ interface
                                TASMNODE
 *****************************************************************************}
 
-    procedure tcgasmnode.pass_2;
+    procedure tcgasmnode.pass_generate_code;
 
       procedure ReLabel(var p:tasmsymbol);
         begin
@@ -320,7 +320,7 @@ interface
                              TBLOCKNODE
 *****************************************************************************}
 
-    procedure tcgblocknode.pass_2;
+    procedure tcgblocknode.pass_generate_code;
       var
         hp : tstatementnode;
         oldexitlabel : tasmlabel;
@@ -363,7 +363,7 @@ interface
                           TTEMPCREATENODE
 *****************************************************************************}
 
-    procedure tcgtempcreatenode.pass_2;
+    procedure tcgtempcreatenode.pass_generate_code;
       begin
         location_reset(location,LOC_VOID,OS_NO);
 
@@ -372,43 +372,43 @@ interface
           internalerror(200108222);
 
         { get a (persistent) temp }
-        if tempinfo^.restype.def.needs_inittable then
+        if tempinfo^.typedef.needs_inittable then
           begin
-            location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.restype.def));
-            tg.GetTempTyped(current_asmdata.CurrAsmList,tempinfo^.restype.def,tempinfo^.temptype,tempinfo^.location.reference);
+            location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.typedef));
+            tg.GetTempTyped(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.temptype,tempinfo^.location.reference);
             { the temp could have been used previously either because the memory location was reused or
               because we're in a loop }
-            cg.g_finalize(current_asmdata.CurrAsmList,tempinfo^.restype.def,tempinfo^.location.reference);
+            cg.g_finalize(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.location.reference);
           end
         else if tempinfo^.may_be_in_reg then
           begin
-            if tempinfo^.restype.def.deftype=floatdef then
+            if tempinfo^.typedef.deftype=floatdef then
               begin
 {$ifdef x86}
-                if use_sse(tempinfo^.restype.def) then
+                if use_sse(tempinfo^.typedef) then
                   begin
                     if (tempinfo^.temptype = tt_persistent) then
-                      location_reset(tempinfo^.location,LOC_CMMREGISTER,def_cgsize(tempinfo^.restype.def))
+                      location_reset(tempinfo^.location,LOC_CMMREGISTER,def_cgsize(tempinfo^.typedef))
                     else
-                      location_reset(tempinfo^.location,LOC_MMREGISTER,def_cgsize(tempinfo^.restype.def));
+                      location_reset(tempinfo^.location,LOC_MMREGISTER,def_cgsize(tempinfo^.typedef));
                     tempinfo^.location.register:=cg.getmmregister(current_asmdata.CurrAsmList,tempinfo^.location.size);
                   end
                 else
 {$endif x86}
                   begin
                     if (tempinfo^.temptype = tt_persistent) then
-                      location_reset(tempinfo^.location,LOC_CFPUREGISTER,def_cgsize(tempinfo^.restype.def))
+                      location_reset(tempinfo^.location,LOC_CFPUREGISTER,def_cgsize(tempinfo^.typedef))
                     else
-                      location_reset(tempinfo^.location,LOC_FPUREGISTER,def_cgsize(tempinfo^.restype.def));
+                      location_reset(tempinfo^.location,LOC_FPUREGISTER,def_cgsize(tempinfo^.typedef));
                     tempinfo^.location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,tempinfo^.location.size);
                   end;
               end
             else
               begin
                 if (tempinfo^.temptype = tt_persistent) then
-                  location_reset(tempinfo^.location,LOC_CREGISTER,def_cgsize(tempinfo^.restype.def))
+                  location_reset(tempinfo^.location,LOC_CREGISTER,def_cgsize(tempinfo^.typedef))
                 else
-                  location_reset(tempinfo^.location,LOC_REGISTER,def_cgsize(tempinfo^.restype.def));
+                  location_reset(tempinfo^.location,LOC_REGISTER,def_cgsize(tempinfo^.typedef));
 {$ifndef cpu64bit}
                 if tempinfo^.location.size in [OS_64,OS_S64] then
                   begin
@@ -422,7 +422,7 @@ interface
           end
         else
           begin
-            location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.restype.def));
+            location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.typedef));
             tg.GetTemp(current_asmdata.CurrAsmList,size,tempinfo^.temptype,tempinfo^.location.reference);
           end;
         tempinfo^.valid := true;
@@ -433,7 +433,7 @@ interface
                              TTEMPREFNODE
 *****************************************************************************}
 
-    procedure tcgtemprefnode.pass_2;
+    procedure tcgtemprefnode.pass_generate_code;
       begin
         { check if the temp is valid }
         if not tempinfo^.valid then
@@ -475,7 +475,7 @@ interface
                            TTEMPDELETENODE
 *****************************************************************************}
 
-    procedure tcgtempdeletenode.pass_2;
+    procedure tcgtempdeletenode.pass_generate_code;
       begin
         location_reset(location,LOC_VOID,OS_NO);
 

+ 39 - 39
compiler/ncgcal.pas

@@ -67,7 +67,7 @@ interface
           procedure extra_post_call_code;virtual;
           procedure do_syscall;virtual;abstract;
        public
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
 
@@ -123,15 +123,15 @@ implementation
 {$endif i386}
       begin
         { we've nothing to push when the size of the parameter is 0 }
-        if left.resulttype.def.size=0 then
+        if left.resultdef.size=0 then
           exit;
 
         { Move flags and jump in register to make it less complex }
         if left.location.loc in [LOC_FLAGS,LOC_JUMP,LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF] then
-          location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false);
+          location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false);
 
         { Handle Floating point types differently }
-        if (left.resulttype.def.deftype=floatdef) and not(cs_fp_emulation in aktmoduleswitches) then
+        if (left.resultdef.deftype=floatdef) and not(cs_fp_emulation in aktmoduleswitches) then
          begin
 {$ifdef i386}
            if tempcgpara.location^.loc<>LOC_REFERENCE then
@@ -153,7 +153,7 @@ implementation
              LOC_MMREGISTER,
              LOC_CMMREGISTER:
                begin
-                 size:=align(tfloatdef(left.resulttype.def).size,tempcgpara.alignment);
+                 size:=align(tfloatdef(left.resultdef).size,tempcgpara.alignment);
                  if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
                    begin
                      cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
@@ -166,7 +166,7 @@ implementation
              LOC_REFERENCE,
              LOC_CREFERENCE :
                begin
-                 size:=align(left.resulttype.def.size,tempcgpara.alignment);
+                 size:=align(left.resultdef.size,tempcgpara.alignment);
                  if (not use_fixed_stack) and
                     (tempcgpara.location^.reference.index=NR_STACK_POINTER_REG) then
                    cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
@@ -324,7 +324,7 @@ implementation
                begin
 {$ifndef cpu64bit}
                  { use cg64 only for int64, not for 8 byte records }
-                 if is_64bit(left.resulttype.def) then
+                 if is_64bit(left.resultdef) then
                    cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara)
                  else
 {$endif cpu64bit}
@@ -375,10 +375,10 @@ implementation
 
              { release memory for refcnt out parameters }
              if (parasym.varspez=vs_out) and
-                (left.resulttype.def.needs_inittable) then
+                (left.resultdef.needs_inittable) then
                begin
                  location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false);
-                 cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resulttype.def,href);
+                 cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
                end;
 
              paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
@@ -386,7 +386,7 @@ implementation
              { handle varargs first, because parasym is not valid }
              if (cpf_varargs_para in callparaflags) then
                begin
-                 if paramanager.push_addr_param(vs_value,left.resulttype.def,
+                 if paramanager.push_addr_param(vs_value,left.resultdef,
                         aktcallnode.procdefinition.proccalloption) then
                    push_addr_para
                  else
@@ -398,15 +398,15 @@ implementation
                  { don't push a node that already generated a pointer type
                    by address for implicit hidden parameters }
                  if (vo_is_funcret in parasym.varoptions) or
-                    (not(left.resulttype.def.deftype in [pointerdef,classrefdef]) and
-                     paramanager.push_addr_param(parasym.varspez,parasym.vartype.def,
+                    (not(left.resultdef.deftype in [pointerdef,classrefdef]) and
+                     paramanager.push_addr_param(parasym.varspez,parasym.vardef,
                          aktcallnode.procdefinition.proccalloption)) then
                    push_addr_para
                  else
                    push_value_para;
                end
              { formal def }
-             else if (parasym.vartype.def.deftype=formaldef) then
+             else if (parasym.vardef.deftype=formaldef) then
                begin
                   { allow passing of a constant to a const formaldef }
                   if (parasym.varspez=vs_const) and
@@ -421,14 +421,14 @@ implementation
                    by address for implicit hidden parameters }
                  if (not(
                          (vo_is_hidden_para in parasym.varoptions) and
-                         (left.resulttype.def.deftype in [pointerdef,classrefdef])
+                         (left.resultdef.deftype in [pointerdef,classrefdef])
                         ) and
-                     paramanager.push_addr_param(parasym.varspez,parasym.vartype.def,
+                     paramanager.push_addr_param(parasym.varspez,parasym.vardef,
                          aktcallnode.procdefinition.proccalloption)) and
                      { dyn. arrays passed to an array of const must be passed by value, see tests/webtbs/tw4219.pp }
                      not(
-                         is_array_of_const(parasym.vartype.def) and
-                         is_dynamic_array(left.resulttype.def)
+                         is_array_of_const(parasym.vardef) and
+                         is_dynamic_array(left.resultdef)
                         ) then
                    begin
                       { Passing a var parameter to a var parameter, we can
@@ -504,7 +504,7 @@ implementation
         { structured results are easy to handle....
           needed also when result_no_used !! }
         if (procdefinition.proctypeoption<>potype_constructor) and
-           paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
+           paramanager.ret_in_param(resultdef,procdefinition.proccalloption) then
           begin
             { Location should be setup by the funcret para }
             if location.loc<>LOC_REFERENCE then
@@ -512,7 +512,7 @@ implementation
           end
         else
           { ansi/widestrings must be registered, so we can dispose them }
-          if resulttype.def.needs_inittable then
+          if resultdef.needs_inittable then
             begin
               if procdefinition.funcretloc[callerside].loc<>LOC_REGISTER then
                 internalerror(200409261);
@@ -539,10 +539,10 @@ implementation
                   { original funcretnode isn't touched -> make sure it's    }
                   { the same here (not sure if it's necessary)              }
                   tempnode := funcretnode.getcopy;
-                  tempnode.pass_2;
+                  tempnode.pass_generate_code;
                   location := tempnode.location;
                   tempnode.free;
-                  cg.g_decrrefcount(current_asmdata.CurrAsmList,resulttype.def,location.reference);
+                  cg.g_decrrefcount(current_asmdata.CurrAsmList,resultdef,location.reference);
                   cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
                end;
             end
@@ -595,15 +595,15 @@ implementation
                             begin
                               { change register size after the unget because the
                                 getregister was done for the full register
-                                def_cgsize(resulttype.def) is used here because
+                                def_cgsize(resultdef) is used here because
                                 it could be a constructor call }
                               if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
                                 cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
-                              location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resulttype.def));
-                              cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resulttype.def),procdefinition.funcretloc[callerside].register,location.register);
+                              location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resultdef));
+                              cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resultdef),procdefinition.funcretloc[callerside].register,location.register);
                             end;
 {$ifdef arm}
-                          if (resulttype.def.deftype=floatdef) and (aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
+                          if (resultdef.deftype=floatdef) and (aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
                             begin
                               location_force_mem(current_asmdata.CurrAsmList,location);
                             end;
@@ -611,7 +611,7 @@ implementation
                         end
                        else
                         begin
-                          if resulttype.def.size>0 then
+                          if resultdef.size>0 then
                             internalerror(200305131);
                         end;
                      end;
@@ -648,8 +648,8 @@ implementation
           begin
             if location.loc=LOC_REFERENCE then
               begin
-                if resulttype.def.needs_inittable then
-                  cg.g_finalize(current_asmdata.CurrAsmList,resulttype.def,location.reference);
+                if resultdef.needs_inittable then
+                  cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
                 tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference)
               end;
           end;
@@ -811,7 +811,7 @@ implementation
 
 
 
-    procedure tcgcallnode.pass_2;
+    procedure tcgcallnode.pass_generate_code;
       var
         regs_to_save_int,
         regs_to_save_fpu,
@@ -833,15 +833,15 @@ implementation
          if assigned(methodpointerinit) then
            secondpass(methodpointerinit);
 
-         if resulttype.def.needs_inittable and
-            not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
+         if resultdef.needs_inittable and
+            not paramanager.ret_in_param(resultdef,procdefinition.proccalloption) and
             not assigned(funcretnode) then
            begin
-             tg.gettemptyped(current_asmdata.CurrAsmList,resulttype.def,tt_normal,refcountedtemp);
+             tg.gettemptyped(current_asmdata.CurrAsmList,resultdef,tt_normal,refcountedtemp);
              { finalize instead of only decrref,  because if the called }
              { function throws an exception this temp will be decrref'd }
              { again (tw7100)                                           }
-             cg.g_finalize(current_asmdata.CurrAsmList,resulttype.def,refcountedtemp);
+             cg.g_finalize(current_asmdata.CurrAsmList,resultdef,refcountedtemp);
            end;
 
          regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
@@ -849,7 +849,7 @@ implementation
          regs_to_save_mm:=paramanager.get_volatile_registers_mm(procdefinition.proccalloption);
 
          { Include Function result registers }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
           begin
             case procdefinition.funcretloc[callerside].loc of
               LOC_REGISTER,
@@ -894,8 +894,8 @@ implementation
                  secondpass(methodpointer);
 
                  { Load VMT from self }
-                 if methodpointer.resulttype.def.deftype=objectdef then
-                   gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(methodpointer.resulttype.def),methodpointer.location,vmtreg)
+                 if methodpointer.resultdef.deftype=objectdef then
+                   gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(methodpointer.resultdef),methodpointer.location,vmtreg)
                  else
                    begin
                      { Load VMT value in register }
@@ -1024,7 +1024,7 @@ implementation
             pop_size:=pushedparasize;
             { for Cdecl functions we don't need to pop the funcret when it
               was pushed by para }
-            if paramanager.ret_in_param(procdefinition.rettype.def,procdefinition.proccalloption) then
+            if paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) then
               dec(pop_size,sizeof(aint));
             { Remove parameters/alignment from the stack }
             pop_parasize(pop_size);
@@ -1032,7 +1032,7 @@ implementation
 
          { Release registers, but not the registers that contain the
            function result }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
            begin
              case procdefinition.funcretloc[callerside].loc of
                LOC_REGISTER,
@@ -1081,7 +1081,7 @@ implementation
          cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
 
          { handle function results }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
            handle_return_value
          else
            location_reset(location,LOC_VOID,OS_NO);

+ 34 - 34
compiler/ncgcnv.pas

@@ -47,11 +47,11 @@ interface
          procedure second_class_to_intf;override;
          procedure second_char_to_char;override;
          procedure second_nothing;override;
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
        end;
 
        tcgasnode = class(tasnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
        end;
 
   implementation
@@ -76,19 +76,19 @@ interface
         ressize,
         leftsize : longint;
       begin
-        newsize:=def_cgsize(resulttype.def);
+        newsize:=def_cgsize(resultdef);
 
         { insert range check if not explicit conversion }
         if not(nf_explicit in flags) then
-          cg.g_rangecheck(current_asmdata.CurrAsmList,left.location,left.resulttype.def,resulttype.def);
+          cg.g_rangecheck(current_asmdata.CurrAsmList,left.location,left.resultdef,resultdef);
 
         { is the result size smaller? when typecasting from void
           we always reuse the current location, because there is
           nothing that we can load in a register }
-        ressize := resulttype.def.size;
-        leftsize := left.resulttype.def.size;
+        ressize := resultdef.size;
+        leftsize := left.resultdef.size;
         if (ressize<>leftsize) and
-           not is_void(left.resulttype.def) then
+           not is_void(left.resultdef) then
           begin
             location_copy(location,left.location);
             { reuse a loc_reference when the newsize is smaller than
@@ -103,7 +103,7 @@ interface
             else
               location_force_reg(current_asmdata.CurrAsmList,location,newsize,false);
 {$ifndef cpu64bit}
-            // if is_signed(left.resulttype) and
+            // if is_signed(left.resultdef) and
 {$endif cpu64bit}
           end
         else
@@ -116,7 +116,7 @@ interface
             { which don't have 8bit register components etc) (JM)    }
             location_copy(location,left.location);
             location.size:=newsize;
-            orgsize := def_cgsize(left.resulttype.def);
+            orgsize := def_cgsize(left.resultdef);
             if (ressize < tcgsize2size[OS_INT]) and
                (location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
                (orgsize <> newsize) then
@@ -200,12 +200,12 @@ interface
 
     procedure tcgtypeconvnode.second_string_to_chararray;
       begin
-        if is_chararray(left.resulttype.def) then
+        if is_chararray(left.resultdef) then
           begin
             location_copy(location,left.location);
             exit;
           end;
-        { should be handled already in resulttype pass (JM) }
+        { should be handled already in resultdef pass (JM) }
         internalerror(200108292);
       end;
 
@@ -260,7 +260,7 @@ interface
     procedure tcgtypeconvnode.second_char_to_string;
       begin
          location_reset(location,LOC_REFERENCE,OS_NO);
-         case tstringdef(resulttype.def).string_typ of
+         case tstringdef(resultdef).string_typ of
            st_shortstring :
              begin
                tg.GetTemp(current_asmdata.CurrAsmList,256,tt_normal,location.reference);
@@ -268,7 +268,7 @@ interface
                  location.reference);
                location_freetemp(current_asmdata.CurrAsmList,left.location);
              end;
-           { the rest is removed in the resulttype pass and converted to compilerprocs }
+           { the rest is removed in the resultdef pass and converted to compilerprocs }
            else
             internalerror(4179);
         end;
@@ -277,7 +277,7 @@ interface
 
     procedure tcgtypeconvnode.second_real_to_real;
       begin
-         location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+         location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
 {$ifdef x86}
          { extended types in memory which should be loaded into the sse unit
            must be converted by the fpu first, so force them to be loaded into
@@ -292,7 +292,7 @@ interface
             LOC_CFPUREGISTER:
               begin
                 location_copy(location,left.location);
-                location.size:=def_cgsize(resulttype.def);
+                location.size:=def_cgsize(resultdef);
                 case expectloc of
                   LOC_FPUREGISTER:
                     ;
@@ -308,7 +308,7 @@ interface
               begin
                  if expectloc=LOC_MMREGISTER then
                    begin
-                     location_reset(location,LOC_MMREGISTER,def_cgsize(resulttype.def));
+                     location_reset(location,LOC_MMREGISTER,def_cgsize(resultdef));
                      location.register:=cg.getmmregister(current_asmdata.CurrAsmList,location.size);
                      cg.a_loadmm_loc_reg(current_asmdata.CurrAsmList,location.size,left.location,location.register,mms_movescalar)
                    end
@@ -327,7 +327,7 @@ interface
                   LOC_FPUREGISTER:
                     begin
                       location_force_fpureg(current_asmdata.CurrAsmList,location,false);
-                      location.size:=def_cgsize(resulttype.def);
+                      location.size:=def_cgsize(resultdef);
                     end;
                   LOC_MMREGISTER:
                     ;
@@ -351,7 +351,7 @@ interface
 
     procedure tcgtypeconvnode.second_proc_to_procvar;
       begin
-        if tabstractprocdef(resulttype.def).is_addressonly then
+        if tabstractprocdef(resultdef).is_addressonly then
           begin
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
@@ -375,9 +375,9 @@ interface
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { be accepted for var parameters                            }
          if not((nf_explicit in flags) and
-                (left.resulttype.def.size=resulttype.def.size) and
+                (left.resultdef.size=resultdef.size) and
                 (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER])) then
-           location_force_reg(current_asmdata.CurrAsmList,location,def_cgsize(resulttype.def),false);
+           location_force_reg(current_asmdata.CurrAsmList,location,def_cgsize(resultdef),false);
          current_procinfo.CurrTrueLabel:=oldTrueLabel;
          current_procinfo.CurrFalseLabel:=oldFalseLabel;
       end;
@@ -400,7 +400,7 @@ interface
             location_copy(location,left.location);
           end
          else
-           if resulttype.def.size<left.resulttype.def.size then
+           if resultdef.size<left.resultdef.size then
              second_int_to_bool
            else
              second_bool_to_int;
@@ -470,14 +470,14 @@ interface
          end;
          current_asmdata.getjumplabel(l1);
          cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,location.register,l1);
-         hd:=tobjectdef(left.resulttype.def);
+         hd:=tobjectdef(left.resultdef);
          while assigned(hd) do
            begin
-              if hd.implementedinterfaces.searchintf(resulttype.def)<>-1 then
+              if hd.implementedinterfaces.searchintf(resultdef)<>-1 then
                 begin
                    cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR,
                      hd.implementedinterfaces.ioffsets(
-                       hd.implementedinterfaces.searchintf(resulttype.def)),location.register);
+                       hd.implementedinterfaces.searchintf(resultdef)),location.register);
                    break;
                 end;
               hd:=hd.childof;
@@ -509,17 +509,17 @@ interface
           or the other way round, move to memory first to prevent
           invalid LOC_FPUREGISTER locations }
         if (
-            (resulttype.def.deftype=floatdef) and
+            (resultdef.deftype=floatdef) and
             (location.loc=LOC_CONSTANT)
            ) or
            (
-            (left.resulttype.def.deftype=floatdef) xor
-            (resulttype.def.deftype=floatdef)
+            (left.resultdef.deftype=floatdef) xor
+            (resultdef.deftype=floatdef)
            ) then
           location_force_mem(current_asmdata.CurrAsmList,location);
 
         { but use the new size, but we don't know the size of all arrays }
-        newsize:=def_cgsize(resulttype.def);
+        newsize:=def_cgsize(resultdef);
         location.size:=newsize;
       end;
 
@@ -532,7 +532,7 @@ interface
 {$endif TESTOBJEXT2}
 
 
-    procedure tcgtypeconvnode.pass_2;
+    procedure tcgtypeconvnode.pass_generate_code;
       begin
         { the boolean routines can be called with LOC_JUMP and
           call secondpass themselves in the helper }
@@ -548,17 +548,17 @@ interface
 {$ifdef TESTOBJEXT2}
          { Check explicit conversions to objects pointers !! }
          if p^.explizit and
-            (p^.resulttype.def.deftype=pointerdef) and
-            (tpointerdef(p^.resulttype.def).definition.deftype=objectdef) and not
-            (tobjectdef(tpointerdef(p^.resulttype.def).definition).isclass) and
-            ((tobjectdef(tpointerdef(p^.resulttype.def).definition).options and oo_hasvmt)<>0) and
+            (p^.resultdef.deftype=pointerdef) and
+            (tpointerdef(p^.resultdef).definition.deftype=objectdef) and not
+            (tobjectdef(tpointerdef(p^.resultdef).definition).isclass) and
+            ((tobjectdef(tpointerdef(p^.resultdef).definition).options and oo_hasvmt)<>0) and
             (cs_check_range in aktlocalswitches) then
            checkobject;
 {$endif TESTOBJEXT2}
       end;
 
 
-    procedure tcgasnode.pass_2;
+    procedure tcgasnode.pass_generate_code;
       begin
         secondpass(call);
         location_copy(location,call.location);

+ 25 - 25
compiler/ncgcon.pas

@@ -31,31 +31,31 @@ interface
 
     type
        tcgrealconstnode = class(trealconstnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgordconstnode = class(tordconstnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgpointerconstnode = class(tpointerconstnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgstringconstnode = class(tstringconstnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgsetconstnode = class(tsetconstnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgnilnode = class(tnilnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgguidconstnode = class(tguidconstnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
 
@@ -75,7 +75,7 @@ implementation
                            TCGREALCONSTNODE
 *****************************************************************************}
 
-    procedure tcgrealconstnode.pass_2;
+    procedure tcgrealconstnode.pass_generate_code;
       { I suppose the parser/pass_1 must make sure the generated real  }
       { constants are actually supported by the target processor? (JM) }
       const
@@ -90,9 +90,9 @@ implementation
 {$endif ARM}
 
       begin
-        location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
+        location_reset(location,LOC_CREFERENCE,def_cgsize(resultdef));
         lastlabel:=nil;
-        realait:=floattype2ait[tfloatdef(resulttype.def).typ];
+        realait:=floattype2ait[tfloatdef(resultdef).typ];
 {$ifdef ARM}
         hiloswapped:=aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11];
 {$endif ARM}
@@ -139,7 +139,7 @@ implementation
                   current_asmdata.getdatalabel(lastlabel);
                   lab_real:=lastlabel;
                   maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]);
-                  new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata,lastlabel.name,const_align(resulttype.def.size));
+                  new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata,lastlabel.name,const_align(resultdef.size));
                   current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel));
                   case realait of
                     ait_real_32bit :
@@ -209,9 +209,9 @@ implementation
                             TCGORDCONSTNODE
 *****************************************************************************}
 
-    procedure tcgordconstnode.pass_2;
+    procedure tcgordconstnode.pass_generate_code;
       begin
-         location_reset(location,LOC_CONSTANT,def_cgsize(resulttype.def));
+         location_reset(location,LOC_CONSTANT,def_cgsize(resultdef));
 {$ifdef cpu64bit}
          location.value:=value;
 {$else cpu64bit}
@@ -224,7 +224,7 @@ implementation
                           TCGPOINTERCONSTNODE
 *****************************************************************************}
 
-    procedure tcgpointerconstnode.pass_2;
+    procedure tcgpointerconstnode.pass_generate_code;
       begin
          { an integer const. behaves as a memory reference }
          location_reset(location,LOC_CONSTANT,OS_ADDR);
@@ -236,7 +236,7 @@ implementation
                           TCGSTRINGCONSTNODE
 *****************************************************************************}
 
-    procedure tcgstringconstnode.pass_2;
+    procedure tcgstringconstnode.pass_generate_code;
       var
          hp1,hp2 : tai;
          l1,l2,
@@ -255,18 +255,18 @@ implementation
             exit;
           end;
          { return a constant reference in memory }
-         location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
+         location_reset(location,LOC_CREFERENCE,def_cgsize(resultdef));
          { const already used ? }
          lastlabel:=nil;
          lastlabelhp:=nil;
          if not assigned(lab_str) then
            begin
-              if is_shortstring(resulttype.def) then
+              if is_shortstring(resultdef) then
                 mylength:=len+2
               else
                 mylength:=len+1;
               { widestrings can't be reused yet }
-              if not(is_widestring(resulttype.def)) then
+              if not(is_widestring(resultdef)) then
                 begin
                   { tries to find an old entry }
                   hp1:=tai(current_asmdata.asmlists[al_typedconsts].first);
@@ -428,11 +428,11 @@ implementation
                                 { at least for now                          }
                                 { Consts.concat(Tai_const.Create_8bit(2)); }
                                 if tf_winlikewidestring in target_info.flags then
-                                  current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(len*cwidechartype.def.size))
+                                  current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(len*cwidechartype.size))
                                 else
                                   begin
                                     current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(-1));
-                                    current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(len*cwidechartype.def.size));
+                                    current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(len*cwidechartype.size));
                                   end;
                                 current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1));
                                 for i:=0 to len-1 do
@@ -476,7 +476,7 @@ implementation
                            TCGSETCONSTNODE
 *****************************************************************************}
 
-    procedure tcgsetconstnode.pass_2;
+    procedure tcgsetconstnode.pass_generate_code;
       var
          hp1         : tai;
          lastlabel   : tasmlabel;
@@ -495,7 +495,7 @@ implementation
         else
           indexadjust := 3;
         { small sets are loaded as constants }
-        if tsetdef(resulttype.def).settype=smallset then
+        if tsetdef(resultdef).settype=smallset then
          begin
            location_reset(location,LOC_CONSTANT,OS_32);
            location.value:=pLongint(value_set)^;
@@ -565,7 +565,7 @@ implementation
                  new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata,lastlabel.name,const_align(sizeof(aint)));
                  current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel));
                  { already handled at the start of this method?? (JM)
-                 if tsetdef(resulttype.def).settype=smallset then
+                 if tsetdef(resultdef).settype=smallset then
                   begin
                     move(value_set^,i,sizeof(longint));
                     Consts.concat(Tai_const.Create_32bit(i));
@@ -586,7 +586,7 @@ implementation
                              TCGNILNODE
 *****************************************************************************}
 
-    procedure tcgnilnode.pass_2;
+    procedure tcgnilnode.pass_generate_code;
       begin
          location_reset(location,LOC_CONSTANT,OS_ADDR);
          location.value:=0;
@@ -597,7 +597,7 @@ implementation
                           TCGPOINTERCONSTNODE
 *****************************************************************************}
 
-    procedure tcgguidconstnode.pass_2;
+    procedure tcgguidconstnode.pass_generate_code;
       var
         tmplabel : TAsmLabel;
         i : integer;

+ 27 - 27
compiler/ncgflw.pas

@@ -31,37 +31,37 @@ interface
 
     type
        tcgwhilerepeatnode = class(twhilerepeatnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
           procedure sync_regvars(checkusedregvars: boolean);
 
           usedregvars: tusedregvars;
        end;
 
        tcgifnode = class(tifnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgfornode = class(tfornode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
           procedure sync_regvars(checkusedregvars: boolean);
 
           usedregvars: tusedregvars;
        end;
 
        tcgexitnode = class(texitnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgbreaknode = class(tbreaknode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgcontinuenode = class(tcontinuenode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcggotonode = class(tgotonode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcglabelnode = class(tlabelnode)
@@ -69,23 +69,23 @@ interface
           asmlabel : tasmlabel;
        public
           function getasmlabel : tasmlabel;
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgraisenode = class(traisenode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgtryexceptnode = class(ttryexceptnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgtryfinallynode = class(ttryfinallynode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgonnode = class(tonnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
 implementation
@@ -132,7 +132,7 @@ implementation
       end;
 
 
-    procedure tcgwhilerepeatnode.pass_2;
+    procedure tcgwhilerepeatnode.pass_generate_code;
       var
          lcont,lbreak,lloop,
          oldclabel,oldblabel : tasmlabel;
@@ -208,7 +208,7 @@ implementation
                                tcgIFNODE
 *****************************************************************************}
 
-    procedure tcgifnode.pass_2;
+    procedure tcgifnode.pass_generate_code;
 
       var
          hl,otlabel,oflabel : tasmlabel;
@@ -407,7 +407,7 @@ implementation
       end;
 
 
-    procedure tcgfornode.pass_2;
+    procedure tcgfornode.pass_generate_code;
       var
          l3,oldclabel,oldblabel : tasmlabel;
          temptovalue : boolean;
@@ -429,8 +429,8 @@ implementation
          current_asmdata.getjumplabel(l3);
 
          { only calculate reference }
-         opsize := def_cgsize(left.resulttype.def);
-         count_var_is_signed:=is_signed(left.resulttype.def);
+         opsize := def_cgsize(left.resultdef);
+         count_var_is_signed:=is_signed(left.resultdef);
 
          { first set the to value
            because the count var can be in the expression ! }
@@ -773,7 +773,7 @@ implementation
                               SecondExitN
 *****************************************************************************}
 
-    procedure tcgexitnode.pass_2;
+    procedure tcgexitnode.pass_generate_code;
       begin
          location_reset(location,LOC_VOID,OS_NO);
 
@@ -789,7 +789,7 @@ implementation
                               SecondBreakN
 *****************************************************************************}
 
-    procedure tcgbreaknode.pass_2;
+    procedure tcgbreaknode.pass_generate_code;
       begin
          location_reset(location,LOC_VOID,OS_NO);
 
@@ -810,7 +810,7 @@ implementation
                               SecondContinueN
 *****************************************************************************}
 
-    procedure tcgcontinuenode.pass_2;
+    procedure tcgcontinuenode.pass_generate_code;
       begin
          location_reset(location,LOC_VOID,OS_NO);
 
@@ -831,7 +831,7 @@ implementation
                              SecondGoto
 *****************************************************************************}
 
-    procedure tcggotonode.pass_2;
+    procedure tcggotonode.pass_generate_code;
 
        begin
          location_reset(location,LOC_VOID,OS_NO);
@@ -856,7 +856,7 @@ implementation
       end;
 
 
-    procedure tcglabelnode.pass_2;
+    procedure tcglabelnode.pass_generate_code;
       begin
          location_reset(location,LOC_VOID,OS_NO);
 
@@ -873,7 +873,7 @@ implementation
                              SecondRaise
 *****************************************************************************}
 
-    procedure tcgraisenode.pass_2;
+    procedure tcgraisenode.pass_generate_code;
 
       var
          a : tasmlabel;
@@ -980,7 +980,7 @@ implementation
       end;
 
 
-    procedure tcgtryexceptnode.pass_2;
+    procedure tcgtryexceptnode.pass_generate_code;
 
       var
          exceptlabel,doexceptlabel,oldendexceptlabel,
@@ -1228,7 +1228,7 @@ implementation
       end;
 
 
-    procedure tcgonnode.pass_2;
+    procedure tcgonnode.pass_generate_code;
       var
          nextonlabel,
          exitonlabel,
@@ -1270,7 +1270,7 @@ implementation
            begin
              tlocalvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_REFERENCE;
              tlocalvarsym(exceptsymtable.symindex.first).localloc.size:=OS_ADDR;
-             tg.GetLocal(current_asmdata.CurrAsmList,sizeof(aint),voidpointertype.def,
+             tg.GetLocal(current_asmdata.CurrAsmList,sizeof(aint),voidpointertype,
                 tlocalvarsym(exceptsymtable.symindex.first).localloc.reference);
              cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference);
            end
@@ -1384,7 +1384,7 @@ implementation
                              SecondTryFinally
 *****************************************************************************}
 
-    procedure tcgtryfinallynode.pass_2;
+    procedure tcgtryfinallynode.pass_generate_code;
       var
          reraiselabel,
          finallylabel,

+ 27 - 27
compiler/ncginl.pas

@@ -30,7 +30,7 @@ interface
 
     type
        tcginlinenode = class(tinlinenode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
           procedure second_assert;virtual;
           procedure second_sizeoftypeof;virtual;
           procedure second_length;virtual;
@@ -76,7 +76,7 @@ implementation
 *****************************************************************************}
 
 
-    procedure tcginlinenode.pass_2;
+    procedure tcginlinenode.pass_generate_code;
       begin
          location_reset(location,LOC_VOID,OS_NO);
 
@@ -250,7 +250,7 @@ implementation
         if left.nodetype=typen then
           begin
             hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
-            reference_reset_symbol(href,current_asmdata.RefAsmSymbol(tobjectdef(left.resulttype.def).vmt_mangledname),0);
+            reference_reset_symbol(href,current_asmdata.RefAsmSymbol(tobjectdef(left.resultdef).vmt_mangledname),0);
             cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
           end
         else
@@ -263,33 +263,33 @@ implementation
               LOC_CREGISTER,
               LOC_REGISTER :
                 begin
-                  if (left.resulttype.def.deftype=classrefdef) or
+                  if (left.resultdef.deftype=classrefdef) or
                      (po_staticmethod in current_procinfo.procdef.procoptions) then
                     cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.register,hregister)
                   else
                    begin
                      { load VMT pointer }
-                     reference_reset_base(hrefvmt,left.location.register,tobjectdef(left.resulttype.def).vmt_offset);
+                     reference_reset_base(hrefvmt,left.location.register,tobjectdef(left.resultdef).vmt_offset);
                      cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hrefvmt,hregister);
                    end
                 end;
               LOC_REFERENCE,
               LOC_CREFERENCE :
                 begin
-                  if is_class(left.resulttype.def) then
+                  if is_class(left.resultdef) then
                    begin
                      { deref class }
                      cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,hregister);
                      cg.g_maybe_testself(current_asmdata.CurrAsmList,hregister);
                      { load VMT pointer }
-                     reference_reset_base(hrefvmt,hregister,tobjectdef(left.resulttype.def).vmt_offset);
+                     reference_reset_base(hrefvmt,hregister,tobjectdef(left.resultdef).vmt_offset);
                      cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hrefvmt,hregister);
                    end
                   else
                    begin
                      { load VMT pointer, but not for classrefdefs }
-                     if (left.resulttype.def.deftype=objectdef) then
-                       inc(left.location.reference.offset,tobjectdef(left.resulttype.def).vmt_offset);
+                     if (left.resultdef.deftype=objectdef) then
+                       inc(left.location.reference.offset,tobjectdef(left.resultdef).vmt_offset);
                      cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,hregister);
                    end;
                 end;
@@ -320,7 +320,7 @@ implementation
         href : treference;
       begin
         secondpass(left);
-        if is_shortstring(left.resulttype.def) then
+        if is_shortstring(left.resultdef) then
          begin
            location_copy(location,left.location);
            location.size:=OS_8;
@@ -331,7 +331,7 @@ implementation
            location_force_reg(current_asmdata.CurrAsmList,left.location,OS_ADDR,false);
            current_asmdata.getjumplabel(lengthlab);
            cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,left.location.register,lengthlab);
-           if is_widestring(left.resulttype.def) and (tf_winlikewidestring in target_info.flags) then
+           if is_widestring(left.resultdef) and (tf_winlikewidestring in target_info.flags) then
              begin
                reference_reset_base(href,left.location.register,-sizeof(dword));
                hregister:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_INT);
@@ -343,7 +343,7 @@ implementation
                hregister:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_INT);
                cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hregister);
              end;
-           if is_widestring(left.resulttype.def) then
+           if is_widestring(left.resultdef) then
              cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,1,hregister);
            cg.a_label(current_asmdata.CurrAsmList,lengthlab);
            location_reset(location,LOC_REGISTER,OS_INT);
@@ -366,7 +366,7 @@ implementation
            cgop:=OP_SUB
         else
            cgop:=OP_ADD;
-        cgsize:=def_cgsize(resulttype.def);
+        cgsize:=def_cgsize(resultdef);
 
         { we need a value in a register }
         location_copy(location,left.location);
@@ -379,7 +379,7 @@ implementation
 {$endif cpu64bit}
           cg.a_op_const_reg(current_asmdata.CurrAsmList,cgop,location.size,1,location.register);
 
-        cg.g_rangecheck(current_asmdata.CurrAsmList,location,resulttype.def,resulttype.def);
+        cg.g_rangecheck(current_asmdata.CurrAsmList,location,resultdef,resultdef);
       end;
 
 
@@ -407,18 +407,18 @@ implementation
             secondpass(tcallparanode(tcallparanode(left).right).left);
           { load first parameter, must be a reference }
           secondpass(tcallparanode(left).left);
-          cgsize:=def_cgsize(tcallparanode(left).left.resulttype.def);
+          cgsize:=def_cgsize(tcallparanode(left).left.resultdef);
           { get addvalue }
-          case tcallparanode(left).left.resulttype.def.deftype of
+          case tcallparanode(left).left.resultdef.deftype of
             orddef,
             enumdef :
                 addvalue:=1;
             pointerdef :
                begin
-                 if is_void(tpointerdef(tcallparanode(left).left.resulttype.def).pointertype.def) then
+                 if is_void(tpointerdef(tcallparanode(left).left.resultdef).pointeddef) then
                    addvalue:=1
                  else
-                   addvalue:=tpointerdef(tcallparanode(left).left.resulttype.def).pointertype.def.size;
+                   addvalue:=tpointerdef(tcallparanode(left).left.resultdef).pointeddef.size;
                end;
            else
                internalerror(10081);
@@ -464,9 +464,9 @@ implementation
                  cg.a_op_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],
                    hregister,tcallparanode(left).left.location);
              end;
-          cg.g_overflowcheck(current_asmdata.CurrAsmList,tcallparanode(left).left.location,tcallparanode(left).resulttype.def);
-          cg.g_rangecheck(current_asmdata.CurrAsmList,tcallparanode(left).left.location,tcallparanode(left).left.resulttype.def,
-              tcallparanode(left).left.resulttype.def);
+          cg.g_overflowcheck(current_asmdata.CurrAsmList,tcallparanode(left).left.location,tcallparanode(left).resultdef);
+          cg.g_rangecheck(current_asmdata.CurrAsmList,tcallparanode(left).left.location,tcallparanode(left).left.resultdef,
+              tcallparanode(left).left.resultdef);
         end;
 
 
@@ -479,7 +479,7 @@ implementation
         begin
           location_reset(location,LOC_REGISTER,OS_ADDR);
           location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-          reference_reset_symbol(href,tstoreddef(left.resulttype.def).get_rtti_label(fullrtti),0);
+          reference_reset_symbol(href,tstoreddef(left.resultdef).get_rtti_label(fullrtti),0);
           cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
         end;
 
@@ -531,13 +531,13 @@ implementation
             begin
               use_small:=
                  { set type }
-                 (tsetdef(tcallparanode(left).left.resulttype.def).settype=smallset)
+                 (tsetdef(tcallparanode(left).left.resultdef).settype=smallset)
                   and
                    { elemenut number between 1 and 32 }
-                  ((tcallparanode(tcallparanode(left).right).left.resulttype.def.deftype=orddef) and
-                   (torddef(tcallparanode(tcallparanode(left).right).left.resulttype.def).high<=32) or
-                   (tcallparanode(tcallparanode(left).right).left.resulttype.def.deftype=enumdef) and
-                   (tenumdef(tcallparanode(tcallparanode(left).right).left.resulttype.def).max<=32));
+                  ((tcallparanode(tcallparanode(left).right).left.resultdef.deftype=orddef) and
+                   (torddef(tcallparanode(tcallparanode(left).right).left.resultdef).high<=32) or
+                   (tcallparanode(tcallparanode(left).right).left.resultdef.deftype=enumdef) and
+                   (tenumdef(tcallparanode(tcallparanode(left).right).left.resultdef).max<=32));
 
               { generate code for the element to set }
               secondpass(tcallparanode(tcallparanode(left).right).left);

+ 48 - 48
compiler/ncgld.pas

@@ -31,20 +31,20 @@ interface
 
     type
        tcgloadnode = class(tloadnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
           procedure generate_picvaraccess;virtual;
        end;
 
        tcgassignmentnode = class(tassignmentnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgarrayconstructornode = class(tarrayconstructornode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgrttinode = class(trttinode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
 
@@ -77,7 +77,7 @@ implementation
       end;
 
 
-    procedure tcgloadnode.pass_2;
+    procedure tcgloadnode.pass_generate_code;
       var
         hregister : tregister;
         symtabletype : tsymtabletype;
@@ -89,7 +89,7 @@ implementation
       begin
 
          { we don't know the size of all arrays }
-         newsize:=def_cgsize(resulttype.def);
+         newsize:=def_cgsize(resultdef);
          location_reset(location,LOC_REFERENCE,newsize);
          case symtableentry.typ of
             absolutevarsym :
@@ -221,12 +221,12 @@ implementation
                             case getregtype(tvarsym(symtableentry).localloc.register) of
                               R_FPUREGISTER :
                                 begin
-                                  location_reset(location,LOC_CFPUREGISTER,def_cgsize(resulttype.def));
+                                  location_reset(location,LOC_CFPUREGISTER,def_cgsize(resultdef));
                                   location.register:=tvarsym(symtableentry).localloc.register;
                                 end;
                               R_INTREGISTER :
                                 begin
-                                  location_reset(location,LOC_CREGISTER,def_cgsize(resulttype.def));
+                                  location_reset(location,LOC_CREGISTER,def_cgsize(resultdef));
                                   location.register:=tvarsym(symtableentry).localloc.register;
                                   hregister := location.register;
                                 end;
@@ -319,7 +319,7 @@ implementation
                          LOC_REGISTER:
                            begin
                               { this is not possible for objects }
-                              if is_object(left.resulttype.def) then
+                              if is_object(left.resultdef) then
                                 internalerror(200304234);
                               hregister:=left.location.register;
                            end;
@@ -327,7 +327,7 @@ implementation
                          LOC_REFERENCE:
                            begin
                               hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
-                              if is_class_or_interface(left.resulttype.def) then
+                              if is_class_or_interface(left.resultdef) then
                                 cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,hregister)
                               else
                                 cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,hregister);
@@ -388,7 +388,7 @@ implementation
                              SecondAssignment
 *****************************************************************************}
 
-    procedure tcgassignmentnode.pass_2;
+    procedure tcgassignmentnode.pass_generate_code;
       var
          otlabel,hlabel,oflabel : tasmlabel;
          fputyp : tfloattype;
@@ -421,18 +421,18 @@ implementation
         }
         if not(right.expectloc in [LOC_FLAGS,LOC_JUMP]) and
            ((right.nodetype=calln) or
-            (right.resulttype.def.needs_inittable) or
+            (right.resultdef.needs_inittable) or
             (right.registersint>=left.registersint)) then
          begin
            secondpass(right);
            { increment source reference counter, this is
              useless for string constants}
-           if (right.resulttype.def.needs_inittable) and
+           if (right.resultdef.needs_inittable) and
               (right.nodetype<>stringconstn) then
             begin
               location_force_mem(current_asmdata.CurrAsmList,right.location);
               location_get_data_ref(current_asmdata.CurrAsmList,right.location,href,false);
-              cg.g_incrrefcount(current_asmdata.CurrAsmList,right.resulttype.def,href);
+              cg.g_incrrefcount(current_asmdata.CurrAsmList,right.resultdef,href);
             end;
            if codegenerror then
              exit;
@@ -441,10 +441,10 @@ implementation
            { can be false                                             }
            secondpass(left);
            { decrement destination reference counter }
-           if (left.resulttype.def.needs_inittable) then
+           if (left.resultdef.needs_inittable) then
              begin
                location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false);
-               cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resulttype.def,href);
+               cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
              end;
            if codegenerror then
              exit;
@@ -454,10 +454,10 @@ implementation
            { calculate left sides }
            secondpass(left);
            { decrement destination reference counter }
-           if (left.resulttype.def.needs_inittable) then
+           if (left.resultdef.needs_inittable) then
              begin
                location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false);
-               cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resulttype.def,href);
+               cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
              end;
            if codegenerror then
              exit;
@@ -467,12 +467,12 @@ implementation
            secondpass(right);
            { increment source reference counter, this is
              useless for string constants}
-           if (right.resulttype.def.needs_inittable) and
+           if (right.resultdef.needs_inittable) and
               (right.nodetype<>stringconstn) then
              begin
                location_force_mem(current_asmdata.CurrAsmList,right.location);
                location_get_data_ref(current_asmdata.CurrAsmList,right.location,href,false);
-               cg.g_incrrefcount(current_asmdata.CurrAsmList,right.resulttype.def,href);
+               cg.g_incrrefcount(current_asmdata.CurrAsmList,right.resultdef,href);
              end;
 
            if codegenerror then
@@ -501,7 +501,7 @@ implementation
         else
 {$endif old_append_str}
 
-        if is_shortstring(left.resulttype.def) then
+        if is_shortstring(left.resultdef) then
           begin
             {
               we can get here only in the following situations
@@ -522,7 +522,7 @@ implementation
                 cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_8,0,left.location.reference);
               end
             { char loading }
-            else if is_char(right.resulttype.def) then
+            else if is_char(right.resultdef) then
               begin
                 if right.nodetype=ordconstn then
                   begin
@@ -598,10 +598,10 @@ implementation
                       begin
 {$warning HACK: unaligned test, maybe remove all unaligned locations (array of char) from the compiler}
                         { Use unaligned copy when the offset is not aligned }
-                        len:=left.resulttype.def.size;
+                        len:=left.resultdef.size;
                         if (right.location.reference.offset mod sizeof(aint)<>0) or
                           (left.location.reference.offset mod sizeof(aint)<>0) or
-                          (right.resulttype.def.alignment<sizeof(aint)) then
+                          (right.resultdef.alignment<sizeof(aint)) then
                           cg.g_concatcopy_unaligned(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len)
                         else
                           cg.g_concatcopy(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len);
@@ -641,7 +641,7 @@ implementation
               LOC_MMREGISTER,
               LOC_CMMREGISTER:
                 begin
-                  if left.resulttype.def.deftype=arraydef then
+                  if left.resultdef.deftype=arraydef then
                     begin
                     end
                   else
@@ -666,15 +666,15 @@ implementation
               LOC_FPUREGISTER,
               LOC_CFPUREGISTER :
                 begin
-                  if (left.resulttype.def.deftype=floatdef) then
-                   fputyp:=tfloatdef(left.resulttype.def).typ
+                  if (left.resultdef.deftype=floatdef) then
+                   fputyp:=tfloatdef(left.resultdef).typ
                   else
-                   if (right.resulttype.def.deftype=floatdef) then
-                    fputyp:=tfloatdef(right.resulttype.def).typ
+                   if (right.resultdef.deftype=floatdef) then
+                    fputyp:=tfloatdef(right.resultdef).typ
                   else
                    if (right.nodetype=typeconvn) and
-                      (ttypeconvnode(right).left.resulttype.def.deftype=floatdef) then
-                    fputyp:=tfloatdef(ttypeconvnode(right).left.resulttype.def).typ
+                      (ttypeconvnode(right).left.resultdef.deftype=floatdef) then
+                    fputyp:=tfloatdef(ttypeconvnode(right).left.resultdef).typ
                   else
                     fputyp:=s32real;
                   { we can't do direct moves between fpu and mm registers }
@@ -723,14 +723,14 @@ implementation
                   {This can be a wordbool or longbool too, no?}
                   case left.location.loc of
                     LOC_REGISTER,LOC_CREGISTER:
-                      cg.g_flags2reg(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),right.location.resflags,left.location.register);
+                      cg.g_flags2reg(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),right.location.resflags,left.location.register);
                     LOC_REFERENCE:
-                      cg.g_flags2ref(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),right.location.resflags,left.location.reference);
+                      cg.g_flags2ref(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),right.location.resflags,left.location.reference);
                     LOC_SUBSETREG,LOC_SUBSETREF:
                       begin
-                        r:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def));
-                        cg.g_flags2reg(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),right.location.resflags,r);
-                        cg.a_load_reg_loc(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),r,left.location);
+                        r:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(left.resultdef));
+                        cg.g_flags2reg(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),right.location.resflags,r);
+                        cg.a_load_reg_loc(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),r,left.location);
                       end;
                     else
                       internalerror(200203273);
@@ -774,7 +774,7 @@ implementation
         vtAnsiString16 = 18;
         vtAnsiString64 = 19;
 
-    procedure tcgarrayconstructornode.pass_2;
+    procedure tcgarrayconstructornode.pass_generate_code;
       var
         hp    : tarrayconstructornode;
         href  : treference;
@@ -787,21 +787,21 @@ implementation
         tmpreg  : tregister;
         paraloc : tcgparalocation;
       begin
-        if is_packed_array(resulttype.def) then
+        if is_packed_array(resultdef) then
           internalerror(200608042);
-        dovariant:=(nf_forcevaria in flags) or is_variant_array(resulttype.def);
+        dovariant:=(nf_forcevaria in flags) or is_variant_array(resultdef);
         if dovariant then
           elesize:=sizeof(aint)+sizeof(aint)
         else
-          elesize:=tarraydef(resulttype.def).elesize;
+          elesize:=tarraydef(resultdef).elesize;
         location_reset(location,LOC_CREFERENCE,OS_NO);
         fillchar(paraloc,sizeof(paraloc),0);
         { Allocate always a temp, also if no elements are required, to
           be sure that location is valid (PFV) }
-         if tarraydef(resulttype.def).highrange=-1 then
+         if tarraydef(resultdef).highrange=-1 then
            tg.GetTemp(current_asmdata.CurrAsmList,elesize,tt_normal,location.reference)
          else
-           tg.GetTemp(current_asmdata.CurrAsmList,(tarraydef(resulttype.def).highrange+1)*elesize,tt_normal,location.reference);
+           tg.GetTemp(current_asmdata.CurrAsmList,(tarraydef(resultdef).highrange+1)*elesize,tt_normal,location.reference);
          href:=location.reference;
         { Process nodes in array constructor }
         hp:=self;
@@ -815,13 +815,13 @@ implementation
                exit;
               { Move flags and jump in register }
               if hp.left.location.loc in [LOC_FLAGS,LOC_JUMP] then
-                location_force_reg(current_asmdata.CurrAsmList,hp.left.location,def_cgsize(hp.left.resulttype.def),false);
+                location_force_reg(current_asmdata.CurrAsmList,hp.left.location,def_cgsize(hp.left.resultdef),false);
               if dovariant then
                begin
                  { find the correct vtype value }
                  vtype:=$ff;
                  vaddr:=false;
-                 lt:=hp.left.resulttype.def;
+                 lt:=hp.left.resultdef;
                  case lt.deftype of
                    enumdef,
                    orddef :
@@ -935,7 +935,7 @@ implementation
               else
               { normal array constructor of the same type }
                begin
-                 if resulttype.def.needs_inittable then
+                 if resultdef.needs_inittable then
                    freetemp:=false;
                  case hp.left.location.loc of
                    LOC_MMREGISTER,
@@ -948,9 +948,9 @@ implementation
                    LOC_REFERENCE,
                    LOC_CREFERENCE :
                      begin
-                       if is_shortstring(hp.left.resulttype.def) then
+                       if is_shortstring(hp.left.resultdef) then
                          cg.g_copyshortstring(current_asmdata.CurrAsmList,hp.left.location.reference,href,
-                             Tstringdef(hp.left.resulttype.def).len)
+                             Tstringdef(hp.left.resultdef).len)
                        else
                          cg.g_concatcopy(current_asmdata.CurrAsmList,hp.left.location.reference,href,elesize);
                      end;
@@ -979,7 +979,7 @@ implementation
                            SecondRTTI
 *****************************************************************************}
 
-    procedure tcgrttinode.pass_2;
+    procedure tcgrttinode.pass_generate_code;
       begin
         location_reset(location,LOC_CREFERENCE,OS_NO);
         location.reference.symbol:=rttidef.get_rtti_label(rttitype);

+ 31 - 31
compiler/ncgmat.pas

@@ -51,11 +51,11 @@ interface
          procedure second_integer;virtual;
          procedure second_float;virtual;
       public
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
       tcgmoddivnode = class(tmoddivnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       protected
          { This routine must do an actual 32-bit division, be it
            signed or unsigned. The result must set into the the
@@ -104,7 +104,7 @@ interface
          procedure second_64bit;virtual;
 {$endif cpu64bit}
          procedure second_integer;virtual;
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
       tcgnotnode = class(tnotnode)
@@ -118,7 +118,7 @@ interface
 {$endif cpu64bit}
          procedure second_integer;virtual;
       public
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
 
@@ -186,27 +186,27 @@ implementation
     procedure tcgunaryminusnode.second_float;
       begin
         secondpass(left);
-        location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
         case left.location.loc of
           LOC_REFERENCE,
           LOC_CREFERENCE :
             begin
               location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
               cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,
-                 def_cgsize(left.resulttype.def),
+                 def_cgsize(left.resultdef),
                  left.location.reference,location.register);
-              emit_float_sign_change(location.register,def_cgsize(left.resulttype.def));
+              emit_float_sign_change(location.register,def_cgsize(left.resultdef));
             end;
           LOC_FPUREGISTER:
             begin
                location.register:=left.location.register;
-               emit_float_sign_change(location.register,def_cgsize(left.resulttype.def));
+               emit_float_sign_change(location.register,def_cgsize(left.resultdef));
             end;
           LOC_CFPUREGISTER:
             begin
                location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
                cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,location.register);
-               emit_float_sign_change(location.register,def_cgsize(left.resulttype.def));
+               emit_float_sign_change(location.register,def_cgsize(left.resultdef));
             end;
           else
             internalerror(200306021);
@@ -224,19 +224,19 @@ implementation
       end;
 
 
-    procedure tcgunaryminusnode.pass_2;
+    procedure tcgunaryminusnode.pass_generate_code;
       begin
 {$ifndef cpu64bit}
-         if is_64bit(left.resulttype.def) then
+         if is_64bit(left.resultdef) then
            second_64bit
          else
 {$endif cpu64bit}
 {$ifdef SUPPORT_MMX}
-           if (cs_mmx in aktlocalswitches) and is_mmx_able_array(left.resulttype.def) then
+           if (cs_mmx in aktlocalswitches) and is_mmx_able_array(left.resultdef) then
              second_mmx
          else
 {$endif SUPPORT_MMX}
-           if (left.resulttype.def.deftype=floatdef) then
+           if (left.resultdef.deftype=floatdef) then
              second_float
          else
            second_integer;
@@ -259,7 +259,7 @@ implementation
 {$endif cpu64bit}
 
 
-    procedure tcgmoddivnode.pass_2;
+    procedure tcgmoddivnode.pass_generate_code;
       var
          hreg1 : tregister;
          hdenom : tregister;
@@ -277,9 +277,9 @@ implementation
          location_copy(location,left.location);
 
 {$ifndef cpu64bit}
-         if is_64bit(resulttype.def) then
+         if is_64bit(resultdef) then
            begin
-              if is_signed(left.resulttype.def) then
+              if is_signed(left.resultdef) then
                 opsize:=OS_S64
               else
                 opsize:=OS_64;
@@ -290,14 +290,14 @@ implementation
              location_force_reg(current_asmdata.CurrAsmList,location,opsize,false);
              location_copy(location,left.location);
              location_force_reg(current_asmdata.CurrAsmList,right.location,opsize,false);
-             emit64_div_reg_reg(is_signed(left.resulttype.def),
+             emit64_div_reg_reg(is_signed(left.resultdef),
                joinreg64(right.location.register64.reglo,right.location.register64.reghi),
                joinreg64(location.register64.reglo,location.register64.reghi));
            end
          else
 {$endif cpu64bit}
            begin
-              if is_signed(left.resulttype.def) then
+              if is_signed(left.resultdef) then
                 opsize:=OS_SINT
               else
                 opsize:=OS_INT;
@@ -313,7 +313,7 @@ implementation
                   { for signed numbers, the numerator must be adjusted before the
                     shift instruction, but not wih unsigned numbers! Otherwise,
                     "Cardinal($ffffffff) div 16" overflows! (JM) }
-                  If is_signed(left.resulttype.def) Then
+                  If is_signed(left.resultdef) Then
                     Begin
                       current_asmdata.getjumplabel(hl);
                       cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_GT,0,hreg1,hl);
@@ -349,14 +349,14 @@ implementation
                   paraloc1.done;
                   cg.a_label(current_asmdata.CurrAsmList,hl);
                   if nodetype = modn then
-                    emit_mod_reg_reg(is_signed(left.resulttype.def),hdenom,hreg1)
+                    emit_mod_reg_reg(is_signed(left.resultdef),hdenom,hreg1)
                   else
-                    emit_div_reg_reg(is_signed(left.resulttype.def),hdenom,hreg1);
+                    emit_div_reg_reg(is_signed(left.resultdef),hdenom,hreg1);
                 end;
               location_reset(location,LOC_REGISTER,opsize);
               location.register:=hreg1;
            end;
-        cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+        cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
       end;
 
 
@@ -387,7 +387,7 @@ implementation
          end;
          { load left operators in a register }
          location_copy(location,left.location);
-         if is_signed(left.resulttype.def) then
+         if is_signed(left.resultdef) then
            opsize:=OS_SINT
          else
            opsize:=OS_INT;
@@ -425,12 +425,12 @@ implementation
       end;
 
 
-    procedure tcgshlshrnode.pass_2;
+    procedure tcgshlshrnode.pass_generate_code;
       begin
          secondpass(left);
          secondpass(right);
 {$ifndef cpu64bit}
-         if is_64bit(left.resulttype.def) then
+         if is_64bit(left.resultdef) then
            second_64bit
          else
 {$endif cpu64bit}
@@ -446,7 +446,7 @@ implementation
     procedure tcgnotnode.second_64bit;
       begin
         secondpass(left);
-        location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false);
+        location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false);
         location_copy(location,left.location);
         { perform the NOT operation }
         cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,left.location.register64,location.register64);
@@ -457,23 +457,23 @@ implementation
     procedure tcgnotnode.second_integer;
       begin
         secondpass(left);
-        location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false);
+        location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false);
         location_copy(location,left.location);
         { perform the NOT operation }
         cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,location.register,location.register);
       end;
 
 
-    procedure tcgnotnode.pass_2;
+    procedure tcgnotnode.pass_generate_code;
       begin
-        if is_boolean(resulttype.def) then
+        if is_boolean(resultdef) then
           second_boolean
 {$ifdef SUPPORT_MMX}
-        else if (cs_mmx in aktlocalswitches) and is_mmx_able_array(left.resulttype.def) then
+        else if (cs_mmx in aktlocalswitches) and is_mmx_able_array(left.resultdef) then
           second_mmx
 {$endif SUPPORT_MMX}
 {$ifndef cpu64bit}
-        else if is_64bit(left.resulttype.def) then
+        else if is_64bit(left.resultdef) then
           second_64bit
 {$endif cpu64bit}
         else

+ 82 - 82
compiler/ncgmem.pas

@@ -32,27 +32,27 @@ interface
 
     type
        tcgloadvmtaddrnode = class(tloadvmtaddrnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgloadparentfpnode = class(tloadparentfpnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgaddrnode = class(taddrnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgderefnode = class(tderefnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgsubscriptnode = class(tsubscriptnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgwithnode = class(twithnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
        tcgvecnode = class(tvecnode)
@@ -71,7 +71,7 @@ interface
          procedure second_wideansistring;virtual;
          procedure second_dynamicarray;virtual;
        public
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
        end;
 
 
@@ -93,7 +93,7 @@ implementation
                               TCGLOADVMTADDRNODE
 *****************************************************************************}
 
-    procedure tcgloadvmtaddrnode.pass_2;
+    procedure tcgloadvmtaddrnode.pass_generate_code;
       var
        href : treference;
 
@@ -102,7 +102,7 @@ implementation
          if (left.nodetype=typen) then
            begin
              reference_reset_symbol(href,
-               current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname),0);
+               current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resultdef).pointeddef).vmt_mangledname),0);
              location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
              cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
            end
@@ -110,7 +110,7 @@ implementation
            begin
              { left contains self, load vmt from self }
              secondpass(left);
-             gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(left.resulttype.def),left.location,location.register);
+             gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(left.resultdef),left.location,location.register);
            end;
       end;
 
@@ -119,7 +119,7 @@ implementation
                         TCGLOADPARENTFPNODE
 *****************************************************************************}
 
-    procedure tcgloadparentfpnode.pass_2;
+    procedure tcgloadparentfpnode.pass_generate_code;
       var
         currpi : tprocinfo;
         hsym   : tparavarsym;
@@ -164,7 +164,7 @@ implementation
                              TCGADDRNODE
 *****************************************************************************}
 
-    procedure tcgaddrnode.pass_2;
+    procedure tcgaddrnode.pass_generate_code;
       var
         tmpref: treference;
       begin
@@ -180,12 +180,12 @@ implementation
                            TCGDEREFNODE
 *****************************************************************************}
 
-    procedure tcgderefnode.pass_2;
+    procedure tcgderefnode.pass_generate_code;
       var
         paraloc1 : tcgpara;
       begin
          secondpass(left);
-         location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
+         location_reset(location,LOC_REFERENCE,def_cgsize(resultdef));
          case left.location.loc of
             LOC_CREGISTER,
             LOC_REGISTER:
@@ -218,7 +218,7 @@ implementation
          if (cs_use_heaptrc in aktglobalswitches) and
             (cs_checkpointer in aktlocalswitches) and
             not(cs_compilesystem in aktmoduleswitches) and
-            not(tpointerdef(left.resulttype.def).is_far) and
+            not(tpointerdef(left.resultdef).is_far) and
             not(nf_no_checkpointer in flags) then
           begin
             paraloc1.init;
@@ -238,7 +238,7 @@ implementation
                           TCGSUBSCRIPTNODE
 *****************************************************************************}
 
-    procedure tcgsubscriptnode.pass_2;
+    procedure tcgsubscriptnode.pass_generate_code;
       var
         paraloc1 : tcgpara;
         sref: tsubsetreference;
@@ -248,9 +248,9 @@ implementation
            exit;
          paraloc1.init;
          { classes and interfaces must be dereferenced implicit }
-         if is_class_or_interface(left.resulttype.def) then
+         if is_class_or_interface(left.resultdef) then
            begin
-             location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
+             location_reset(location,LOC_REFERENCE,def_cgsize(resultdef));
              case left.location.loc of
                 LOC_CREGISTER,
                 LOC_REGISTER:
@@ -287,10 +287,10 @@ implementation
                 cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
               end;
            end
-         else if is_interfacecom(left.resulttype.def) then
+         else if is_interfacecom(left.resultdef) then
            begin
-             location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
-             tg.GetTempTyped(current_asmdata.CurrAsmList,left.resulttype.def,tt_normal,location.reference);
+             location_reset(location,LOC_REFERENCE,def_cgsize(resultdef));
+             tg.GetTempTyped(current_asmdata.CurrAsmList,left.resultdef,tt_normal,location.reference);
              cg.a_load_loc_ref(current_asmdata.CurrAsmList,OS_ADDR,left.location,location.reference);
              { implicit deferencing also for interfaces }
              if (cs_use_heaptrc in aktglobalswitches) and
@@ -318,7 +318,7 @@ implementation
                LOC_REGISTER,
                LOC_CREGISTER:
                  begin
-                   if (left.resulttype.def.size > sizeof(aint)) then
+                   if (left.resultdef.size > sizeof(aint)) then
                      location_force_mem(current_asmdata.CurrAsmList,location)
                    else
                      begin
@@ -326,10 +326,10 @@ implementation
                          location.loc := LOC_SUBSETREG
                        else
                          location.loc := LOC_CSUBSETREG;
-                       location.size:=def_cgsize(resulttype.def);
+                       location.size:=def_cgsize(resultdef);
                        location.sreg.subsetreg := left.location.register;
                        location.sreg.subsetregsize := left.location.size;
-                       if not is_packed_record_or_object(left.resulttype.def) then
+                       if not is_packed_record_or_object(left.resultdef) then
                          begin
                            if (target_info.endian = ENDIAN_BIG) then
                              location.sreg.startbit := (tcgsize2size[location.sreg.subsetregsize] - tcgsize2size[location.size] - vs.fieldoffset) * 8
@@ -339,7 +339,7 @@ implementation
                          end
                        else
                          begin
-                           location.sreg.bitlen := resulttype.def.packedbitsize;
+                           location.sreg.bitlen := resultdef.packedbitsize;
                            if (target_info.endian = ENDIAN_BIG) then
                              location.sreg.startbit := (tcgsize2size[location.sreg.subsetregsize]*8 - location.sreg.bitlen) - vs.fieldoffset
                            else
@@ -350,9 +350,9 @@ implementation
                LOC_SUBSETREG,
                LOC_CSUBSETREG:
                  begin
-                   location.size:=def_cgsize(resulttype.def);
+                   location.size:=def_cgsize(resultdef);
                    if (target_info.endian = ENDIAN_BIG) then
-                     inc(location.sreg.startbit, (left.resulttype.def.size - tcgsize2size[location.size] - vs.fieldoffset) * 8)
+                     inc(location.sreg.startbit, (left.resultdef.size - tcgsize2size[location.size] - vs.fieldoffset) * 8)
                    else
                      inc(location.sreg.startbit, vs.fieldoffset * 8);
                    location.sreg.bitlen := tcgsize2size[location.size] * 8;
@@ -364,7 +364,7 @@ implementation
 
          if (location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
            begin
-             if not is_packed_record_or_object(left.resulttype.def) then
+             if not is_packed_record_or_object(left.resultdef) then
                begin
                  inc(location.reference.offset,vs.fieldoffset);
 {$ifdef SUPPORT_UNALIGNED}
@@ -376,13 +376,13 @@ implementation
     
                end
              else if (vs.fieldoffset mod 8 = 0) and
-                     (resulttype.def.packedbitsize mod 8 = 0) and
+                     (resultdef.packedbitsize mod 8 = 0) and
                      { is different in case of e.g. packenum 2 and an enum }
                      { which fits in 8 bits                                }
-                     (resulttype.def.size*8 = resulttype.def.packedbitsize) then
+                     (resultdef.size*8 = resultdef.packedbitsize) then
                begin
                  inc(location.reference.offset,vs.fieldoffset div 8);
-                 if (resulttype.def.size*8 <> resulttype.def.packedbitsize) then
+                 if (resultdef.size*8 <> resultdef.packedbitsize) then
                    internalerror(2006082013);
                  { packed records always have an alignment of 1 }
                  location.reference.alignment:=1;
@@ -394,7 +394,7 @@ implementation
                  sref.bitindexreg:=NR_NO;
                  inc(sref.ref.offset,vs.fieldoffset div 8);
                  sref.startbit:=vs.fieldoffset mod 8;
-                 sref.bitlen:=resulttype.def.packedbitsize;
+                 sref.bitlen:=resultdef.packedbitsize;
                  if (left.location.loc=LOC_REFERENCE) then
                    location.loc:=LOC_SUBSETREF
                  else
@@ -402,7 +402,7 @@ implementation
                  location.sref:=sref;
                end;
              { also update the size of the location }
-             location.size:=def_cgsize(resulttype.def);
+             location.size:=def_cgsize(resultdef);
            end;
          paraloc1.done;
       end;
@@ -412,7 +412,7 @@ implementation
                             TCGWITHNODE
 *****************************************************************************}
 
-    procedure tcgwithnode.pass_2;
+    procedure tcgwithnode.pass_generate_code;
       begin
         location_reset(location,LOC_VOID,OS_NO);
 
@@ -431,13 +431,13 @@ implementation
           get_mul_size:=1
          else
           begin
-            if (left.resulttype.def.deftype=arraydef) then
-             if not is_packed_array(left.resulttype.def) then
-              get_mul_size:=tarraydef(left.resulttype.def).elesize
+            if (left.resultdef.deftype=arraydef) then
+             if not is_packed_array(left.resultdef) then
+              get_mul_size:=tarraydef(left.resultdef).elesize
              else
-              get_mul_size:=tarraydef(left.resulttype.def).elepackedbitsize
+              get_mul_size:=tarraydef(left.resultdef).elepackedbitsize
             else
-             get_mul_size:=resulttype.def.size;
+             get_mul_size:=resultdef.size;
           end
        end;
 
@@ -488,10 +488,10 @@ implementation
            internalerror(200608051);
          sref.ref := location.reference;
          offsetreg := cg.getaddressregister(current_asmdata.CurrAsmList);
-         cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,tarraydef(left.resulttype.def).lowrange,reg);
+         cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,tarraydef(left.resultdef).lowrange,reg);
          cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_INT,l,reg);
          { keep alignment for index }
-         sref.ref.alignment := left.resulttype.def.alignment;
+         sref.ref.alignment := left.resultdef.alignment;
          if not ispowerof2(sref.ref.alignment,temp) then
            internalerror(2006081201);
          alignpower:=temp;
@@ -509,7 +509,7 @@ implementation
          cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,OS_INT,(1 shl (3+alignpower))-1,reg);
          sref.bitindexreg := reg;
          sref.startbit := 0;
-         sref.bitlen := resulttype.def.packedbitsize;
+         sref.bitlen := resultdef.packedbitsize;
          if (left.location.loc = LOC_REFERENCE) then
            location.loc := LOC_SUBSETREF
          else
@@ -537,8 +537,8 @@ implementation
        begin
          paraloc1.init;
          paraloc2.init;
-         if is_open_array(left.resulttype.def) or
-            is_array_of_const(left.resulttype.def) then
+         if is_open_array(left.resultdef) or
+            is_array_of_const(left.resultdef) then
           begin
             { cdecl functions don't have high() so we can not check the range }
             if not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
@@ -570,7 +570,7 @@ implementation
              end;
           end
          else
-          if is_dynamic_array(left.resulttype.def) then
+          if is_dynamic_array(left.resultdef) then
             begin
                paramanager.getintparaloc(pocall_default,1,paraloc1);
                paramanager.getintparaloc(pocall_default,2,paraloc2);
@@ -585,13 +585,13 @@ implementation
                cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
             end
          else
-           cg.g_rangecheck(current_asmdata.CurrAsmList,right.location,right.resulttype.def,left.resulttype.def);
+           cg.g_rangecheck(current_asmdata.CurrAsmList,right.location,right.resultdef,left.resultdef);
          paraloc1.done;
          paraloc2.done;
        end;
 
 
-    procedure tcgvecnode.pass_2;
+    procedure tcgvecnode.pass_generate_code;
 
       var
          offsetdec,
@@ -612,12 +612,12 @@ implementation
          paraloc1.init;
          paraloc2.init;
          mulsize:=get_mul_size;
-         if not is_packed_array(left.resulttype.def) then
+         if not is_packed_array(left.resultdef) then
            bytemulsize:=mulsize
          else
            bytemulsize:=mulsize div 8;
 
-         newsize:=def_cgsize(resulttype.def);
+         newsize:=def_cgsize(resultdef);
          secondpass(left);
          if left.location.loc=LOC_CREFERENCE then
            location_reset(location,LOC_CREFERENCE,newsize)
@@ -625,8 +625,8 @@ implementation
            location_reset(location,LOC_REFERENCE,newsize);
 
          { an ansistring needs to be dereferenced }
-         if is_ansistring(left.resulttype.def) or
-            is_widestring(left.resulttype.def) then
+         if is_ansistring(left.resultdef) or
+            is_widestring(left.resultdef) then
            begin
               if nf_callunique in flags then
                 internalerror(200304236);
@@ -655,18 +655,18 @@ implementation
                    cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,location.reference.base,paraloc1);
                    paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1);
                    cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-                   cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO');
+                   cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_CHECKZERO');
                    cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
                 end;
 
               { in ansistrings/widestrings S[1] is p<w>char(S)[0] !! }
-              if is_ansistring(left.resulttype.def) then
+              if is_ansistring(left.resultdef) then
                 offsetdec:=1
               else
                 offsetdec:=2;
               dec(location.reference.offset,offsetdec);
            end
-         else if is_dynamic_array(left.resulttype.def) then
+         else if is_dynamic_array(left.resultdef) then
            begin
               case left.location.loc of
                 LOC_REGISTER,
@@ -691,27 +691,27 @@ implementation
            internalerror(200411013);
 
          { offset can only differ from 0 if arraydef }
-         if (left.resulttype.def.deftype=arraydef) and
-            not(is_dynamic_array(left.resulttype.def)) and
-            (not(is_packed_array(left.resulttype.def)) or
+         if (left.resultdef.deftype=arraydef) and
+            not(is_dynamic_array(left.resultdef)) and
+            (not(is_packed_array(left.resultdef)) or
              ((mulsize mod 8 = 0) and
               ispowerof2(mulsize div 8,temp))) then
-           dec(location.reference.offset,bytemulsize*tarraydef(left.resulttype.def).lowrange);
+           dec(location.reference.offset,bytemulsize*tarraydef(left.resultdef).lowrange);
 
          if right.nodetype=ordconstn then
            begin
               { offset can only differ from 0 if arraydef }
-              case left.resulttype.def.deftype of
+              case left.resultdef.deftype of
                 arraydef :
                   begin
-                     if not(is_open_array(left.resulttype.def)) and
-                        not(is_array_of_const(left.resulttype.def)) and
-                        not(is_dynamic_array(left.resulttype.def)) then
+                     if not(is_open_array(left.resultdef)) and
+                        not(is_array_of_const(left.resultdef)) and
+                        not(is_dynamic_array(left.resultdef)) then
                        begin
-                          if (tordconstnode(right).value>tarraydef(left.resulttype.def).highrange) or
-                             (tordconstnode(right).value<tarraydef(left.resulttype.def).lowrange) then
+                          if (tordconstnode(right).value>tarraydef(left.resultdef).highrange) or
+                             (tordconstnode(right).value<tarraydef(left.resultdef).lowrange) then
                             begin
-                              { this should be caught in the resulttypepass! (JM) }
+                              { this should be caught in the typecheckpass! (JM) }
                               if (cs_check_range in aktlocalswitches) then
                                 CGMessage(parser_e_range_check_error)
                               else
@@ -731,7 +731,7 @@ implementation
                   begin
                     if (cs_check_range in aktlocalswitches) then
                      begin
-                       case tstringdef(left.resulttype.def).string_typ of
+                       case tstringdef(left.resultdef).string_typ of
                          { it's the same for ansi- and wide strings }
                          st_widestring,
                          st_ansistring:
@@ -747,7 +747,7 @@ implementation
                               paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1);
                               paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2);
                               cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-                              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
+                              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_RANGECHECK');
                               cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
                            end;
 
@@ -765,7 +765,7 @@ implementation
                      end;
                    end;
               end;
-              if not(is_packed_array(left.resulttype.def)) or
+              if not(is_packed_array(left.resultdef)) or
                  ((mulsize mod 8 = 0) and
                   ispowerof2(mulsize div 8,temp)) then
                 begin
@@ -775,21 +775,21 @@ implementation
                   { size for bitpacked arrays (e.g. a bitpacked array of      }
                   { enums who are size 2 but fit in one byte -> in the array  }
                   { they will be one byte and have to be stored like that)    }
-                  if is_packed_array(left.resulttype.def) and
+                  if is_packed_array(left.resultdef) and
                      (tcgsize2size[newsize] <> bytemulsize) then
                     newsize:=int_cgsize(bytemulsize);
                 end
               else
                 begin
                   subsetref.ref := location.reference;
-                  subsetref.ref.alignment := left.resulttype.def.alignment;
+                  subsetref.ref.alignment := left.resultdef.alignment;
                   if not ispowerof2(subsetref.ref.alignment,temp) then
                     internalerror(2006081212);
                   alignpow:=temp;
-                  inc(subsetref.ref.offset,((mulsize * (tordconstnode(right).value-tarraydef(left.resulttype.def).lowrange)) shr (3+alignpow)) shl alignpow);
+                  inc(subsetref.ref.offset,((mulsize * (tordconstnode(right).value-tarraydef(left.resultdef).lowrange)) shr (3+alignpow)) shl alignpow);
                   subsetref.bitindexreg := NR_NO;
-                  subsetref.startbit := (mulsize * (tordconstnode(right).value-tarraydef(left.resulttype.def).lowrange)) and ((1 shl (3+alignpow))-1);
-                  subsetref.bitlen := resulttype.def.packedbitsize;
+                  subsetref.startbit := (mulsize * (tordconstnode(right).value-tarraydef(left.resultdef).lowrange)) and ((1 shl (3+alignpow))-1);
+                  subsetref.bitlen := resultdef.packedbitsize;
                   if (left.location.loc = LOC_REFERENCE) then
                     location.loc := LOC_SUBSETREF
                   else
@@ -805,8 +805,8 @@ implementation
                  { need that fancy code (it would be }
                  { buggy)                            }
                  not(cs_check_range in aktlocalswitches) and
-                 (left.resulttype.def.deftype=arraydef) and
-                 not is_packed_array(left.resulttype.def) then
+                 (left.resultdef.deftype=arraydef) and
+                 not is_packed_array(left.resultdef) then
                 begin
                    extraoffset:=0;
                    if (right.nodetype=addn) then
@@ -873,7 +873,7 @@ implementation
               secondpass(right);
 
               { if mulsize = 1, we won't have to modify the index }
-              location_force_reg(current_asmdata.CurrAsmList,right.location,OS_ADDR,not is_packed_array(left.resulttype.def) and (mulsize = 1) );
+              location_force_reg(current_asmdata.CurrAsmList,right.location,OS_ADDR,not is_packed_array(left.resultdef) and (mulsize = 1) );
 
               if isjump then
                begin
@@ -886,20 +886,20 @@ implementation
               { only range check now, we can't range check loc_flags/loc_jump }
               if cs_check_range in aktlocalswitches then
                begin
-                 if left.resulttype.def.deftype=arraydef then
+                 if left.resultdef.deftype=arraydef then
                    rangecheck_array;
                end;
 
             { produce possible range check code: }
               if cs_check_range in aktlocalswitches then
                begin
-                 if left.resulttype.def.deftype=arraydef then
+                 if left.resultdef.deftype=arraydef then
                    begin
                      { done defore (PM) }
                    end
-                 else if (left.resulttype.def.deftype=stringdef) then
+                 else if (left.resultdef.deftype=stringdef) then
                    begin
-                      case tstringdef(left.resulttype.def).string_typ of
+                      case tstringdef(left.resultdef).string_typ of
                          { it's the same for ansi- and wide strings }
                          st_widestring,
                          st_ansistring:
@@ -916,7 +916,7 @@ implementation
                               paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1);
                               paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2);
                               cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-                              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
+                              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_RANGECHECK');
                               cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
                            end;
                          st_shortstring:
@@ -933,7 +933,7 @@ implementation
 
               { insert the register and the multiplication factor in the
                 reference }
-              if not is_packed_array(left.resulttype.def) then
+              if not is_packed_array(left.resultdef) then
                 update_reference_reg_mul(right.location.register,mulsize)
               else
                 update_reference_reg_packed(right.location.register,mulsize);

+ 13 - 13
compiler/ncgopt.pas

@@ -28,9 +28,9 @@ uses node, nopt;
 
 type
   tcgaddsstringcharoptnode = class(taddsstringcharoptnode)
-     function det_resulttype: tnode; override;
+     function pass_typecheck: tnode; override;
      function pass_1: tnode; override;
-     procedure pass_2; override;
+     procedure pass_generate_code; override;
   end;
 
 
@@ -50,18 +50,18 @@ uses
                              TCGADDOPTNODE
 *****************************************************************************}
 
-function tcgaddsstringcharoptnode.det_resulttype: tnode;
+function tcgaddsstringcharoptnode.pass_typecheck: tnode;
 begin
-  det_resulttype := nil;
-  resulttypepass(left);
-  resulttypepass(right);
+  pass_typecheck := nil;
+  typecheckpass(left);
+  typecheckpass(right);
   if codegenerror then
     exit;
   { update the curmaxlen field (before converting to a string!) }
   updatecurmaxlen;
-  if not is_shortstring(left.resulttype.def) then
+  if not is_shortstring(left.resultdef) then
     inserttypeconv(left,cshortstringtype);
-  resulttype:=left.resulttype;
+  resultdef:=left.resultdef;
 end;
 
 
@@ -81,7 +81,7 @@ begin
 end;
 
 
-procedure tcgaddsstringcharoptnode.pass_2;
+procedure tcgaddsstringcharoptnode.pass_generate_code;
 var
   l: tasmlabel;
   href,href2 :  treference;
@@ -90,7 +90,7 @@ var
   len : integer;
 begin
   { first, we have to more or less replicate some code from }
-  { ti386addnode.pass_2                                     }
+  { ti386addnode.pass_generate_code                                     }
   secondpass(left);
   if not(tg.istemp(left.location.reference) and
          (tg.sizeoftemp(current_asmdata.CurrAsmList,left.location.reference) = 256)) then
@@ -99,7 +99,7 @@ begin
        cg.g_copyshortstring(current_asmdata.CurrAsmList,left.location.reference,href,255);
        location_freetemp(current_asmdata.CurrAsmList,left.location);
        { return temp reference }
-       location_reset(left.location,LOC_REFERENCE,def_cgsize(resulttype.def));
+       location_reset(left.location,LOC_REFERENCE,def_cgsize(resultdef));
        left.location.reference:=href;
     end;
   secondpass(right);
@@ -130,7 +130,7 @@ begin
   if tg.istemp(left.location.reference) then
     checklength := curmaxlen = 255
   else
-    checklength := curmaxlen >= tstringdef(left.resulttype.def).len;
+    checklength := curmaxlen >= tstringdef(left.resultdef).len;
   if checklength then
     begin
       { is it already maximal? }
@@ -138,7 +138,7 @@ begin
       if tg.istemp(left.location.reference) then
         len:=255
       else
-        len:=tstringdef(left.resulttype.def).len;
+        len:=tstringdef(left.resultdef).len;
       cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,len,lengthreg,l)
     end;
 

+ 16 - 16
compiler/ncgset.pas

@@ -31,7 +31,7 @@ interface
 
     type
        tcgsetelementnode = class(tsetelementnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
 
 
@@ -43,7 +43,7 @@ interface
 
        tcginnode = class(tinnode)
           function pass_1: tnode;override;
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        protected
           {# Routine to test bitnumber in bitnumber register on value
              in value register. The __result register should be set
@@ -67,7 +67,7 @@ interface
             80x86 version, this version does not emit jump tables,
             because of portability problems.
           }
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
 
         protected
           with_sign : boolean;
@@ -108,7 +108,7 @@ implementation
                           TCGSETELEMENTNODE
 *****************************************************************************}
 
-    procedure tcgsetelementnode.pass_2;
+    procedure tcgsetelementnode.pass_generate_code;
        begin
        { load first value in 32bit register }
          secondpass(left);
@@ -232,9 +232,9 @@ implementation
       begin
          { check if we can use smallset operation using btl which is limited
            to 32 bits, the left side may also not contain higher values !! }
-         use_small:=(tsetdef(right.resulttype.def).settype=smallset) and
-                    ((left.resulttype.def.deftype=orddef) and (torddef(left.resulttype.def).high<=32) or
-                     (left.resulttype.def.deftype=enumdef) and (tenumdef(left.resulttype.def).max<=32));
+         use_small:=(tsetdef(right.resultdef).settype=smallset) and
+                    ((left.resultdef.deftype=orddef) and (torddef(left.resultdef).high<=32) or
+                     (left.resultdef.deftype=enumdef) and (tenumdef(left.resultdef).max<=32));
 
          { Can we generate jumps? Possible for all types of sets }
          checkgenjumps:=(right.nodetype=setconstn) and
@@ -254,7 +254,7 @@ implementation
           expectloc := LOC_JUMP;
       end;
 
-    procedure tcginnode.pass_2;
+    procedure tcginnode.pass_generate_code;
        var
          adjustment : aint;
          href : treference;
@@ -268,7 +268,7 @@ implementation
 
        begin
          { We check first if we can generate jumps, this can be done
-           because the resulttype.def is already set in firstpass }
+           because the resultdef is already set in firstpass }
 
          genjumps := checkgenjumps(setparts,numparts,use_small);
 
@@ -364,7 +364,7 @@ implementation
          {*****************************************************************}
           begin
             { location is always LOC_REGISTER }
-            location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
+            location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
 
             { We will now generated code to check the set itself, no jmps,
               handle smallsets separate, because it allows faster checks }
@@ -532,7 +532,7 @@ implementation
            if assigned(t^.less) then
              genitem(t^.less);
            { do we need to test the first value? }
-           if first and (t^._low>get_min_value(left.resulttype.def)) then
+           if first and (t^._low>get_min_value(left.resultdef)) then
              cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(t^._low),hregister,elselabel);
            if t^._low=t^._high then
              begin
@@ -553,7 +553,7 @@ implementation
                 if first then
                   begin
                      { have we to ajust the first value ? }
-                     if (t^._low>get_min_value(left.resulttype.def)) then
+                     if (t^._low>get_min_value(left.resultdef)) then
                        gensub(aint(t^._low));
                   end
                 else
@@ -681,7 +681,7 @@ implementation
       end;
 
 
-    procedure tcgcasenode.pass_2;
+    procedure tcgcasenode.pass_generate_code;
       var
          oldflowcontrol: tflowcontrol;
          i : longint;
@@ -704,7 +704,7 @@ implementation
          for i:=0 to blocks.count-1 do
            current_asmdata.getjumplabel(pcaseblock(blocks[i])^.blocklabel);
 
-         with_sign:=is_signed(left.resulttype.def);
+         with_sign:=is_signed(left.resultdef);
          if with_sign then
            begin
               jmp_gt:=OC_GT;
@@ -730,7 +730,7 @@ implementation
           end;
          secondpass(left);
          { determines the size of the operand }
-         opsize:=def_cgsize(left.resulttype.def);
+         opsize:=def_cgsize(left.resultdef);
          { copy the case expression to a register }
          location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false);
 {$ifndef cpu64bit}
@@ -777,7 +777,7 @@ implementation
                    max_label:=case_get_max(labels);
                    labelcnt:=case_count_labels(labels);
                    { can we omit the range check of the jump table ? }
-                   getrange(left.resulttype.def,lv,hv);
+                   getrange(left.resultdef,lv,hv);
                    jumptable_no_range:=(lv=min_label) and (hv=max_label);
                    { hack a little bit, because the range can be greater }
                    { than the positive range of a aint            }

+ 52 - 52
compiler/ncgutil.pas

@@ -226,7 +226,7 @@ implementation
       begin
          { always calculate boolean AND and OR from left to right }
          if (p.nodetype in [orn,andn]) and
-            is_boolean(p.left.resulttype.def) then
+            is_boolean(p.left.resultdef) then
            begin
              if nf_swaped in p.flags then
                internalerror(234234);
@@ -275,7 +275,7 @@ implementation
            exit;
          storepos:=aktfilepos;
          aktfilepos:=p.fileinfo;
-         if is_boolean(p.resulttype.def) then
+         if is_boolean(p.resultdef) then
            begin
 {$ifdef OLDREGVARS}
               if loadregvars = lr_load_regvars then
@@ -290,7 +290,7 @@ implementation
                 end
               else
                 begin
-                   opsize:=def_cgsize(p.resulttype.def);
+                   opsize:=def_cgsize(p.resultdef);
                    case p.location.loc of
                      LOC_SUBSETREG,LOC_CSUBSETREG,
                      LOC_SUBSETREF,LOC_CSUBSETREF:
@@ -367,7 +367,7 @@ implementation
         if jmp_buf_size=-1 then
           begin
             srsym:=search_system_type('JMP_BUF');
-            jmp_buf_size:=srsym.restype.def.size;
+            jmp_buf_size:=srsym.typedef.size;
           end;
         tg.GetTemp(list,EXCEPT_BUF_SIZE,tt_persistent,t.envbuf);
         tg.GetTemp(list,jmp_buf_size,tt_persistent,t.jmpbuf);
@@ -862,11 +862,11 @@ implementation
         list:=TAsmList(arg);
         if (tsym(p).typ=paravarsym) and
            (tparavarsym(p).varspez=vs_value) and
-           (paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vartype.def,current_procinfo.procdef.proccalloption)) then
+           (paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vardef,current_procinfo.procdef.proccalloption)) then
          begin
            location_get_data_ref(list,tparavarsym(p).initialloc,href,true);
-           if is_open_array(tparavarsym(p).vartype.def) or
-              is_array_of_const(tparavarsym(p).vartype.def) then
+           if is_open_array(tparavarsym(p).vardef) or
+              is_array_of_const(tparavarsym(p).vardef) then
             begin
               { cdecl functions don't have a high pointer so it is not possible to generate
                 a local copy }
@@ -876,11 +876,11 @@ implementation
                   if not assigned(hsym) then
                     internalerror(200306061);
                   hreg:=cg.getaddressregister(list);
-                  if not is_packed_array(tparavarsym(p).vartype.def) then
-                    cg.g_copyvaluepara_openarray(list,href,hsym.initialloc,tarraydef(tparavarsym(p).vartype.def).elesize,hreg)
+                  if not is_packed_array(tparavarsym(p).vardef) then
+                    cg.g_copyvaluepara_openarray(list,href,hsym.initialloc,tarraydef(tparavarsym(p).vardef).elesize,hreg)
                   else
                     internalerror(2006080401);
-//                    cg.g_copyvaluepara_packedopenarray(list,href,hsym.intialloc,tarraydef(tparavarsym(p).vartype.def).elepackedbitsize,hreg);
+//                    cg.g_copyvaluepara_packedopenarray(list,href,hsym.intialloc,tarraydef(tparavarsym(p).vardef).elepackedbitsize,hreg);
                   cg.a_load_reg_loc(list,OS_ADDR,hreg,tparavarsym(p).initialloc);
                 end;
             end
@@ -890,21 +890,21 @@ implementation
               l:=tparavarsym(p).getsize;
               localcopyloc.loc:=LOC_REFERENCE;
               localcopyloc.size:=int_cgsize(l);
-              tg.GetLocal(list,l,tparavarsym(p).vartype.def,localcopyloc.reference);
+              tg.GetLocal(list,l,tparavarsym(p).vardef,localcopyloc.reference);
               { Copy data }
-              if is_shortstring(tparavarsym(p).vartype.def) then
+              if is_shortstring(tparavarsym(p).vardef) then
                 begin
                   { this code is only executed before the code for the body and the entry/exit code is generated
                     so we're allowed to include pi_do_call here; after pass1 is run, this isn't allowed anymore
                   }
                   include(current_procinfo.flags,pi_do_call);
-                  cg.g_copyshortstring(list,href,localcopyloc.reference,tstringdef(tparavarsym(p).vartype.def).len)
+                  cg.g_copyshortstring(list,href,localcopyloc.reference,tstringdef(tparavarsym(p).vardef).len)
                 end
               else
                 begin
                   { pass proper alignment info }
-                  localcopyloc.reference.alignment:=tparavarsym(p).vartype.def.alignment;
-                  cg.g_concatcopy(list,href,localcopyloc.reference,tparavarsym(p).vartype.def.size);
+                  localcopyloc.reference.alignment:=tparavarsym(p).vardef.alignment;
+                  cg.g_concatcopy(list,href,localcopyloc.reference,tparavarsym(p).vardef.size);
                 end;
               { update localloc of varsym }
               tg.Ungetlocal(list,tparavarsym(p).localloc.reference);
@@ -1042,8 +1042,8 @@ implementation
         if (tsym(p).typ in [globalvarsym,localvarsym]) and
            (tabstractvarsym(p).refs>0) and
            not(vo_is_external in tabstractvarsym(p).varoptions) and
-           not(is_class(tabstractvarsym(p).vartype.def)) and
-           tabstractvarsym(p).vartype.def.needs_inittable then
+           not(is_class(tabstractvarsym(p).vardef)) and
+           tabstractvarsym(p).vardef.needs_inittable then
          begin
            OldAsmList:=current_asmdata.CurrAsmList;
            current_asmdata.CurrAsmList:=TAsmList(arg);
@@ -1079,8 +1079,8 @@ implementation
            (tlocalvarsym(p).refs>0) and
            not(vo_is_external in tlocalvarsym(p).varoptions) and
            not(vo_is_funcret in tlocalvarsym(p).varoptions) and
-           not(is_class(tlocalvarsym(p).vartype.def)) and
-           tlocalvarsym(p).vartype.def.needs_inittable then
+           not(is_class(tlocalvarsym(p).vardef)) and
+           tlocalvarsym(p).vardef.needs_inittable then
           finalize_sym(TAsmList(arg),tsym(p));
       end;
 
@@ -1095,7 +1095,7 @@ implementation
           typedconstsym :
             begin
               if ttypedconstsym(p).is_writable and
-                 ttypedconstsym(p).typedconsttype.def.needs_inittable then
+                 ttypedconstsym(p).typedconstdef.needs_inittable then
                 finalize_sym(TAsmList(arg),tsym(p));
             end;
           procsym :
@@ -1126,14 +1126,14 @@ implementation
               if (tglobalvarsym(p).refs>0) and
                  not(vo_is_funcret in tglobalvarsym(p).varoptions) and
                  not(vo_is_external in tglobalvarsym(p).varoptions) and
-                 not(is_class(tglobalvarsym(p).vartype.def)) and
-                 tglobalvarsym(p).vartype.def.needs_inittable then
+                 not(is_class(tglobalvarsym(p).vardef)) and
+                 tglobalvarsym(p).vardef.needs_inittable then
                 finalize_sym(TAsmList(arg),tsym(p));
             end;
           typedconstsym :
             begin
               if ttypedconstsym(p).is_writable and
-                 ttypedconstsym(p).typedconsttype.def.needs_inittable then
+                 ttypedconstsym(p).typedconstdef.needs_inittable then
                 finalize_sym(TAsmList(arg),tsym(p));
             end;
           procsym :
@@ -1164,14 +1164,14 @@ implementation
         if (tsym(p).typ=paravarsym) then
          begin
            needs_inittable :=
-             not is_class_or_interface(tparavarsym(p).vartype.def) and
-             tparavarsym(p).vartype.def.needs_inittable;
+             not is_class_or_interface(tparavarsym(p).vardef) and
+             tparavarsym(p).vardef.needs_inittable;
            case tparavarsym(p).varspez of
              vs_value :
                if needs_inittable then
                  begin
-                   location_get_data_ref(list,tparavarsym(p).initialloc,href,is_open_array(tparavarsym(p).vartype.def));
-                   cg.g_incrrefcount(list,tparavarsym(p).vartype.def,href);
+                   location_get_data_ref(list,tparavarsym(p).initialloc,href,is_open_array(tparavarsym(p).vardef));
+                   cg.g_incrrefcount(list,tparavarsym(p).vardef,href);
                  end;
              vs_out :
                begin
@@ -1184,10 +1184,10 @@ implementation
                      if (localvartrashing <> -1) and
                         { needs separate implementation to trash open arrays }
                         { since their size is only known at run time         }
-                        not is_special_array(tparavarsym(p).vartype.def) then
-                       trash_reference(list,href,tparavarsym(p).vartype.def.size);
+                        not is_special_array(tparavarsym(p).vardef) then
+                       trash_reference(list,href,tparavarsym(p).vardef.size);
                      if needs_inittable then
-                       cg.g_initialize(list,tparavarsym(p).vartype.def,href);
+                       cg.g_initialize(list,tparavarsym(p).vardef,href);
                    end;
                end;
              else if (localvartrashing <> -1) and
@@ -1196,7 +1196,7 @@ implementation
                      tmpreg:=cg.getaddressregister(list);
                      cg.a_load_loc_reg(list,OS_ADDR,tparavarsym(p).initialloc,tmpreg);
                      reference_reset_base(href,tmpreg,0);
-                     trash_reference(list,href,tparavarsym(p).vartype.def.size);
+                     trash_reference(list,href,tparavarsym(p).vardef.size);
                    end
            end;
          end;
@@ -1212,20 +1212,20 @@ implementation
         if not(tsym(p).typ=paravarsym) then
           exit;
         list:=TAsmList(arg);
-        if not is_class_or_interface(tparavarsym(p).vartype.def) and
-           tparavarsym(p).vartype.def.needs_inittable then
+        if not is_class_or_interface(tparavarsym(p).vardef) and
+           tparavarsym(p).vardef.needs_inittable then
          begin
            if (tparavarsym(p).varspez=vs_value) then
             begin
               include(current_procinfo.flags,pi_needs_implicit_finally);
-              location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vartype.def));
-              cg.g_decrrefcount(list,tparavarsym(p).vartype.def,href);
+              location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vardef));
+              cg.g_decrrefcount(list,tparavarsym(p).vardef,href);
             end;
          end
         else
          if (tparavarsym(p).varspez=vs_value) and
-            (is_open_array(tparavarsym(p).vartype.def) or
-             is_array_of_const(tparavarsym(p).vartype.def)) then
+            (is_open_array(tparavarsym(p).vardef) or
+             is_array_of_const(tparavarsym(p).vardef)) then
            begin
              { cdecl functions don't have a high pointer so it is not possible to generate
                a local copy }
@@ -1397,7 +1397,7 @@ implementation
                         end;
                       { it could be that a structure is passed in memory but the function is expected to
                         return a pointer to this memory }
-                      if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
+                      if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption) then
                         cg.a_load_loc_reg(list,OS_ADDR,restmploc,hreg)
                       else
                       cg.a_load_loc_reg(list,restmploc.size,restmploc,hreg);
@@ -1663,7 +1663,7 @@ implementation
                 begin
 {$ifndef cpu64bit}
                   if (currpara.paraloc[calleeside].size in [OS_64,OS_S64]) and
-                     is_64bit(currpara.vartype.def) then
+                     is_64bit(currpara.vardef) then
                     begin
                       case paraloc^.loc of
                         LOC_REGISTER:
@@ -2013,7 +2013,7 @@ implementation
         if current_procinfo.procdef.proccalloption in clearstack_pocalls then
           begin
             parasize:=0;
-            if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
+            if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption) then
               inc(parasize,sizeof(aint));
           end
         else
@@ -2023,7 +2023,7 @@ implementation
         cg.g_proc_exit(list,parasize,(po_nostackframe in current_procinfo.procdef.procoptions));
 
         { release return registers, needed for optimizer }
-        if not is_void(current_procinfo.procdef.rettype.def) then
+        if not is_void(current_procinfo.procdef.returndef) then
           location_free(list,current_procinfo.procdef.funcretloc[calleeside]);
 
         { end of frame marker for call frame info }
@@ -2251,11 +2251,11 @@ implementation
                     else
                       begin
                         isaddr:=(st.symtabletype=parasymtable) and
-                                paramanager.push_addr_param(varspez,vartype.def,current_procinfo.procdef.proccalloption);
+                                paramanager.push_addr_param(varspez,vardef,current_procinfo.procdef.proccalloption);
                         if isaddr then
                           cgsize:=OS_ADDR
                         else
-                          cgsize:=def_cgsize(vartype.def);
+                          cgsize:=def_cgsize(vardef);
 {$ifndef OLDREGVARS}
                         { When there is assembler code we can't use regvars }
                         if is_regvar(isaddr) then
@@ -2281,15 +2281,15 @@ implementation
                                   else
                                     begin
                                       if isaddr then
-                                        tg.GetLocal(list,sizeof(aint),voidpointertype.def,initialloc.reference)
+                                        tg.GetLocal(list,sizeof(aint),voidpointertype,initialloc.reference)
                                       else
-                                        tg.GetLocal(list,getsize,tparavarsym(sym).paraloc[calleeside].alignment,vartype.def,initialloc.reference);
+                                        tg.GetLocal(list,getsize,tparavarsym(sym).paraloc[calleeside].alignment,vardef,initialloc.reference);
                                     end;
                                 end;
                               localsymtable,
                               stt_exceptsymtable :
                                 begin
-                                  tg.GetLocal(list,getsize,vartype.def,initialloc.reference);
+                                  tg.GetLocal(list,getsize,vardef,initialloc.reference);
                                 end;
                               staticsymtable :
                                 begin
@@ -2368,8 +2368,8 @@ implementation
           vecn:
             { range checks sometimes need the high parameter }
             if (cs_check_range in aktlocalswitches) and
-               (is_open_array(tvecnode(n).left.resulttype.def) or
-                is_array_of_const(tvecnode(n).left.resulttype.def)) and
+               (is_open_array(tvecnode(n).left.resultdef) or
+                is_array_of_const(tvecnode(n).left.resultdef)) and
                not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
               add_regvars(rv^,tabstractnormalvarsym(get_high_value_sym(tparavarsym(tloadnode(tvecnode(n).left).symtableentry))).localloc)
 
@@ -2616,7 +2616,7 @@ implementation
                       LOC_CREGISTER :
 {$ifndef cpu64bit}
                         if (pi_has_goto in current_procinfo.flags) then
-                          if def_cgsize(vartype.def) in [OS_64,OS_S64] then
+                          if def_cgsize(vardef) in [OS_64,OS_S64] then
                             begin
                               cg.a_reg_sync(list,localloc.register64.reglo);
                               cg.a_reg_sync(list,localloc.register64.reghi);
@@ -2652,7 +2652,7 @@ implementation
         def  : tstoreddef;
       begin
         { rtti can only be generated for classes that are always typesyms }
-        def:=tstoreddef(ttypesym(p).restype.def);
+        def:=tstoreddef(ttypesym(p).typedef);
         { there is an error, skip rtti info }
         if (def.deftype=errordef) or (Errorcount>0) then
           exit;
@@ -2688,11 +2688,11 @@ implementation
         { anonymous types are also allowed for records that can be varsym }
         case p.typ of
           typesym :
-            def:=tstoreddef(ttypesym(p).restype.def);
+            def:=tstoreddef(ttypesym(p).typedef);
           globalvarsym,
           localvarsym,
           paravarsym :
-            def:=tstoreddef(tabstractvarsym(p).vartype.def);
+            def:=tstoreddef(tabstractvarsym(p).vardef);
           else
             internalerror(200108263);
         end;

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 219 - 218
compiler/ncnv.pas


+ 105 - 101
compiler/ncon.pas

@@ -33,54 +33,57 @@ interface
 
     type
        trealconstnode = class(tnode)
-          restype : ttype;
+          typedef : tdef;
+          typedefderef : tderef;
           value_real : bestreal;
           lab_real : tasmlabel;
-          constructor create(v : bestreal;const t:ttype);virtual;
+          constructor create(v : bestreal;def:tdef);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode) : boolean; override;
           procedure printnodedata(var t:text);override;
        end;
        trealconstnodeclass = class of trealconstnode;
 
        tordconstnode = class(tnode)
-          restype : ttype;
+          typedef : tdef;
+          typedefderef : tderef;
           value : TConstExprInt;
           rangecheck : boolean;
           { create an ordinal constant node of the specified type and value.
             _rangecheck determines if the value of the ordinal should be checked
             against the ranges of the type definition.
           }
-          constructor create(v : tconstexprint;const t:ttype; _rangecheck : boolean);virtual;
+          constructor create(v : tconstexprint;def:tdef; _rangecheck : boolean);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode) : boolean; override;
           procedure printnodedata(var t:text);override;
        end;
        tordconstnodeclass = class of tordconstnode;
 
        tpointerconstnode = class(tnode)
-          restype : ttype;
+          typedef : tdef;
+          typedefderef : tderef;
           value   : TConstPtrUInt;
-          constructor create(v : TConstPtrUInt;const t:ttype);virtual;
+          constructor create(v : TConstPtrUInt;def:tdef);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode) : boolean; override;
        end;
        tpointerconstnodeclass = class of tpointerconstnode;
@@ -106,28 +109,29 @@ interface
           procedure buildderefimpl;override;
           procedure derefimpl;override;
           destructor destroy;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function getpcharcopy : pchar;
           function docompare(p: tnode) : boolean; override;
-          procedure changestringtype(const newtype:ttype);
+          procedure changestringtype(def:tdef);
        end;
        tstringconstnodeclass = class of tstringconstnode;
 
        tsetconstnode = class(tunarynode)
-          restype : ttype;
+          typedef : tdef;
+          typedefderef : tderef;
           value_set : pconstset;
           lab_set : tasmlabel;
-          constructor create(s : pconstset;const t:ttype);virtual;
+          constructor create(s : pconstset;def:tdef);virtual;
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode) : boolean; override;
        end;
        tsetconstnodeclass = class of tsetconstnode;
@@ -135,7 +139,7 @@ interface
        tnilnode = class(tnode)
           constructor create;virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        end;
        tnilnodeclass = class of tnilnode;
 
@@ -144,9 +148,9 @@ interface
           constructor create(const g:tguid);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode) : boolean; override;
        end;
        tguidconstnodeclass = class of tguidconstnode;
@@ -180,7 +184,7 @@ implementation
 
     function genintconstnode(v : TConstExprInt) : tordconstnode;
       var
-        htype : ttype;
+        htype : tdef;
       begin
          int_to_type(v,htype);
          genintconstnode:=cordconstnode.create(v,htype,true);
@@ -189,9 +193,9 @@ implementation
 
     function genenumnode(v : tenumsym) : tordconstnode;
       var
-        htype : ttype;
+        htype : tdef;
       begin
-         htype.setdef(v.definition);
+         htype:=v.definition;
          genenumnode:=cordconstnode.create(v.value,htype,true);
       end;
 
@@ -235,7 +239,7 @@ implementation
         p1:=nil;
         case p.consttyp of
           constord :
-            p1:=cordconstnode.create(p.value.valueord,p.consttype,true);
+            p1:=cordconstnode.create(p.value.valueord,p.constdef,true);
           conststring :
             begin
               len:=p.value.len;
@@ -247,9 +251,9 @@ implementation
           constreal :
             p1:=crealconstnode.create(pbestreal(p.value.valueptr)^,pbestrealtype^);
           constset :
-            p1:=csetconstnode.create(pconstset(p.value.valueptr),p.consttype);
+            p1:=csetconstnode.create(pconstset(p.value.valueptr),p.constdef);
           constpointer :
-            p1:=cpointerconstnode.create(p.value.valueordptr,p.consttype);
+            p1:=cpointerconstnode.create(p.value.valueordptr,p.constdef);
           constnil :
             p1:=cnilnode.create;
           else
@@ -265,10 +269,10 @@ implementation
     { generic code     }
     { overridden by:   }
     {   i386           }
-    constructor trealconstnode.create(v : bestreal;const t:ttype);
+    constructor trealconstnode.create(v : bestreal;def:tdef);
       begin
          inherited create(realconstn);
-         restype:=t;
+         typedef:=def;
          value_real:=v;
          lab_real:=nil;
       end;
@@ -276,7 +280,7 @@ implementation
     constructor trealconstnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
-        ppufile.gettype(restype);
+        ppufile.getderef(typedefderef);
         value_real:=ppufile.getreal;
         lab_real:=tasmlabel(ppufile.getasmsymbol);
       end;
@@ -285,7 +289,7 @@ implementation
     procedure trealconstnode.ppuwrite(ppufile:tcompilerppufile);
       begin
         inherited ppuwrite(ppufile);
-        ppufile.puttype(restype);
+        ppufile.putderef(typedefderef);
         ppufile.putreal(value_real);
         ppufile.putasmsymbol(lab_real);
       end;
@@ -294,33 +298,33 @@ implementation
     procedure trealconstnode.buildderefimpl;
       begin
         inherited buildderefimpl;
-        restype.buildderef;
+        typedefderef.build(typedef);
       end;
 
 
     procedure trealconstnode.derefimpl;
       begin
         inherited derefimpl;
-        restype.resolve;
+        typedef:=tdef(typedefderef.resolve);
       end;
 
 
-    function trealconstnode._getcopy : tnode;
+    function trealconstnode.dogetcopy : tnode;
 
       var
          n : trealconstnode;
 
       begin
-         n:=trealconstnode(inherited _getcopy);
+         n:=trealconstnode(inherited dogetcopy);
          n.value_real:=value_real;
          n.lab_real:=lab_real;
-         _getcopy:=n;
+         dogetcopy:=n;
       end;
 
-    function trealconstnode.det_resulttype:tnode;
+    function trealconstnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=restype;
+        resultdef:=typedef;
       end;
 
     function trealconstnode.pass_1 : tnode;
@@ -353,12 +357,12 @@ implementation
                               TORDCONSTNODE
 *****************************************************************************}
 
-    constructor tordconstnode.create(v : tconstexprint;const t:ttype;_rangecheck : boolean);
+    constructor tordconstnode.create(v : tconstexprint;def:tdef;_rangecheck : boolean);
 
       begin
          inherited create(ordconstn);
          value:=v;
-         restype:=t;
+         typedef:=def;
          rangecheck := _rangecheck;
       end;
 
@@ -366,7 +370,7 @@ implementation
     constructor tordconstnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
-        ppufile.gettype(restype);
+        ppufile.getderef(typedefderef);
         value:=ppufile.getexprint;
         { normally, the value is already compiled, so we don't need
           to do once again a range check
@@ -378,7 +382,7 @@ implementation
     procedure tordconstnode.ppuwrite(ppufile:tcompilerppufile);
       begin
         inherited ppuwrite(ppufile);
-        ppufile.puttype(restype);
+        ppufile.putderef(typedefderef);
         ppufile.putexprint(value);
       end;
 
@@ -386,36 +390,36 @@ implementation
     procedure tordconstnode.buildderefimpl;
       begin
         inherited buildderefimpl;
-        restype.buildderef;
+        typedefderef.build(typedef);
       end;
 
 
     procedure tordconstnode.derefimpl;
       begin
         inherited derefimpl;
-        restype.resolve;
+        typedef:=tdef(typedefderef.resolve);
       end;
 
 
-    function tordconstnode._getcopy : tnode;
+    function tordconstnode.dogetcopy : tnode;
 
       var
          n : tordconstnode;
 
       begin
-         n:=tordconstnode(inherited _getcopy);
+         n:=tordconstnode(inherited dogetcopy);
          n.value:=value;
-         n.restype := restype;
-         _getcopy:=n;
+         n.typedef := typedef;
+         dogetcopy:=n;
       end;
 
-    function tordconstnode.det_resulttype:tnode;
+    function tordconstnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=restype;
+        resultdef:=typedef;
         { only do range checking when explicitly asked for it }
         if rangecheck then
-           testrange(resulttype.def,value,false);
+           testrange(resultdef,value,false);
       end;
 
     function tordconstnode.pass_1 : tnode;
@@ -443,19 +447,19 @@ implementation
                             TPOINTERCONSTNODE
 *****************************************************************************}
 
-    constructor tpointerconstnode.create(v : TConstPtrUInt;const t:ttype);
+    constructor tpointerconstnode.create(v : TConstPtrUInt;def:tdef);
 
       begin
          inherited create(pointerconstn);
          value:=v;
-         restype:=t;
+         typedef:=def;
       end;
 
 
     constructor tpointerconstnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
-        ppufile.gettype(restype);
+        ppufile.getderef(typedefderef);
         value:=ppufile.getptruint;
       end;
 
@@ -463,7 +467,7 @@ implementation
     procedure tpointerconstnode.ppuwrite(ppufile:tcompilerppufile);
       begin
         inherited ppuwrite(ppufile);
-        ppufile.puttype(restype);
+        ppufile.putderef(typedefderef);
         ppufile.putptruint(value);
       end;
 
@@ -471,33 +475,33 @@ implementation
     procedure tpointerconstnode.buildderefimpl;
       begin
         inherited buildderefimpl;
-        restype.buildderef;
+        typedefderef.build(typedef);
       end;
 
 
     procedure tpointerconstnode.derefimpl;
       begin
         inherited derefimpl;
-        restype.resolve;
+        typedef:=tdef(typedefderef.resolve);
       end;
 
 
-    function tpointerconstnode._getcopy : tnode;
+    function tpointerconstnode.dogetcopy : tnode;
 
       var
          n : tpointerconstnode;
 
       begin
-         n:=tpointerconstnode(inherited _getcopy);
+         n:=tpointerconstnode(inherited dogetcopy);
          n.value:=value;
-         n.restype := restype;
-         _getcopy:=n;
+         n.typedef := typedef;
+         dogetcopy:=n;
       end;
 
-    function tpointerconstnode.det_resulttype:tnode;
+    function tpointerconstnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=restype;
+        resultdef:=typedef;
       end;
 
     function tpointerconstnode.pass_1 : tnode;
@@ -614,13 +618,13 @@ implementation
       end;
 
 
-    function tstringconstnode._getcopy : tnode;
+    function tstringconstnode.dogetcopy : tnode;
 
       var
          n : tstringconstnode;
 
       begin
-         n:=tstringconstnode(inherited _getcopy);
+         n:=tstringconstnode(inherited dogetcopy);
          n.cst_type:=cst_type;
          n.len:=len;
          n.lab_str:=lab_str;
@@ -631,10 +635,10 @@ implementation
            end
          else
            n.value_str:=getpcharcopy;
-         _getcopy:=n;
+         dogetcopy:=n;
       end;
 
-    function tstringconstnode.det_resulttype:tnode;
+    function tstringconstnode.pass_typecheck:tnode;
       var
         l : aint;
       begin
@@ -647,18 +651,18 @@ implementation
                 l:=len-1
               else
                 l:=0;
-              resulttype.setdef(tarraydef.create(0,l,s32inttype));
-              tarraydef(resulttype.def).setelementtype(cchartype);
-              include(tarraydef(resulttype.def).arrayoptions,ado_IsConstString);
+              resultdef:=tarraydef.create(0,l,s32inttype);
+              tarraydef(resultdef).elementdef:=cchartype;
+              include(tarraydef(resultdef).arrayoptions,ado_IsConstString);
             end;
           cst_shortstring :
-            resulttype:=cshortstringtype;
+            resultdef:=cshortstringtype;
           cst_ansistring :
-            resulttype:=cansistringtype;
+            resultdef:=cansistringtype;
           cst_widestring :
-            resulttype:=cwidestringtype;
+            resultdef:=cwidestringtype;
           cst_longstring :
-            resulttype:=clongstringtype;
+            resultdef:=clongstringtype;
         end;
       end;
 
@@ -697,7 +701,7 @@ implementation
       end;
 
 
-    procedure tstringconstnode.changestringtype(const newtype:ttype);
+    procedure tstringconstnode.changestringtype(def:tdef);
       const
         st2cst : array[tstringtype] of tconststringtype = (
           cst_shortstring,cst_longstring,cst_ansistring,cst_widestring
@@ -706,10 +710,10 @@ implementation
         pw : pcompilerwidestring;
         pc : pchar;
       begin
-        if newtype.def.deftype<>stringdef then
+        if def.deftype<>stringdef then
           internalerror(200510011);
         { convert ascii 2 unicode }
-        if (tstringdef(newtype.def).string_typ=st_widestring) and
+        if (tstringdef(def).string_typ=st_widestring) and
            (cst_type<>cst_widestring) then
           begin
             initwidestring(pw);
@@ -720,7 +724,7 @@ implementation
         else
           { convert unicode 2 ascii }
           if (cst_type=cst_widestring) and
-            (tstringdef(newtype.def).string_typ<>st_widestring) then
+            (tstringdef(def).string_typ<>st_widestring) then
             begin
               pw:=pcompilerwidestring(value_str);
               getmem(pc,getlengthwidestring(pw)+1);
@@ -728,8 +732,8 @@ implementation
               donewidestring(pw);
               value_str:=pc;
             end;
-        cst_type:=st2cst[tstringdef(newtype.def).string_typ];
-        resulttype:=newtype;
+        cst_type:=st2cst[tstringdef(def).string_typ];
+        resultdef:=def;
       end;
 
 
@@ -737,11 +741,11 @@ implementation
                              TSETCONSTNODE
 *****************************************************************************}
 
-    constructor tsetconstnode.create(s : pconstset;const t:ttype);
+    constructor tsetconstnode.create(s : pconstset;def:tdef);
 
       begin
          inherited create(setconstn,nil);
-         restype:=t;
+         typedef:=def;
          if assigned(s) then
            begin
               new(value_set);
@@ -762,7 +766,7 @@ implementation
     constructor tsetconstnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
-        ppufile.gettype(restype);
+        ppufile.getderef(typedefderef);
         new(value_set);
         ppufile.getdata(value_set^,sizeof(tconstset));
       end;
@@ -771,7 +775,7 @@ implementation
     procedure tsetconstnode.ppuwrite(ppufile:tcompilerppufile);
       begin
         inherited ppuwrite(ppufile);
-        ppufile.puttype(restype);
+        ppufile.putderef(typedefderef);
         ppufile.putdata(value_set^,sizeof(tconstset));
       end;
 
@@ -779,24 +783,24 @@ implementation
     procedure tsetconstnode.buildderefimpl;
       begin
         inherited buildderefimpl;
-        restype.buildderef;
+        typedefderef.build(typedef);
       end;
 
 
     procedure tsetconstnode.derefimpl;
       begin
         inherited derefimpl;
-        restype.resolve;
+        typedef:=tdef(typedefderef.resolve);
       end;
 
 
-    function tsetconstnode._getcopy : tnode;
+    function tsetconstnode.dogetcopy : tnode;
 
       var
          n : tsetconstnode;
 
       begin
-         n:=tsetconstnode(inherited _getcopy);
+         n:=tsetconstnode(inherited dogetcopy);
          if assigned(value_set) then
            begin
               new(n.value_set);
@@ -804,21 +808,21 @@ implementation
            end
          else
            n.value_set:=nil;
-         n.restype := restype;
+         n.typedef := typedef;
          n.lab_set:=lab_set;
-         _getcopy:=n;
+         dogetcopy:=n;
       end;
 
-    function tsetconstnode.det_resulttype:tnode;
+    function tsetconstnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=restype;
+        resultdef:=typedef;
       end;
 
     function tsetconstnode.pass_1 : tnode;
       begin
          result:=nil;
-         if tsetdef(resulttype.def).settype=smallset then
+         if tsetdef(resultdef).settype=smallset then
           expectloc:=LOC_CONSTANT
          else
           expectloc:=LOC_CREFERENCE;
@@ -842,10 +846,10 @@ implementation
         inherited create(niln);
       end;
 
-    function tnilnode.det_resulttype:tnode;
+    function tnilnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidpointertype;
+        resultdef:=voidpointertype;
       end;
 
     function tnilnode.pass_1 : tnode;
@@ -879,21 +883,21 @@ implementation
       end;
 
 
-    function tguidconstnode._getcopy : tnode;
+    function tguidconstnode.dogetcopy : tnode;
 
       var
          n : tguidconstnode;
 
       begin
-         n:=tguidconstnode(inherited _getcopy);
+         n:=tguidconstnode(inherited dogetcopy);
          n.value:=value;
-         _getcopy:=n;
+         dogetcopy:=n;
       end;
 
-    function tguidconstnode.det_resulttype:tnode;
+    function tguidconstnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype.setdef(rec_tguid);
+        resultdef:=rec_tguid;
       end;
 
     function tguidconstnode.pass_1 : tnode;

+ 100 - 100
compiler/nflw.pas

@@ -60,7 +60,7 @@ interface
           loopflags : tloopflags;
           constructor create(tt : tnodetype;l,r,_t1,_t2 : tnode);virtual;
           destructor destroy;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
@@ -72,7 +72,7 @@ interface
 
        twhilerepeatnode = class(tloopnode)
           constructor create(l,r:Tnode;tab,cn:boolean);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
 {$ifdef state_tracking}
           function track_state_pass(exec_known:boolean):boolean;override;
@@ -82,7 +82,7 @@ interface
 
        tifnode = class(tloopnode)
           constructor create(l,r,_t1 : tnode);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        tifnodeclass = class of tifnode;
@@ -95,7 +95,7 @@ interface
           loopvar_notid:cardinal;
           constructor create(l,r,_t1,_t2 : tnode;back : boolean);virtual;
           procedure loop_var_access(not_type:Tnotification_flag;symbol:Tsym);
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        tfornodeclass = class of tfornode;
@@ -104,21 +104,21 @@ interface
           constructor create(l:tnode);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        texitnodeclass = class of texitnode;
 
        tbreaknode = class(tnode)
           constructor create;virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        tbreaknodeclass = class of tbreaknode;
 
        tcontinuenode = class(tnode)
           constructor create;virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        tcontinuenodeclass = class of tcontinuenode;
@@ -137,8 +137,8 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
-          function det_resulttype:tnode;override;
+          function dogetcopy : tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
@@ -155,8 +155,8 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
-          function det_resulttype:tnode;override;
+          function dogetcopy : tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
@@ -169,9 +169,9 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           procedure insertintolist(l : tnodelist);override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
@@ -179,7 +179,7 @@ interface
 
        ttryexceptnode = class(tloopnode)
           constructor create(l,r,_t1 : tnode);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        ttryexceptnodeclass = class of ttryexceptnode;
@@ -188,7 +188,7 @@ interface
           implicitframe : boolean;
           constructor create(l,r:tnode);virtual;
           constructor create_implicit(l,r,_t1:tnode);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        ttryfinallynodeclass = class of ttryfinallynode;
@@ -199,9 +199,9 @@ interface
           constructor create(l,r:tnode);virtual;
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
        tonnodeclass = class of tonnode;
@@ -296,23 +296,23 @@ implementation
       end;
 
 
-    function tloopnode._getcopy : tnode;
+    function tloopnode.dogetcopy : tnode;
 
       var
          p : tloopnode;
 
       begin
-         p:=tloopnode(inherited _getcopy);
+         p:=tloopnode(inherited dogetcopy);
          if assigned(t1) then
-           p.t1:=t1._getcopy
+           p.t1:=t1.dogetcopy
          else
            p.t1:=nil;
          if assigned(t2) then
-           p.t2:=t2._getcopy
+           p.t2:=t2.dogetcopy
          else
            p.t2:=nil;
          p.loopflags:=loopflags;
-         _getcopy:=p;
+         dogetcopy:=p;
       end;
 
     procedure tloopnode.insertintolist(l : tnodelist);
@@ -358,14 +358,14 @@ implementation
               include(loopflags,lnf_checknegate);
       end;
 
-    function twhilerepeatnode.det_resulttype:tnode;
+    function twhilerepeatnode.pass_typecheck:tnode;
       var
          t:Tunarynode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
 
-         resulttypepass(left);
+         typecheckpass(left);
 
          { tp procvar support }
          maybe_call_procvar(left,true);
@@ -382,17 +382,17 @@ implementation
            end;
          { loop instruction }
          if assigned(right) then
-           resulttypepass(right);
+           typecheckpass(right);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
            exit;
 
-         if not is_boolean(left.resulttype.def) then
+         if not is_boolean(left.resultdef) then
            begin
-             if left.resulttype.def.deftype=variantdef then
+             if left.resultdef.deftype=variantdef then
                inserttypeconv(left,booltype)
              else
-               CGMessage1(type_e_boolean_expr_expected,left.resulttype.def.typename);
+               CGMessage1(type_e_boolean_expr_expected,left.resultdef.typename);
            end;
 
          { Give warnings for code that will never be executed for
@@ -558,7 +558,7 @@ implementation
                        cderefnode.create(ctypeconvnode.create(assignmentnode.right.getcopy,voidpointertype))));
                      addstatement(prefetchstatements,right);
                      right := prefetchcode;
-                     resulttypepass(right);
+                     typecheckpass(right);
                    end;
                end;
            end;
@@ -602,9 +602,9 @@ implementation
             if change then
                 begin
                     track_state_pass:=true;
-                    {Force new resulttype pass.}
-                    condition.resulttype.def:=nil;
-                    do_resulttypepass(condition);
+                    {Force new resultdef pass.}
+                    condition.resultdef:=nil;
+                    do_typecheckpass(condition);
                 end;
             if is_constboolnode(condition) then
                 begin
@@ -642,9 +642,9 @@ implementation
         if condition.track_state_pass(exec_known) then
             begin
                 track_state_pass:=true;
-                {Force new resulttype pass.}
-                condition.resulttype.def:=nil;
-                do_resulttypepass(condition);
+                {Force new resultdef pass.}
+                condition.resultdef:=nil;
+                do_typecheckpass(condition);
             end;
         if not is_constboolnode(condition) then
             aktstate.store_fact(condition,
@@ -664,32 +664,32 @@ implementation
       end;
 
 
-    function tifnode.det_resulttype:tnode;
+    function tifnode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
 
-         resulttypepass(left);
+         typecheckpass(left);
 
          { tp procvar support }
          maybe_call_procvar(left,true);
 
          { if path }
          if assigned(right) then
-           resulttypepass(right);
+           typecheckpass(right);
          { else path }
          if assigned(t1) then
-           resulttypepass(t1);
+           typecheckpass(t1);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
            exit;
 
-         if not is_boolean(left.resulttype.def) then
+         if not is_boolean(left.resultdef) then
            begin
-             if left.resulttype.def.deftype=variantdef then
+             if left.resultdef.deftype=variantdef then
                inserttypeconv(left,booltype)
              else
-               Message1(type_e_boolean_expr_expected,left.resulttype.def.typename);
+               Message1(type_e_boolean_expr_expected,left.resultdef.typename);
            end;
 
          { optimize constant expressions }
@@ -810,12 +810,12 @@ implementation
       Tabstractvarsym(symbol).unregister_notification(loopvar_notid);
     end;
 
-    function tfornode.det_resulttype:tnode;
+    function tfornode.pass_typecheck:tnode;
       var
         unrollres : tnode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
 
          { loop unrolling }
          if cs_opt_loopunroll in aktoptimizerswitches then
@@ -823,16 +823,16 @@ implementation
              unrollres:=unroll_loop(self);
              if assigned(unrollres) then
                begin
-                 resulttypepass(unrollres);
+                 typecheckpass(unrollres);
                  result:=unrollres;
                  exit;
                end;
            end;
 
          { process the loopvar, from and to, varstates are already set }
-         resulttypepass(left);
-         resulttypepass(right);
-         resulttypepass(t1);
+         typecheckpass(left);
+         typecheckpass(right);
+         typecheckpass(t1);
 
          {Can we spare the first comparision?}
          if (t1.nodetype=ordconstn) and
@@ -851,14 +851,14 @@ implementation
 
          { Make sure that the loop var and the
            from and to values are compatible types }
-         check_ranges(right.fileinfo,right,left.resulttype.def);
-         inserttypeconv(right,left.resulttype);
+         check_ranges(right.fileinfo,right,left.resultdef);
+         inserttypeconv(right,left.resultdef);
 
-         check_ranges(t1.fileinfo,t1,left.resulttype.def);
-         inserttypeconv(t1,left.resulttype);
+         check_ranges(t1.fileinfo,t1,left.resultdef);
+         inserttypeconv(t1,left.resultdef);
 
          if assigned(t2) then
-           resulttypepass(t2);
+           typecheckpass(t2);
       end;
 
 
@@ -947,20 +947,20 @@ implementation
       end;
 
 
-    function texitnode.det_resulttype:tnode;
+    function texitnode.pass_typecheck:tnode;
       begin
         result:=nil;
         if assigned(left) then
           begin
             { add assignment to funcretsym }
-            inserttypeconv(left,current_procinfo.procdef.rettype);
+            inserttypeconv(left,current_procinfo.procdef.returndef);
             left:=cassignmentnode.create(
                 cloadnode.create(current_procinfo.procdef.funcretsym,current_procinfo.procdef.funcretsym.owner),
                 left);
-            resulttypepass(left);
+            typecheckpass(left);
             set_varstate(left,vs_read,[vsf_must_be_valid]);
           end;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
       end;
 
 
@@ -993,10 +993,10 @@ implementation
       end;
 
 
-    function tbreaknode.det_resulttype:tnode;
+    function tbreaknode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
       end;
 
 
@@ -1017,10 +1017,10 @@ implementation
       end;
 
 
-    function tcontinuenode.det_resulttype:tnode;
+    function tcontinuenode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
       end;
 
 
@@ -1086,10 +1086,10 @@ implementation
       end;
 
 
-    function tgotonode.det_resulttype:tnode;
+    function tgotonode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
       end;
 
 
@@ -1114,12 +1114,12 @@ implementation
       end;
 
 
-   function tgotonode._getcopy : tnode;
+   function tgotonode.dogetcopy : tnode;
      var
        p : tgotonode;
        i : longint;
      begin
-        p:=tgotonode(inherited _getcopy);
+        p:=tgotonode(inherited dogetcopy);
         p.exceptionblock:=exceptionblock;
 
         { force a valid labelnode }
@@ -1130,7 +1130,7 @@ implementation
             else
               internalerror(200610291);
           end;
-        p.labelnode:=tlabelnode(labelnode._getcopy);
+        p.labelnode:=tlabelnode(labelnode.dogetcopy);
         result:=p;
      end;
 
@@ -1178,13 +1178,13 @@ implementation
       end;
 
 
-    function tlabelnode.det_resulttype:tnode;
+    function tlabelnode.pass_typecheck:tnode;
       begin
         result:=nil;
         { left could still be unassigned }
         if assigned(left) then
-         resulttypepass(left);
-        resulttype:=voidtype;
+         typecheckpass(left);
+        resultdef:=voidtype;
       end;
 
 
@@ -1204,10 +1204,10 @@ implementation
       end;
 
 
-   function tlabelnode._getcopy : tnode;
+   function tlabelnode.dogetcopy : tnode;
      begin
         if not(assigned(copiedto)) then
-          copiedto:=tlabelnode(inherited _getcopy);
+          copiedto:=tlabelnode(inherited dogetcopy);
         copiedto.exceptionblock:=exceptionblock;
 
         result:=copiedto;
@@ -1261,16 +1261,16 @@ implementation
       end;
 
 
-    function traisenode._getcopy : tnode;
+    function traisenode.dogetcopy : tnode;
       var
          n : traisenode;
       begin
-         n:=traisenode(inherited _getcopy);
+         n:=traisenode(inherited dogetcopy);
          if assigned(frametree) then
-           n.frametree:=frametree._getcopy
+           n.frametree:=frametree.dogetcopy
          else
            n.frametree:=nil;
-         _getcopy:=n;
+         dogetcopy:=n;
       end;
 
 
@@ -1279,29 +1279,29 @@ implementation
       end;
 
 
-    function traisenode.det_resulttype:tnode;
+    function traisenode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
          if assigned(left) then
            begin
               { first para must be a _class_ }
-              resulttypepass(left);
+              typecheckpass(left);
               set_varstate(left,vs_read,[vsf_must_be_valid]);
               if codegenerror then
                exit;
-              if not(is_class(left.resulttype.def)) then
-                CGMessage1(type_e_class_type_expected,left.resulttype.def.typename);
+              if not(is_class(left.resultdef)) then
+                CGMessage1(type_e_class_type_expected,left.resultdef.typename);
               { insert needed typeconvs for addr,frame }
               if assigned(right) then
                begin
                  { addr }
-                 resulttypepass(right);
+                 typecheckpass(right);
                  inserttypeconv(right,voidpointertype);
                  { frame }
                  if assigned(frametree) then
                   begin
-                    resulttypepass(frametree);
+                    typecheckpass(frametree);
                     inserttypeconv(frametree,voidpointertype);
                   end;
                end;
@@ -1348,17 +1348,17 @@ implementation
       end;
 
 
-    function ttryexceptnode.det_resulttype:tnode;
+    function ttryexceptnode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttypepass(left);
+         typecheckpass(left);
          { on statements }
          if assigned(right) then
-           resulttypepass(right);
+           typecheckpass(right);
          { else block }
          if assigned(t1) then
-           resulttypepass(t1);
-         resulttype:=voidtype;
+           typecheckpass(t1);
+         resultdef:=voidtype;
       end;
 
 
@@ -1409,24 +1409,24 @@ implementation
       end;
 
 
-    function ttryfinallynode.det_resulttype:tnode;
+    function ttryfinallynode.pass_typecheck:tnode;
       begin
          result:=nil;
          include(current_procinfo.flags,pi_do_call);
-         resulttype:=voidtype;
+         resultdef:=voidtype;
 
-         resulttypepass(left);
+         typecheckpass(left);
          // "try block" is "used"? (JM)
          set_varstate(left,vs_readwritten,[vsf_must_be_valid]);
 
-         resulttypepass(right);
+         typecheckpass(right);
          // "except block" is "used"? (JM)
          set_varstate(right,vs_readwritten,[vsf_must_be_valid]);
 
          { special finally block only executed when there was an exception }
          if assigned(t1) then
            begin
-             resulttypepass(t1);
+             typecheckpass(t1);
              // "finally block" is "used"? (JM)
              set_varstate(t1,vs_readwritten,[vsf_must_be_valid]);
            end;
@@ -1483,27 +1483,27 @@ implementation
       end;
 
 
-    function tonnode._getcopy : tnode;
+    function tonnode.dogetcopy : tnode;
       var
          n : tonnode;
       begin
-         n:=tonnode(inherited _getcopy);
+         n:=tonnode(inherited dogetcopy);
          n.exceptsymtable:=exceptsymtable.getcopy;
          n.excepttype:=excepttype;
          result:=n;
       end;
 
 
-    function tonnode.det_resulttype:tnode;
+    function tonnode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttype:=voidtype;
+         resultdef:=voidtype;
          if not(is_class(excepttype)) then
            CGMessage1(type_e_class_type_expected,excepttype.typename);
          if assigned(left) then
-           resulttypepass(left);
+           typecheckpass(left);
          if assigned(right) then
-           resulttypepass(right);
+           typecheckpass(right);
       end;
 
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 188 - 188
compiler/ninl.pas


+ 145 - 144
compiler/nld.pas

@@ -49,9 +49,9 @@ interface
           procedure derefimpl;override;
           procedure set_mp(p:tnode);
           function  is_addr_param_load:boolean;
-          function  _getcopy : tnode;override;
+          function  dogetcopy : tnode;override;
           function  pass_1 : tnode;override;
-          function  det_resulttype:tnode;override;
+          function  pass_typecheck:tnode;override;
           procedure mark_write;override;
           function  docompare(p: tnode): boolean; override;
           procedure printnodedata(var t:text);override;
@@ -67,9 +67,9 @@ interface
           constructor create(l,r : tnode);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        {$ifdef state_tracking}
           function track_state_pass(exec_known:boolean):boolean;override;
        {$endif state_tracking}
@@ -80,31 +80,32 @@ interface
        tarrayconstructorrangenode = class(tbinarynode)
           constructor create(l,r : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        end;
        tarrayconstructorrangenodeclass = class of tarrayconstructorrangenode;
 
        tarrayconstructornode = class(tbinarynode)
           constructor create(l,r : tnode);virtual;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode): boolean; override;
-          procedure force_type(tt:ttype);
+          procedure force_type(def:tdef);
           procedure insert_typeconvs;
        end;
        tarrayconstructornodeclass = class of tarrayconstructornode;
 
        ttypenode = class(tnode)
           allowed : boolean;
-          restype : ttype;
-          constructor create(t : ttype);virtual;
+          typedef : tdef;
+          typedefderef : tderef;
+          constructor create(def:tdef);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
        ttypenodeclass = class of ttypenode;
@@ -119,9 +120,9 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function  _getcopy : tnode;override;
+          function  dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function docompare(p: tnode): boolean; override;
        end;
        trttinodeclass = class of trttinode;
@@ -218,12 +219,12 @@ implementation
       end;
 
 
-    function tloadnode._getcopy : tnode;
+    function tloadnode.dogetcopy : tnode;
       var
          n : tloadnode;
 
       begin
-         n:=tloadnode(inherited _getcopy);
+         n:=tloadnode(inherited dogetcopy);
          n.symtable:=symtable;
          n.symtableentry:=symtableentry;
          n.procdef:=procdef;
@@ -237,20 +238,20 @@ implementation
                 (symtableentry.typ=paravarsym) and
                 not(vo_has_local_copy in tparavarsym(symtableentry).varoptions) and
                 not(nf_load_self_pointer in flags) and
-                paramanager.push_addr_param(tparavarsym(symtableentry).varspez,tparavarsym(symtableentry).vartype.def,tprocdef(symtable.defowner).proccalloption);
+                paramanager.push_addr_param(tparavarsym(symtableentry).varspez,tparavarsym(symtableentry).vardef,tprocdef(symtable.defowner).proccalloption);
       end;
 
 
-    function tloadnode.det_resulttype:tnode;
+    function tloadnode.pass_typecheck:tnode;
       begin
          result:=nil;
          case symtableentry.typ of
            absolutevarsym :
-             resulttype:=tabsolutevarsym(symtableentry).vartype;
+             resultdef:=tabsolutevarsym(symtableentry).vardef;
            constsym:
              begin
                if tconstsym(symtableentry).consttyp=constresourcestring then
-                 resulttype:=cansistringtype
+                 resultdef:=cansistringtype
                else
                  internalerror(22799);
              end;
@@ -289,24 +290,24 @@ implementation
                  definition }
                if vo_is_self in tabstractvarsym(symtableentry).varoptions then
                  begin
-                   resulttype.setdef(tprocdef(symtableentry.owner.defowner)._class);
+                   resultdef:=tprocdef(symtableentry.owner.defowner)._class;
                    if (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) or
                       (po_staticmethod in tprocdef(symtableentry.owner.defowner).procoptions) then
-                     resulttype.setdef(tclassrefdef.create(resulttype))
-                   else if is_object(resulttype.def) and
+                     resultdef:=tclassrefdef.create(resultdef)
+                   else if is_object(resultdef) and
                            (nf_load_self_pointer in flags) then
-                     resulttype.setdef(tpointerdef.create(resulttype));
+                     resultdef:=tpointerdef.create(resultdef);
                  end
                else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then
                  begin
-                   resulttype.setdef(tprocdef(symtableentry.owner.defowner)._class);
-                   resulttype.setdef(tclassrefdef.create(resulttype));
+                   resultdef:=tprocdef(symtableentry.owner.defowner)._class;
+                   resultdef:=tclassrefdef.create(resultdef);
                  end
                else
-                 resulttype:=tabstractvarsym(symtableentry).vartype;
+                 resultdef:=tabstractvarsym(symtableentry).vardef;
              end;
            typedconstsym :
-             resulttype:=ttypedconstsym(symtableentry).typedconsttype;
+             resultdef:=ttypedconstsym(symtableentry).typedconstdef;
            procsym :
              begin
                { Return the first procdef. In case of overlaoded
@@ -319,16 +320,16 @@ implementation
                  CGMessage(type_e_cant_take_address_of_local_subroutine);
 
                { the result is a procdef, addrn and proc_to_procvar
-                 typeconvn need this as resulttype so they know
+                 typeconvn need this as resultdef so they know
                  that the address needs to be returned }
-               resulttype.setdef(procdef);
+               resultdef:=procdef;
 
                { process methodpointer }
                if assigned(left) then
-                 resulttypepass(left);
+                 typecheckpass(left);
              end;
            labelsym:
-             resulttype:=voidtype;
+             resultdef:=voidtype;
            else
              internalerror(200104141);
          end;
@@ -384,7 +385,7 @@ implementation
                   if (tabstractvarsym(symtableentry).varspez=vs_const) then
                     expectloc:=LOC_CREFERENCE;
                 { we need a register for call by reference parameters }
-                if paramanager.push_addr_param(tabstractvarsym(symtableentry).varspez,tabstractvarsym(symtableentry).vartype.def,pocall_default) then
+                if paramanager.push_addr_param(tabstractvarsym(symtableentry).varspez,tabstractvarsym(symtableentry).vardef,pocall_default) then
                   registersint:=1;
                 if ([vo_is_thread_var,vo_is_dll_var]*tabstractvarsym(symtableentry).varoptions)<>[] then
                   registersint:=1;
@@ -449,7 +450,7 @@ implementation
     procedure tloadnode.setprocdef(p : tprocdef);
       begin
         procdef:=p;
-        resulttype.setdef(p);
+        resultdef:=p;
         if po_local in p.procoptions then
           CGMessage(type_e_cant_take_address_of_local_subroutine);
       end;
@@ -481,33 +482,33 @@ implementation
       end;
 
 
-    function tassignmentnode._getcopy : tnode;
+    function tassignmentnode.dogetcopy : tnode;
 
       var
          n : tassignmentnode;
 
       begin
-         n:=tassignmentnode(inherited _getcopy);
+         n:=tassignmentnode(inherited dogetcopy);
          n.assigntype:=assigntype;
          result:=n;
       end;
 
 
-    function tassignmentnode.det_resulttype:tnode;
+    function tassignmentnode.pass_typecheck:tnode;
       var
         hp : tnode;
         useshelper : boolean;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
 
         { must be made unique }
         set_unique(left);
 
-        resulttypepass(left);
+        typecheckpass(left);
 
 {$ifdef old_append_str}
-        if is_ansistring(left.resulttype.def) then
+        if is_ansistring(left.resultdef) then
           begin
             { fold <ansistring>:=<ansistring>+<char|shortstring|ansistring> }
             if (right.nodetype=addn) and
@@ -518,27 +519,27 @@ implementation
                (tbinarynode(right).left.nodetype<>addn) and
                (tbinarynode(right).right.nodetype<>addn) then
               begin
-                { don't do a resulttypepass(right), since then the addnode }
+                { don't do a typecheckpass(right), since then the addnode }
                 { may insert typeconversions that make this optimization   }
                 { opportunity quite difficult to detect (JM)               }
-                resulttypepass(tbinarynode(right).left);
-                resulttypepass(tbinarynode(right).right);
+                typecheckpass(tbinarynode(right).left);
+                typecheckpass(tbinarynode(right).right);
                 if (tbinarynode(right).right.nodetype=stringconstn) or
-		   is_char(tbinarynode(right).right.resulttype.def) or
-                   is_shortstring(tbinarynode(right).right.resulttype.def) or
-                   is_ansistring(tbinarynode(right).right.resulttype.def) then
+		   is_char(tbinarynode(right).right.resultdef) or
+                   is_shortstring(tbinarynode(right).right.resultdef) or
+                   is_ansistring(tbinarynode(right).right.resultdef) then
                   begin
                     { remove property flag so it'll not trigger an error }
                     exclude(left.flags,nf_isproperty);
                     { generate call to helper }
                     hp:=ccallparanode.create(tbinarynode(right).right,
                       ccallparanode.create(left,nil));
-                    if is_char(tbinarynode(right).right.resulttype.def) then
-                      result:=ccallnode.createintern('fpc_'+Tstringdef(left.resulttype.def).stringtypname+'_append_char',hp)
-                    else if is_shortstring(tbinarynode(right).right.resulttype.def) then
-                      result:=ccallnode.createintern('fpc_'+Tstringdef(left.resulttype.def).stringtypname+'_append_shortstring',hp)
+                    if is_char(tbinarynode(right).right.resultdef) then
+                      result:=ccallnode.createintern('fpc_'+Tstringdef(left.resultdef).stringtypname+'_append_char',hp)
+                    else if is_shortstring(tbinarynode(right).right.resultdef) then
+                      result:=ccallnode.createintern('fpc_'+Tstringdef(left.resultdef).stringtypname+'_append_shortstring',hp)
                     else
-                      result:=ccallnode.createintern('fpc_'+Tstringdef(left.resulttype.def).stringtypname+'_append_ansistring',hp);
+                      result:=ccallnode.createintern('fpc_'+Tstringdef(left.resultdef).stringtypname+'_append_ansistring',hp);
                     tbinarynode(right).right:=nil;
                     left:=nil;
                     exit;
@@ -547,7 +548,7 @@ implementation
           end
         else
 
-         if is_shortstring(left.resulttype.def) then
+         if is_shortstring(left.resultdef) then
           begin
             { fold <shortstring>:=<shortstring>+<shortstring>,
               <shortstring>+<char> is handled by an optimized node }
@@ -558,19 +559,19 @@ implementation
                (tbinarynode(right).left.nodetype<>addn) and
                (tbinarynode(right).right.nodetype<>addn) then
               begin
-                { don't do a resulttypepass(right), since then the addnode }
+                { don't do a typecheckpass(right), since then the addnode }
                 { may insert typeconversions that make this optimization   }
                 { opportunity quite difficult to detect (JM)               }
-                resulttypepass(tbinarynode(right).left);
-                resulttypepass(tbinarynode(right).right);
-                if is_shortstring(tbinarynode(right).right.resulttype.def) then
+                typecheckpass(tbinarynode(right).left);
+                typecheckpass(tbinarynode(right).right);
+                if is_shortstring(tbinarynode(right).right.resultdef) then
                   begin
                     { remove property flag so it'll not trigger an error }
                     exclude(left.flags,nf_isproperty);
                     { generate call to helper }
                     hp:=ccallparanode.create(tbinarynode(right).right,
                       ccallparanode.create(left,nil));
-                    if is_shortstring(tbinarynode(right).right.resulttype.def) then
+                    if is_shortstring(tbinarynode(right).right.resultdef) then
                       result:=ccallnode.createintern('fpc_shortstr_append_shortstr',hp);
                     tbinarynode(right).right:=nil;
                     left:=nil;
@@ -580,7 +581,7 @@ implementation
           end;
 {$endif old_append_str}
 
-        resulttypepass(right);
+        typecheckpass(right);
         set_varstate(right,vs_read,[vsf_must_be_valid]);
         set_varstate(left,vs_written,[]);
         if codegenerror then
@@ -588,23 +589,23 @@ implementation
 
         { tp procvar support, when we don't expect a procvar
           then we need to call the procvar }
-        if (left.resulttype.def.deftype<>procvardef) then
+        if (left.resultdef.deftype<>procvardef) then
           maybe_call_procvar(right,true);
 
         { assignments to formaldefs and open arrays aren't allowed }
-        if (left.resulttype.def.deftype=formaldef) or
-           is_open_array(left.resulttype.def) then
+        if (left.resultdef.deftype=formaldef) or
+           is_open_array(left.resultdef) then
           CGMessage(type_e_operator_not_allowed);
 
         { test if node can be assigned, properties are allowed }
         valid_for_assignment(left,true);
 
         { assigning nil to a dynamic array clears the array }
-        if is_dynamic_array(left.resulttype.def) and
+        if is_dynamic_array(left.resultdef) and
            (right.nodetype=niln) then
          begin
            hp:=ccallparanode.create(caddrnode.create_internal
-                   (crttinode.create(tstoreddef(left.resulttype.def),initrtti)),
+                   (crttinode.create(tstoreddef(left.resultdef),initrtti)),
                ccallparanode.create(ctypeconvnode.create_internal(left,voidpointertype),nil));
            result := ccallnode.createintern('fpc_dynarray_clear',hp);
            left:=nil;
@@ -613,15 +614,15 @@ implementation
 
         { shortstring helpers can do the conversion directly,
           so treat them separatly }
-        if (is_shortstring(left.resulttype.def)) then
+        if (is_shortstring(left.resultdef)) then
          begin
            { insert typeconv, except for chars that are handled in
              secondpass and except for ansi/wide string that can
              be converted immediatly }
-           if not(is_char(right.resulttype.def) or
-                  (right.resulttype.def.deftype=stringdef)) then
-             inserttypeconv(right,left.resulttype);
-           if right.resulttype.def.deftype=stringdef then
+           if not(is_char(right.resultdef) or
+                  (right.resultdef.deftype=stringdef)) then
+             inserttypeconv(right,left.resultdef);
+           if right.resultdef.deftype=stringdef then
             begin
               useshelper:=true;
               { convert constant strings to shortstrings. But
@@ -633,10 +634,10 @@ implementation
                   { just emit a warning, delphi gives an    }
                   { error, only if the type definition of   }
                   { of the string is less  < 255 characters }
-                  if not is_open_string(left.resulttype.def) and
-                     (tstringconstnode(right).len > tstringdef(left.resulttype.def).len) then
+                  if not is_open_string(left.resultdef) and
+                     (tstringconstnode(right).len > tstringdef(left.resultdef).len) then
                      cgmessage(type_w_string_too_long);
-                  inserttypeconv(right,left.resulttype);
+                  inserttypeconv(right,left.resultdef);
                   if (tstringconstnode(right).len=0) then
                     useshelper:=false;
                 end;
@@ -648,12 +649,12 @@ implementation
         else
           begin
            { check if the assignment may cause a range check error }
-           check_ranges(fileinfo,right,left.resulttype.def);
-           inserttypeconv(right,left.resulttype);
+           check_ranges(fileinfo,right,left.resultdef);
+           inserttypeconv(right,left.resultdef);
           end;
 
         { call helpers for interface }
-        if is_interfacecom(left.resulttype.def) then
+        if is_interfacecom(left.resultdef) then
          begin
            {
            hp:=
@@ -667,7 +668,7 @@ implementation
 
            hp:=
              ccallparanode.create(
-               cguidconstnode.create(tobjectdef(left.resulttype.def).iidguid^),
+               cguidconstnode.create(tobjectdef(left.resultdef).iidguid^),
              ccallparanode.create(
                ctypeconvnode.create_internal(right,voidpointertype),
              ccallparanode.create(
@@ -682,7 +683,7 @@ implementation
 
         { call helpers for variant, they can contain non ref. counted types like
           vararrays which must be really copied }
-        if left.resulttype.def.deftype=variantdef then
+        if left.resultdef.deftype=variantdef then
          begin
            hp:=ccallparanode.create(ctypeconvnode.create_internal(
                  caddrnode.create_internal(right),voidpointertype),
@@ -696,7 +697,7 @@ implementation
          end;
 
         { call helpers for windows widestrings, they aren't ref. counted }
-        if (tf_winlikewidestring in target_info.flags) and is_widestring(left.resulttype.def) then
+        if (tf_winlikewidestring in target_info.flags) and is_widestring(left.resultdef) then
          begin
            hp:=ccallparanode.create(ctypeconvnode.create_internal(right,voidpointertype),
                ccallparanode.create(ctypeconvnode.create_internal(left,voidpointertype),
@@ -708,8 +709,8 @@ implementation
          end;
 
         { check if local proc/func is assigned to procvar }
-        if right.resulttype.def.deftype=procvardef then
-          test_local_to_procvar(tprocvardef(right.resulttype.def),left.resulttype.def);
+        if right.resultdef.deftype=procvardef then
+          test_local_to_procvar(tprocvardef(right.resultdef),left.resultdef);
       end;
 
 
@@ -747,7 +748,7 @@ implementation
 
          if (cs_opt_level1 in aktoptimizerswitches) and
             (right.nodetype = calln) and
-            (right.resulttype.def=left.resulttype.def) and
+            (right.resultdef=left.resultdef) and
             { left must be a temp, since otherwise as soon as you modify the }
             { result, the current left node is modified and that one may     }
             { still be an argument to the function or even accessed in the   }
@@ -755,11 +756,11 @@ implementation
             (
              (
               (left.nodetype = temprefn) and
-              paramanager.ret_in_param(right.resulttype.def,tcallnode(right).procdefinition.proccalloption)
+              paramanager.ret_in_param(right.resultdef,tcallnode(right).procdefinition.proccalloption)
              ) or
              { there's special support for ansi/widestrings in the callnode }
-             is_ansistring(right.resulttype.def) or
-             is_widestring(right.resulttype.def)
+             is_ansistring(right.resultdef) or
+             is_widestring(right.resultdef)
             )  then
            begin
              make_not_regable(left,vr_addr);
@@ -771,14 +772,14 @@ implementation
            end;
 
          { assignment to refcounted variable -> inc/decref }
-         if (not is_class(left.resulttype.def) and
-            left.resulttype.def.needs_inittable) then
+         if (not is_class(left.resultdef) and
+            left.resultdef.needs_inittable) then
            include(current_procinfo.flags,pi_do_call);
 
 
-        if (is_shortstring(left.resulttype.def)) then
+        if (is_shortstring(left.resultdef)) then
           begin
-           if right.resulttype.def.deftype=stringdef then
+           if right.resultdef.deftype=stringdef then
             begin
               if (right.nodetype<>stringconstn) or
                  (tstringconstnode(right).len<>0) then
@@ -787,11 +788,11 @@ implementation
                  if (cs_opt_level1 in aktoptimizerswitches) and
                     (right.nodetype in [calln,blockn]) and
                     (left.nodetype = temprefn) and
-                    is_shortstring(right.resulttype.def) and
-                    not is_open_string(left.resulttype.def) and
-                    (tstringdef(left.resulttype.def).len = 255) then
+                    is_shortstring(right.resultdef) and
+                    not is_open_string(left.resultdef) and
+                    (tstringdef(left.resultdef).len = 255) then
                    begin
-                     { the blocknode case is handled in pass_2 at the temp }
+                     { the blocknode case is handled in pass_generate_code at the temp }
                      { reference level (mainly for callparatemp)  (JM)     }
                      if (right.nodetype = calln) then
                        begin
@@ -808,7 +809,7 @@ implementation
                            (right,
                       ccallparanode.create(cinlinenode.create
                            (in_high_x,false,left.getcopy),nil));
-                     result:=ccallnode.createinternreturn('fpc_'+tstringdef(right.resulttype.def).stringtypname+'_to_shortstr',hp,left);
+                     result:=ccallnode.createinternreturn('fpc_'+tstringdef(right.resultdef).stringtypname+'_to_shortstr',hp,left);
                      firstpass(result);
                    end;
                  left:=nil;
@@ -843,10 +844,10 @@ implementation
         if exec_known then
             begin
                 track_state_pass:=right.track_state_pass(exec_known);
-                {Force a new resulttype pass.}
-                right.resulttype.def:=nil;
-                do_resulttypepass(right);
-                resulttypepass(right);
+                {Force a new resultdef pass.}
+                right.resultdef:=nil;
+                do_typecheckpass(right);
+                typecheckpass(right);
                 aktstate.store_fact(left.getcopy,right.getcopy);
             end
         else
@@ -865,16 +866,16 @@ implementation
          inherited create(arrayconstructorrangen,l,r);
       end;
 
-    function tarrayconstructorrangenode.det_resulttype:tnode;
+    function tarrayconstructorrangenode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttypepass(left);
-        resulttypepass(right);
+        typecheckpass(left);
+        typecheckpass(right);
         set_varstate(left,vs_read,[vsf_must_be_valid]);
         set_varstate(right,vs_read,[vsf_must_be_valid]);
         if codegenerror then
          exit;
-        resulttype:=left.resulttype;
+        resultdef:=left.resultdef;
       end;
 
 
@@ -898,18 +899,18 @@ implementation
       end;
 
 
-    function tarrayconstructornode._getcopy : tnode;
+    function tarrayconstructornode.dogetcopy : tnode;
       var
          n : tarrayconstructornode;
       begin
-         n:=tarrayconstructornode(inherited _getcopy);
+         n:=tarrayconstructornode(inherited dogetcopy);
          result:=n;
       end;
 
 
-    function tarrayconstructornode.det_resulttype:tnode;
+    function tarrayconstructornode.pass_typecheck:tnode;
       var
-        htype : ttype;
+        hdef  : tdef;
         hp    : tarrayconstructornode;
         len   : longint;
         varia : boolean;
@@ -918,7 +919,7 @@ implementation
 
       { are we allowing array constructor? Then convert it to a set.
         Do this only if we didn't convert the arrayconstructor yet. This
-        is needed for the cases where the resulttype is forced for a second
+        is needed for the cases where the resultdef is forced for a second
         run }
         if (not allow_array_constructor) then
          begin
@@ -929,7 +930,7 @@ implementation
          end;
 
       { only pass left tree, right tree contains next construct if any }
-        htype.reset;
+        hdef:=nil;
         len:=0;
         varia:=false;
         if assigned(left) then
@@ -937,20 +938,20 @@ implementation
            hp:=self;
            while assigned(hp) do
             begin
-              resulttypepass(hp.left);
+              typecheckpass(hp.left);
               set_varstate(hp.left,vs_read,[vsf_must_be_valid]);
-              if (htype.def=nil) then
-               htype:=hp.left.resulttype
+              if (hdef=nil) then
+               hdef:=hp.left.resultdef
               else
                begin
-                 if (not varia) and (not equal_defs(htype.def,hp.left.resulttype.def)) then
+                 if (not varia) and (not equal_defs(hdef,hp.left.resultdef)) then
                    begin
                      { If both are integers we need to take the type that can hold both
                        defs }
-                     if is_integer(htype.def) and is_integer(hp.left.resulttype.def) then
+                     if is_integer(hdef) and is_integer(hp.left.resultdef) then
                        begin
-                         if is_in_limit(htype.def,hp.left.resulttype.def) then
-                           htype:=hp.left.resulttype;
+                         if is_in_limit(hdef,hp.left.resultdef) then
+                           hdef:=hp.left.resultdef;
                        end
                      else
                        if (nf_novariaallowed in flags) then
@@ -963,33 +964,33 @@ implementation
          end;
          { Set the type of empty or varia arrays to void. Also
            do this if the type is array of const/open array
-           because those can't be used with setelementtype }
-         if not assigned(htype.def) or
+           because those can't be used with setelementdef }
+         if not assigned(hdef) or
             varia or
-            is_array_of_const(htype.def) or
-            is_open_array(htype.def) then
-           htype:=voidtype;
-         resulttype.setdef(tarraydef.create(0,len-1,s32inttype));
-         tarraydef(resulttype.def).setelementtype(htype);
-         include(tarraydef(resulttype.def).arrayoptions,ado_IsConstructor);
+            is_array_of_const(hdef) or
+            is_open_array(hdef) then
+           hdef:=voidtype;
+         resultdef:=tarraydef.create(0,len-1,s32inttype);
+         tarraydef(resultdef).elementdef:=hdef;
+         include(tarraydef(resultdef).arrayoptions,ado_IsConstructor);
          if varia then
-           include(tarraydef(resulttype.def).arrayoptions,ado_IsVariant);
+           include(tarraydef(resultdef).arrayoptions,ado_IsVariant);
       end;
 
 
-    procedure tarrayconstructornode.force_type(tt:ttype);
+    procedure tarrayconstructornode.force_type(def:tdef);
       var
         hp : tarrayconstructornode;
       begin
-        tarraydef(resulttype.def).setelementtype(tt);
-        include(tarraydef(resulttype.def).arrayoptions,ado_IsConstructor);
-        exclude(tarraydef(resulttype.def).arrayoptions,ado_IsVariant);
+        tarraydef(resultdef).elementdef:=def;
+        include(tarraydef(resultdef).arrayoptions,ado_IsConstructor);
+        exclude(tarraydef(resultdef).arrayoptions,ado_IsVariant);
         if assigned(left) then
          begin
            hp:=self;
            while assigned(hp) do
             begin
-              inserttypeconv(hp.left,tt);
+              inserttypeconv(hp.left,def);
               hp:=tarrayconstructornode(hp.right);
             end;
          end;
@@ -1001,14 +1002,14 @@ implementation
         hp        : tarrayconstructornode;
         dovariant : boolean;
       begin
-        dovariant:=(nf_forcevaria in flags) or (ado_isvariant in tarraydef(resulttype.def).arrayoptions);
+        dovariant:=(nf_forcevaria in flags) or (ado_isvariant in tarraydef(resultdef).arrayoptions);
         { only pass left tree, right tree contains next construct if any }
         if assigned(left) then
          begin
            hp:=self;
            while assigned(hp) do
             begin
-              resulttypepass(hp.left);
+              typecheckpass(hp.left);
               { Insert typeconvs for array of const }
               if dovariant then
                 { at this time C varargs are no longer an arrayconstructornode }
@@ -1024,11 +1025,11 @@ implementation
         hp : tarrayconstructornode;
         do_variant:boolean;
       begin
-        do_variant:=(nf_forcevaria in flags) or (ado_isvariant in tarraydef(resulttype.def).arrayoptions);
+        do_variant:=(nf_forcevaria in flags) or (ado_isvariant in tarraydef(resultdef).arrayoptions);
         result:=nil;
         { Insert required type convs, this must be
           done in pass 1, because the call must be
-          resulttypepassed already }
+          typecheckpassed already }
         if assigned(left) then
           begin
             insert_typeconvs;
@@ -1064,10 +1065,10 @@ implementation
                               TTYPENODE
 *****************************************************************************}
 
-    constructor ttypenode.create(t : ttype);
+    constructor ttypenode.create(def:tdef);
       begin
          inherited create(typen);
-         restype:=t;
+         typedef:=def;
          allowed:=false;
       end;
 
@@ -1075,7 +1076,7 @@ implementation
     constructor ttypenode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
-        ppufile.gettype(restype);
+        ppufile.getderef(typedefderef);
         allowed:=boolean(ppufile.getbyte);
       end;
 
@@ -1083,7 +1084,7 @@ implementation
     procedure ttypenode.ppuwrite(ppufile:tcompilerppufile);
       begin
         inherited ppuwrite(ppufile);
-        ppufile.puttype(restype);
+        ppufile.putderef(typedefderef);
         ppufile.putbyte(byte(allowed));
       end;
 
@@ -1091,23 +1092,23 @@ implementation
     procedure ttypenode.buildderefimpl;
       begin
         inherited buildderefimpl;
-        restype.buildderef;
+        typedefderef.build(typedef);
       end;
 
 
     procedure ttypenode.derefimpl;
       begin
         inherited derefimpl;
-        restype.resolve;
+        typedef:=tdef(typedefderef.resolve);
       end;
 
 
-    function ttypenode.det_resulttype:tnode;
+    function ttypenode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=restype;
+        resultdef:=typedef;
         { check if it's valid }
-        if restype.def.deftype = errordef then
+        if typedef.deftype = errordef then
           CGMessage(parser_e_illegal_expression);
       end;
 
@@ -1117,7 +1118,7 @@ implementation
          result:=nil;
          expectloc:=LOC_VOID;
          { a typenode can't generate code, so we give here
-           an error. Else it'll be an abstract error in pass_2.
+           an error. Else it'll be an abstract error in pass_generate_code.
            Only when the allowed flag is set we don't generate
            an error }
          if not allowed then
@@ -1175,22 +1176,22 @@ implementation
       end;
 
 
-    function trttinode._getcopy : tnode;
+    function trttinode.dogetcopy : tnode;
       var
          n : trttinode;
       begin
-         n:=trttinode(inherited _getcopy);
+         n:=trttinode(inherited dogetcopy);
          n.rttidef:=rttidef;
          n.rttitype:=rttitype;
          result:=n;
       end;
 
 
-    function trttinode.det_resulttype:tnode;
+    function trttinode.pass_typecheck:tnode;
       begin
         { rtti information will be returned as a void pointer }
         result:=nil;
-        resulttype:=voidpointertype;
+        resultdef:=voidpointertype;
       end;
 
 

+ 88 - 88
compiler/nmat.pas

@@ -31,7 +31,7 @@ interface
     type
        tmoddivnode = class(tbinopnode)
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function simplify : tnode;override;
          protected
 {$ifndef cpu64bit}
@@ -46,7 +46,7 @@ interface
 
        tshlshrnode = class(tbinopnode)
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function simplify : tnode;override;
 {$ifndef cpu64bit}
           { override the following if you want to implement }
@@ -62,7 +62,7 @@ interface
        tunaryminusnode = class(tunarynode)
           constructor create(expr : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function simplify : tnode;override;
        end;
        tunaryminusnodeclass = class of tunaryminusnode;
@@ -70,7 +70,7 @@ interface
        tnotnode = class(tunarynode)
           constructor create(expr : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function simplify : tnode;override;
        {$ifdef state_tracking}
           function track_state_pass(exec_known:boolean):boolean;override;
@@ -114,7 +114,7 @@ implementation
               begin
                 case nodetype of
                   modn:
-                    result := cordconstnode.create(0,left.resulttype,true);
+                    result := cordconstnode.create(0,left.resultdef,true);
                   divn:
                     result := left.getcopy;
                 end;
@@ -124,8 +124,8 @@ implementation
 
         if is_constintnode(right) and is_constintnode(left) then
           begin
-            rd:=torddef(right.resulttype.def);
-            ld:=torddef(left.resulttype.def);
+            rd:=torddef(right.resultdef);
+            ld:=torddef(left.resultdef);
 
             rv:=tordconstnode(right).value;
             lv:=tordconstnode(left).value;
@@ -150,15 +150,15 @@ implementation
       end;
 
 
-    function tmoddivnode.det_resulttype:tnode;
+    function tmoddivnode.pass_typecheck:tnode;
       var
         hp,t : tnode;
         rd,ld : torddef;
         rv : tconstexprint;
       begin
          result:=nil;
-         resulttypepass(left);
-         resulttypepass(right);
+         typecheckpass(left);
+         typecheckpass(right);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          set_varstate(right,vs_read,[vsf_must_be_valid]);
          if codegenerror then
@@ -177,15 +177,15 @@ implementation
            end;
 
          { we need 2 orddefs always }
-         if (left.resulttype.def.deftype<>orddef) then
+         if (left.resultdef.deftype<>orddef) then
            inserttypeconv(right,sinttype);
-         if (right.resulttype.def.deftype<>orddef) then
+         if (right.resultdef.deftype<>orddef) then
            inserttypeconv(right,sinttype);
          if codegenerror then
            exit;
 
-         rd:=torddef(right.resulttype.def);
-         ld:=torddef(left.resulttype.def);
+         rd:=torddef(right.resultdef);
+         ld:=torddef(left.resultdef);
 
          { check for division by zero }
          if is_constintnode(right) then
@@ -208,15 +208,15 @@ implementation
             is_constintnode(left) and
             (tordconstnode(left).value >= 0) then
            begin
-             inserttypeconv(left,right.resulttype);
-             ld:=torddef(left.resulttype.def);
+             inserttypeconv(left,right.resultdef);
+             ld:=torddef(left.resultdef);
            end;
          if (ld.typ in [u32bit,u64bit]) and
             is_constintnode(right) and
             (tordconstnode(right).value >= 0) then
           begin
-            inserttypeconv(right,left.resulttype);
-            rd:=torddef(right.resulttype.def);
+            inserttypeconv(right,left.resultdef);
+            rd:=torddef(right.resultdef);
           end;
 
          { when there is one currency value, everything is done
@@ -228,14 +228,14 @@ implementation
               inserttypeconv(left,s64currencytype);
              if (rd.typ<>scurrency) then
               inserttypeconv(right,s64currencytype);
-             resulttype:=left.resulttype;
+             resultdef:=left.resultdef;
            end
          else
 {$ifndef cpu64bit}
           { when there is one 64bit value, everything is done
             in 64bit }
-          if (is_64bitint(left.resulttype.def) or
-              is_64bitint(right.resulttype.def)) then
+          if (is_64bitint(left.resultdef) or
+              is_64bitint(right.resultdef)) then
            begin
              if is_signed(rd) or is_signed(ld) then
                begin
@@ -251,7 +251,7 @@ implementation
                   if (rd.typ<>u64bit) then
                     inserttypeconv(right,u64inttype);
                end;
-             resulttype:=left.resulttype;
+             resultdef:=left.resultdef;
            end
          else
           { when mixing cardinals and signed numbers, convert everythign to 64bit (JM) }
@@ -265,17 +265,17 @@ implementation
                 inserttypeconv(left,s64inttype);
               if (rd.typ<>s64bit) then
                 inserttypeconv(right,s64inttype);
-              resulttype:=left.resulttype;
+              resultdef:=left.resultdef;
            end
          else
 {$endif cpu64bit}
            begin
               { Make everything always default singed int }
-              if not(rd.typ in [torddef(sinttype.def).typ,torddef(uinttype.def).typ]) then
+              if not(rd.typ in [torddef(sinttype).typ,torddef(uinttype).typ]) then
                 inserttypeconv(right,sinttype);
-              if not(ld.typ in [torddef(sinttype.def).typ,torddef(uinttype.def).typ]) then
+              if not(ld.typ in [torddef(sinttype).typ,torddef(uinttype).typ]) then
                 inserttypeconv(left,sinttype);
-              resulttype:=right.resulttype;
+              resultdef:=right.resultdef;
            end;
 
          { when the result is currency we need some extra code for
@@ -283,7 +283,7 @@ implementation
            created internally }
          if (nodetype=divn) and
             not(nf_is_currency in flags) and
-            is_currency(resulttype.def) then
+            is_currency(resultdef) then
           begin
             hp:=caddnode.create(muln,getcopy,cordconstnode.create(10000,s64currencytype,false));
             include(hp.flags,nf_is_currency);
@@ -306,7 +306,7 @@ implementation
           procname := 'fpc_mod_';
         { only qword needs the unsigned code, the
           signed code is also used for currency }
-        if is_signed(resulttype.def) then
+        if is_signed(resultdef) then
           procname := procname + 'longint'
         else
           procname := procname + 'dword';
@@ -333,10 +333,10 @@ implementation
 
         { when currency is used set the result of the
           parameters to s64bit, so they are not converted }
-        if is_currency(resulttype.def) then
+        if is_currency(resultdef) then
           begin
-            left.resulttype:=s64inttype;
-            right.resulttype:=s64inttype;
+            left.resultdef:=s64inttype;
+            right.resultdef:=s64inttype;
           end;
 
         { otherwise create a call to a helper }
@@ -346,7 +346,7 @@ implementation
           procname := 'fpc_mod_';
         { only qword needs the unsigned code, the
           signed code is also used for currency }
-        if is_signed(resulttype.def) then
+        if is_signed(resultdef) then
           procname := procname + 'int64'
         else
           procname := procname + 'qword';
@@ -370,16 +370,16 @@ implementation
         if (cs_opt_peephole in aktoptimizerswitches) and
            (right.nodetype = ordconstn) and
 {           ((nodetype = divn) or
-            not is_signed(resulttype.def)) and}
-           (not is_signed(resulttype.def)) and
+            not is_signed(resultdef)) and}
+           (not is_signed(resultdef)) and
            ispowerof2(tordconstnode(right).value,power) then
           begin
             if nodetype = divn then
               begin
 (*
-                if is_signed(resulttype.def) then
+                if is_signed(resultdef) then
                   begin
-                    if is_64bitint(left.resulttype.def) then
+                    if is_64bitint(left.resultdef) then
                       if not (cs_opt_size in aktoptimizerswitches) then
                         shiftval := 63
                       else
@@ -395,7 +395,7 @@ implementation
                         cshlshrnode.create(sarn,left.getcopy,
                           cordconstnode.create(shiftval,sinttype,false)),
                         cordconstnode.create(tordconstnode(right).value-1,
-                          right.resulttype,false)));
+                          right.resultdef,false)));
                     newtype := sarn;
                   end
                 else
@@ -433,9 +433,9 @@ implementation
 
 {$ifndef cpu64bit}
          { 64bit }
-         if (left.resulttype.def.deftype=orddef) and
-            (right.resulttype.def.deftype=orddef) and
-            (is_64bitint(left.resulttype.def) or is_64bitint(right.resulttype.def)) then
+         if (left.resultdef.deftype=orddef) and
+            (right.resultdef.deftype=orddef) and
+            (is_64bitint(left.resultdef) or is_64bitint(right.resultdef)) then
            begin
              result := first_moddiv64bitint;
              if assigned(result) then
@@ -483,13 +483,13 @@ implementation
       end;
 
 
-    function tshlshrnode.det_resulttype:tnode;
+    function tshlshrnode.pass_typecheck:tnode;
       var
          t : tnode;
       begin
          result:=nil;
-         resulttypepass(left);
-         resulttypepass(right);
+         typecheckpass(left);
+         typecheckpass(right);
          set_varstate(right,vs_read,[vsf_must_be_valid]);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
@@ -510,13 +510,13 @@ implementation
          { calculations for ordinals < 32 bit have to be done in
            32 bit for backwards compatibility. That way 'shl 33' is
            the same as 'shl 1'. It's ugly but compatible with delphi/tp/gcc }
-         if (not is_64bit(left.resulttype.def)) and
-            (torddef(left.resulttype.def).typ<>u32bit) then
+         if (not is_64bit(left.resultdef)) and
+            (torddef(left.resultdef).typ<>u32bit) then
            inserttypeconv(left,s32inttype);
 
          inserttypeconv(right,sinttype);
 
-         resulttype:=left.resulttype;
+         resultdef:=left.resultdef;
       end;
 
 
@@ -554,7 +554,7 @@ implementation
 
 {$ifndef cpu64bit}
          { 64 bit ints have their own shift handling }
-         if is_64bit(left.resulttype.def) then
+         if is_64bit(left.resultdef) then
            begin
              result := first_shlshr64bitint;
              if assigned(result) then
@@ -603,12 +603,12 @@ implementation
       end;
 
 
-    function tunaryminusnode.det_resulttype : tnode;
+    function tunaryminusnode.pass_typecheck : tnode;
       var
          t : tnode;
       begin
          result:=nil;
-         resulttypepass(left);
+         typecheckpass(left);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
            exit;
@@ -617,32 +617,32 @@ implementation
          if assigned(result) then
            exit;
 
-         resulttype:=left.resulttype;
-         if (left.resulttype.def.deftype=floatdef) then
+         resultdef:=left.resultdef;
+         if (left.resultdef.deftype=floatdef) then
            begin
            end
 {$ifdef SUPPORT_MMX}
          else if (cs_mmx in aktlocalswitches) and
-           is_mmx_able_array(left.resulttype.def) then
+           is_mmx_able_array(left.resultdef) then
              begin
-               { if saturation is on, left.resulttype.def isn't
+               { if saturation is on, left.resultdef isn't
                  "mmx able" (FK)
                if (cs_mmx_saturation in aktlocalswitches^) and
-                 (torddef(tarraydef(resulttype.def).definition).typ in
+                 (torddef(tarraydef(resultdef).definition).typ in
                  [s32bit,u32bit]) then
                  CGMessage(type_e_mismatch);
                }
              end
 {$endif SUPPORT_MMX}
 {$ifndef cpu64bit}
-         else if is_64bitint(left.resulttype.def) then
+         else if is_64bitint(left.resultdef) then
            begin
            end
 {$endif cpu64bit}
-         else if (left.resulttype.def.deftype=orddef) then
+         else if (left.resultdef.deftype=orddef) then
            begin
               inserttypeconv(left,sinttype);
-              resulttype:=left.resulttype;
+              resultdef:=left.resultdef;
            end
          else
            begin
@@ -664,27 +664,27 @@ implementation
     function tunaryminusnode.pass_1 : tnode;
       var
         procname: string[31];
-        floattype : ttype;
+        fdef : tdef;
       begin
         result:=nil;
         firstpass(left);
         if codegenerror then
           exit;
 
-        if (cs_fp_emulation in aktmoduleswitches) and (left.resulttype.def.deftype=floatdef) then
+        if (cs_fp_emulation in aktmoduleswitches) and (left.resultdef.deftype=floatdef) then
           begin
             if not(target_info.system in system_wince) then
               begin
-                case tfloatdef(resulttype.def).typ of
+                case tfloatdef(resultdef).typ of
                   s32real:
                     begin
                       procname:='float32_sub';
-                      floattype:=search_system_type('FLOAT32REC').restype;
+                      fdef:=search_system_type('FLOAT32REC').typedef;
                     end;
                   s64real:
                     begin
                       procname:='float64_sub';
-                      floattype:=search_system_type('FLOAT64').restype;
+                      fdef:=search_system_type('FLOAT64').typedef;
                     end;
                   {!!! not yet implemented
                   s128real:
@@ -693,12 +693,12 @@ implementation
                     internalerror(2005082801);
                 end;
                 result:=ctypeconvnode.create_internal(ccallnode.createintern(procname,ccallparanode.create(
-                  ctypeconvnode.create_internal(crealconstnode.create(0,resulttype),floattype),
-                  ccallparanode.create(ctypeconvnode.create_internal(left,floattype),nil))),resulttype);
+                  ctypeconvnode.create_internal(crealconstnode.create(0,resultdef),fdef),
+                  ccallparanode.create(ctypeconvnode.create_internal(left,fDef),nil))),resultdef);
               end
             else
               begin
-                case tfloatdef(resulttype.def).typ of
+                case tfloatdef(resultdef).typ of
                   s32real:
                     procname:='NEGS';
                   s64real:
@@ -722,7 +722,7 @@ implementation
             registersmmx:=left.registersmmx;
 {$endif SUPPORT_MMX}
 
-            if (left.resulttype.def.deftype=floatdef) then
+            if (left.resultdef.deftype=floatdef) then
               begin
                 if (left.expectloc<>LOC_REGISTER) and
                   (registersfpu<1) then
@@ -731,7 +731,7 @@ implementation
               end
 {$ifdef SUPPORT_MMX}
              else if (cs_mmx in aktlocalswitches) and
-               is_mmx_able_array(left.resulttype.def) then
+               is_mmx_able_array(left.resultdef) then
                  begin
                    if (left.expectloc<>LOC_MMXREGISTER) and
                       (registersmmx<1) then
@@ -739,7 +739,7 @@ implementation
                  end
 {$endif SUPPORT_MMX}
 {$ifndef cpu64bit}
-             else if is_64bit(left.resulttype.def) then
+             else if is_64bit(left.resultdef) then
                begin
                   if (left.expectloc<>LOC_REGISTER) and
                      (registersint<2) then
@@ -747,7 +747,7 @@ implementation
                   expectloc:=LOC_REGISTER;
                end
 {$endif cpu64bit}
-             else if (left.resulttype.def.deftype=orddef) then
+             else if (left.resultdef.deftype=orddef) then
                begin
                   if (left.expectloc<>LOC_REGISTER) and
                      (registersint<1) then
@@ -777,7 +777,7 @@ implementation
       var
         v : tconstexprint;
         t : tnode;
-        tt : ttype;
+        def : tdef;
       begin
         result:=nil;
         { Try optmimizing ourself away }
@@ -794,7 +794,7 @@ implementation
            { Not of boolean expression. Turn around the operator and remove
              the not. This is not allowed for sets with the gten/lten,
              because there is no ltn/gtn support }
-           if (taddnode(left).left.resulttype.def.deftype<>setdef) or
+           if (taddnode(left).left.resultdef.deftype<>setdef) or
               (left.nodetype in [equaln,unequaln]) then
             begin
               result:=left;
@@ -808,8 +808,8 @@ implementation
         if (left.nodetype=ordconstn) then
           begin
              v:=tordconstnode(left).value;
-             tt:=left.resulttype;
-             case torddef(left.resulttype.def).typ of
+             def:=left.resultdef;
+             case torddef(left.resultdef).typ of
                bool8bit,
                bool16bit,
                bool32bit,
@@ -831,52 +831,52 @@ implementation
                u64bit :
                  begin
                    v:=int64(not int64(v)); { maybe qword is required }
-                   int_to_type(v,tt);
+                   int_to_type(v,def);
                  end;
                else
                  CGMessage(type_e_mismatch);
              end;
-             t:=cordconstnode.create(v,tt,true);
+             t:=cordconstnode.create(v,def,true);
              result:=t;
              exit;
           end;
       end;
 
 
-    function tnotnode.det_resulttype : tnode;
+    function tnotnode.pass_typecheck : tnode;
       var
          t : tnode;
       begin
          result:=nil;
-         resulttypepass(left);
+         typecheckpass(left);
          set_varstate(left,vs_read,[]);
          if codegenerror then
            exit;
 
-         resulttype:=left.resulttype;
+         resultdef:=left.resultdef;
 
          result:=simplify;
          if assigned(result) then
            exit;
 
-         if is_boolean(resulttype.def) then
+         if is_boolean(resultdef) then
            begin
            end
          else
 {$ifdef SUPPORT_MMX}
            if (cs_mmx in aktlocalswitches) and
-             is_mmx_able_array(left.resulttype.def) then
+             is_mmx_able_array(left.resultdef) then
              begin
              end
          else
 {$endif SUPPORT_MMX}
 {$ifndef cpu64bit}
-           if is_64bitint(left.resulttype.def) then
+           if is_64bitint(left.resultdef) then
              begin
              end
          else
 {$endif cpu64bit}
-           if is_integer(left.resulttype.def) then
+           if is_integer(left.resultdef) then
              begin
              end
          else
@@ -906,7 +906,7 @@ implementation
 {$ifdef SUPPORT_MMX}
          registersmmx:=left.registersmmx;
 {$endif SUPPORT_MMX}
-         if is_boolean(resulttype.def) then
+         if is_boolean(resultdef) then
            begin
              if (expectloc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
               begin
@@ -924,7 +924,7 @@ implementation
          else
 {$ifdef SUPPORT_MMX}
            if (cs_mmx in aktlocalswitches) and
-             is_mmx_able_array(left.resulttype.def) then
+             is_mmx_able_array(left.resultdef) then
              begin
                if (left.expectloc<>LOC_MMXREGISTER) and
                  (registersmmx<1) then
@@ -933,7 +933,7 @@ implementation
          else
 {$endif SUPPORT_MMX}
 {$ifndef cpu64bit}
-           if is_64bit(left.resulttype.def) then
+           if is_64bit(left.resultdef) then
              begin
                 if (expectloc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
                  begin
@@ -944,7 +944,7 @@ implementation
              end
          else
 {$endif cpu64bit}
-           if is_integer(left.resulttype.def) then
+           if is_integer(left.resultdef) then
              begin
                if (left.expectloc<>LOC_REGISTER) and
                   (registersint<1) then
@@ -959,8 +959,8 @@ implementation
         track_state_pass:=true;
         if left.track_state_pass(exec_known) then
           begin
-            left.resulttype.def:=nil;
-            do_resulttypepass(left);
+            left.resultdef:=nil;
+            do_typecheckpass(left);
           end;
       end;
 {$endif}

+ 103 - 103
compiler/nmem.pas

@@ -33,7 +33,7 @@ interface
        tloadvmtaddrnode = class(tunarynode)
           constructor create(l : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        end;
        tloadvmtaddrnodeclass = class of tloadvmtaddrnode;
 
@@ -46,8 +46,8 @@ interface
           procedure buildderefimpl;override;
           procedure derefimpl;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
-          function _getcopy : tnode;override;
+          function pass_typecheck:tnode;override;
+          function dogetcopy : tnode;override;
        end;
        tloadparentfpnodeclass = class of tloadparentfpnode;
 
@@ -61,16 +61,16 @@ interface
           procedure mark_write;override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        end;
        taddrnodeclass = class of taddrnode;
 
        tderefnode = class(tunarynode)
           constructor create(l : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           procedure mark_write;override;
        end;
        tderefnodeclass = class of tderefnode;
@@ -83,10 +83,10 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
           function docompare(p: tnode): boolean; override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           procedure mark_write;override;
        end;
        tsubscriptnodeclass = class of tsubscriptnode;
@@ -94,7 +94,7 @@ interface
        tvecnode = class(tbinarynode)
           constructor create(l,r : tnode);virtual;
           function pass_1 : tnode;override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           procedure mark_write;override;
        end;
        tvecnodeclass = class of tvecnode;
@@ -104,10 +104,10 @@ interface
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           function pass_1 : tnode;override;
           function docompare(p: tnode): boolean; override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
        end;
        twithnodeclass = class of twithnode;
 
@@ -142,18 +142,18 @@ implementation
       end;
 
 
-    function tloadvmtaddrnode.det_resulttype:tnode;
+    function tloadvmtaddrnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttypepass(left);
+        typecheckpass(left);
         if codegenerror then
          exit;
 
-        case left.resulttype.def.deftype of
+        case left.resultdef.deftype of
           classrefdef :
-            resulttype:=left.resulttype;
+            resultdef:=left.resultdef;
           objectdef :
-            resulttype.setdef(tclassrefdef.create(left.resulttype));
+            resultdef:=tclassrefdef.create(left.resultdef);
           else
             Message(parser_e_pointer_to_class_expected);
         end;
@@ -217,17 +217,17 @@ implementation
       end;
 
 
-    function tloadparentfpnode._getcopy : tnode;
+    function tloadparentfpnode.dogetcopy : tnode;
       var
          p : tloadparentfpnode;
       begin
-         p:=tloadparentfpnode(inherited _getcopy);
+         p:=tloadparentfpnode(inherited dogetcopy);
          p.parentpd:=parentpd;
-         _getcopy:=p;
+         dogetcopy:=p;
       end;
 
 
-    function tloadparentfpnode.det_resulttype:tnode;
+    function tloadparentfpnode.pass_typecheck:tnode;
 {$ifdef dummy}
       var
         currpi : tprocinfo;
@@ -235,7 +235,7 @@ implementation
 {$endif dummy}
       begin
         result:=nil;
-        resulttype:=voidpointertype;
+        resultdef:=voidpointertype;
 {$ifdef dummy}
         { currently parentfps are never loaded in registers (FK) }
 
@@ -319,26 +319,26 @@ implementation
       end;
 
 
-    function taddrnode._getcopy : tnode;
+    function taddrnode.dogetcopy : tnode;
 
       var
          p : taddrnode;
 
       begin
-         p:=taddrnode(inherited _getcopy);
+         p:=taddrnode(inherited dogetcopy);
          p.getprocvardef:=getprocvardef;
-         _getcopy:=p;
+         dogetcopy:=p;
       end;
 
 
-    function taddrnode.det_resulttype:tnode;
+    function taddrnode.pass_typecheck:tnode;
       var
          hp  : tnode;
          hsym : tfieldvarsym;
          isprocvar : boolean;
       begin
         result:=nil;
-        resulttypepass(left);
+        typecheckpass(left);
         if codegenerror then
          exit;
 
@@ -359,19 +359,19 @@ implementation
 
         { Handle @proc special, also @procvar in tp-mode needs
           special handling }
-        if (left.resulttype.def.deftype=procdef) or
+        if (left.resultdef.deftype=procdef) or
            (
-            (left.resulttype.def.deftype=procvardef) and
+            (left.resultdef.deftype=procvardef) and
             ((m_tp_procvar in aktmodeswitches) or
              (m_mac_procvar in aktmodeswitches))
            ) then
           begin
-            isprocvar:=(left.resulttype.def.deftype=procvardef);
+            isprocvar:=(left.resultdef.deftype=procvardef);
 
             if not isprocvar then
               begin
                 left:=ctypeconvnode.create_proc_to_procvar(left);
-                resulttypepass(left);
+                typecheckpass(left);
               end;
 
             { In tp procvar mode the result is always a voidpointer. Insert
@@ -380,7 +380,7 @@ implementation
             if (m_tp_procvar in aktmodeswitches) or
                (m_mac_procvar in aktmodeswitches) then
               begin
-                if tabstractprocdef(left.resulttype.def).is_addressonly then
+                if tabstractprocdef(left.resultdef).is_addressonly then
                   begin
                     result:=ctypeconvnode.create_internal(left,voidpointertype);
                     include(result.flags,nf_load_procvar);
@@ -393,7 +393,7 @@ implementation
                     if isprocvar then
                       begin
                         { find proc field in methodpointer record }
-                        hsym:=tfieldvarsym(trecorddef(methodpointertype.def).symtable.search('proc'));
+                        hsym:=tfieldvarsym(trecorddef(methodpointertype).symtable.search('proc'));
                         if not assigned(hsym) then
                           internalerror(200412041);
                         { Load tmehodpointer(left).proc }
@@ -427,9 +427,9 @@ implementation
                tabsolutevarsym(tloadnode(hp).symtableentry).absseg) then
               begin
                 if not(nf_typedaddr in flags) then
-                  resulttype:=voidfarpointertype
+                  resultdef:=voidfarpointertype
                 else
-                  resulttype.setdef(tpointerdef.createfar(left.resulttype));
+                  resultdef:=tpointerdef.createfar(left.resultdef);
               end
             else
 {$endif i386}
@@ -437,9 +437,9 @@ implementation
                  valid_for_addr(left,true) then
                 begin
                   if not(nf_typedaddr in flags) then
-                    resulttype:=voidpointertype
+                    resultdef:=voidpointertype
                   else
-                    resulttype.setdef(tpointerdef.create(left.resulttype));
+                    resultdef:=tpointerdef.create(left.resultdef);
                 end
             else
               CGMessage(type_e_variable_id_expected);
@@ -487,10 +487,10 @@ implementation
 
       end;
 
-    function tderefnode.det_resulttype:tnode;
+    function tderefnode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttypepass(left);
+         typecheckpass(left);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
           exit;
@@ -498,8 +498,8 @@ implementation
          { tp procvar support }
          maybe_call_procvar(left,true);
 
-         if left.resulttype.def.deftype=pointerdef then
-          resulttype:=tpointerdef(left.resulttype.def).pointertype
+         if left.resultdef.deftype=pointerdef then
+          resultdef:=tpointerdef(left.resultdef).pointeddef
          else
           CGMessage(parser_e_invalid_qualifier);
       end;
@@ -567,29 +567,29 @@ implementation
       end;
 
 
-    function tsubscriptnode._getcopy : tnode;
+    function tsubscriptnode.dogetcopy : tnode;
 
       var
          p : tsubscriptnode;
 
       begin
-         p:=tsubscriptnode(inherited _getcopy);
+         p:=tsubscriptnode(inherited dogetcopy);
          p.vs:=vs;
-         _getcopy:=p;
+         dogetcopy:=p;
       end;
 
 
-    function tsubscriptnode.det_resulttype:tnode;
+    function tsubscriptnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttypepass(left);
+        typecheckpass(left);
         { tp procvar support }
         maybe_call_procvar(left,true);
-        resulttype:=vs.vartype;
+        resultdef:=vs.vardef;
 
         // don't put records from which we load fields which aren't regable in integer registers
-        if (left.resulttype.def.deftype = recorddef) and
-           not(tstoreddef(resulttype.def).is_intregable) then
+        if (left.resultdef.deftype = recorddef) and
+           not(tstoreddef(resultdef).is_intregable) then
           make_not_regable(left,vr_addr);
       end;
 
@@ -612,7 +612,7 @@ implementation
          registersmmx:=left.registersmmx;
 {$endif SUPPORT_MMX}
          { classes must be dereferenced implicit }
-         if is_class_or_interface(left.resulttype.def) then
+         if is_class_or_interface(left.resultdef) then
            begin
               if registersint=0 then
                 registersint:=1;
@@ -624,7 +624,7 @@ implementation
                LOC_REGISTER,
                LOC_SUBSETREG:
                  // can happen for function results on win32 and darwin/x86
-                 if (left.resulttype.def.size > sizeof(aint)) then
+                 if (left.resultdef.size > sizeof(aint)) then
                    expectloc:=LOC_REFERENCE
                  else
                    expectloc:=LOC_SUBSETREG;
@@ -658,14 +658,14 @@ implementation
       end;
 
 
-    function tvecnode.det_resulttype:tnode;
+    function tvecnode.pass_typecheck:tnode;
       var
-         htype,elementtype : ttype;
+         htype,elementdef : tdef;
          valid : boolean;
       begin
          result:=nil;
-         resulttypepass(left);
-         resulttypepass(right);
+         typecheckpass(left);
+         typecheckpass(right);
 
          { implicitly convert stringconstant to stringdef,
            see tbs/tb0476.pp for a test }
@@ -682,11 +682,11 @@ implementation
            declared a shortstring or normal array that has
            undefined number of elements. Dynamic array and
            ansi/widestring needs to be valid }
-         valid:=is_dynamic_array(left.resulttype.def) or
-                is_ansistring(left.resulttype.def) or
-                is_widestring(left.resulttype.def) or
+         valid:=is_dynamic_array(left.resultdef) or
+                is_ansistring(left.resultdef) or
+                is_widestring(left.resultdef) or
                 { implicit pointer dereference -> pointer is read }
-                (left.resulttype.def.deftype = pointerdef);
+                (left.resultdef.deftype = pointerdef);
          if valid then
            set_varstate(left,vs_read,[vsf_must_be_valid]);
 {
@@ -702,79 +702,79 @@ implementation
            do not convert enums,booleans,char
            and do not convert range nodes }
          if (right.nodetype<>rangen) and (
-             ((right.resulttype.def.deftype<>enumdef) and
-               not(is_char(right.resulttype.def) or is_widechar(right.resulttype.def)) and
-               not(is_boolean(right.resulttype.def))
+             ((right.resultdef.deftype<>enumdef) and
+               not(is_char(right.resultdef) or is_widechar(right.resultdef)) and
+               not(is_boolean(right.resultdef))
              ) or
-             (left.resulttype.def.deftype <> arraydef) 
+             (left.resultdef.deftype <> arraydef) 
             ) then
            begin
              inserttypeconv(right,sinttype);
            end;
 
-         case left.resulttype.def.deftype of
+         case left.resultdef.deftype of
            arraydef :
              begin
                { check type of the index value }
-               if (compare_defs(right.resulttype.def,tarraydef(left.resulttype.def).rangetype.def,right.nodetype)=te_incompatible) then
-                 IncompatibleTypes(right.resulttype.def,tarraydef(left.resulttype.def).rangetype.def);
+               if (compare_defs(right.resultdef,tarraydef(left.resultdef).rangedef,right.nodetype)=te_incompatible) then
+                 IncompatibleTypes(right.resultdef,tarraydef(left.resultdef).rangedef);
                if right.nodetype=rangen then
-                 resulttype:=left.resulttype
+                 resultdef:=left.resultdef
                else
-                 resulttype:=Tarraydef(left.resulttype.def).elementtype;
+                 resultdef:=Tarraydef(left.resultdef).elementdef;
              end;
            pointerdef :
              begin
                { are we accessing a pointer[], then convert the pointer to
                  an array first, in FPC this is allowed for all pointers
                  (except voidpointer) in delphi/tp7 it's only allowed for pchars. }
-               if not is_voidpointer(left.resulttype.def) and
+               if not is_voidpointer(left.resultdef) and
                   (
                    (m_fpc in aktmodeswitches) or
-                   is_pchar(left.resulttype.def) or
-                   is_pwidechar(left.resulttype.def)
+                   is_pchar(left.resultdef) or
+                   is_pwidechar(left.resultdef)
                   ) then
                 begin
                   { convert pointer to array }
-                  htype.setdef(tarraydef.create_from_pointer(tpointerdef(left.resulttype.def).pointertype));
+                  htype:=tarraydef.create_from_pointer(tpointerdef(left.resultdef).pointeddef);
                   inserttypeconv(left,htype);
                   if right.nodetype=rangen then
-                    resulttype:=htype
+                    resultdef:=htype
                   else
-                    resulttype:=tarraydef(htype.def).elementtype;
+                    resultdef:=tarraydef(htype).elementdef;
                 end
                else
                 CGMessage(type_e_array_required);
              end;
            stringdef :
              begin
-                case tstringdef(left.resulttype.def).string_typ of
+                case tstringdef(left.resultdef).string_typ of
                   st_widestring :
-                    elementtype:=cwidechartype;
+                    elementdef:=cwidechartype;
                   st_ansistring :
-                    elementtype:=cchartype;
+                    elementdef:=cchartype;
                   st_longstring :
-                    elementtype:=cchartype;
+                    elementdef:=cchartype;
                   st_shortstring :
-                    elementtype:=cchartype;
+                    elementdef:=cchartype;
                 end;
                 if right.nodetype=rangen then
                   begin
-                    htype.setdef(Tarraydef.create_from_pointer(elementtype));
-                    resulttype:=htype;
+                    htype:=Tarraydef.create_from_pointer(elementdef);
+                    resultdef:=htype;
                   end
                 else
                  begin
                    { indexed access to 0 element is only allowed for shortstrings }
                    if (right.nodetype=ordconstn) and
                       (tordconstnode(right).value=0) and
-                      not is_shortstring(left.resulttype.def) then
+                      not is_shortstring(left.resultdef) then
                      CGMessage(cg_e_can_access_element_zero);
-                   resulttype:=elementtype;
+                   resultdef:=elementdef;
                  end;
              end;
            variantdef :
-             resulttype:=cvarianttype;
+             resultdef:=cvarianttype;
            else
              CGMessage(type_e_array_required);
         end;
@@ -799,19 +799,19 @@ implementation
            exit;
 
          if (nf_callunique in flags) and
-            (is_ansistring(left.resulttype.def) or
-             (is_widestring(left.resulttype.def) and not(tf_winlikewidestring in target_info.flags))) then
+            (is_ansistring(left.resultdef) or
+             (is_widestring(left.resultdef) and not(tf_winlikewidestring in target_info.flags))) then
            begin
-             left := ctypeconvnode.create_internal(ccallnode.createintern('fpc_'+tstringdef(left.resulttype.def).stringtypname+'_unique',
+             left := ctypeconvnode.create_internal(ccallnode.createintern('fpc_'+tstringdef(left.resultdef).stringtypname+'_unique',
                ccallparanode.create(
                  ctypeconvnode.create_internal(left,voidpointertype),nil)),
-               left.resulttype);
+               left.resultdef);
              firstpass(left);
-             { double resulttype passes somwhere else may cause this to be }
+             { double resultdef passes somwhere else may cause this to be }
              { reset though :/                                             }
              exclude(flags,nf_callunique);
            end
-         else if is_widestring(left.resulttype.def) and (tf_winlikewidestring in target_info.flags) then
+         else if is_widestring(left.resultdef) and (tf_winlikewidestring in target_info.flags) then
            exclude(flags,nf_callunique);
 
          { the register calculation is easy if a const index is used }
@@ -832,10 +832,10 @@ implementation
               registersint:=left.registersint;
 
               { for ansi/wide strings, we need at least one register }
-              if is_ansistring(left.resulttype.def) or
-                is_widestring(left.resulttype.def) or
+              if is_ansistring(left.resultdef) or
+                is_widestring(left.resultdef) or
               { ... as well as for dynamic arrays }
-                is_dynamic_array(left.resulttype.def) then
+                is_dynamic_array(left.resultdef) then
                 registersint:=max(registersint,1);
            end
          else
@@ -845,10 +845,10 @@ implementation
               registersint:=max(left.registersint,right.registersint);
 
               { for ansi/wide strings, we need at least one register }
-              if is_ansistring(left.resulttype.def) or
-                is_widestring(left.resulttype.def) or
+              if is_ansistring(left.resultdef) or
+                is_widestring(left.resultdef) or
               { ... as well as for dynamic arrays }
-                is_dynamic_array(left.resulttype.def) then
+                is_dynamic_array(left.resultdef) then
                 registersint:=max(registersint,1);
 
               { need we an extra register when doing the restore ? }
@@ -877,8 +877,8 @@ implementation
 {$ifdef SUPPORT_MMX}
          registersmmx:=max(left.registersmmx,right.registersmmx);
 {$endif SUPPORT_MMX}
-         if (not is_packed_array(left.resulttype.def)) or
-            ((tarraydef(left.resulttype.def).elepackedbitsize mod 8) = 0) then
+         if (not is_packed_array(left.resultdef)) or
+            ((tarraydef(left.resultdef).elepackedbitsize mod 8) = 0) then
            if left.expectloc=LOC_CREFERENCE then
              expectloc:=LOC_CREFERENCE
            else
@@ -920,21 +920,21 @@ implementation
       end;
 
 
-    function twithnode._getcopy : tnode;
+    function twithnode.dogetcopy : tnode;
       var
          p : twithnode;
       begin
-         p:=twithnode(inherited _getcopy);
+         p:=twithnode(inherited dogetcopy);
          result:=p;
       end;
 
 
-    function twithnode.det_resulttype:tnode;
+    function twithnode.pass_typecheck:tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
         if assigned(left) then
-          resulttypepass(left);
+          typecheckpass(left);
       end;
 
 
@@ -959,7 +959,7 @@ implementation
     function is_big_untyped_addrnode(p: tnode): boolean;
       begin
         is_big_untyped_addrnode:=(p.nodetype=addrn) and 
-	  not (nf_typedaddr in p.flags) and (taddrnode(p).left.resulttype.def.size > 1);
+	  not (nf_typedaddr in p.flags) and (taddrnode(p).left.resultdef.size > 1);
       end;
 
 begin

+ 7 - 7
compiler/nobj.pas

@@ -704,13 +704,13 @@ implementation
                                         end;
 
                                      { error, if the return types aren't equal }
-                                     if not(equal_defs(procdefcoll^.data.rettype.def,pd.rettype.def)) and
-                                        not((procdefcoll^.data.rettype.def.deftype=objectdef) and
-                                         (pd.rettype.def.deftype=objectdef) and
-                                         is_class_or_interface(procdefcoll^.data.rettype.def) and
-                                         is_class_or_interface(pd.rettype.def) and
-                                         (tobjectdef(pd.rettype.def).is_related(
-                                             tobjectdef(procdefcoll^.data.rettype.def)))) then
+                                     if not(equal_defs(procdefcoll^.data.returndef,pd.returndef)) and
+                                        not((procdefcoll^.data.returndef.deftype=objectdef) and
+                                         (pd.returndef.deftype=objectdef) and
+                                         is_class_or_interface(procdefcoll^.data.returndef) and
+                                         is_class_or_interface(pd.returndef) and
+                                         (tobjectdef(pd.returndef).is_related(
+                                             tobjectdef(procdefcoll^.data.returndef)))) then
                                        begin
                                          if not((m_delphi in aktmodeswitches) and
                                                 is_interface(_class)) then

+ 34 - 33
compiler/node.pas

@@ -277,15 +277,16 @@ interface
           { this field is set by concattolist  }
           parent : tnode;
           { there are some properties about the node stored }
-          flags : tnodeflags;
+          flags  : tnodeflags;
           ppuidx : longint;
           { the number of registers needed to evalute the node }
           registersint,registersfpu,registersmm : longint;  { must be longint !!!! }
 {$ifdef SUPPORT_MMX}
-          registersmmx : longint;
+          registersmmx  : longint;
 {$endif SUPPORT_MMX}
-          resulttype : ttype;
-          fileinfo : tfileposinfo;
+          resultdef     : tdef;
+          resultdefderef : tderef;
+          fileinfo      : tfileposinfo;
           localswitches : tlocalswitches;
 {$ifdef extdebug}
           maxfirstpasscount,
@@ -308,10 +309,10 @@ interface
           { the 1.1 code generator may override pass_1 }
           { and it need not to implement det_* then    }
           { 1.1: pass_1 returns a value<>0 if the node has been transformed }
-          { 2.0: runs det_resulttype and det_temp                           }
+          { 2.0: runs pass_typecheck and det_temp                           }
           function pass_1 : tnode;virtual;abstract;
-          { dermines the resulttype of the node }
-          function det_resulttype : tnode;virtual;abstract;
+          { dermines the resultdef of the node }
+          function pass_typecheck : tnode;virtual;abstract;
 
           { tries to simplify the node, returns a value <>nil if a simplified
             node has been created }
@@ -328,7 +329,7 @@ interface
             the node }
           procedure det_temp;virtual;abstract;
 
-          procedure pass_2;virtual;abstract;
+          procedure pass_generate_code;virtual;abstract;
 
           { comparing of nodes }
           function isequal(p : tnode) : boolean;
@@ -338,7 +339,7 @@ interface
           function getcopy : tnode;
 
           { does the real copying of a node }
-          function _getcopy : tnode;virtual;
+          function dogetcopy : tnode;virtual;
 
           procedure insertintolist(l : tnodelist);virtual;
           { writes a node for debugging purpose, shouldn't be called }
@@ -371,7 +372,7 @@ interface
           procedure concattolist(l : tlinkedlist);override;
           function ischild(p : tnode) : boolean;override;
           function docompare(p : tnode) : boolean;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           procedure insertintolist(l : tnodelist);override;
           procedure left_max;
           procedure printnodedata(var t:text);override;
@@ -391,7 +392,7 @@ interface
           function ischild(p : tnode) : boolean;override;
           function docompare(p : tnode) : boolean;override;
           procedure swapleftright;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           procedure insertintolist(l : tnodelist);override;
           procedure left_right_max;
           procedure printnodedata(var t:text);override;
@@ -603,19 +604,19 @@ implementation
 
     function is_constintnode(p : tnode) : boolean;
       begin
-         is_constintnode:=(p.nodetype=ordconstn) and is_integer(p.resulttype.def);
+         is_constintnode:=(p.nodetype=ordconstn) and is_integer(p.resultdef);
       end;
 
 
     function is_constcharnode(p : tnode) : boolean;
       begin
-         is_constcharnode:=(p.nodetype=ordconstn) and is_char(p.resulttype.def);
+         is_constcharnode:=(p.nodetype=ordconstn) and is_char(p.resultdef);
       end;
 
 
     function is_constwidecharnode(p : tnode) : boolean;
       begin
-         is_constwidecharnode:=(p.nodetype=ordconstn) and is_widechar(p.resulttype.def);
+         is_constwidecharnode:=(p.nodetype=ordconstn) and is_widechar(p.resultdef);
       end;
 
 
@@ -627,13 +628,13 @@ implementation
 
     function is_constboolnode(p : tnode) : boolean;
       begin
-         is_constboolnode:=(p.nodetype=ordconstn) and is_boolean(p.resulttype.def);
+         is_constboolnode:=(p.nodetype=ordconstn) and is_boolean(p.resultdef);
       end;
 
 
     function is_constenumnode(p : tnode) : boolean;
       begin
-         is_constenumnode:=(p.nodetype=ordconstn) and (p.resulttype.def.deftype=enumdef);
+         is_constenumnode:=(p.nodetype=ordconstn) and (p.resultdef.deftype=enumdef);
       end;
 
 {****************************************************************************
@@ -653,7 +654,7 @@ implementation
          { save local info }
          fileinfo:=aktfilepos;
          localswitches:=aktlocalswitches;
-         resulttype.reset;
+         resultdef:=nil;
          registersint:=0;
          registersfpu:=0;
 {$ifdef SUPPORT_MMX}
@@ -680,7 +681,7 @@ implementation
         blocktype:=tblock_type(ppufile.getbyte);
         ppufile.getposinfo(fileinfo);
         ppufile.getsmallset(localswitches);
-        ppufile.gettype(resulttype);
+        ppufile.getderef(resultdefderef);
         ppufile.getsmallset(flags);
         { updated by firstpass }
         expectloc:=LOC_INVALID;
@@ -704,20 +705,20 @@ implementation
         ppufile.putbyte(byte(block_type));
         ppufile.putposinfo(fileinfo);
         ppufile.putsmallset(localswitches);
-        ppufile.puttype(resulttype);
+        ppufile.putderef(resultdefderef);
         ppufile.putsmallset(flags);
       end;
 
 
     procedure tnode.buildderefimpl;
       begin
-        resulttype.buildderef;
+        resultdefderef.build(resultdef);
       end;
 
 
     procedure tnode.derefimpl;
       begin
-        resulttype.resolve;
+        resultdef:=tdef(resultdefderef.resolve);
       end;
 
 
@@ -772,10 +773,10 @@ implementation
     procedure tnode.printnodeinfo(var t:text);
       begin
         write(t,nodetype2str[nodetype]);
-        if assigned(resulttype.def) then
-          write(t,', resulttype = "',resulttype.def.gettypename,'"')
+        if assigned(resultdef) then
+          write(t,', resultdef = "',resultdef.GetTypeName,'"')
         else
-          write(t,', resulttype = <nil>');
+          write(t,', resultdef = <nil>');
         write(t,', pos = (',fileinfo.line,',',fileinfo.column,')',
                   ', loc = ',tcgloc2str[location.loc],
                   ', expectloc = ',tcgloc2str[expectloc],
@@ -838,12 +839,12 @@ implementation
 
     function tnode.getcopy : tnode;
       begin
-        result:=_getcopy;
+        result:=dogetcopy;
         foreachnodestatic(pm_postprocess,self,@cleanupcopiedto,nil);
       end;
 
 
-    function tnode._getcopy : tnode;
+    function tnode.dogetcopy : tnode;
       var
          p : tnode;
       begin
@@ -861,7 +862,7 @@ implementation
          p.registersmmx:=registersmmx;
          p.registersmm:=registersmm;
 {$endif SUPPORT_MMX}
-         p.resulttype:=resulttype;
+         p.resultdef:=resultdef;
          p.fileinfo:=fileinfo;
          p.localswitches:=localswitches;
 {$ifdef extdebug}
@@ -941,13 +942,13 @@ implementation
       end;
 
 
-    function tunarynode._getcopy : tnode;
+    function tunarynode.dogetcopy : tnode;
       var
          p : tunarynode;
       begin
-         p:=tunarynode(inherited _getcopy);
+         p:=tunarynode(inherited dogetcopy);
          if assigned(left) then
-           p.left:=left._getcopy
+           p.left:=left.dogetcopy
          else
            p.left:=nil;
          result:=p;
@@ -1072,13 +1073,13 @@ implementation
       end;
 
 
-    function tbinarynode._getcopy : tnode;
+    function tbinarynode.dogetcopy : tnode;
       var
          p : tbinarynode;
       begin
-         p:=tbinarynode(inherited _getcopy);
+         p:=tbinarynode(inherited dogetcopy);
          if assigned(right) then
-           p.right:=right._getcopy
+           p.right:=right.dogetcopy
          else
            p.right:=nil;
          result:=p;

+ 28 - 28
compiler/nopt.pas

@@ -37,10 +37,10 @@ type
      subnodetype: tsubnodetype;
      constructor create(ts: tsubnodetype; l,r : tnode); virtual;
      { pass_1 will be overridden by the separate subclasses    }
-     { By default, pass_2 is the same as for addnode           }
+     { By default, pass_generate_code is the same as for addnode           }
      { Only if there's a processor specific implementation, it }
      { will be overridden.                                     }
-     function _getcopy: tnode; override;
+     function dogetcopy: tnode; override;
      function docompare(p: tnode): boolean; override;
   end;
 
@@ -49,9 +49,9 @@ type
     { sometimes (it's initialized/updated by calling updatecurmaxlen)     }
     curmaxlen: byte;
     { pass_1 must be overridden, otherwise we get an endless loop }
-    function det_resulttype: tnode; override;
+    function pass_typecheck: tnode; override;
     function pass_1: tnode; override;
-    function _getcopy: tnode; override;
+    function dogetcopy: tnode; override;
     function docompare(p: tnode): boolean; override;
    protected
     procedure updatecurmaxlen;
@@ -96,20 +96,20 @@ uses cutils, htypechk, defutil, defcmp, globtype, globals, cpubase, ncnv, ncon,n
 
 constructor taddoptnode.create(ts: tsubnodetype; l,r : tnode);
 begin
-  { we need to keep the addn nodetype, otherwise taddnode.pass_2 will be }
+  { we need to keep the addn nodetype, otherwise taddnode.pass_generate_code will be }
   { confused. Comparison for equal nodetypes therefore has to be         }
   { implemented using the classtype() method (JM)                        }
   inherited create(addn,l,r);
   subnodetype := ts;
 end;
 
-function taddoptnode._getcopy: tnode;
+function taddoptnode.dogetcopy: tnode;
 var
   hp: taddoptnode;
 begin
-  hp := taddoptnode(inherited _getcopy);
+  hp := taddoptnode(inherited dogetcopy);
   hp.subnodetype := subnodetype;
-  _getcopy := hp;
+  dogetcopy := hp;
 end;
 
 function taddoptnode.docompare(p: tnode): boolean;
@@ -124,16 +124,16 @@ end;
                         TADDSSTRINGOPTNODE
 *****************************************************************************}
 
-function taddsstringoptnode.det_resulttype: tnode;
+function taddsstringoptnode.pass_typecheck: tnode;
 begin
   result := nil;
   updatecurmaxlen;
   { left and right are already firstpass'ed by taddnode.pass_1 }
-  if not is_shortstring(left.resulttype.def) then
+  if not is_shortstring(left.resultdef) then
    inserttypeconv(left,cshortstringtype);
-  if not is_shortstring(right.resulttype.def) then
+  if not is_shortstring(right.resultdef) then
    inserttypeconv(right,cshortstringtype);
-  resulttype := left.resulttype;
+  resultdef := left.resultdef;
 end;
 
 function taddsstringoptnode.pass_1: tnode;
@@ -145,13 +145,13 @@ begin
   include(current_procinfo.flags,pi_do_call);
 end;
 
-function taddsstringoptnode._getcopy: tnode;
+function taddsstringoptnode.dogetcopy: tnode;
 var
   hp: taddsstringoptnode;
 begin
-  hp := taddsstringoptnode(inherited _getcopy);
+  hp := taddsstringoptnode(inherited dogetcopy);
   hp.curmaxlen := curmaxlen;
-  _getcopy := hp;
+  dogetcopy := hp;
 end;
 
 function taddsstringoptnode.docompare(p: tnode): boolean;
@@ -188,7 +188,7 @@ begin
     end
   else if (left.nodetype = stringconstn) then
     curmaxlen := min(tstringconstnode(left).len,255)
-  else if is_char(left.resulttype.def) then
+  else if is_char(left.resultdef) then
     curmaxlen := 1
   else if (left.nodetype = typeconvn) then
     begin
@@ -198,7 +198,7 @@ begin
 {       doesn't work yet, don't know why (JM)
         tc_chararray_2_string:
           curmaxlen :=
-            min(ttypeconvnode(left).left.resulttype.def.size,255); }
+            min(ttypeconvnode(left).left.resultdef.size,255); }
         else curmaxlen := 255;
       end;
     end
@@ -247,9 +247,9 @@ begin
     (cs_opt_level1 in aktoptimizerswitches) and
 
 {   the shortstring will be gotten through conversion if necessary (JM)
-    is_shortstring(p.left.resulttype.def) and }
+    is_shortstring(p.left.resultdef) and }
     ((p.nodetype = addn) and
-     is_char(p.right.resulttype.def));
+     is_char(p.right.resultdef));
 end;
 
 function genaddsstringcharoptnode(p: taddnode): tnode;
@@ -269,7 +269,7 @@ begin
     (cs_opt_level1 in aktoptimizerswitches) and
 
 {   the shortstring will be gotten through conversion if necessary (JM)
-    is_shortstring(p.left.resulttype.def) and }
+    is_shortstring(p.left.resultdef) and }
     ((p.nodetype = addn) and
      (p.right.nodetype = stringconstn));
 end;
@@ -290,7 +290,7 @@ var
   i  : longint;
 begin
   result:=false;
-  if p.resulttype.def.deftype<>stringdef then
+  if p.resultdef.deftype<>stringdef then
     exit;
   i:=0;
   hp:=p;
@@ -313,11 +313,11 @@ var
 begin
   arrp:=nil;
   hp:=p;
-  is_shortstr:=is_shortstring(p.resulttype.def);
+  is_shortstr:=is_shortstring(p.resultdef);
   while assigned(hp) and (hp.nodetype=addn) do
     begin
       sn:=taddnode(hp).right.getcopy;
-      inserttypeconv(sn,p.resulttype);
+      inserttypeconv(sn,p.resultdef);
       if is_shortstr then
         begin
           sn:=caddrnode.create(sn);
@@ -327,7 +327,7 @@ begin
       hp:=taddnode(hp).left;
     end;
   sn:=hp.getcopy;
-  inserttypeconv(sn,p.resulttype);
+  inserttypeconv(sn,p.resultdef);
   if is_shortstr then
     begin
       sn:=caddrnode.create(sn);
@@ -336,11 +336,11 @@ begin
   arrp:=carrayconstructornode.create(sn,arrp);
   if assigned(aktassignmentnode) and
      (aktassignmentnode.right=p) and
-     (aktassignmentnode.left.resulttype.def=p.resulttype.def) and
+     (aktassignmentnode.left.resultdef=p.resultdef) and
      valid_for_var(aktassignmentnode.left,false) then
     begin
       result:=ccallnode.createintern('fpc_'+
-        tstringdef(p.resulttype.def).stringtypname+'_concat_multi',
+        tstringdef(p.resultdef).stringtypname+'_concat_multi',
         ccallparanode.create(arrp,
         ccallparanode.create(aktassignmentnode.left.getcopy,nil)));
       include(aktassignmentnode.flags,nf_assign_done_in_right);
@@ -348,10 +348,10 @@ begin
   else
     begin
       result:=internalstatements(newstatement);
-      tempnode:=ctempcreatenode.create(p.resulttype,p.resulttype.def.size,tt_persistent ,true);
+      tempnode:=ctempcreatenode.create(p.resultdef,p.resultdef.size,tt_persistent ,true);
       addstatement(newstatement,tempnode);
       addstatement(newstatement,ccallnode.createintern('fpc_'+
-        tstringdef(p.resulttype.def).stringtypname+'_concat_multi',
+        tstringdef(p.resultdef).stringtypname+'_concat_multi',
         ccallparanode.create(arrp,
         ccallparanode.create(ctemprefnode.create(tempnode),nil))));
       addstatement(newstatement,ctempdeletenode.create_normal_temp(tempnode));

+ 47 - 47
compiler/nset.pas

@@ -45,7 +45,7 @@ interface
 
        pcaseblock = ^tcaseblock;
        tcaseblock = record
-          { label (only used in pass_2) }
+          { label (only used in pass_generate_code) }
           blocklabel : tasmlabel;
           { instructions }
           statement  : tnode;
@@ -53,21 +53,21 @@ interface
 
        tsetelementnode = class(tbinarynode)
           constructor create(l,r : tnode);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        tsetelementnodeclass = class of tsetelementnode;
 
        tinnode = class(tbinopnode)
           constructor create(l,r : tnode);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        tinnodeclass = class of tinnode;
 
        trangenode = class(tbinarynode)
           constructor create(l,r : tnode);virtual;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
        end;
        trangenodeclass = class of trangenode;
@@ -82,9 +82,9 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderefimpl;override;
           procedure derefimpl;override;
-          function _getcopy : tnode;override;
+          function dogetcopy : tnode;override;
           procedure insertintolist(l : tnodelist);override;
-          function det_resulttype:tnode;override;
+          function pass_typecheck:tnode;override;
           function pass_1 : tnode;override;
           function docompare(p: tnode): boolean; override;
           procedure addlabel(blockid:longint;l,h : TConstExprInt);
@@ -128,17 +128,17 @@ implementation
       end;
 
 
-    function tsetelementnode.det_resulttype:tnode;
+    function tsetelementnode.pass_typecheck:tnode;
       begin
          result:=nil;
-         resulttypepass(left);
+         typecheckpass(left);
          if assigned(right) then
-          resulttypepass(right);
+          typecheckpass(right);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
           exit;
 
-         resulttype:=left.resulttype;
+         resultdef:=left.resultdef;
       end;
 
 
@@ -167,7 +167,7 @@ implementation
       end;
 
 
-    function tinnode.det_resulttype:tnode;
+    function tinnode.pass_typecheck:tnode;
 
       var
         t : tnode;
@@ -180,10 +180,10 @@ implementation
           i : longint;
         begin
           new(pcs);
-          case psd.elementtype.def.deftype of
+          case psd.elementdef.deftype of
             enumdef :
               begin
-                pes:=tenumsym(tenumdef(psd.elementtype.def).firstenum);
+                pes:=tenumsym(tenumdef(psd.elementdef).firstenum);
                 while assigned(pes) do
                   begin
                     include(pcs^,pes.value);
@@ -192,7 +192,7 @@ implementation
               end;
             orddef :
               begin
-                for i:=torddef(psd.elementtype.def).low to torddef(psd.elementtype.def).high do
+                for i:=torddef(psd.elementdef).low to torddef(psd.elementdef).high do
                   include(pcs^,i);
               end;
           end;
@@ -201,14 +201,14 @@ implementation
 
       begin
          result:=nil;
-         resulttype:=booltype;
-         resulttypepass(right);
+         resultdef:=booltype;
+         typecheckpass(right);
          set_varstate(right,vs_read,[vsf_must_be_valid]);
          if codegenerror then
           exit;
 
          { Convert array constructor first to set }
-         if is_array_constructor(right.resulttype.def) then
+         if is_array_constructor(right.resultdef) then
           begin
             arrayconstructor_to_set(right);
             firstpass(right);
@@ -216,25 +216,25 @@ implementation
              exit;
           end;
 
-         if right.resulttype.def.deftype<>setdef then
+         if right.resultdef.deftype<>setdef then
            CGMessage(sym_e_set_expected);
 
          if (right.nodetype=typen) then
            begin
              { we need to create a setconstn }
-             pst:=createsetconst(tsetdef(ttypenode(right).resulttype.def));
-             t:=csetconstnode.create(pst,ttypenode(right).resulttype);
+             pst:=createsetconst(tsetdef(ttypenode(right).resultdef));
+             t:=csetconstnode.create(pst,ttypenode(right).resultdef);
              dispose(pst);
              right.free;
              right:=t;
            end;
 
-         resulttypepass(left);
+         typecheckpass(left);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
            exit;
 
-         if not assigned(left.resulttype.def) then
+         if not assigned(left.resultdef) then
            internalerror(20021126);
 
          if (m_fpc in aktmodeswitches) then
@@ -243,35 +243,35 @@ implementation
                elements with the in operator.
              }
              if  (
-                   (left.resulttype.def.deftype = orddef) and not
-                   (torddef(left.resulttype.def).typ in [s8bit,u8bit,uchar,bool8bit])
+                   (left.resultdef.deftype = orddef) and not
+                   (torddef(left.resultdef).typ in [s8bit,u8bit,uchar,bool8bit])
                  )
                 or
                  (
-                   (left.resulttype.def.deftype = enumdef) and
-                   (tenumdef(left.resulttype.def).maxval > 255)
+                   (left.resultdef.deftype = enumdef) and
+                   (tenumdef(left.resultdef).maxval > 255)
                  )
               then
                  CGMessage(type_h_in_range_check);
 
              { type conversion/check }
-             if assigned(tsetdef(right.resulttype.def).elementtype.def) then
-               inserttypeconv(left,tsetdef(right.resulttype.def).elementtype);
+             if assigned(tsetdef(right.resultdef).elementdef) then
+               inserttypeconv(left,tsetdef(right.resultdef).elementdef);
            end
          else
            begin
              { insert explicit type conversion/check }
-             if assigned(tsetdef(right.resulttype.def).elementtype.def) then
-               inserttypeconv_internal(left,tsetdef(right.resulttype.def).elementtype);
+             if assigned(tsetdef(right.resultdef).elementdef) then
+               inserttypeconv_internal(left,tsetdef(right.resultdef).elementdef);
            end;
 
          { empty set then return false }
-         if not assigned(tsetdef(right.resulttype.def).elementtype.def) or
+         if not assigned(tsetdef(right.resultdef).elementdef) or
             ((right.nodetype = setconstn) and
              (tnormalset(tsetconstnode(right).value_set^) = [])) then
           begin
             t:=cordconstnode.create(0,booltype,false);
-            resulttypepass(t);
+            typecheckpass(t);
             result:=t;
             exit;
           end;
@@ -281,7 +281,7 @@ implementation
           begin
             t:=cordconstnode.create(byte(tordconstnode(left).value in Tsetconstnode(right).value_set^),
                booltype,true);
-            resulttypepass(t);
+            typecheckpass(t);
             result:=t;
             exit;
           end;
@@ -304,7 +304,7 @@ implementation
 
          left_right_max;
 
-         if tsetdef(right.resulttype.def).settype<>smallset then
+         if tsetdef(right.resultdef).settype<>smallset then
            begin
              if registersint < 3 then
                registersint := 3;
@@ -331,18 +331,18 @@ implementation
       end;
 
 
-    function trangenode.det_resulttype : tnode;
+    function trangenode.pass_typecheck : tnode;
       begin
          result:=nil;
-         resulttypepass(left);
-         resulttypepass(right);
+         typecheckpass(left);
+         typecheckpass(right);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          set_varstate(right,vs_read,[vsf_must_be_valid]);
          if codegenerror then
            exit;
          { both types must be compatible }
-         if compare_defs(left.resulttype.def,right.resulttype.def,left.nodetype)=te_incompatible then
-           IncompatibleTypes(left.resulttype.def,right.resulttype.def);
+         if compare_defs(left.resultdef,right.resultdef,left.nodetype)=te_incompatible then
+           IncompatibleTypes(left.resultdef,right.resultdef);
          { Check if only when its a constant set }
          if (left.nodetype=ordconstn) and (right.nodetype=ordconstn) then
           begin
@@ -351,7 +351,7 @@ implementation
                ((tordconstnode(left).value<0) or (tordconstnode(right).value>=0)) then
               CGMessage(parser_e_upper_lower_than_lower);
           end;
-        resulttype:=left.resulttype;
+        resultdef:=left.resultdef;
       end;
 
 
@@ -562,10 +562,10 @@ implementation
       end;
 
 
-    function tcasenode.det_resulttype : tnode;
+    function tcasenode.pass_typecheck : tnode;
       begin
         result:=nil;
-        resulttype:=voidtype;
+        resultdef:=voidtype;
       end;
 
 
@@ -640,15 +640,15 @@ implementation
       end;
 
 
-    function tcasenode._getcopy : tnode;
+    function tcasenode.dogetcopy : tnode;
 
       var
          n : tcasenode;
          i : longint;
       begin
-         n:=tcasenode(inherited _getcopy);
+         n:=tcasenode(inherited dogetcopy);
          if assigned(elseblock) then
-           n.elseblock:=elseblock._getcopy
+           n.elseblock:=elseblock.dogetcopy
          else
            n.elseblock:=nil;
          if assigned(labels) then
@@ -662,12 +662,12 @@ implementation
                begin
                  if not assigned(blocks[i]) then
                    internalerror(200411302);
-                 n.addblock(i,pcaseblock(blocks[i])^.statement._getcopy);
+                 n.addblock(i,pcaseblock(blocks[i])^.statement.dogetcopy);
                end;
            end
          else
            n.labels:=nil;
-         _getcopy:=n;
+         dogetcopy:=n;
       end;
 
     procedure tcasenode.insertintolist(l : tnodelist);

+ 23 - 23
compiler/nutils.pas

@@ -33,7 +33,7 @@ interface
     NODE_COMPLEXITY_INF = 255;
 
   type
-    { resulttype of functions that process on all nodes in a (sub)tree }
+    { resultdef of functions that process on all nodes in a (sub)tree }
     foreachnoderesult = (
       { false, continue recursion }
       fen_false,
@@ -268,7 +268,7 @@ implementation
                (tcallnode(p1).methodpointer.nodetype<>typen) then
               tloadnode(p2).set_mp(tcallnode(p1).get_load_methodpointer);
           end;
-        resulttypepass(p2);
+        typecheckpass(p2);
         p1.free;
         p1:=p2;
       end;
@@ -279,7 +279,7 @@ implementation
         hp : tnode;
       begin
         result:=false;
-        if (p1.resulttype.def.deftype<>procvardef) or
+        if (p1.resultdef.deftype<>procvardef) or
            (tponly and
             not(m_tp_procvar in aktmodeswitches)) then
           exit;
@@ -300,7 +300,7 @@ implementation
         if (hp.nodetype in [calln,loadn,temprefn]) then
           begin
             hp:=ccallnode.create_procvar(nil,p1);
-            resulttypepass(hp);
+            typecheckpass(hp);
             p1:=hp;
             result:=true;
           end;
@@ -322,7 +322,7 @@ implementation
         if assigned(srsym) then
           begin
             result:=cloadnode.create(srsym,vs.owner);
-            resulttypepass(result);
+            typecheckpass(result);
           end
         else
           CGMessage(parser_e_illegal_expression);
@@ -346,7 +346,7 @@ implementation
             result:=cerrornode.create;
             CGMessage(parser_e_illegal_expression);
           end;
-        resulttypepass(result);
+        typecheckpass(result);
       end;
 
 
@@ -364,7 +364,7 @@ implementation
             result:=cerrornode.create;
             CGMessage(parser_e_illegal_expression);
           end;
-        resulttypepass(result);
+        typecheckpass(result);
       end;
 
 
@@ -385,7 +385,7 @@ implementation
             result:=cerrornode.create;
             CGMessage(parser_e_illegal_expression);
           end;
-        resulttypepass(result);
+        typecheckpass(result);
       end;
 
 
@@ -403,7 +403,7 @@ implementation
             result:=cerrornode.create;
             CGMessage(parser_e_illegal_expression);
           end;
-        resulttypepass(result);
+        typecheckpass(result);
       end;
 
 
@@ -481,12 +481,12 @@ implementation
 
     function initialize_data_node(p:tnode):tnode;
       begin
-        if not assigned(p.resulttype.def) then
-          resulttypepass(p);
-        if is_ansistring(p.resulttype.def) or
-           is_widestring(p.resulttype.def) or
-           is_interfacecom(p.resulttype.def) or
-           is_dynamic_array(p.resulttype.def) then
+        if not assigned(p.resultdef) then
+          typecheckpass(p);
+        if is_ansistring(p.resultdef) or
+           is_widestring(p.resultdef) or
+           is_interfacecom(p.resultdef) or
+           is_dynamic_array(p.resultdef) then
           begin
             result:=cassignmentnode.create(
                ctypeconvnode.create_internal(p,voidpointertype),
@@ -499,7 +499,7 @@ implementation
                   ccallparanode.create(
                       caddrnode.create_internal(
                           crttinode.create(
-                              tstoreddef(p.resulttype.def),initrtti)),
+                              tstoreddef(p.resultdef),initrtti)),
                   ccallparanode.create(
                       caddrnode.create_internal(p),
                   nil)));
@@ -511,9 +511,9 @@ implementation
       var
         newstatement : tstatementnode;
       begin
-        if not assigned(p.resulttype.def) then
-          resulttypepass(p);
-        if is_ansistring(p.resulttype.def) then
+        if not assigned(p.resultdef) then
+          typecheckpass(p);
+        if is_ansistring(p.resultdef) then
           begin
             result:=internalstatements(newstatement);
             addstatement(newstatement,ccallnode.createintern('fpc_ansistr_decr_ref',
@@ -525,7 +525,7 @@ implementation
                cnilnode.create
                ));
           end
-        else if is_widestring(p.resulttype.def) then
+        else if is_widestring(p.resultdef) then
           begin
             result:=internalstatements(newstatement);
             addstatement(newstatement,ccallnode.createintern('fpc_widestr_decr_ref',
@@ -542,7 +542,7 @@ implementation
                 ccallparanode.create(
                     caddrnode.create_internal(
                         crttinode.create(
-                            tstoreddef(p.resulttype.def),initrtti)),
+                            tstoreddef(p.resultdef),initrtti)),
                 ccallparanode.create(
                     caddrnode.create_internal(p),
                 nil)));
@@ -665,14 +665,14 @@ implementation
       begin
         result:=fen_false;
 
-//        do_resulttypepass(n);
+//        do_typecheckpass(n);
 
         hn:=n.simplify;
         if assigned(hn) then
           begin
             treechanged:=true;
             n:=hn;
-            resulttypepass(n);
+            typecheckpass(n);
           end;
       end;
 

+ 3 - 3
compiler/optcse.pas

@@ -60,12 +60,12 @@ unit optcse;
                   - temp. creation
                   - expression calculation
                   - assignment of expression to temp. }
-                tempnode:=ctempcreatenode.create(nodelist[i].resulttype,nodelist[i].resulttype.def.size,tt_persistent,
-                  nodelist[i].resulttype.def.is_intregable or nodelist[i].resulttype.def.is_fpuregable);
+                tempnode:=ctempcreatenode.create(nodelist[i].resultdef,nodelist[i].resultdef.size,tt_persistent,
+                  nodelist[i].resultdef.is_intregable or nodelist[i].resultdef.is_fpuregable);
                 addstatement(createstatement,tempnode);
                 addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                       caddrnode.create_internal(para.left)));
-                    para.left := ctypeconvnode.create_internal(cderefnode.create(ctemprefnode.create(tempnode)),para.left.resulttype);
+                    para.left := ctypeconvnode.create_internal(cderefnode.create(ctemprefnode.create(tempnode)),para.left.resultdef);
                     addstatement(deletestatement,ctempdeletenode.create(tempnode));
 
                 { replace next nodes by loading the temp. reference }

+ 2 - 2
compiler/opttail.pas

@@ -117,7 +117,7 @@ unit opttail;
                     paranode:=tcallparanode(usedcallnode.left);
                     while assigned(paranode) do
                       begin
-                        tempnode:=ctempcreatenode.create(paranode.left.resulttype,paranode.left.resulttype.def.size,tt_persistent,true);
+                        tempnode:=ctempcreatenode.create(paranode.left.resultdef,paranode.left.resultdef.size,tt_persistent,true);
                         addstatement(calcstatements,tempnode);
                         addstatement(calcstatements,
                           cassignmentnode.create(
@@ -188,7 +188,7 @@ unit opttail;
           with tparavarsym(p.paras[i]) do
             if (varspez in [vs_out,vs_var]) or
               ((varspez=vs_const) and
-               (paramanager.push_addr_param(varspez,vartype.def,p.proccalloption))) then
+               (paramanager.push_addr_param(varspez,vardef,p.proccalloption))) then
                exit;
         if find_and_replace_tailcalls(n) then
           begin

+ 1 - 1
compiler/paramgr.pas

@@ -316,7 +316,7 @@ implementation
         while assigned(paraloc) do
           begin
             if paraloc^.size=OS_NO then
-              len:=push_size(parasym.varspez,parasym.vartype.def,calloption)
+              len:=push_size(parasym.varspez,parasym.vardef,calloption)
             else
               len:=tcgsize2size[paraloc^.size];
             newparaloc:=cgpara.add_location;

+ 20 - 20
compiler/pass_1.pas

@@ -1,7 +1,7 @@
 {
     Copyright (c) 1998-2002 by Florian Klaempfl
 
-    This unit handles the typecheck and node conversion pass
+    This unit handles the pass_typecheck and node conversion pass
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -28,8 +28,8 @@ interface
     uses
        node;
 
-    procedure resulttypepass(var p : tnode);
-    function  do_resulttypepass(var p : tnode) : boolean;
+    procedure typecheckpass(var p : tnode);
+    function  do_typecheckpass(var p : tnode) : boolean;
 
     procedure firstpass(var p : tnode);
     function  do_firstpass(var p : tnode) : boolean;
@@ -57,14 +57,14 @@ implementation
                             Global procedures
 *****************************************************************************}
 
-    procedure resulttypepass(var p : tnode);
+    procedure typecheckpass(var p : tnode);
       var
          oldcodegenerror  : boolean;
          oldlocalswitches : tlocalswitches;
          oldpos    : tfileposinfo;
          hp        : tnode;
       begin
-        if (p.resulttype.def=nil) then
+        if (p.resultdef=nil) then
          begin
            oldcodegenerror:=codegenerror;
            oldpos:=aktfilepos;
@@ -72,13 +72,13 @@ implementation
            codegenerror:=false;
            aktfilepos:=p.fileinfo;
            aktlocalswitches:=p.localswitches;
-           hp:=p.det_resulttype;
+           hp:=p.pass_typecheck;
            { should the node be replaced? }
            if assigned(hp) then
             begin
                p.free;
-               { run resulttypepass }
-               resulttypepass(hp);
+               { run typecheckpass }
+               typecheckpass(hp);
                { switch to new node }
                p:=hp;
             end;
@@ -88,8 +88,8 @@ implementation
             begin
               include(p.flags,nf_error);
               { default to errortype if no type is set yet }
-              if p.resulttype.def=nil then
-               p.resulttype:=generrortype;
+              if p.resultdef=nil then
+               p.resultdef:=generrordef;
             end;
            codegenerror:=codegenerror or oldcodegenerror;
          end
@@ -102,11 +102,11 @@ implementation
       end;
 
 
-    function do_resulttypepass(var p : tnode) : boolean;
+    function do_typecheckpass(var p : tnode) : boolean;
       begin
          codegenerror:=false;
-         resulttypepass(p);
-         do_resulttypepass:=codegenerror;
+         typecheckpass(p);
+         do_typecheckpass:=codegenerror;
       end;
 
 
@@ -130,18 +130,18 @@ implementation
               { checks make always a call }
               if ([cs_check_range,cs_check_overflow,cs_check_stack] * aktlocalswitches <> []) then
                 include(current_procinfo.flags,pi_do_call);
-              { determine the resulttype if not done }
-              if (p.resulttype.def=nil) then
+              { determine the resultdef if not done }
+              if (p.resultdef=nil) then
                begin
                  aktfilepos:=p.fileinfo;
                  aktlocalswitches:=p.localswitches;
-                 hp:=p.det_resulttype;
+                 hp:=p.pass_typecheck;
                  { should the node be replaced? }
                  if assigned(hp) then
                   begin
                      p.free;
-                     { run resulttypepass }
-                     resulttypepass(hp);
+                     { run typecheckpass }
+                     typecheckpass(hp);
                      { switch to new node }
                      p:=hp;
                   end;
@@ -149,8 +149,8 @@ implementation
                   begin
                     include(p.flags,nf_error);
                     { default to errortype if no type is set yet }
-                    if p.resulttype.def=nil then
-                     p.resulttype:=generrortype;
+                    if p.resultdef=nil then
+                     p.resultdef:=generrordef;
                   end;
                  aktlocalswitches:=oldlocalswitches;
                  aktfilepos:=oldpos;

+ 1 - 1
compiler/pass_2.pas

@@ -172,7 +172,7 @@ implementation
             if (cs_asm_nodes in aktglobalswitches) then
               logsecond(p.nodetype,true);
 {$endif EXTDEBUG}
-            p.pass_2;
+            p.pass_generate_code;
 {$ifdef EXTDEBUG}
             if (cs_asm_nodes in aktglobalswitches) then
               logsecond(p.nodetype,false);

+ 63 - 63
compiler/pdecl.pas

@@ -89,14 +89,14 @@ implementation
         case p.nodetype of
            ordconstn:
              begin
-               if p.resulttype.def.deftype=pointerdef then
-                 hp:=tconstsym.create_ordptr(orgname,constpointer,tordconstnode(p).value,p.resulttype)
+               if p.resultdef.deftype=pointerdef then
+                 hp:=tconstsym.create_ordptr(orgname,constpointer,tordconstnode(p).value,p.resultdef)
                else
-                 hp:=tconstsym.create_ord(orgname,constord,tordconstnode(p).value,p.resulttype);
+                 hp:=tconstsym.create_ord(orgname,constord,tordconstnode(p).value,p.resultdef);
              end;
            stringconstn:
              begin
-               if is_widestring(p.resulttype.def) then
+               if is_widestring(p.resultdef) then
                  begin
                    initwidestring(pw);
                    copywidestring(pcompilerwidestring(tstringconstnode(p).value_str),pw);
@@ -113,34 +113,34 @@ implementation
              begin
                 new(pd);
                 pd^:=trealconstnode(p).value_real;
-                hp:=tconstsym.create_ptr(orgname,constreal,pd,p.resulttype);
+                hp:=tconstsym.create_ptr(orgname,constreal,pd,p.resultdef);
              end;
            setconstn :
              begin
                new(ps);
                ps^:=tsetconstnode(p).value_set^;
-               hp:=tconstsym.create_ptr(orgname,constset,ps,p.resulttype);
+               hp:=tconstsym.create_ptr(orgname,constset,ps,p.resultdef);
              end;
            pointerconstn :
              begin
-               hp:=tconstsym.create_ordptr(orgname,constpointer,tpointerconstnode(p).value,p.resulttype);
+               hp:=tconstsym.create_ordptr(orgname,constpointer,tpointerconstnode(p).value,p.resultdef);
              end;
            niln :
              begin
-               hp:=tconstsym.create_ord(orgname,constnil,0,p.resulttype);
+               hp:=tconstsym.create_ord(orgname,constnil,0,p.resultdef);
              end;
            typen :
              begin
-               if is_interface(p.resulttype.def) then
+               if is_interface(p.resultdef) then
                 begin
-                  if assigned(tobjectdef(p.resulttype.def).iidguid) then
+                  if assigned(tobjectdef(p.resultdef).iidguid) then
                    begin
                      new(pg);
-                     pg^:=tobjectdef(p.resulttype.def).iidguid^;
-                     hp:=tconstsym.create_ptr(orgname,constguid,pg,p.resulttype);
+                     pg^:=tobjectdef(p.resultdef).iidguid^;
+                     hp:=tconstsym.create_ptr(orgname,constguid,pg,p.resultdef);
                    end
                   else
-                   Message1(parser_e_interface_has_no_guid,tobjectdef(p.resulttype.def).objrealname^);
+                   Message1(parser_e_interface_has_no_guid,tobjectdef(p.resultdef).objrealname^);
                 end
                else
                 Message(parser_e_illegal_expression);
@@ -157,7 +157,7 @@ implementation
     procedure const_dec;
       var
          orgname : stringid;
-         tt  : ttype;
+         hdef : tdef;
          sym : tsym;
          dummysymoptions : tsymoptions;
          storetokenpos,filepos : tfileposinfo;
@@ -196,19 +196,19 @@ implementation
                    block_type:=bt_type;
                    consume(_COLON);
                    ignore_equal:=true;
-                   read_anon_type(tt,false);
+                   read_anon_type(hdef,false);
                    ignore_equal:=false;
                    block_type:=bt_const;
                    skipequal:=false;
                    { create symbol }
                    storetokenpos:=akttokenpos;
                    akttokenpos:=filepos;
-                   sym:=ttypedconstsym.createtype(orgname,tt,(cs_typed_const_writable in aktlocalswitches));
+                   sym:=ttypedconstsym.create(orgname,hdef,(cs_typed_const_writable in aktlocalswitches));
                    akttokenpos:=storetokenpos;
                    symtablestack.top.insert(sym);
                    { procvar can have proc directives, but not type references }
-                   if (tt.def.deftype=procvardef) and
-                      (tt.def.typesym=nil) then
+                   if (hdef.deftype=procvardef) and
+                      (hdef.typesym=nil) then
                     begin
                       { support p : procedure;stdcall=nil; }
                       if try_to_consume(_SEMICOLON) then
@@ -228,7 +228,7 @@ implementation
                           parse_var_proc_directives(sym);
                        end;
                       { add default calling convention }
-                      handle_calling_convention(tabstractprocdef(tt.def));
+                      handle_calling_convention(tabstractprocdef(hdef));
                     end;
                    if not skipequal then
                     begin
@@ -238,7 +238,7 @@ implementation
                         tclist:=current_asmdata.asmlists[al_rotypedconsts]
                       else
                         tclist:=current_asmdata.asmlists[al_typedconsts];
-                      readtypedconst(tclist,tt,ttypedconstsym(sym),(cs_typed_const_writable in aktlocalswitches));
+                      readtypedconst(tclist,hdef,ttypedconstsym(sym),(cs_typed_const_writable in aktlocalswitches));
                       consume(_SEMICOLON);
                     end;
                 end;
@@ -287,9 +287,9 @@ implementation
          { Check only typesyms or record/object fields }
          case tsym(p).typ of
            typesym :
-             pd:=ttypesym(p).restype.def;
+             pd:=ttypesym(p).typedef;
            fieldvarsym :
-             pd:=tfieldvarsym(p).vartype.def
+             pd:=tfieldvarsym(p).vardef
            else
              exit;
          end;
@@ -298,15 +298,15 @@ implementation
            case pd.deftype of
              arraydef :
                begin
-                 { elementtype could also be defined using a forwarddef }
-                 pd:=tarraydef(pd).elementtype.def;
+                 { elementdef could also be defined using a forwarddef }
+                 pd:=tarraydef(pd).elementdef;
                  again:=true;
                end;
              pointerdef,
              classrefdef :
                begin
                  { classrefdef inherits from pointerdef }
-                 hpd:=tabstractpointerdef(pd).pointertype.def;
+                 hpd:=tabstractpointerdef(pd).pointeddef;
                  { still a forward def ? }
                  if hpd.deftype=forwarddef then
                   begin
@@ -324,24 +324,24 @@ implementation
                     akttokenpos:=stpos;
                     { we don't need the forwarddef anymore, dispose it }
                     hpd.free;
-                    tabstractpointerdef(pd).pointertype.def:=nil; { if error occurs }
+                    tabstractpointerdef(pd).pointeddef:=nil; { if error occurs }
                     { was a type sym found ? }
                     if assigned(srsym) and
                        (srsym.typ=typesym) then
                      begin
-                       tabstractpointerdef(pd).pointertype.setdef(ttypesym(srsym).restype.def);
+                       tabstractpointerdef(pd).pointeddef:=ttypesym(srsym).typedef;
                        { avoid wrong unused warnings web bug 801 PM }
                        inc(ttypesym(srsym).refs);
                        { we need a class type for classrefdef }
                        if (pd.deftype=classrefdef) and
-                          not(is_class(ttypesym(srsym).restype.def)) then
-                         Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename);
+                          not(is_class(ttypesym(srsym).typedef)) then
+                         Message1(type_e_class_type_expected,ttypesym(srsym).typedef.typename);
                      end
                     else
                      begin
                        MessagePos1(tsym(p).fileinfo,sym_e_forward_type_not_resolved,tsym(p).realname);
                        { try to recover }
-                       tabstractpointerdef(pd).pointertype:=generrortype;
+                       tabstractpointerdef(pd).pointeddef:=generrordef;
                      end;
                   end;
                end;
@@ -392,7 +392,7 @@ implementation
          newtype  : ttypesym;
          sym      : tsym;
          srsymtable : tsymtable;
-         tt       : ttype;
+         hdef     : tdef;
          oldfilepos,
          defpos,storetokenpos : tfileposinfo;
          old_block_type : tblock_type;
@@ -456,15 +456,15 @@ implementation
                  if ((token=_CLASS) or
                      (token=_INTERFACE) or
                      (token=_DISPINTERFACE)) and
-                    (assigned(ttypesym(sym).restype.def)) and
-                    is_class_or_interface_or_dispinterface(ttypesym(sym).restype.def) and
-                    (oo_is_forward in tobjectdef(ttypesym(sym).restype.def).objectoptions) then
+                    (assigned(ttypesym(sym).typedef)) and
+                    is_class_or_interface_or_dispinterface(ttypesym(sym).typedef) and
+                    (oo_is_forward in tobjectdef(ttypesym(sym).typedef).objectoptions) then
                   begin
                     { we can ignore the result   }
                     { the definition is modified }
-                    object_dec(orgtypename,nil,nil,tobjectdef(ttypesym(sym).restype.def));
+                    object_dec(orgtypename,nil,nil,tobjectdef(ttypesym(sym).typedef));
                     newtype:=ttypesym(sym);
-                    tt:=newtype.restype;
+                    hdef:=newtype.typedef;
                   end
                  else
                   message1(parser_h_type_redef,orgtypename);
@@ -476,43 +476,43 @@ implementation
               { insert the new type first with an errordef, so that
                 referencing the type before it's really set it
                 will give an error (PFV) }
-              tt:=generrortype;
+              hdef:=generrordef;
               storetokenpos:=akttokenpos;
-              newtype:=ttypesym.create(orgtypename,tt);
+              newtype:=ttypesym.create(orgtypename,hdef);
               symtablestack.top.insert(newtype);
               akttokenpos:=defpos;
               akttokenpos:=storetokenpos;
               { read the type definition }
-              read_named_type(tt,orgtypename,nil,generictypelist,false);
+              read_named_type(hdef,orgtypename,nil,generictypelist,false);
               { update the definition of the type }
-              if assigned(tt.def) then
+              if assigned(hdef) then
                 begin
-                  if assigned(tt.def.typesym) then
+                  if assigned(hdef.typesym) then
                     istyperenaming:=true;
                   if isunique then
                     begin
-                      tt.setdef(tstoreddef(tt.def).getcopy);
-                      include(tt.def.defoptions,df_unique);
+                      hdef:=tstoreddef(hdef).getcopy;
+                      include(hdef.defoptions,df_unique);
                     end;
-                  if not assigned(tt.def.typesym) then
-                    tt.def.typesym:=newtype;
+                  if not assigned(hdef.typesym) then
+                    hdef.typesym:=newtype;
                 end;
-              newtype.restype:=tt;
+              newtype.typedef:=hdef;
               { KAZ: handle TGUID declaration in system unit }
               if (cs_compilesystem in aktmoduleswitches) and not assigned(rec_tguid) and
                  (typename='TGUID') and { name: TGUID and size=16 bytes that is 128 bits }
-                 assigned(tt.def) and (tt.def.deftype=recorddef) and (tt.def.size=16) then
-                rec_tguid:=trecorddef(tt.def);
+                 assigned(hdef) and (hdef.deftype=recorddef) and (hdef.size=16) then
+                rec_tguid:=trecorddef(hdef);
             end;
-           if assigned(tt.def) then
+           if assigned(hdef) then
             begin
-              case tt.def.deftype of
+              case hdef.deftype of
                 pointerdef :
                   begin
                     consume(_SEMICOLON);
                     if try_to_consume(_FAR) then
                      begin
-                       tpointerdef(tt.def).is_far:=true;
+                       tpointerdef(hdef).is_far:=true;
                        consume(_SEMICOLON);
                      end;
                   end;
@@ -526,7 +526,7 @@ implementation
                        if not check_proc_directive(true) then
                         consume(_SEMICOLON);
                        parse_var_proc_directives(tsym(newtype));
-                       handle_calling_convention(tprocvardef(tt.def));
+                       handle_calling_convention(tprocvardef(hdef));
                      end;
                   end;
                 objectdef,
@@ -544,14 +544,14 @@ implementation
            if assigned(generictypelist) then
              begin
                current_scanner.stoprecordtokens;
-               tstoreddef(tt.def).generictokenbuf:=generictokenbuf;
+               tstoreddef(hdef).generictokenbuf:=generictokenbuf;
                { Generic is never a type renaming }
-               tt.def.typesym:=newtype;
+               hdef.typesym:=newtype;
              end;
 
            { Write tables if we are the typesym that defines
              this type. This will not be done for simple type renamings }
-           if (tt.def.typesym=newtype) then
+           if (hdef.typesym=newtype) then
             begin
               { file position }
               oldfilepos:=aktfilepos;
@@ -560,28 +560,28 @@ implementation
               { generate persistent init/final tables when it's declared in the interface so it can
                 be reused in other used }
               if current_module.in_interface and
-                 ((is_class(tt.def) and
-                   tobjectdef(tt.def).members_need_inittable) or
-                  tt.def.needs_inittable) then
+                 ((is_class(hdef) and
+                   tobjectdef(hdef).members_need_inittable) or
+                  hdef.needs_inittable) then
                 generate_inittable(newtype);
 
               { for objects we should write the vmt and interfaces.
                 This need to be done after the rtti has been written, because
                 it can contain a reference to that data (PFV)
                 This is not for forward classes }
-              if (tt.def.deftype=objectdef) and
-                 (tt.def.owner.symtabletype in [staticsymtable,globalsymtable]) then
-                with Tobjectdef(tt.def) do
+              if (hdef.deftype=objectdef) and
+                 (hdef.owner.symtabletype in [staticsymtable,globalsymtable]) then
+                with Tobjectdef(hdef) do
                   begin
                     if not(oo_is_forward in objectoptions) then
                       begin
-                        ch:=tclassheader.create(tobjectdef(tt.def));
+                        ch:=tclassheader.create(tobjectdef(hdef));
                         { generate and check virtual methods, must be done
                           before RTTI is written }
                         ch.genvmt;
                         { Generate RTTI for class }
                         generate_rtti(newtype);
-                        if is_interface(tobjectdef(tt.def)) then
+                        if is_interface(tobjectdef(hdef)) then
                           ch.writeinterfaceids;
                         if (oo_has_vmt in objectoptions) then
                           ch.writevmt;

+ 29 - 30
compiler/pdecobj.pas

@@ -55,6 +55,12 @@ implementation
       var
          there_is_a_destructor : boolean;
          classtype : tobjectdeftype;
+         pcrd      : tclassrefdef;
+         hdef      : tdef;
+         old_object_option : tsymoptions;
+         oldparse_only : boolean;
+         storetypecanbeforward : boolean;
+
 
       function constructor_head:tprocdef;
         var
@@ -76,12 +82,12 @@ implementation
            { Set return type, class constructors return the
              created instance, object constructors return boolean }
            if is_class(pd._class) then
-             pd.rettype.setdef(pd._class)
+             pd.returndef:=pd._class
            else
 {$ifdef CPU64bit}
-             pd.rettype:=bool64type;
+             pd.returndef:=bool64type;
 {$else CPU64bit}
-             pd.rettype:=bool32type;
+             pd.returndef:=bool32type;
 {$endif CPU64bit}
            constructor_head:=pd;
         end;
@@ -135,17 +141,10 @@ implementation
            consume(_SEMICOLON);
            include(aktobjectdef.objectoptions,oo_has_destructor);
            { no return value }
-           pd.rettype:=voidtype;
+           pd.returndef:=voidtype;
            destructor_head:=pd;
         end;
 
-      var
-         pcrd       : tclassrefdef;
-         tt     : ttype;
-         old_object_option : tsymoptions;
-         oldparse_only : boolean;
-         storetypecanbeforward : boolean;
-
       procedure setclassattributes;
 
         begin
@@ -275,19 +274,19 @@ implementation
                         { a hack, but it's easy to handle }
                         { class reference type }
                         consume(_OF);
-                        single_type(tt,typecanbeforward);
+                        single_type(hdef,typecanbeforward);
 
                         { accept hp1, if is a forward def or a class }
-                        if (tt.def.deftype=forwarddef) or
-                           is_class(tt.def) then
+                        if (hdef.deftype=forwarddef) or
+                           is_class(hdef) then
                           begin
-                             pcrd:=tclassrefdef.create(tt);
+                             pcrd:=tclassrefdef.create(hdef);
                              object_dec:=pcrd;
                           end
                         else
                           begin
-                             object_dec:=generrortype.def;
-                             Message1(type_e_class_type_expected,generrortype.def.typename);
+                             object_dec:=generrordef;
+                             Message1(type_e_class_type_expected,generrordef.typename);
                           end;
                         typecanbeforward:=storetypecanbeforward;
                         readobjecttype:=false;
@@ -346,17 +345,17 @@ implementation
 
       procedure readimplementedinterfaces;
         var
-          tt      : ttype;
+          hdef : tdef;
         begin
           while try_to_consume(_COMMA) do
             begin
-               id_type(tt,false);
-               if (tt.def.deftype<>objectdef) then
+               id_type(hdef,false);
+               if (hdef.deftype<>objectdef) then
                  begin
-                    Message1(type_e_interface_type_expected,tt.def.typename);
+                    Message1(type_e_interface_type_expected,hdef.typename);
                     continue;
                  end;
-               handleimplementedinterface(tobjectdef(tt.def));
+               handleimplementedinterface(tobjectdef(hdef));
             end;
         end;
 
@@ -387,7 +386,7 @@ implementation
         var
            intfchildof,
            childof : tobjectdef;
-           tt : ttype;
+           hdef : tdef;
            hasparentdefined : boolean;
         begin
           childof:=nil;
@@ -397,16 +396,16 @@ implementation
           { reads the parent class }
           if try_to_consume(_LKLAMMER) then
             begin
-              id_type(tt,false);
-              if (not assigned(tt.def)) or
-                 (tt.def.deftype<>objectdef) then
+              id_type(hdef,false);
+              if (not assigned(hdef)) or
+                 (hdef.deftype<>objectdef) then
                 begin
-                  if assigned(tt.def) then
-                    Message1(type_e_class_type_expected,tt.def.typename);
+                  if assigned(hdef) then
+                    Message1(type_e_class_type_expected,hdef.typename);
                 end
               else
                 begin
-                  childof:=tobjectdef(tt.def);
+                  childof:=tobjectdef(hdef);
                   { a mix of class, interfaces, objects and cppclasses
                     isn't allowed }
                   case classtype of
@@ -554,7 +553,7 @@ implementation
              for i:=0 to genericlist.count-1 do
                begin
                  generictype:=ttypesym(genericlist[i]);
-                 if generictype.restype.def.deftype=undefineddef then
+                 if generictype.typedef.deftype=undefineddef then
                    include(aktobjectdef.defoptions,df_generic)
                  else
                    include(aktobjectdef.defoptions,df_specialization);

+ 85 - 90
compiler/pdecsub.pas

@@ -93,8 +93,8 @@ implementation
         paranr   : word;
       begin
         if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
-           not is_void(pd.rettype.def) and
-           paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
+           not is_void(pd.returndef) and
+           paramanager.ret_in_param(pd.returndef,pd.proccalloption) then
          begin
            storepos:=akttokenpos;
            if pd.deftype=procdef then
@@ -106,7 +106,7 @@ implementation
            else
              paranr:=paranr_result;
            { Generate result variable accessing function result }
-           vs:=tparavarsym.create('$result',paranr,vs_var,pd.rettype,[vo_is_funcret,vo_is_hidden_para]);
+           vs:=tparavarsym.create('$result',paranr,vs_var,pd.returndef,[vo_is_funcret,vo_is_hidden_para]);
            pd.parast.insert(vs);
            { Store the this symbol as funcretsym for procedures }
            if pd.deftype=procdef then
@@ -144,15 +144,14 @@ implementation
       var
         storepos : tfileposinfo;
         vs       : tparavarsym;
-        tt       : ttype;
+        hdef     : tdef;
         vsp      : tvarspez;
       begin
         if (pd.deftype=procvardef) and
            pd.is_methodpointer then
           begin
             { Generate self variable }
-            tt:=voidpointertype;
-            vs:=tparavarsym.create('$self',paranr_self,vs_value,tt,[vo_is_self,vo_is_hidden_para]);
+            vs:=tparavarsym.create('$self',paranr_self,vs_value,voidpointertype,[vo_is_self,vo_is_hidden_para]);
             pd.parast.insert(vs);
           end
         else
@@ -169,8 +168,7 @@ implementation
                  begin
                    { can't use classrefdef as type because inheriting
                      will then always file because of a type mismatch }
-                   tt:=voidpointertype;
-                   vs:=tparavarsym.create('$vmt',paranr_vmt,vs_value,tt,[vo_is_vmt,vo_is_hidden_para]);
+                   vs:=tparavarsym.create('$vmt',paranr_vmt,vs_value,voidpointertype,[vo_is_vmt,vo_is_hidden_para]);
                    pd.parast.insert(vs);
                  end;
 
@@ -180,17 +178,14 @@ implementation
                 vsp:=vs_value;
                 if (po_staticmethod in pd.procoptions) or
                    (po_classmethod in pd.procoptions) then
-                  begin
-                    tt.setdef(tprocdef(pd)._class);
-                    tt.setdef(tclassrefdef.create(tt));
-                  end
+                  hdef:=tclassrefdef.create(tprocdef(pd)._class)
                 else
                   begin
                     if is_object(tprocdef(pd)._class) then
                       vsp:=vs_var;
-                    tt.setdef(tprocdef(pd)._class);
+                    hdef:=tprocdef(pd)._class;
                   end;
-                vs:=tparavarsym.create('$self',paranr_self,vsp,tt,[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);
 
                 akttokenpos:=storepos;
@@ -208,7 +203,7 @@ implementation
       begin
         { The result from constructors and destructors can't be accessed directly }
         if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
-           not is_void(pd.rettype.def) then
+           not is_void(pd.returndef) then
          begin
            storepos:=akttokenpos;
            akttokenpos:=pd.fileinfo;
@@ -219,9 +214,9 @@ implementation
 
            { We need to insert a varsym for the result in the localst
              when it is returning in a register }
-           if not paramanager.ret_in_param(pd.rettype.def,pd.proccalloption) then
+           if not paramanager.ret_in_param(pd.returndef,pd.proccalloption) then
             begin
-              vs:=tlocalvarsym.create('$result',vs_value,pd.rettype,[vo_is_funcret]);
+              vs:=tlocalvarsym.create('$result',vs_value,pd.returndef,[vo_is_funcret]);
               pd.localst.insert(vs);
               pd.funcretsym:=vs;
             end;
@@ -233,7 +228,7 @@ implementation
             pd.resultname:=pd.procsym.name;
            sl:=tpropaccesslist.create;
            sl.addsym(sl_load,pd.funcretsym);
-           aliasvs:=tabsolutevarsym.create_ref(pd.resultname,pd.rettype,sl);
+           aliasvs:=tabsolutevarsym.create_ref(pd.resultname,pd.returndef,sl);
            include(aliasvs.varoptions,vo_is_funcret);
            tlocalsymtable(pd.localst).insert(aliasvs);
 
@@ -242,7 +237,7 @@ implementation
             begin
               sl:=tpropaccesslist.create;
               sl.addsym(sl_load,pd.funcretsym);
-              aliasvs:=tabsolutevarsym.create_ref('RESULT',pd.rettype,sl);
+              aliasvs:=tabsolutevarsym.create_ref('RESULT',pd.returndef,sl);
               include(aliasvs.varoptions,vo_is_funcret);
               include(aliasvs.varoptions,vo_is_result);
               tlocalsymtable(pd.localst).insert(aliasvs);
@@ -267,13 +262,13 @@ implementation
              an exception because they are allocated at runtime and the
              address that is pushed is patched }
            if (varspez=vs_value) and
-              paramanager.push_addr_param(varspez,vartype.def,pd.proccalloption) and
-              not(is_open_array(vartype.def) or
-                  is_array_of_const(vartype.def)) then
+              paramanager.push_addr_param(varspez,vardef,pd.proccalloption) and
+              not(is_open_array(vardef) or
+                  is_array_of_const(vardef)) then
              include(varoptions,vo_has_local_copy);
 
            { needs high parameter ? }
-           if paramanager.push_high_param(varspez,vartype.def,pd.proccalloption) then
+           if paramanager.push_high_param(varspez,vardef,pd.proccalloption) then
              begin
                hvs:=tparavarsym.create('$high'+name,paranr+1,vs_const,sinttype,[vo_is_high_para,vo_is_hidden_para]);
                owner.insert(hvs);
@@ -283,9 +278,9 @@ implementation
               { Give a warning that cdecl routines does not include high()
                 support }
               if (pd.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
-                 paramanager.push_high_param(varspez,vartype.def,pocall_default) then
+                 paramanager.push_high_param(varspez,vardef,pocall_default) then
                begin
-                 if is_open_string(vartype.def) then
+                 if is_open_string(vardef) then
                     Message(parser_w_cdecl_no_openstring);
                  if not (po_external in pd.procoptions) then
                    Message(parser_w_cdecl_has_no_high);
@@ -300,16 +295,16 @@ implementation
          exit;
         with tparavarsym(p) do
          begin
-           case vartype.def.deftype of
+           case vardef.deftype of
              arraydef :
                begin
-                 if not is_variant_array(vartype.def) and
-                    not is_array_of_const(vartype.def) then
+                 if not is_variant_array(vardef) and
+                    not is_array_of_const(vardef) then
                   begin
                     if (varspez<>vs_var) then
                       Message(parser_h_c_arrays_are_references);
                   end;
-                 if is_array_of_const(vartype.def) and
+                 if is_array_of_const(vardef) and
                     assigned(indexnext) and
                     (tsym(indexnext).typ=paravarsym) and
                     not(vo_is_high_para in tparavarsym(indexnext).varoptions) then
@@ -346,11 +341,11 @@ implementation
          exit;
         with tparavarsym(p) do
          begin
-           case vartype.def.deftype of
+           case vardef.deftype of
              arraydef :
                begin
-                 if is_array_constructor(vartype.def) or
-                    is_variant_array(vartype.def) then
+                 if is_array_constructor(vardef) or
+                    is_variant_array(vardef) then
                    begin
                      Message1(parser_w_not_supported_for_inline,'array of const');
                      Message(parser_w_inlining_disabled);
@@ -368,8 +363,8 @@ implementation
          exit;
         with tparavarsym(p) do
          begin
-           if not vartype.def.needs_inittable and
-              paramanager.push_addr_param(varspez,vartype.def,tprocdef(arg).proccalloption) then
+           if not vardef.needs_inittable and
+              paramanager.push_addr_param(varspez,vardef,tprocdef(arg).proccalloption) then
              varregable:=vr_intreg;
          end;
       end;
@@ -383,8 +378,8 @@ implementation
         tppv = (pv_none,pv_proc,pv_func);
       var
         sc      : TFPObjectList;
-        tt      : ttype;
-        arrayelementtype : ttype;
+        hdef    : tdef;
+        arrayelementdef : tdef;
         vs      : tparavarsym;
         i       : longint;
         srsym   : tsym;
@@ -452,12 +447,12 @@ implementation
           else
               varspez:=vs_value;
           defaultvalue:=nil;
-          tt.reset;
+          hdef:=nil;
           { read identifiers and insert with error type }
           sc.clear;
           repeat
             inc(paranr);
-            vs:=tparavarsym.create(orgpattern,paranr*10,varspez,generrortype,[]);
+            vs:=tparavarsym.create(orgpattern,paranr*10,varspez,generrordef,[]);
             currparast.insert(vs);
             if assigned(vs.owner) then
              sc.add(vs)
@@ -475,16 +470,16 @@ implementation
              if parseprocvar=pv_func then
               begin
                 consume(_COLON);
-                single_type(pv.rettype,false);
+                single_type(pv.returndef,false);
               end;
-             tt.def:=pv;
+             hdef:=pv;
              { possible proc directives }
              if check_proc_directive(true) then
                begin
-                  dummytype:=ttypesym.create('unnamed',tt);
+                  dummytype:=ttypesym.create('unnamed',hdef);
                   parse_var_proc_directives(tsym(dummytype));
-                  dummytype.restype.def:=nil;
-                  tt.def.typesym:=nil;
+                  dummytype.typedef:=nil;
+                  hdef.typesym:=nil;
                   dummytype.free;
                end;
              { Add implicit hidden parameters and function result }
@@ -501,33 +496,33 @@ implementation
                 consume(_ARRAY);
                 consume(_OF);
                 { define range and type of range }
-                tt.setdef(tarraydef.create(0,-1,s32inttype));
+                hdef:=tarraydef.create(0,-1,s32inttype);
                 { array of const ? }
                 if (token=_CONST) and (m_objpas in aktmodeswitches) then
                  begin
                    consume(_CONST);
                    srsym:=search_system_type('TVARREC');
-                   tarraydef(tt.def).setelementtype(ttypesym(srsym).restype);
-                   include(tarraydef(tt.def).arrayoptions,ado_IsArrayOfConst);
+                   tarraydef(hdef).elementdef:=ttypesym(srsym).typedef;
+                   include(tarraydef(hdef).arrayoptions,ado_IsArrayOfConst);
                  end
                 else
                  begin
                    { define field type }
-                   single_type(arrayelementtype,false);
-                   tarraydef(tt.def).setelementtype(arrayelementtype);
+                   single_type(arrayelementdef,false);
+                   tarraydef(hdef).elementdef:=arrayelementdef;
                  end;
               end
              else
               begin
                 if (m_mac in aktmodeswitches) then
                   try_to_consume(_UNIV); {currently does nothing}
-                single_type(tt,false);
+                single_type(hdef,false);
 
                 { open string ? }
                 if (varspez in [vs_out,vs_var]) and
                    (cs_openstring in aktmoduleswitches) and
-                   is_shortstring(tt.def) then
-                  tt:=openshortstringtype;
+                   is_shortstring(hdef) then
+                  hdef:=openshortstringtype;
 
                 if (target_info.system in [system_powerpc_morphos,system_m68k_amiga]) then
                   begin
@@ -573,10 +568,10 @@ implementation
               end;
            end
           else
-           tt:=cformaltype;
+           hdef:=cformaltype;
 
           { File types are only allowed for var and out parameters }
-          if (tt.def.deftype=filedef) and
+          if (hdef.deftype=filedef) and
              not(varspez in [vs_out,vs_var]) then
             CGMessage(cg_e_file_must_call_by_reference);
 
@@ -584,7 +579,7 @@ implementation
             begin
               vs:=tparavarsym(sc[i]);
               { update varsym }
-              vs.vartype:=tt;
+              vs.vardef:=hdef;
               vs.defaultconstsym:=defaultvalue;
 
               if (target_info.system in [system_powerpc_morphos,system_m68k_amiga]) then
@@ -673,8 +668,8 @@ implementation
            akttokenpos:=storepos;
            { qualifier is interface? }
            if (srsym.typ=typesym) and
-              (ttypesym(srsym).restype.def.deftype=objectdef) then
-             i:=aclass.implementedinterfaces.searchintf(ttypesym(srsym).restype.def)
+              (ttypesym(srsym).typedef.deftype=objectdef) then
+             i:=aclass.implementedinterfaces.searchintf(ttypesym(srsym).typedef)
            else
              i:=-1;
            if (i=-1) then
@@ -714,9 +709,9 @@ implementation
            consume(_ID);
            { qualifier is class name ? }
            if (srsym.typ=typesym) and
-              (ttypesym(srsym).restype.def.deftype=objectdef) then
+              (ttypesym(srsym).typedef.deftype=objectdef) then
             begin
-              aclass:=tobjectdef(ttypesym(srsym).restype.def);
+              aclass:=tobjectdef(ttypesym(srsym).typedef);
               aprocsym:=tprocsym(aclass.symtable.search(sp));
               { we solve this below }
               if assigned(aprocsym) then
@@ -934,7 +929,7 @@ implementation
                              symtablestack.push(pd._class.symtable);
                              popclass:=true;
                            end;
-                         single_type(pd.rettype,false);
+                         single_type(pd.returndef,false);
                          if popclass then
                            symtablestack.pop(pd._class.symtable);
                          pd.test_if_fpu_result;
@@ -996,7 +991,7 @@ implementation
                   { pd=nil when it is a interface mapping }
                   if assigned(pd) then
                     begin
-                      pd.rettype:=voidtype;
+                      pd.returndef:=voidtype;
                       if isclassmethod then
                         include(pd.procoptions,po_classmethod);
                     end;
@@ -1013,12 +1008,12 @@ implementation
                   { Set return type, class constructors return the
                     created instance, object constructors return boolean }
                   if is_class(pd._class) then
-                    pd.rettype.setdef(pd._class)
+                    pd.returndef:=pd._class
                   else
 {$ifdef CPU64bit}
-                    pd.rettype:=bool64type;
+                    pd.returndef:=bool64type;
 {$else CPU64bit}
-                    pd.rettype:=bool32type;
+                    pd.returndef:=bool32type;
 {$endif CPU64bit}
                 end;
             end;
@@ -1028,7 +1023,7 @@ implementation
               consume(_DESTRUCTOR);
               parse_proc_head(aclass,potype_destructor,pd);
               if assigned(pd) then
-                pd.rettype:=voidtype;
+                pd.returndef:=voidtype;
             end;
 
           _OPERATOR :
@@ -1064,20 +1059,20 @@ implementation
                   if not try_to_consume(_COLON) then
                     begin
                       consume(_COLON);
-                      pd.rettype:=generrortype;
+                      pd.returndef:=generrordef;
                       consume_all_until(_SEMICOLON);
                     end
                   else
                    begin
-                     single_type(pd.rettype,false);
+                     single_type(pd.returndef,false);
                      pd.test_if_fpu_result;
                      if (optoken in [_EQUAL,_GT,_LT,_GTE,_LTE]) and
-                        ((pd.rettype.def.deftype<>orddef) or
-                         (torddef(pd.rettype.def).typ<>bool8bit)) then
+                        ((pd.returndef.deftype<>orddef) or
+                         (torddef(pd.returndef).typ<>bool8bit)) then
                         Message(parser_e_comparative_operator_return_boolean);
                      if (optoken=_ASSIGNMENT) and
-                        equal_defs(pd.rettype.def,
-                           tparavarsym(pd.parast.symindex.first).vartype.def) then
+                        equal_defs(pd.returndef,
+                           tparavarsym(pd.parast.symindex.first).vardef) then
                        message(parser_e_no_such_assignment)
                      else if not isoperatoracceptable(pd,optoken) then
                        Message(parser_e_overload_impossible);
@@ -1347,14 +1342,14 @@ begin
         begin
           if (sym.typ=globalvarsym) and
              (
-              (tabstractvarsym(sym).vartype.def.deftype=pointerdef) or
-              is_32bitint(tabstractvarsym(sym).vartype.def)
+              (tabstractvarsym(sym).vardef.deftype=pointerdef) or
+              is_32bitint(tabstractvarsym(sym).vardef)
              ) then
             begin
               tprocdef(pd).libsym:=sym;
               if po_syscall_legacy in tprocdef(pd).procoptions then
                 begin
-                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vartype,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
+                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
                   paramanager.parseparaloc(vs,'A6');
                   pd.parast.insert(vs);
                 end
@@ -1377,12 +1372,12 @@ begin
         begin
           if (sym.typ=globalvarsym) and
              (
-              (tabstractvarsym(sym).vartype.def.deftype=pointerdef) or
-              is_32bitint(tabstractvarsym(sym).vartype.def)
+              (tabstractvarsym(sym).vardef.deftype=pointerdef) or
+              is_32bitint(tabstractvarsym(sym).vardef)
              ) then
             begin
               tprocdef(pd).libsym:=sym;
-              vs:=tparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vartype,[vo_is_syscall_lib,vo_is_hidden_para]);
+              vs:=tparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]);
               pd.parast.insert(vs);
             end
           else
@@ -1440,14 +1435,14 @@ begin
         begin
           if (sym.typ=globalvarsym) and
              (
-              (tabstractvarsym(sym).vartype.def.deftype=pointerdef) or
-              is_32bitint(tabstractvarsym(sym).vartype.def)
+              (tabstractvarsym(sym).vardef.deftype=pointerdef) or
+              is_32bitint(tabstractvarsym(sym).vardef)
              ) then
             begin
               tprocdef(pd).libsym:=sym;
               if po_syscall_legacy in tprocdef(pd).procoptions then
                 begin
-                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vartype,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
+                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
                   paramanager.parseparaloc(vs,'A6');
                   pd.parast.insert(vs);
                 end
@@ -1457,17 +1452,17 @@ begin
                 end
               else if po_syscall_basesysv in tprocdef(pd).procoptions then
                 begin
-                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vartype,[vo_is_syscall_lib,vo_is_hidden_para]);
+                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]);
                   pd.parast.insert(vs);
                 end
               else if po_syscall_sysvbase in tprocdef(pd).procoptions then
                 begin
-                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_sysvbase,vs_value,tabstractvarsym(sym).vartype,[vo_is_syscall_lib,vo_is_hidden_para]);
+                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_sysvbase,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]);
                   pd.parast.insert(vs);
                 end
               else if po_syscall_r12base in tprocdef(pd).procoptions then
                 begin
-                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_r12base,vs_value,tabstractvarsym(sym).vartype,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
+                  vs:=tparavarsym.create('$syscalllib',paranr_syscall_r12base,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
                   paramanager.parseparaloc(vs,'R12');
                   pd.parast.insert(vs);
                 end
@@ -2375,11 +2370,11 @@ const
           globalvarsym,
           localvarsym,
           paravarsym :
-            pd:=tabstractprocdef(tabstractvarsym(sym).vartype.def);
+            pd:=tabstractprocdef(tabstractvarsym(sym).vardef);
           typedconstsym :
-            pd:=tabstractprocdef(ttypedconstsym(sym).typedconsttype.def);
+            pd:=tabstractprocdef(ttypedconstsym(sym).typedconstdef);
           typesym :
-            pd:=tabstractprocdef(ttypesym(sym).restype.def);
+            pd:=tabstractprocdef(ttypesym(sym).typedef);
           else
             internalerror(2003042617);
         end;
@@ -2442,9 +2437,9 @@ const
                { for operators equal_paras is not enough !! }
                ((pd.proctypeoption<>potype_operator) or (optoken<>_ASSIGNMENT) or
                 { be careful here, equal_defs doesn't take care of unique }
-                (hd.rettype.def=pd.rettype.def) or
-                (equal_defs(hd.rettype.def,pd.rettype.def) and
-                 not(df_unique in hd.rettype.def.defoptions) and not(df_unique in pd.rettype.def.defoptions)
+                (hd.returndef=pd.returndef) or
+                (equal_defs(hd.returndef,pd.returndef) and
+                 not(df_unique in hd.returndef.defoptions) and not(df_unique in pd.returndef.defoptions)
                 )
                )
               ) then
@@ -2466,8 +2461,8 @@ const
                       ) or
                       (
                        ((m_repeat_forward in aktmodeswitches) or
-                        not(is_void(pd.rettype.def))) and
-                       (not equal_defs(hd.rettype.def,pd.rettype.def))) then
+                        not(is_void(pd.returndef))) and
+                       (not equal_defs(hd.returndef,pd.returndef))) then
                      begin
                        MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,
                                    pd.fullprocname(false));

+ 102 - 104
compiler/pdecvar.pas

@@ -92,7 +92,7 @@ implementation
                         if not(sp_private in current_object_option) then
                           addsymref(sym);
                         pl.addsym(sl_load,sym);
-                        def:=tfieldvarsym(sym).vartype.def;
+                        def:=tfieldvarsym(sym).vardef;
                       end;
                     procsym :
                       begin
@@ -134,7 +134,7 @@ implementation
                                 pl.addsym(sl_subscript,sym);
                                 case sym.typ of
                                   fieldvarsym :
-                                    def:=tfieldvarsym(sym).vartype.def;
+                                    def:=tfieldvarsym(sym).vardef;
                                   else
                                     begin
                                       Message1(sym_e_illegal_field,orgpattern);
@@ -173,17 +173,17 @@ implementation
                              begin
                                if (p.nodetype=ordconstn) then
                                  begin
-                                   if compare_defs(p.resulttype.def,tarraydef(def).rangetype.def,nothingn)>=te_equal then
+                                   if compare_defs(p.resultdef,tarraydef(def).rangedef,nothingn)>=te_equal then
                                      idx:=tordconstnode(p).value
                                    else
-                                     IncompatibleTypes(p.resulttype.def,tarraydef(def).rangetype.def);
+                                     IncompatibleTypes(p.resultdef,tarraydef(def).rangedef);
                                  end
                                else
                                 Message(type_e_ordinal_expr_expected)
                              end;
                             p.free;
-                            pl.addconst(sl_vec,idx,p.resulttype);
-                            def:=tarraydef(def).elementtype.def;
+                            pl.addconst(sl_vec,idx,p.resultdef);
+                            def:=tarraydef(def).elementdef;
                           end
                          else
                           begin
@@ -214,8 +214,8 @@ implementation
          p : tpropertysym;
          overriden : tsym;
          varspez : tvarspez;
-         tt : ttype;
-         arraytype : ttype;
+         hdef : tdef;
+         arraytype : tdef;
          def : tdef;
          pt : tnode;
          sc : TFPObjectList;
@@ -244,7 +244,7 @@ implementation
            end;
 
          { method for stored must return boolean }
-         storedprocdef.rettype:=booltype;
+         storedprocdef.returndef:=booltype;
 
          if token<>_ID then
            begin
@@ -278,7 +278,7 @@ implementation
                 sc.clear;
                 repeat
                   inc(paranr);
-                  hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrortype,[]);
+                  hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrordef,[]);
                   readprocdef.parast.insert(hreadparavs);
                   sc.add(hreadparavs);
                   consume(_ID);
@@ -289,22 +289,22 @@ implementation
                       begin
                         consume(_OF);
                         { define range and type of range }
-                        tt.setdef(tarraydef.create(0,-1,s32inttype));
+                        hdef:=tarraydef.create(0,-1,s32inttype);
                         { define field type }
                         single_type(arraytype,false);
-                        tarraydef(tt.def).setelementtype(arraytype);
+                        tarraydef(hdef).elementdef:=arraytype;
                       end
                     else
-                      single_type(tt,false);
+                      single_type(hdef,false);
                   end
                 else
-                  tt:=cformaltype;
+                  hdef:=cformaltype;
                 for i:=0 to sc.count-1 do
                   begin
                     hreadparavs:=tparavarsym(sc[i]);
-                    hreadparavs.vartype:=tt;
+                    hreadparavs.vardef:=hdef;
                     { also update the writeprocdef }
-                    hparavs:=tparavarsym.create(hreadparavs.realname,hreadparavs.paranr,vs_value,tt,[]);
+                    hparavs:=tparavarsym.create(hreadparavs.realname,hreadparavs.paranr,vs_value,hdef,[]);
                     writeprocdef.parast.insert(hparavs);
                   end;
               until not try_to_consume(_SEMICOLON);
@@ -325,7 +325,7 @@ implementation
          if (token=_COLON) or (paranr>0) or (aclass=nil) then
            begin
               consume(_COLON);
-              single_type(p.proptype,false);
+              single_type(p.propdef,false);
               if (idtoken=_INDEX) then
                 begin
                    consume(_INDEX);
@@ -334,13 +334,13 @@ implementation
                      values to s32int to be compatible with delphi, because the
                      procedure matching requires equal parameters }
                    if is_constnode(pt) and
-                      is_ordinal(pt.resulttype.def)
+                      is_ordinal(pt.resultdef)
 {$ifndef cpu64bit}
-                      and (not is_64bitint(pt.resulttype.def))
+                      and (not is_64bitint(pt.resultdef))
 {$endif cpu64bit}
                       then
                      begin
-                       if is_integer(pt.resulttype.def) then
+                       if is_integer(pt.resultdef) then
                          inserttypeconv_internal(pt,s32inttype);
                        p.index:=tordconstnode(pt).value;
                      end
@@ -349,15 +349,15 @@ implementation
                        Message(parser_e_invalid_property_index_value);
                        p.index:=0;
                      end;
-                   p.indextype:=pt.resulttype;
+                   p.indexdef:=pt.resultdef;
                    include(p.propoptions,ppo_indexed);
                    { concat a longint to the para templates }
                    inc(paranr);
-                   hparavs:=tparavarsym.create('$index',10*paranr,vs_value,p.indextype,[]);
+                   hparavs:=tparavarsym.create('$index',10*paranr,vs_value,p.indexdef,[]);
                    readprocdef.parast.insert(hparavs);
-                   hparavs:=tparavarsym.create('$index',10*paranr,vs_value,p.indextype,[]);
+                   hparavs:=tparavarsym.create('$index',10*paranr,vs_value,p.indexdef,[]);
                    writeprocdef.parast.insert(hparavs);
-                   hparavs:=tparavarsym.create('$index',10*paranr,vs_value,p.indextype,[]);
+                   hparavs:=tparavarsym.create('$index',10*paranr,vs_value,p.indexdef,[]);
                    storedprocdef.parast.insert(hparavs);
                    pt.free;
                 end;
@@ -372,20 +372,20 @@ implementation
                 begin
                   p.overridenpropsym:=tpropertysym(overriden);
                   { inherit all type related entries }
-                  p.indextype:=tpropertysym(overriden).indextype;
-                  p.proptype:=tpropertysym(overriden).proptype;
+                  p.indexdef:=tpropertysym(overriden).indexdef;
+                  p.propdef:=tpropertysym(overriden).propdef;
                   p.index:=tpropertysym(overriden).index;
                   p.default:=tpropertysym(overriden).default;
                   p.propoptions:=tpropertysym(overriden).propoptions;
                 end
               else
                 begin
-                  p.proptype:=generrortype;
+                  p.propdef:=generrordef;
                   message(parser_e_no_property_found_to_override);
                 end;
            end;
          if ((sp_published in current_object_option) or is_dispinterface(aclass)) and
-            not(p.proptype.def.is_publishable) then
+            not(p.propdef.is_publishable) then
            Message(parser_e_cant_publish_that_property);
 
          if not(is_dispinterface(aclass)) then
@@ -400,14 +400,14 @@ implementation
                       procsym :
                         begin
                           { read is function returning the type of the property }
-                          readprocdef.rettype:=p.proptype;
+                          readprocdef.returndef:=p.propdef;
                           { Insert hidden parameters }
                           handle_calling_convention(readprocdef);
                           { search procdefs matching readprocdef }
                           { we ignore hidden stuff here because the property access symbol might have
                             non default calling conventions which might change the hidden stuff;
                             see tw3216.pp (FK) }
-                          p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.paras,p.proptype.def,[cpo_allowdefaults,cpo_ignorehidden]);
+                          p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.paras,p.propdef,[cpo_allowdefaults,cpo_ignorehidden]);
                           if not assigned(p.readaccess.procdef) then
                             Message(parser_e_ill_property_access_sym);
                         end;
@@ -415,7 +415,7 @@ implementation
                         begin
                           if not assigned(def) then
                             internalerror(200310071);
-                          if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
+                          if compare_defs(def,p.propdef,nothingn)>=te_equal then
                            begin
                              { property parameters are allowed if this is
                                an indexed property, because the index is then
@@ -426,7 +426,7 @@ implementation
                               Message(parser_e_ill_property_access_sym);
                            end
                           else
-                           IncompatibleTypes(def,p.proptype.def);
+                           IncompatibleTypes(def,p.propdef);
                         end;
                       else
                         Message(parser_e_ill_property_access_sym);
@@ -444,14 +444,14 @@ implementation
                         begin
                           { write is a procedure with an extra value parameter
                             of the of the property }
-                          writeprocdef.rettype:=voidtype;
+                          writeprocdef.returndef:=voidtype;
                           inc(paranr);
-                          hparavs:=tparavarsym.create('$value',10*paranr,vs_value,p.proptype,[]);
+                          hparavs:=tparavarsym.create('$value',10*paranr,vs_value,p.propdef,[]);
                           writeprocdef.parast.insert(hparavs);
                           { Insert hidden parameters }
                           handle_calling_convention(writeprocdef);
                           { search procdefs matching writeprocdef }
-                          p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.paras,writeprocdef.rettype.def,[cpo_allowdefaults]);
+                          p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.paras,writeprocdef.returndef,[cpo_allowdefaults]);
                           if not assigned(p.writeaccess.procdef) then
                             Message(parser_e_ill_property_access_sym);
                         end;
@@ -459,7 +459,7 @@ implementation
                         begin
                           if not assigned(def) then
                             internalerror(200310072);
-                          if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
+                          if compare_defs(def,p.propdef,nothingn)>=te_equal then
                            begin
                              { property parameters are allowed if this is
                                an indexed property, because the index is then
@@ -470,7 +470,7 @@ implementation
                               Message(parser_e_ill_property_access_sym);
                            end
                           else
-                           IncompatibleTypes(def,p.proptype.def);
+                           IncompatibleTypes(def,p.propdef);
                         end;
                       else
                         Message(parser_e_ill_property_access_sym);
@@ -523,7 +523,7 @@ implementation
                                 begin
                                    { Insert hidden parameters }
                                    handle_calling_convention(storedprocdef);
-                                   p.storedaccess.procdef:=Tprocsym(sym).search_procdef_bypara(storedprocdef.paras,storedprocdef.rettype.def,[cpo_allowdefaults,cpo_ignorehidden]);
+                                   p.storedaccess.procdef:=Tprocsym(sym).search_procdef_bypara(storedprocdef.paras,storedprocdef.returndef,[cpo_allowdefaults,cpo_ignorehidden]);
                                    if not assigned(p.storedaccess.procdef) then
                                      message(parser_e_ill_property_storage_sym);
                                 end;
@@ -556,16 +556,16 @@ implementation
            end;
          if try_to_consume(_DEFAULT) then
            begin
-              if not(is_ordinal(p.proptype.def) or
+              if not(is_ordinal(p.propdef) or
 {$ifndef cpu64bit}
-                     is_64bitint(p.proptype.def) or
+                     is_64bitint(p.propdef) or
 {$endif cpu64bit}
-                     is_class(p.proptype.def) or
-                     is_single(p.proptype.def) or
-                     (p.proptype.def.deftype in [classrefdef,pointerdef]) or
-                     ((p.proptype.def.deftype=setdef) and
-                      (tsetdef(p.proptype.def).settype=smallset))) or
-                     ((p.proptype.def.deftype=arraydef) and
+                     is_class(p.propdef) or
+                     is_single(p.propdef) or
+                     (p.propdef.deftype in [classrefdef,pointerdef]) or
+                     ((p.propdef.deftype=setdef) and
+                      (tsetdef(p.propdef).settype=smallset))) or
+                     ((p.propdef.deftype=arraydef) and
                       (ppo_indexed in p.propoptions)) or
                  (ppo_hasparameters in p.propoptions) then
                 begin
@@ -579,13 +579,13 @@ implementation
                   { Get the result of the default, the firstpass is
                     needed to support values like -1 }
                   pt:=comp_expr(true);
-                  if (p.proptype.def.deftype=setdef) and
+                  if (p.propdef.deftype=setdef) and
                      (pt.nodetype=arrayconstructorn) then
                     begin
                       arrayconstructor_to_set(pt);
-                      do_resulttypepass(pt);
+                      do_typecheckpass(pt);
                     end;
-                  inserttypeconv(pt,p.proptype);
+                  inserttypeconv(pt,p.propdef);
                   if not(is_constnode(pt)) then
                     Message(parser_e_property_default_value_must_const);
                   { Set default value }
@@ -611,12 +611,12 @@ implementation
          begin
            consume(_ID);
            {$message warn unlocalized string}
-           if not is_interface(p.proptype.def) then
+           if not is_interface(p.propdef) then
            begin
              writeln('Implements property must have interface type');
              Message1(sym_e_illegal_field, pattern);
            end;
-           if pattern <> p.proptype.def.mangledparaname() then
+           if pattern <> p.propdef.mangledparaname() then
            begin
              writeln('Implements-property must implement interface of correct type');
              Message1(sym_e_illegal_field, pattern);
@@ -649,20 +649,20 @@ implementation
       end;
 
 
-     function maybe_parse_proc_directives(const tt:ttype):boolean;
+     function maybe_parse_proc_directives(def:tdef):boolean;
        var
          newtype : ttypesym;
        begin
          result:=false;
          { Process procvar directives before = and ; }
-         if (tt.def.deftype=procvardef) and
-            (tt.def.typesym=nil) and
+         if (def.deftype=procvardef) and
+            (def.typesym=nil) and
             check_proc_directive(true) then
            begin
-              newtype:=ttypesym.create('unnamed',tt);
+              newtype:=ttypesym.create('unnamed',def);
               parse_var_proc_directives(tsym(newtype));
-              newtype.restype.def:=nil;
-              tt.def.typesym:=nil;
+              newtype.typedef:=nil;
+              def.typesym:=nil;
               newtype.free;
               result:=true;
            end;
@@ -674,7 +674,7 @@ implementation
 
     procedure read_var_decls(options:Tvar_dec_options);
 
-      procedure read_default_value(sc : TFPObjectList;tt : ttype;is_threadvar : boolean);
+      procedure read_default_value(sc : TFPObjectList;def:tdef;is_threadvar : boolean);
         var
           vs : tabstractnormalvarsym;
           tcsym : ttypedconstsym;
@@ -687,22 +687,22 @@ implementation
           if symtablestack.top.symtabletype=localsymtable then
             begin
               consume(_EQUAL);
-              tcsym:=ttypedconstsym.createtype('$default'+vs.realname,tt,false);
+              tcsym:=ttypedconstsym.create('$default'+vs.realname,def,false);
               include(tcsym.symoptions,sp_internal);
               vs.defaultconstsym:=tcsym;
               symtablestack.top.insert(tcsym);
-              readtypedconst(current_asmdata.asmlists[al_typedconsts],tt,tcsym,false);
+              readtypedconst(current_asmdata.asmlists[al_typedconsts],def,tcsym,false);
               { The variable has a value assigned }
               vs.varstate:=vs_initialised;
             end
           else
             begin
-              tcsym:=ttypedconstsym.createtype(vs.realname,tt,true);
+              tcsym:=ttypedconstsym.create(vs.realname,def,true);
               tcsym.fileinfo:=vs.fileinfo;
               symtablestack.top.replace(vs,tcsym);
               vs.free;
               consume(_EQUAL);
-              readtypedconst(current_asmdata.asmlists[al_typedconsts],tt,tcsym,true);
+              readtypedconst(current_asmdata.asmlists[al_typedconsts],def,tcsym,true);
             end;
         end;
 
@@ -720,7 +720,7 @@ implementation
          extern_var,export_var : boolean;
          old_current_object_option : tsymoptions;
          hs,sorg,C_name,dll_name : string;
-         tt : ttype;
+         hdef : tdef;
          hp,pt : tnode;
          vs    : tabstractvarsym;
          hintsymoptions : tsymoptions;
@@ -749,10 +749,10 @@ implementation
                  begin
                    case symtablestack.top.symtabletype of
                      localsymtable :
-                       vs:=tlocalvarsym.create(orgpattern,vs_value,generrortype,[]);
+                       vs:=tlocalvarsym.create(orgpattern,vs_value,generrordef,[]);
                      staticsymtable,
                      globalsymtable :
-                       vs:=tglobalvarsym.create(orgpattern,vs_value,generrortype,[]);
+                       vs:=tglobalvarsym.create(orgpattern,vs_value,generrordef,[]);
                      else
                        internalerror(200411064);
                    end;
@@ -775,11 +775,11 @@ implementation
              { this is needed for Delphi mode at least
                but should be OK for all modes !! (PM) }
              ignore_equal:=true;
-             read_anon_type(tt,false);
+             read_anon_type(hdef,false);
              ignore_equal:=false;
 
              { Process procvar directives }
-             if maybe_parse_proc_directives(tt) then
+             if maybe_parse_proc_directives(hdef) then
                semicoloneaten:=true;
 
              if is_gpc_name then
@@ -787,7 +787,7 @@ implementation
                   vs:=tabstractvarsym(sc[0]);
                   if sc.count>1 then
                     Message(parser_e_absolute_only_one_var);
-                  vs.vartype:=tt;
+                  vs.vardef:=hdef;
                   if vs.typ=globalvarsym then
                     begin
                       tglobalvarsym(vs).set_mangledname(target_info.Cprefix+sorg);
@@ -814,7 +814,7 @@ implementation
                 if (pt.nodetype=stringconstn) or
                    (is_constcharnode(pt)) then
                  begin
-                   abssym:=tabsolutevarsym.create(vs.realname,tt);
+                   abssym:=tabsolutevarsym.create(vs.realname,hdef);
                    abssym.fileinfo:=vs.fileinfo;
                    if pt.nodetype=stringconstn then
                      hs:=strpas(tstringconstnode(pt).value_str)
@@ -836,7 +836,7 @@ implementation
                          (m_objfpc in aktmodeswitches) or
                          (m_delphi in aktmodeswitches)) then
                  begin
-                   abssym:=tabsolutevarsym.create(vs.realname,tt);
+                   abssym:=tabsolutevarsym.create(vs.realname,hdef);
                    abssym.fileinfo:=vs.fileinfo;
                    abssym.abstyp:=toaddr;
                    abssym.addroffset:=tordconstnode(pt).value;
@@ -872,7 +872,7 @@ implementation
                        if not (tloadnode(hp).symtableentry.typ in [fieldvarsym,globalvarsym,localvarsym,
                                                                    paravarsym,typedconstsym]) then
                          Message(parser_e_absolute_only_to_var_or_const);
-                       abssym:=tabsolutevarsym.create(vs.realname,tt);
+                       abssym:=tabsolutevarsym.create(vs.realname,hdef);
                        abssym.fileinfo:=vs.fileinfo;
                        abssym.abstyp:=tovar;
                        abssym.ref:=node_to_propaccesslist(pt);
@@ -903,10 +903,10 @@ implementation
                 (symtablestack.top.symtabletype<>parasymtable) then
                begin
                  { Add calling convention for procvar }
-                 if (tt.def.deftype=procvardef) and
-                    (tt.def.typesym=nil) then
-                   handle_calling_convention(tprocvardef(tt.def));
-                 read_default_value(sc,tt,vd_threadvar in options);
+                 if (hdef.deftype=procvardef) and
+                    (hdef.typesym=nil) then
+                   handle_calling_convention(tprocvardef(hdef));
+                 read_default_value(sc,hdef,vd_threadvar in options);
                  consume(_SEMICOLON);
                  { for locals we've created typedconstsym with a different name }
                  if symtablestack.top.symtabletype<>localsymtable then
@@ -921,19 +921,19 @@ implementation
 
              { Support calling convention for procvars after semicolon }
              if not(hasdefaultvalue) and
-                (tt.def.deftype=procvardef) and
-                (tt.def.typesym=nil) then
+                (hdef.deftype=procvardef) and
+                (hdef.typesym=nil) then
                begin
                  { Parse procvar directives after ; }
-                 maybe_parse_proc_directives(tt);
+                 maybe_parse_proc_directives(hdef);
                  { Add calling convention for procvar }
-                 handle_calling_convention(tprocvardef(tt.def));
+                 handle_calling_convention(tprocvardef(hdef));
                  { Handling of Delphi typed const = initialized vars }
                  if (token=_EQUAL) and
                     not(m_tp7 in aktmodeswitches) and
                     (symtablestack.top.symtabletype<>parasymtable) then
                    begin
-                     read_default_value(sc,tt,vd_threadvar in options);
+                     read_default_value(sc,hdef,vd_threadvar in options);
                      consume(_SEMICOLON);
                      symdone:=true;
                      hasdefaultvalue:=true;
@@ -958,7 +958,7 @@ implementation
                    if sc.count>1 then
                      Message(parser_e_absolute_only_one_var);
                    { set type of the var }
-                   vs.vartype:=tt;
+                   vs.vardef:=hdef;
                    vs.symoptions := vs.symoptions + hintsymoptions;
                    { defaults }
                    is_dll:=false;
@@ -1079,7 +1079,7 @@ implementation
                  for i:=0 to sc.count-1 do
                    begin
                      vs:=tabstractvarsym(sc[i]);
-                     vs.vartype:=tt;
+                     vs.vardef:=hdef;
                      { insert any additional hint directives }
                      vs.symoptions := vs.symoptions + hintsymoptions;
                      if vd_threadvar in options then
@@ -1104,7 +1104,7 @@ implementation
          old_block_type : tblock_type;
          old_current_object_option : tsymoptions;
          hs,sorg : string;
-         tt,casetype : ttype;
+         hdef,casetype : tdef;
          { maxsize contains the max. size of a variant }
          { startvarrec contains the start of the variant part of a record }
          maxsize, startvarrecsize : longint;
@@ -1122,7 +1122,6 @@ implementation
          offset : longint;
          uniondef : trecorddef;
          unionsym : tfieldvarsym;
-         uniontype : ttype;
          hintsymoptions : tsymoptions;
          semicoloneaten: boolean;
 {$ifdef powerpc}
@@ -1155,7 +1154,7 @@ implementation
              repeat
                if try_to_consume(_ID) then
                  begin
-                   vs:=tfieldvarsym.create(orgpattern,vs_value,generrortype,[]);
+                   vs:=tfieldvarsym.create(orgpattern,vs_value,generrordef,[]);
                    sc.add(vs);
                    recst.insert(vs);
                  end;
@@ -1166,13 +1165,13 @@ implementation
              if ([df_generic,df_specialization]*tdef(recst.defowner).defoptions=[]) then
                symtablestack.pop(recst);
              ignore_equal:=true;
-             read_anon_type(tt,false);
+             read_anon_type(hdef,false);
              ignore_equal:=false;
              if ([df_generic,df_specialization]*tdef(recst.defowner).defoptions=[]) then
                symtablestack.push(recst);
 
              { Process procvar directives }
-             if maybe_parse_proc_directives(tt) then
+             if maybe_parse_proc_directives(hdef) then
                semicoloneaten:=true;
 
 {$ifdef powerpc}
@@ -1191,9 +1190,9 @@ implementation
                 (symtablestack.top.symtabletype = recordsymtable) and
                 (trecordsymtable(symtablestack.top).usefieldalignment = -1) then
                begin
-                 tempdef := tt.def;
+                 tempdef := hdef;
                  while tempdef.deftype = arraydef do
-                   tempdef := tarraydef(tempdef).elementtype.def;
+                   tempdef := tarraydef(tempdef).elementdef;
                  if tempdef.deftype <> recorddef then
                    maxpadalign := tempdef.alignment
                  else
@@ -1209,7 +1208,7 @@ implementation
              { types that use init/final are not allowed in variant parts, but
                classes are allowed }
              if (variantrecordlevel>0) and
-                (tt.def.needs_inittable and not is_class(tt.def)) then
+                (hdef.needs_inittable and not is_class(hdef)) then
                Message(parser_e_cant_use_inittable_here);
 
              { try to parse the hint directives }
@@ -1223,12 +1222,12 @@ implementation
                consume(_SEMICOLON);
 
              { Parse procvar directives after ; }
-             maybe_parse_proc_directives(tt);
+             maybe_parse_proc_directives(hdef);
 
              { Add calling convention for procvar }
-             if (tt.def.deftype=procvardef) and
-                (tt.def.typesym=nil) then
-               handle_calling_convention(tprocvardef(tt.def));
+             if (hdef.deftype=procvardef) and
+                (hdef.typesym=nil) then
+               handle_calling_convention(tprocvardef(hdef));
 
              { Check for STATIC directive }
              if (vd_object in options) and
@@ -1240,7 +1239,7 @@ implementation
                end;
 
              if (sp_published in current_object_option) and
-                not(is_class(tt.def)) then
+                not(is_class(hdef)) then
                begin
                  Message(parser_e_cant_publish_that);
                  exclude(current_object_option,sp_published);
@@ -1254,7 +1253,7 @@ implementation
                end
              else
               if (sp_published in current_object_option) and
-                 not(oo_can_have_published in tobjectdef(tt.def).objectoptions) then
+                 not(oo_can_have_published in tobjectdef(hdef).objectoptions) then
                begin
                  Message(parser_e_only_publishable_classes_can__be_published);
                  exclude(current_object_option,sp_published);
@@ -1264,7 +1263,7 @@ implementation
              for i:=0 to sc.count-1 do
                begin
                  fieldvs:=tfieldvarsym(sc[i]);
-                 fieldvs.vartype:=tt;
+                 fieldvs.vardef:=hdef;
                  { insert any additional hint directives }
                  fieldvs.symoptions := fieldvs.symoptions + hintsymoptions;
                  if (sp_static in current_object_option) then
@@ -1272,7 +1271,7 @@ implementation
                  { static data fields are inserted in the globalsymtable }
                  if (sp_static in current_object_option) then
                    begin
-                      hstaticvs:=tglobalvarsym.create('$'+lower(symtablestack.top.name^)+'_'+fieldvs.name,vs_value,tt,[]);
+                      hstaticvs:=tglobalvarsym.create('$'+lower(symtablestack.top.name^)+'_'+fieldvs.name,vs_value,hdef,[]);
                       recst.defowner.owner.insert(hstaticvs);
                       insertbssdata(hstaticvs);
                    end
@@ -1301,18 +1300,18 @@ implementation
                 begin
                   consume(_ID);
                   consume(_COLON);
-                  fieldvs:=tfieldvarsym.create(sorg,vs_value,generrortype,[]);
+                  fieldvs:=tfieldvarsym.create(sorg,vs_value,generrordef,[]);
                   symtablestack.top.insert(fieldvs);
                 end;
               read_anon_type(casetype,true);
               if assigned(fieldvs) then
                 begin
-                  fieldvs.vartype:=casetype;
+                  fieldvs.vardef:=casetype;
                   recst.addfield(fieldvs);
                 end;
-              if not(is_ordinal(casetype.def))
+              if not(is_ordinal(casetype))
 {$ifndef cpu64bit}
-                 or is_64bitint(casetype.def)
+                 or is_64bitint(casetype)
 {$endif cpu64bit}
                  then
                 Message(type_e_ordinal_expr_expected);
@@ -1363,8 +1362,7 @@ implementation
               { at last set the record size to that of the biggest variant }
               unionsymtable.datasize:=maxsize;
               unionsymtable.fieldalignment:=maxalignment;
-              uniontype.def:=uniondef;
-              UnionSym:=tfieldvarsym.create('$case',vs_value,uniontype,[]);
+              UnionSym:=tfieldvarsym.create('$case',vs_value,uniondef,[]);
               unionsymtable.addalignmentpadding;
 {$ifdef powerpc}
               { parent inherits the alignment padding if the variant is the first "field" of the parent record/variant }

+ 155 - 164
compiler/pexpr.pas

@@ -39,7 +39,7 @@ interface
     { reads a single factor }
     function factor(getaddr : boolean) : tnode;
 
-    procedure string_dec(var t: ttype);
+    procedure string_dec(var def: tdef);
 
     procedure propaccesslist_to_node(var p1:tnode;st:tsymtable;pl:tpropaccesslist);
 
@@ -91,14 +91,14 @@ implementation
        { last def found, only used by anon. inherited calls to insert proper type casts }
        srdef : tdef = nil;
 
-    procedure string_dec(var t: ttype);
+    procedure string_dec(var def:tdef);
     { reads a string type with optional length }
     { and returns a pointer to the string      }
     { definition                               }
       var
          p : tnode;
       begin
-         t:=cshortstringtype;
+         def:=cshortstringtype;
          consume(_STRING);
          if try_to_consume(_LECKKLAMMER) then
            begin
@@ -120,23 +120,23 @@ implementation
                  if tordconstnode(p).value>255 then
                   begin
                     { longstring is currently unsupported (CEC)! }
-{                   t.setdef(tstringdef.createlong(tordconstnode(p).value))}
+{                   t:=tstringdef.createlong(tordconstnode(p).value))}
                      Message(parser_e_invalid_string_size);
                      tordconstnode(p).value:=255;
-                     t.setdef(tstringdef.createshort(tordconstnode(p).value));
+                     def:=tstringdef.createshort(tordconstnode(p).value);
                   end
                  else
                    if tordconstnode(p).value<>255 then
-                     t.setdef(tstringdef.createshort(tordconstnode(p).value));
+                     def:=tstringdef.createshort(tordconstnode(p).value);
                end;
               p.free;
            end
           else
             begin
                if cs_ansistrings in aktlocalswitches then
-                 t:=cansistringtype
+                 def:=cansistringtype
                else
-                 t:=cshortstringtype;
+                 def:=cshortstringtype;
             end;
        end;
 
@@ -178,14 +178,14 @@ implementation
                  p1:=csubscriptnode.create(plist^.sym,p1);
                end;
              sl_typeconv :
-               p1:=ctypeconvnode.create_explicit(p1,plist^.tt);
+               p1:=ctypeconvnode.create_explicit(p1,plist^.def);
              sl_absolutetype :
                begin
-                 p1:=ctypeconvnode.create(p1,plist^.tt);
+                 p1:=ctypeconvnode.create(p1,plist^.def);
                  include(p1.flags,nf_absolute);
                end;
              sl_vec :
-               p1:=cvecnode.create(p1,cordconstnode.create(plist^.value,plist^.valuett,true));
+               p1:=cvecnode.create(p1,cordconstnode.create(plist^.value,plist^.valuedef,true));
              else
                internalerror(200110205);
            end;
@@ -210,20 +210,20 @@ implementation
               begin
                 addnode(ttypeconvnode(p).left);
                 if nf_absolute in ttypeconvnode(p).flags then
-                  sl.addtype(sl_absolutetype,ttypeconvnode(p).totype)
+                  sl.addtype(sl_absolutetype,ttypeconvnode(p).totypedef)
                 else
-                  sl.addtype(sl_typeconv,ttypeconvnode(p).totype);
+                  sl.addtype(sl_typeconv,ttypeconvnode(p).totypedef);
               end;
             vecn :
               begin
                 addnode(tvecnode(p).left);
                 if tvecnode(p).right.nodetype=ordconstn then
-                  sl.addconst(sl_vec,tordconstnode(tvecnode(p).right).value,tvecnode(p).right.resulttype)
+                  sl.addconst(sl_vec,tordconstnode(tvecnode(p).right).value,tvecnode(p).right.resultdef)
                 else
                   begin
                     Message(parser_e_illegal_expression);
                     { recovery }
-                    sl.addconst(sl_vec,0,tvecnode(p).right.resulttype);
+                    sl.addconst(sl_vec,0,tvecnode(p).right.resultdef);
                   end;
              end;
             loadn :
@@ -287,7 +287,7 @@ implementation
      function gen_c_style_operator(ntyp:tnodetype;p1,p2:tnode) : tnode;
        var
          hp    : tnode;
-         htype : ttype;
+         hdef  : tdef;
          temp  : ttempcreatenode;
          newstatement : tstatementnode;
        begin
@@ -309,10 +309,10 @@ implementation
            internalerror(200410121);
          if (hp.nodetype=calln) then
            begin
-             resulttypepass(p1);
+             typecheckpass(p1);
              result:=internalstatements(newstatement);
-             htype.setdef(tpointerdef.create(p1.resulttype));
-             temp:=ctempcreatenode.create(htype,sizeof(aint),tt_persistent,false);
+             hdef:=tpointerdef.create(p1.resultdef);
+             temp:=ctempcreatenode.create(hdef,sizeof(aint),tt_persistent,false);
              addstatement(newstatement,temp);
              addstatement(newstatement,cassignmentnode.create(ctemprefnode.create(temp),caddrnode.create_internal(p1)));
              addstatement(newstatement,cassignmentnode.create(
@@ -377,7 +377,7 @@ implementation
                               p1:=nil;
                             end
                           else if (not assigned(current_procinfo) or
-                              is_void(current_procinfo.procdef.rettype.def)) then
+                              is_void(current_procinfo.procdef.returndef)) then
                             begin
                               Message(parser_e_void_function);
                               { recovery }
@@ -456,11 +456,11 @@ implementation
                 ttypenode(p1).allowed:=true;
               { Allow classrefdef, which is required for
                 Typeof(self) in static class methods }
-              if (p1.resulttype.def.deftype = objectdef) or
+              if (p1.resultdef.deftype = objectdef) or
                  (assigned(current_procinfo) and
                   ((po_classmethod in current_procinfo.procdef.procoptions) or
                    (po_staticmethod in current_procinfo.procdef.procoptions)) and
-                  (p1.resulttype.def.deftype=classrefdef)) then
+                  (p1.resultdef.deftype=classrefdef)) then
                statement_syssym:=geninlinenode(in_typeof_x,false,p1)
               else
                begin
@@ -479,11 +479,11 @@ implementation
               consume(_RKLAMMER);
               if (p1.nodetype<>typen) and
                  (
-                  (is_object(p1.resulttype.def) and
-                   (oo_has_constructor in tobjectdef(p1.resulttype.def).objectoptions)) or
-                  is_open_array(p1.resulttype.def) or
-                  is_array_of_const(p1.resulttype.def) or
-                  is_open_string(p1.resulttype.def)
+                  (is_object(p1.resultdef) and
+                   (oo_has_constructor in tobjectdef(p1.resultdef).objectoptions)) or
+                  is_open_array(p1.resultdef) or
+                  is_array_of_const(p1.resultdef) or
+                  is_open_string(p1.resultdef)
                  ) then
                 begin
                   statement_syssym:=geninlinenode(in_sizeof_x,false,p1);
@@ -495,16 +495,16 @@ implementation
                begin
                  if (l = in_sizeof_x) or
                     (not((p1.nodetype = vecn) and
-                         is_packed_array(tvecnode(p1).left.resulttype.def)) and
+                         is_packed_array(tvecnode(p1).left.resultdef)) and
                      not((p1.nodetype = subscriptn) and
-                         is_packed_record_or_object(tsubscriptnode(p1).left.resulttype.def))) then
+                         is_packed_record_or_object(tsubscriptnode(p1).left.resultdef))) then
                    begin
-                     statement_syssym:=cordconstnode.create(p1.resulttype.def.size,sinttype,true);
+                     statement_syssym:=cordconstnode.create(p1.resultdef.size,sinttype,true);
                      if (l = in_bitsizeof_x) then
                        statement_syssym:=caddnode.create(muln,statement_syssym,cordconstnode.create(8,sinttype,true));
                    end
                  else
-                   statement_syssym:=cordconstnode.create(p1.resulttype.def.packedbitsize,sinttype,true);
+                   statement_syssym:=cordconstnode.create(p1.resultdef.packedbitsize,sinttype,true);
                  { p1 not needed !}
                  p1.destroy;
                end;
@@ -568,19 +568,19 @@ implementation
                 end;
               if not codegenerror then
                begin
-                 case p1.resulttype.def.deftype of
+                 case p1.resultdef.deftype of
                    procdef, { procvar }
                    pointerdef,
                    procvardef,
                    classrefdef : ;
                    objectdef :
-                     if not is_class_or_interface(p1.resulttype.def) then
+                     if not is_class_or_interface(p1.resultdef) then
                        begin
                          Message(parser_e_illegal_parameter_list);
                          err:=true;
                        end;
                    arraydef :
-                     if not is_dynamic_array(p1.resulttype.def) then
+                     if not is_dynamic_array(p1.resultdef) then
                        begin
                          Message(parser_e_illegal_parameter_list);
                          err:=true;
@@ -626,9 +626,9 @@ implementation
               in_args:=true;
               p1:=comp_expr(true);
               p1:=caddrnode.create(p1);
-              do_resulttypepass(p1);
+              do_typecheckpass(p1);
               { Ofs() returns a cardinal/qword, not a pointer }
-              p1.resulttype:=uinttype;
+              p1.resultdef:=uinttype;
               consume(_RKLAMMER);
               statement_syssym:=p1;
             end;
@@ -739,9 +739,9 @@ implementation
                   begin
                     { Force string type if it isn't yet }
                     if not(
-                           (p1.resulttype.def.deftype=stringdef) or
-                           is_chararray(p1.resulttype.def) or
-                           is_char(p1.resulttype.def)
+                           (p1.resultdef.deftype=stringdef) or
+                           is_chararray(p1.resultdef) or
+                           is_char(p1.resultdef)
                           ) then
                       inserttypeconv(p1,cshortstringtype);
                     p2:=p1;
@@ -997,7 +997,7 @@ implementation
                           { anonymous inherited via msgid calls only require a var parameter for
                             both methods, so we need some type casting here }
                           para:=ccallparanode.create(ctypeconvnode.create_internal(ctypeconvnode.create_internal(
-                            cloadnode.create(currpara,currpara.owner),cformaltype),tparavarsym(tprocdef(srdef).paras[i]).vartype),
+                            cloadnode.create(currpara,currpara.owner),cformaltype),tparavarsym(tprocdef(srdef).paras[i]).vardef),
                           para)
                         else
                           para:=ccallparanode.create(cloadnode.create(currpara,currpara.owner),para);
@@ -1093,7 +1093,7 @@ implementation
          { indexed property }
          if (ppo_indexed in propsym.propoptions) then
            begin
-             p2:=cordconstnode.create(propsym.index,propsym.indextype,true);
+             p2:=cordconstnode.create(propsym.index,propsym.indexdef,true);
              paras:=ccallparanode.create(p2,paras);
            end;
          { we need only a write property if a := follows }
@@ -1123,8 +1123,8 @@ implementation
                          paras:=nil;
                          consume(_ASSIGNMENT);
                          { read the expression }
-                         if propsym.proptype.def.deftype=procvardef then
-                           getprocvardef:=tprocvardef(propsym.proptype.def);
+                         if propsym.propdef.deftype=procvardef then
+                           getprocvardef:=tprocvardef(propsym.propdef);
                          p2:=comp_expr(true);
                          if assigned(getprocvardef) then
                            handle_procvar(getprocvardef,p2);
@@ -1227,9 +1227,9 @@ implementation
            begin
               if assigned(p1) then
                begin
-                 if not assigned(p1.resulttype.def) then
-                  do_resulttypepass(p1);
-                 isclassref:=(p1.resulttype.def.deftype=classrefdef);
+                 if not assigned(p1.resultdef) then
+                  do_typecheckpass(p1);
+                 isclassref:=(p1.resultdef.deftype=classrefdef);
                end
               else
                isclassref:=false;
@@ -1243,7 +1243,7 @@ implementation
                                    (getaddr and not(token in [_CARET,_POINT])),
                                    again,p1,callflags);
                       { we need to know which procedure is called }
-                      do_resulttypepass(p1);
+                      do_typecheckpass(p1);
                       { calling using classref? }
                       if isclassref and
                          (p1.nodetype=calln) and
@@ -1302,7 +1302,6 @@ implementation
            possible_error : boolean;
            srsymtable : tsymtable;
            hdef  : tdef;
-           htype : ttype;
            static_name : string;
          begin
            { allow post fix operators }
@@ -1334,16 +1333,6 @@ implementation
                   srsym:=generrorsym;
                 end;
               srsymtable:=srsym.owner;
-{
-              storesymtablestack:=symtablestack;
-              symtablestack:=srsym.owner.next;
-              searchsym(srsym.name,srsym,srsymtable);
-              if not assigned(srsym) then
-               srsym:=generrorsym;
-              if (srsym.typ<>procsym) then
-               Message(parser_e_illegal_expression);
-              symtablestack:=storesymtablestack;
-}
             end;
 
             begin
@@ -1354,7 +1343,7 @@ implementation
                       begin
                         p1:=nil;
                         propaccesslist_to_node(p1,nil,tabsolutevarsym(srsym).ref);
-                        p1:=ctypeconvnode.create(p1,tabsolutevarsym(srsym).vartype);
+                        p1:=ctypeconvnode.create(p1,tabsolutevarsym(srsym).vardef);
                         include(p1.flags,nf_absolute);
                       end
                     else
@@ -1413,15 +1402,15 @@ implementation
 
                 typesym :
                   begin
-                    htype:=ttypesym(srsym).restype;
-                    if not assigned(htype.def) then
+                    hdef:=ttypesym(srsym).typedef;
+                    if not assigned(hdef) then
                      begin
                        again:=false;
                      end
                     else
                      begin
                        { We need to know if this unit uses Variants }
-                       if (htype.def=cvarianttype.def) and
+                       if (hdef=cvarianttype) and
                           not(cs_compilesystem in aktmoduleswitches) then
                          current_module.flags:=current_module.flags or uf_uses_variants;
                        if (block_type<>bt_specialize) and
@@ -1429,26 +1418,26 @@ implementation
                         begin
                           p1:=comp_expr(true);
                           consume(_RKLAMMER);
-                          p1:=ctypeconvnode.create_explicit(p1,htype);
+                          p1:=ctypeconvnode.create_explicit(p1,hdef);
                         end
                        else { not LKLAMMER }
                         if (token=_POINT) and
-                           is_object(htype.def) then
+                           is_object(hdef) then
                          begin
                            consume(_POINT);
                            if assigned(current_procinfo) and
                               assigned(current_procinfo.procdef._class) and
                               not(getaddr) then
                             begin
-                              if current_procinfo.procdef._class.is_related(tobjectdef(htype.def)) then
+                              if current_procinfo.procdef._class.is_related(tobjectdef(hdef)) then
                                begin
-                                 p1:=ctypenode.create(htype);
+                                 p1:=ctypenode.create(hdef);
                                  { search also in inherited methods }
-                                 searchsym_in_class(tobjectdef(htype.def),current_procinfo.procdef._class,pattern,srsym,srsymtable);
+                                 searchsym_in_class(tobjectdef(hdef),current_procinfo.procdef._class,pattern,srsym,srsymtable);
                                  if assigned(srsym) then
                                    check_hints(srsym,srsym.symoptions);
                                  consume(_ID);
-                                 do_member_read(tobjectdef(htype.def),false,srsym,p1,again,[]);
+                                 do_member_read(tobjectdef(hdef),false,srsym,p1,again,[]);
                                end
                               else
                                begin
@@ -1460,10 +1449,10 @@ implementation
                             begin
                               { allows @TObject.Load }
                               { also allows static methods and variables }
-                              p1:=ctypenode.create(htype);
+                              p1:=ctypenode.create(hdef);
                               { TP allows also @TMenu.Load if Load is only }
                               { defined in an anchestor class              }
-                              srsym:=search_class_member(tobjectdef(htype.def),pattern);
+                              srsym:=search_class_member(tobjectdef(hdef),pattern);
                               if assigned(srsym) then
                                 begin
                                   check_hints(srsym,srsym.symoptions);
@@ -1472,7 +1461,7 @@ implementation
                                   else
                                     begin
                                       consume(_ID);
-                                      do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
+                                      do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[]);
                                     end;
                                 end
                               else
@@ -1482,22 +1471,22 @@ implementation
                        else
                         begin
                           { class reference ? }
-                          if is_class(htype.def) then
+                          if is_class(hdef) then
                            begin
                              if getaddr and (token=_POINT) then
                               begin
                                 consume(_POINT);
                                 { allows @Object.Method }
                                 { also allows static methods and variables }
-                                p1:=ctypenode.create(htype);
+                                p1:=ctypenode.create(hdef);
                                 { TP allows also @TMenu.Load if Load is only }
                                 { defined in an anchestor class              }
-                                srsym:=search_class_member(tobjectdef(htype.def),pattern);
+                                srsym:=search_class_member(tobjectdef(hdef),pattern);
                                 if assigned(srsym) then
                                  begin
                                    check_hints(srsym,srsym.symoptions);
                                    consume(_ID);
-                                   do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
+                                   do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[]);
                                  end
                                 else
                                  begin
@@ -1507,7 +1496,7 @@ implementation
                               end
                              else
                               begin
-                                p1:=ctypenode.create(htype);
+                                p1:=ctypenode.create(hdef);
                                 { For a type block we simply return only
                                   the type. For all other blocks we return
                                   a loadvmt node }
@@ -1516,7 +1505,7 @@ implementation
                               end;
                            end
                           else
-                           p1:=ctypenode.create(htype);
+                           p1:=ctypenode.create(hdef);
                         end;
                      end;
                   end;
@@ -1531,9 +1520,9 @@ implementation
                     case tconstsym(srsym).consttyp of
                       constord :
                         begin
-                          if tconstsym(srsym).consttype.def=nil then
+                          if tconstsym(srsym).constdef=nil then
                             internalerror(200403232);
-                          p1:=cordconstnode.create(tconstsym(srsym).value.valueord,tconstsym(srsym).consttype,true);
+                          p1:=cordconstnode.create(tconstsym(srsym).value.valueord,tconstsym(srsym).constdef,true);
                         end;
                       conststring :
                         begin
@@ -1550,16 +1539,16 @@ implementation
                       constreal :
                         p1:=crealconstnode.create(pbestreal(tconstsym(srsym).value.valueptr)^,pbestrealtype^);
                       constset :
-                        p1:=csetconstnode.create(pconstset(tconstsym(srsym).value.valueptr),tconstsym(srsym).consttype);
+                        p1:=csetconstnode.create(pconstset(tconstsym(srsym).value.valueptr),tconstsym(srsym).constdef);
                       constpointer :
-                        p1:=cpointerconstnode.create(tconstsym(srsym).value.valueordptr,tconstsym(srsym).consttype);
+                        p1:=cpointerconstnode.create(tconstsym(srsym).value.valueordptr,tconstsym(srsym).constdef);
                       constnil :
                         p1:=cnilnode.create;
                       constresourcestring:
                         begin
                           p1:=cloadnode.create(srsym,srsymtable);
-                          do_resulttypepass(p1);
-                          p1.resulttype:=cansistringtype;
+                          do_typecheckpass(p1);
+                          p1.resultdef:=cansistringtype;
                         end;
                       constguid :
                         p1:=cguidconstnode.create(pguid(tconstsym(srsym).value.valueptr)^);
@@ -1582,7 +1571,7 @@ implementation
                     { we need to know which procedure is called }
                     if possible_error then
                      begin
-                       do_resulttypepass(p1);
+                       do_typecheckpass(p1);
                        if (p1.nodetype=calln) and
                           assigned(tcallnode(p1).procdefinition) and
                           not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) and
@@ -1730,12 +1719,12 @@ implementation
               p4:=comp_expr(true);
 
               addstatement(newstatement,cassignmentnode.create(
-                ctemprefnode.create_offset(temp,countindices*sinttype.def.size),p4));
+                ctemprefnode.create_offset(temp,countindices*sinttype.size),p4));
                inc(countindices);
             until not try_to_consume(_COMMA);
 
             { set real size }
-            temp.size:=countindices*sinttype.def.size;
+            temp.size:=countindices*sinttype.size;
 
             consume(_RECKKLAMMER);
 
@@ -1760,7 +1749,7 @@ implementation
             else
               begin
                 { create temp for result }
-                tempresultvariant:=ctempcreatenode.create(cvarianttype,cvarianttype.def.size,tt_persistent,true);
+                tempresultvariant:=ctempcreatenode.create(cvarianttype,cvarianttype.size,tt_persistent,true);
                 addstatement(newstatement,tempresultvariant);
 
                 { create call to fpc_vararray_get }
@@ -1800,8 +1789,8 @@ implementation
           again:=true;
           while again do
            begin
-             { we need the resulttype }
-             do_resulttypepass(p1);
+             { we need the resultdef }
+             do_typecheckpass(p1);
 
              if codegenerror then
               begin
@@ -1818,14 +1807,14 @@ implementation
                       pointer type }
                     if ((m_tp_procvar in aktmodeswitches) or
                         (m_mac_procvar in aktmodeswitches)) and
-                       (p1.resulttype.def.deftype=procvardef) and
-                       (tprocvardef(p1.resulttype.def).rettype.def.deftype=pointerdef) then
+                       (p1.resultdef.deftype=procvardef) and
+                       (tprocvardef(p1.resultdef).returndef.deftype=pointerdef) then
                       begin
                         p1:=ccallnode.create_procvar(nil,p1);
-                        resulttypepass(p1);
+                        typecheckpass(p1);
                       end;
 
-                    if (p1.resulttype.def.deftype<>pointerdef) then
+                    if (p1.resultdef.deftype<>pointerdef) then
                       begin
                          { ^ as binary operator is a problem!!!! (FK) }
                          again:=false;
@@ -1840,10 +1829,10 @@ implementation
 
                _LECKKLAMMER:
                   begin
-                    if is_class_or_interface(p1.resulttype.def) then
+                    if is_class_or_interface(p1.resultdef) then
                       begin
                         { default property }
-                        protsym:=search_default_property(tobjectdef(p1.resulttype.def));
+                        protsym:=search_default_property(tobjectdef(p1.resultdef));
                         if not(assigned(protsym)) then
                           begin
                              p1.destroy;
@@ -1863,16 +1852,16 @@ implementation
                         consume(_LECKKLAMMER);
                         repeat
                           ok := true;
-                          case p1.resulttype.def.deftype of
+                          case p1.resultdef.deftype of
                             pointerdef:
                               begin
                                  { support delphi autoderef }
-                                 if (tpointerdef(p1.resulttype.def).pointertype.def.deftype=arraydef) and
+                                 if (tpointerdef(p1.resultdef).pointeddef.deftype=arraydef) and
                                     (m_autoderef in aktmodeswitches) then
                                    p1:=cderefnode.create(p1);
                                  p2:=comp_expr(true);
+                                 { Support Pbytevar[0..9] which returns array [0..9].}
                                  if try_to_consume(_POINTPOINT) then
-                                   { Support Pbytevar[0..9] which returns array [0..9].}
                                    p2:=crangenode.create(p2,comp_expr(true));
                                  p1:=cvecnode.create(p1,p2);
                               end;
@@ -1885,8 +1874,8 @@ implementation
                             stringdef :
                               begin
                                 p2:=comp_expr(true);
+                                { Support string[0..9] which returns array [0..9] of char.}
                                 if try_to_consume(_POINTPOINT) then
-                                  { Support string[0..9] which returns array [0..9] of char.}
                                   p2:=crangenode.create(p2,comp_expr(true));
                                 p1:=cvecnode.create(p1,p2);
                               end;
@@ -1897,13 +1886,15 @@ implementation
                                 { an array[1..4] of char. The                  }
                                 { FPC_Internal_Four_Char_Array is defined in   }
                                 { the macpas unit                              }
-                                if (p1.resulttype.def.deftype = orddef) then
-                                  if (m_mac in aktmodeswitches) and
-                                     is_integer(p1.resulttype.def) and
-                                     (p1.resulttype.def.size = 4) then
-                                    int_to_4cc(p1)
-                                  else
-                                    ok := false;
+                                if (p1.resultdef.deftype = orddef) then
+                                  begin
+                                    if (m_mac in aktmodeswitches) and
+                                       is_integer(p1.resultdef) and
+                                       (p1.resultdef.size = 4) then
+                                      int_to_4cc(p1)
+                                    else
+                                      ok := false;
+                                  end;    
                                 if ok then
                                   begin
                                     p2:=comp_expr(true);
@@ -1958,7 +1949,7 @@ implementation
                               comp_expr(true);
                               again:=false;
                             end;
-                          do_resulttypepass(p1);
+                          do_typecheckpass(p1);
                         until not try_to_consume(_COMMA);
                         consume(_RECKKLAMMER);
                         { handle_variantarray eats the RECKKLAMMER and jumps here }
@@ -1969,18 +1960,18 @@ implementation
                _POINT :
                   begin
                     consume(_POINT);
-                    if (p1.resulttype.def.deftype=pointerdef) and
+                    if (p1.resultdef.deftype=pointerdef) and
                        (m_autoderef in aktmodeswitches) then
                       begin
                         p1:=cderefnode.create(p1);
-                        do_resulttypepass(p1);
+                        do_typecheckpass(p1);
                       end;
-                    case p1.resulttype.def.deftype of
+                    case p1.resultdef.deftype of
                       recorddef:
                         begin
                           if token=_ID then
                             begin
-                              srsym:=tsym(trecorddef(p1.resulttype.def).symtable.search(pattern));
+                              srsym:=tsym(trecorddef(p1.resultdef).symtable.search(pattern));
                               if assigned(srsym) and
                                  (srsym.typ=fieldvarsym) then
                                 begin
@@ -2003,7 +1994,7 @@ implementation
                          begin
                            if token=_ID then
                              begin
-                               classh:=tobjectdef(tclassrefdef(p1.resulttype.def).pointertype.def);
+                               classh:=tobjectdef(tclassrefdef(p1.resultdef).pointeddef);
                                searchsym_in_class(classh,classh,pattern,srsym,srsymtable);
                                if assigned(srsym) then
                                  begin
@@ -2029,7 +2020,7 @@ implementation
                              begin
                                store_static:=allow_only_static;
                                allow_only_static:=false;
-                               classh:=tobjectdef(p1.resulttype.def);
+                               classh:=tobjectdef(p1.resultdef);
                                searchsym_in_class(classh,classh,pattern,srsym,srsymtable);
                                allow_only_static:=store_static;
                                if assigned(srsym) then
@@ -2053,7 +2044,7 @@ implementation
                        pointerdef:
                          begin
                            Message(parser_e_invalid_qualifier);
-                           if tpointerdef(p1.resulttype.def).pointertype.def.deftype in [recorddef,objectdef,classrefdef] then
+                           if tpointerdef(p1.resultdef).pointeddef.deftype in [recorddef,objectdef,classrefdef] then
                              Message(parser_h_maybe_deref_caret_missing);
                          end;
                        else
@@ -2070,11 +2061,11 @@ implementation
                else
                  begin
                    { is this a procedure variable ? }
-                   if assigned(p1.resulttype.def) and
-                      (p1.resulttype.def.deftype=procvardef) then
+                   if assigned(p1.resultdef) and
+                      (p1.resultdef.deftype=procvardef) then
                      begin
                        if assigned(getprocvardef) and
-                          equal_defs(p1.resulttype.def,getprocvardef) then
+                          equal_defs(p1.resultdef,getprocvardef) then
                          again:=false
                        else
                          begin
@@ -2122,10 +2113,10 @@ implementation
          srsym      : tsym;
          srsymtable : tsymtable;
          pd         : tprocdef;
-         classh     : tobjectdef;
+         hclassdef     : tobjectdef;
          d          : bestreal;
          hs,hsorg   : string;
-         htype      : ttype;
+         hdef       : tdef;
          filepos    : tfileposinfo;
       begin
         oldp1:=nil;
@@ -2178,7 +2169,7 @@ implementation
                if assigned(current_procinfo) and
                   assigned(current_procinfo.procdef._class) then
                 begin
-                  classh:=current_procinfo.procdef._class.childof;
+                  hclassdef:=current_procinfo.procdef._class.childof;
                   { if inherited; only then we need the method with
                     the same name }
                   if token in endtokens then
@@ -2191,12 +2182,12 @@ implementation
                      pd:=tprocsym(current_procinfo.procdef.procsym).first_procdef;
                      srdef:=nil;
                      if (po_msgint in pd.procoptions) then
-                       searchsym_in_class_by_msgint(classh,pd.messageinf.i,srdef,srsym,srsymtable)
+                       searchsym_in_class_by_msgint(hclassdef,pd.messageinf.i,srdef,srsym,srsymtable)
                      else
                       if (po_msgstr in pd.procoptions) then
-                        searchsym_in_class_by_msgstr(classh,pd.messageinf.str^,srsym,srsymtable)
+                        searchsym_in_class_by_msgstr(hclassdef,pd.messageinf.str^,srsym,srsymtable)
                      else
-                       searchsym_in_class(classh,current_procinfo.procdef._class,hs,srsym,srsymtable);
+                       searchsym_in_class(hclassdef,current_procinfo.procdef._class,hs,srsym,srsymtable);
                    end
                   else
                    begin
@@ -2204,7 +2195,7 @@ implementation
                      hsorg:=orgpattern;
                      consume(_ID);
                      anon_inherited:=false;
-                     searchsym_in_class(classh,current_procinfo.procdef._class,hs,srsym,srsymtable);
+                     searchsym_in_class(hclassdef,current_procinfo.procdef._class,hs,srsym,srsymtable);
                    end;
                   if assigned(srsym) then
                    begin
@@ -2215,11 +2206,11 @@ implementation
                       begin
                         if (srsym.typ = procsym) then
                           begin
-                            htype.setdef(classh);
+                            hdef:=hclassdef;
                             if (po_classmethod in current_procinfo.procdef.procoptions) or
                                (po_staticmethod in current_procinfo.procdef.procoptions) then
-                              htype.setdef(tclassrefdef.create(htype));
-                            p1:=ctypenode.create(htype);
+                              hdef:=tclassrefdef.create(hdef);
+                            p1:=ctypenode.create(hdef);
                           end;
                       end
                      else
@@ -2227,7 +2218,7 @@ implementation
                         Message(parser_e_methode_id_expected);
                         p1:=cerrornode.create;
                       end;
-                     do_member_read(classh,getaddr,srsym,p1,again,[cnf_inherited,cnf_anon_inherited]);
+                     do_member_read(hclassdef,getaddr,srsym,p1,again,[cnf_inherited,cnf_anon_inherited]);
                    end
                   else
                    begin
@@ -2237,12 +2228,12 @@ implementation
                         if (po_msgint in pd.procoptions) or
                            (po_msgstr in pd.procoptions) then
                           begin
-                            searchsym_in_class(classh,classh,'DEFAULTHANDLER',srsym,srsymtable);
+                            searchsym_in_class(hclassdef,hclassdef,'DEFAULTHANDLER',srsym,srsymtable);
                             if not assigned(srsym) or
                                (srsym.typ<>procsym) then
                               internalerror(200303171);
                             p1:=nil;
-                            do_proc_call(srsym,srsym.owner,classh,false,again,p1,[]);
+                            do_proc_call(srsym,srsym.owner,hclassdef,false,again,p1,[]);
                           end
                         else
                           begin
@@ -2279,8 +2270,8 @@ implementation
                if code=0 then
                  begin
                     consume(_INTCONST);
-                    int_to_type(ic,htype);
-                    p1:=cordconstnode.create(ic,htype,true);
+                    int_to_type(ic,hdef);
+                    p1:=cordconstnode.create(ic,hdef,true);
                  end
                else
                  begin
@@ -2289,8 +2280,8 @@ implementation
                    if code=0 then
                      begin
                         consume(_INTCONST);
-                        htype:=u64inttype;
-                        p1:=cordconstnode.create(qc,htype,true);
+                        hdef:=u64inttype;
+                        p1:=cordconstnode.create(qc,hdef,true);
                      end;
                  end;
 {$else}
@@ -2299,8 +2290,8 @@ implementation
                if code=0 then
                  begin
                     consume(_INTCONST);
-                    int_to_type(card,htype);
-                    p1:=cordconstnode.create(card,htype,true);
+                    int_to_type(card,hdef);
+                    p1:=cordconstnode.create(card,hdef,true);
                  end
                else
                  begin
@@ -2309,8 +2300,8 @@ implementation
                    if code = 0 then
                      begin
                        consume(_INTCONST);
-                       int_to_type(l,htype);
-                       p1:=cordconstnode.create(l,htype,true);
+                       int_to_type(l,hdef);
+                       p1:=cordconstnode.create(l,hdef,true);
                      end
                    else
                      begin
@@ -2319,8 +2310,8 @@ implementation
                        if code=0 then
                          begin
                             consume(_INTCONST);
-                            int_to_type(ic,htype);
-                            p1:=cordconstnode.create(ic,htype,true);
+                            int_to_type(ic,hdef);
+                            p1:=cordconstnode.create(ic,hdef,true);
                          end
                        else
                          begin
@@ -2329,8 +2320,8 @@ implementation
                            if code=0 then
                              begin
                                 consume(_INTCONST);
-                                htype:=u64inttype;
-                                p1:=cordconstnode.create(tconstexprint(qc),htype,true);
+                                hdef:=u64inttype;
+                                p1:=cordconstnode.create(tconstexprint(qc),hdef,true);
                              end;
                          end;
                      end;
@@ -2369,38 +2360,38 @@ implementation
 
            _STRING :
              begin
-               string_dec(htype);
+               string_dec(hdef);
                { STRING can be also a type cast }
                if try_to_consume(_LKLAMMER) then
                 begin
                   p1:=comp_expr(true);
                   consume(_RKLAMMER);
-                  p1:=ctypeconvnode.create_explicit(p1,htype);
+                  p1:=ctypeconvnode.create_explicit(p1,hdef);
                   { handle postfix operators here e.g. string(a)[10] }
                   again:=true;
                   postfixoperators(p1,again);
                 end
                else
-                p1:=ctypenode.create(htype);
+                p1:=ctypenode.create(hdef);
              end;
 
            _FILE :
              begin
-               htype:=cfiletype;
+               hdef:=cfiletype;
                consume(_FILE);
                { FILE can be also a type cast }
                if try_to_consume(_LKLAMMER) then
                 begin
                   p1:=comp_expr(true);
                   consume(_RKLAMMER);
-                  p1:=ctypeconvnode.create_explicit(p1,htype);
+                  p1:=ctypeconvnode.create_explicit(p1,hdef);
                   { handle postfix operators here e.g. string(a)[10] }
                   again:=true;
                   postfixoperators(p1,again);
                 end
                else
                 begin
-                  p1:=ctypenode.create(htype);
+                  p1:=ctypenode.create(hdef);
                 end;
              end;
 
@@ -2576,9 +2567,9 @@ implementation
            p1:=cerrornode.create;
          end;
 
-        { get the resulttype for the node }
-        if (not assigned(p1.resulttype.def)) then
-         do_resulttypepass(p1);
+        { get the resultdef for the node }
+        if (not assigned(p1.resultdef)) then
+         do_typecheckpass(p1);
 
         if assigned(p1) and
            (p1<>oldp1) then
@@ -2702,9 +2693,9 @@ implementation
          oldafterassignment:=afterassignment;
          afterassignment:=true;
          p1:=sub_expr(opcompare,accept_equal);
-         { get the resulttype for this expression }
-         if not assigned(p1.resulttype.def) then
-          do_resulttypepass(p1);
+         { get the resultdef for this expression }
+         if not assigned(p1.resultdef) then
+          do_typecheckpass(p1);
          afterassignment:=oldafterassignment;
          comp_expr:=p1;
       end;
@@ -2721,9 +2712,9 @@ implementation
       begin
          oldafterassignment:=afterassignment;
          p1:=sub_expr(opcompare,true);
-         { get the resulttype for this expression }
-         if not assigned(p1.resulttype.def) then
-          do_resulttypepass(p1);
+         { get the resultdef for this expression }
+         if not assigned(p1.resultdef) then
+          do_typecheckpass(p1);
          filepos:=akttokenpos;
          if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
            afterassignment:=true;
@@ -2738,8 +2729,8 @@ implementation
            _ASSIGNMENT :
              begin
                 consume(_ASSIGNMENT);
-                if (p1.resulttype.def.deftype=procvardef) then
-                  getprocvardef:=tprocvardef(p1.resulttype.def);
+                if (p1.resultdef.deftype=procvardef) then
+                  getprocvardef:=tprocvardef(p1.resultdef);
                 p2:=sub_expr(opcompare,true);
                 if assigned(getprocvardef) then
                   handle_procvar(getprocvardef,p2);
@@ -2771,9 +2762,9 @@ implementation
                p1:=gen_c_style_operator(slashn,p1,p2);
             end;
          end;
-         { get the resulttype for this expression }
-         if not assigned(p1.resulttype.def) then
-          do_resulttypepass(p1);
+         { get the resultdef for this expression }
+         if not assigned(p1.resultdef) then
+          do_typecheckpass(p1);
          afterassignment:=oldafterassignment;
          if p1<>oldp1 then
            p1.fileinfo:=filepos;
@@ -2791,7 +2782,7 @@ implementation
       if not codegenerror then
        begin
          if (p.nodetype<>ordconstn) or
-            not(is_integer(p.resulttype.def)) then
+            not(is_integer(p.resultdef)) then
           Message(parser_e_illegal_expression)
          else
           result:=tordconstnode(p).value;
@@ -2810,7 +2801,7 @@ implementation
       p:=comp_expr(true);
       if p.nodetype<>stringconstn then
         begin
-          if (p.nodetype=ordconstn) and is_char(p.resulttype.def) then
+          if (p.nodetype=ordconstn) and is_char(p.resultdef) then
             get_stringconst:=char(tordconstnode(p).value)
           else
             Message(parser_e_illegal_expression);

+ 51 - 51
compiler/pinline.pas

@@ -83,14 +83,14 @@ implementation
         else
           set_varstate(p,vs_readwritten,[vsf_must_be_valid]);
         if (m_mac in aktmodeswitches) and
-           is_class(p.resulttype.def) then
+           is_class(p.resultdef) then
           begin
-            classh:=tobjectdef(p.resulttype.def);
+            classh:=tobjectdef(p.resultdef);
 
             if is_new then
               begin
                 sym:=search_class_member(classh,'CREATE');
-                p2 := cloadvmtaddrnode.create(ctypenode.create(p.resulttype));;
+                p2 := cloadvmtaddrnode.create(ctypenode.create(p.resultdef));;
               end
             else
               begin
@@ -112,7 +112,7 @@ implementation
             do_member_read(classh,false,sym,p2,again,[]);
 
             { we need the real called method }
-            do_resulttypepass(p2);
+            do_typecheckpass(p2);
 
             if (p2.nodetype=calln) and
                assigned(tcallnode(p2).procdefinition) then
@@ -121,9 +121,9 @@ implementation
                   begin
                     if (tcallnode(p2).procdefinition.proctypeoption<>potype_constructor) then
                       Message(parser_e_expr_have_to_be_constructor_call);
-                    p2.resulttype:=p.resulttype;
+                    p2.resultdef:=p.resultdef;
                     p2:=cassignmentnode.create(p,p2);
-                    resulttypepass(p2);
+                    typecheckpass(p2);
                   end
                 else
                   begin
@@ -148,9 +148,9 @@ implementation
             destructorpos:=akttokenpos;
             consume(_ID);
 
-            if (p.resulttype.def.deftype<>pointerdef) then
+            if (p.resultdef.deftype<>pointerdef) then
               begin
-                 Message1(type_e_pointer_type_expected,p.resulttype.def.typename);
+                 Message1(type_e_pointer_type_expected,p.resultdef.typename);
                  p.free;
                  p:=factor(false);
                  p.free;
@@ -159,7 +159,7 @@ implementation
                  exit;
               end;
             { first parameter must be an object or class }
-            if tpointerdef(p.resulttype.def).pointertype.def.deftype<>objectdef then
+            if tpointerdef(p.resultdef).pointeddef.deftype<>objectdef then
               begin
                  Message(parser_e_pointer_to_class_expected);
                  p.free;
@@ -169,7 +169,7 @@ implementation
                  exit;
               end;
             { check, if the first parameter is a pointer to a _class_ }
-            classh:=tobjectdef(tpointerdef(p.resulttype.def).pointertype.def);
+            classh:=tobjectdef(tpointerdef(p.resultdef).pointeddef);
             if is_class(classh) then
               begin
                  Message(parser_e_no_new_or_dispose_for_classes);
@@ -203,7 +203,7 @@ implementation
                   p2:=cderefnode.create(p.getcopy)
                 else
                   p2:=cderefnode.create(p);
-                do_resulttypepass(p2);
+                do_typecheckpass(p2);
                 if is_new then
                   callflag:=cnf_new_call
                 else
@@ -231,7 +231,7 @@ implementation
                   end;
 
                 { we need the real called method }
-                do_resulttypepass(p2);
+                do_typecheckpass(p2);
 
                 if (p2.nodetype=calln) and
                    assigned(tcallnode(p2).procdefinition) then
@@ -240,7 +240,7 @@ implementation
                      begin
                        if (tcallnode(p2).procdefinition.proctypeoption<>potype_constructor) then
                          Message(parser_e_expr_have_to_be_constructor_call);
-                       p2.resulttype:=p.resulttype;
+                       p2.resultdef:=p.resultdef;
                        p2:=cassignmentnode.create(p,p2);
                      end
                     else
@@ -262,18 +262,18 @@ implementation
           end
         else
           begin
-             if (p.resulttype.def.deftype<>pointerdef) then
+             if (p.resultdef.deftype<>pointerdef) then
                Begin
-                  Message1(type_e_pointer_type_expected,p.resulttype.def.typename);
+                  Message1(type_e_pointer_type_expected,p.resultdef.typename);
                   new_dispose_statement:=cerrornode.create;
                end
              else
                begin
-                  if (tpointerdef(p.resulttype.def).pointertype.def.deftype=objectdef) and
-                     (oo_has_vmt in tobjectdef(tpointerdef(p.resulttype.def).pointertype.def).objectoptions) then
+                  if (tpointerdef(p.resultdef).pointeddef.deftype=objectdef) and
+                     (oo_has_vmt in tobjectdef(tpointerdef(p.resultdef).pointeddef).objectoptions) then
                     Message(parser_w_use_extended_syntax_for_objects);
-                  if (tpointerdef(p.resulttype.def).pointertype.def.deftype=orddef) and
-                     (torddef(tpointerdef(p.resulttype.def).pointertype.def).typ=uvoid) then
+                  if (tpointerdef(p.resultdef).pointeddef.deftype=orddef) and
+                     (torddef(tpointerdef(p.resultdef).pointeddef).typ=uvoid) then
                     begin
                       if (m_tp7 in aktmodeswitches) or
                          (m_delphi in aktmodeswitches) then
@@ -289,18 +289,18 @@ implementation
                   if is_new then
                    begin
                      { create temp for result }
-                     temp := ctempcreatenode.create(p.resulttype,p.resulttype.def.size,tt_persistent,true);
+                     temp := ctempcreatenode.create(p.resultdef,p.resultdef.size,tt_persistent,true);
                      addstatement(newstatement,temp);
 
                      { create call to fpc_getmem }
                      para := ccallparanode.create(cordconstnode.create
-                         (tpointerdef(p.resulttype.def).pointertype.def.size,s32inttype,true),nil);
+                         (tpointerdef(p.resultdef).pointeddef.size,s32inttype,true),nil);
                      addstatement(newstatement,cassignmentnode.create(
                          ctemprefnode.create(temp),
                          ccallnode.createintern('fpc_getmem',para)));
 
                      { create call to fpc_initialize }
-                     if tpointerdef(p.resulttype.def).pointertype.def.needs_inittable then
+                     if tpointerdef(p.resultdef).pointeddef.needs_inittable then
                        addstatement(newstatement,initialize_data_node(cderefnode.create(ctemprefnode.create(temp))));
 
                      { copy the temp to the destination }
@@ -314,7 +314,7 @@ implementation
                   else
                    begin
                      { create call to fpc_finalize }
-                     if tpointerdef(p.resulttype.def).pointertype.def.needs_inittable then
+                     if tpointerdef(p.resultdef).pointeddef.needs_inittable then
                        addstatement(newstatement,finalize_data_node(cderefnode.create(p.getcopy)));
 
                      { create call to fpc_freemem }
@@ -351,9 +351,9 @@ implementation
            exit;
          end;
 
-        if (p1.resulttype.def.deftype<>pointerdef) then
+        if (p1.resultdef.deftype<>pointerdef) then
          begin
-           Message1(type_e_pointer_type_expected,p1.resulttype.def.typename);
+           Message1(type_e_pointer_type_expected,p1.resultdef.typename);
            consume_all_until(_RKLAMMER);
            consume(_RKLAMMER);
            p1.destroy;
@@ -363,29 +363,29 @@ implementation
 
         if try_to_consume(_RKLAMMER) then
           begin
-            if (tpointerdef(p1.resulttype.def).pointertype.def.deftype=objectdef) and
-               (oo_has_vmt in tobjectdef(tpointerdef(p1.resulttype.def).pointertype.def).objectoptions)  then
+            if (tpointerdef(p1.resultdef).pointeddef.deftype=objectdef) and
+               (oo_has_vmt in tobjectdef(tpointerdef(p1.resultdef).pointeddef).objectoptions)  then
               Message(parser_w_use_extended_syntax_for_objects);
 
             { create statements with call to getmem+initialize }
             newblock:=internalstatements(newstatement);
 
             { create temp for result }
-            temp := ctempcreatenode.create(p1.resulttype,p1.resulttype.def.size,tt_persistent,true);
+            temp := ctempcreatenode.create(p1.resultdef,p1.resultdef.size,tt_persistent,true);
             addstatement(newstatement,temp);
 
             { create call to fpc_getmem }
             para := ccallparanode.create(cordconstnode.create
-                (tpointerdef(p1.resulttype.def).pointertype.def.size,s32inttype,true),nil);
+                (tpointerdef(p1.resultdef).pointeddef.size,s32inttype,true),nil);
             addstatement(newstatement,cassignmentnode.create(
                 ctemprefnode.create(temp),
                 ccallnode.createintern('fpc_getmem',para)));
 
             { create call to fpc_initialize }
-            if tpointerdef(p1.resulttype.def).pointertype.def.needs_inittable then
+            if tpointerdef(p1.resultdef).pointeddef.needs_inittable then
              begin
                para := ccallparanode.create(caddrnode.create_internal(crttinode.create
-                          (tstoreddef(tpointerdef(p1.resulttype.def).pointertype.def),initrtti)),
+                          (tstoreddef(tpointerdef(p1.resultdef).pointeddef),initrtti)),
                        ccallparanode.create(ctemprefnode.create
                           (temp),nil));
                addstatement(newstatement,ccallnode.createintern('fpc_initialize',para));
@@ -404,7 +404,7 @@ implementation
         else
           begin
             consume(_COMMA);
-            if tpointerdef(p1.resulttype.def).pointertype.def.deftype<>objectdef then
+            if tpointerdef(p1.resultdef).pointeddef.deftype<>objectdef then
              begin
                Message(parser_e_pointer_to_class_expected);
                consume_all_until(_RKLAMMER);
@@ -413,11 +413,11 @@ implementation
                new_function:=cerrornode.create;
                exit;
              end;
-            classh:=tobjectdef(tpointerdef(p1.resulttype.def).pointertype.def);
+            classh:=tobjectdef(tpointerdef(p1.resultdef).pointeddef);
             { use the objectdef for loading the VMT }
             p2:=p1;
-            p1:=ctypenode.create(tpointerdef(p1.resulttype.def).pointertype);
-            do_resulttypepass(p1);
+            p1:=ctypenode.create(tpointerdef(p1.resultdef).pointeddef);
+            do_typecheckpass(p1);
             { search the constructor also in the symbol tables of
               the parents }
             afterassignment:=false;
@@ -425,16 +425,16 @@ implementation
             consume(_ID);
             do_member_read(classh,false,srsym,p1,again,[cnf_new_call]);
             { we need to know which procedure is called }
-            do_resulttypepass(p1);
+            do_typecheckpass(p1);
             if not(
                    (p1.nodetype=calln) and
                    assigned(tcallnode(p1).procdefinition) and
                    (tcallnode(p1).procdefinition.proctypeoption=potype_constructor)
                   ) then
               Message(parser_e_expr_have_to_be_constructor_call);
-            { constructors return boolean, update resulttype to return
+            { constructors return boolean, update resultdef to return
               the pointer to the object }
-            p1.resulttype:=p2.resulttype;
+            p1.resultdef:=p2.resultdef;
             p2.free;
             consume(_RKLAMMER);
           end;
@@ -494,8 +494,8 @@ implementation
         set_varstate(destppn,vs_written,[]);
         dec(parsing_para_level);
         { first param must be a string or dynamic array ...}
-        isarray:=is_dynamic_array(destppn.resulttype.def);
-        if not((destppn.resulttype.def.deftype=stringdef) or
+        isarray:=is_dynamic_array(destppn.resultdef);
+        if not((destppn.resultdef.deftype=stringdef) or
                isarray) then
          begin
            CGMessage(type_e_mismatch);
@@ -511,7 +511,7 @@ implementation
            else
             begin
               { check if the amount of dimensions is valid }
-              def := tarraydef(destppn.resulttype.def).elementtype.def;
+              def := tarraydef(destppn.resultdef).elementdef;
               counter:=dims;
               while counter > 1 do
                 begin
@@ -521,7 +521,7 @@ implementation
                       break;
                     end;
                   dec(counter);
-                  def := tarraydef(def).elementtype.def;
+                  def := tarraydef(def).elementdef;
                 end;
             end;
          end;
@@ -533,7 +533,7 @@ implementation
             newblock:=internalstatements(newstatement);
 
             { get temp for array of lengths }
-            temp := ctempcreatenode.create(sinttype,dims*sinttype.def.size,tt_persistent,false);
+            temp := ctempcreatenode.create(sinttype,dims*sinttype.size,tt_persistent,false);
             addstatement(newstatement,temp);
 
             { load array of lengths }
@@ -542,7 +542,7 @@ implementation
             while assigned(ppn.right) do
              begin
                addstatement(newstatement,cassignmentnode.create(
-                   ctemprefnode.create_offset(temp,counter*sinttype.def.size),
+                   ctemprefnode.create_offset(temp,counter*sinttype.size),
                    ppn.left));
                ppn.left:=nil;
                inc(counter);
@@ -557,7 +557,7 @@ implementation
                    ccallparanode.create(cordconstnode.create
                       (counter,s32inttype,true),
                    ccallparanode.create(caddrnode.create_internal
-                      (crttinode.create(tstoreddef(destppn.resulttype.def),initrtti)),
+                      (crttinode.create(tstoreddef(destppn.resultdef),initrtti)),
                    ccallparanode.create(ctypeconvnode.create_internal(destppn,voidpointertype),nil))));
             addstatement(newstatement,ccallnode.createintern('fpc_dynarray_setlength',npara));
             addstatement(newstatement,ctempdeletenode.create(temp));
@@ -569,7 +569,7 @@ implementation
          begin
             { we can reuse the supplied parameters }
             newblock:=ccallnode.createintern(
-               'fpc_'+tstringdef(destppn.resulttype.def).stringtypname+'_setlength',paras);
+               'fpc_'+tstringdef(destppn.resultdef).stringtypname+'_setlength',paras);
          end;
 
         result.free;
@@ -647,11 +647,11 @@ implementation
             end;
            { create call to fpc_finalize_array }
            npara:=ccallparanode.create(cordconstnode.create
-                     (destppn.left.resulttype.def.size,s32inttype,true),
+                     (destppn.left.resultdef.size,s32inttype,true),
                   ccallparanode.create(ctypeconvnode.create
                      (ppn.left,s32inttype),
                   ccallparanode.create(caddrnode.create_internal
-                     (crttinode.create(tstoreddef(destppn.left.resulttype.def),initrtti)),
+                     (crttinode.create(tstoreddef(destppn.left.resultdef),initrtti)),
                   ccallparanode.create(caddrnode.create_internal
                      (destppn.left),nil))));
            newblock:=ccallnode.createintern('fpc_finalize_array',npara);
@@ -701,7 +701,7 @@ implementation
            inc(counter);
            ppn:=tcallparanode(ppn.right);
          end;
-        paradef:=ppn.left.resulttype.def;
+        paradef:=ppn.left.resultdef;
         if is_ansistring(paradef) or
            (is_chararray(paradef) and
             (paradef.size>255)) or
@@ -744,10 +744,10 @@ implementation
             npara:=ccallparanode.create(highppn,
                    ccallparanode.create(lowppn,
                    ccallparanode.create(caddrnode.create_internal
-                      (crttinode.create(tstoreddef(ppn.left.resulttype.def),initrtti)),
+                      (crttinode.create(tstoreddef(ppn.left.resultdef),initrtti)),
                    ccallparanode.create
                       (ctypeconvnode.create_internal(ppn.left,voidpointertype),nil))));
-            copynode:=ccallnode.createinternres('fpc_dynarray_copy',npara,ppn.left.resulttype);
+            copynode:=ccallnode.createinternres('fpc_dynarray_copy',npara,ppn.left.resultdef);
 
             ppn.left:=nil;
             paras.free;

+ 1 - 1
compiler/pmodules.pas

@@ -479,7 +479,7 @@ implementation
         { Set the owner of errorsym and errortype to symtable to
           prevent crashes when accessing .owner }
         generrorsym.owner:=systemunit;
-        generrortype.def.owner:=systemunit;
+        generrordef.owner:=systemunit;
 
         { Units only required for main module }
         if not(current_module.is_unit) then

+ 14 - 14
compiler/powerpc/cpupara.pas

@@ -236,19 +236,19 @@ unit cpupara;
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         p.funcretloc[side].size:=retcgsize;
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
             p.funcretloc[side].loc:=LOC_VOID;
             exit;
           end;
 
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -256,7 +256,7 @@ unit cpupara;
           end
         else
          { Return in register? }
-         if not ret_in_param(p.rettype.def,p.proccalloption) then
+         if not ret_in_param(p.returndef,p.proccalloption) then
           begin
 {$ifndef cpu64bit}
             if retcgsize in [OS_64,OS_S64] then
@@ -342,7 +342,7 @@ unit cpupara;
           for i:=0 to paras.count-1 do
             begin
               hp:=tparavarsym(paras[i]);
-              paradef := hp.vartype.def;
+              paradef := hp.vardef;
               { Syscall for Morphos can have already a paraloc set }
               if (vo_has_explicit_paraloc in hp.varoptions) then
                 begin
@@ -368,7 +368,7 @@ unit cpupara;
                  is_open_array(paradef) or
                  is_array_of_const(paradef) then
                 begin
-                  paradef:=voidpointertype.def;
+                  paradef:=voidpointertype;
                   loc:=LOC_REGISTER;
                   paracgsize := OS_ADDR;
                   paralen := tcgsize2size[OS_ADDR];
@@ -387,14 +387,14 @@ unit cpupara;
                       { if a record has only one field and that field is }
                       { non-composite (not array or record), it must be  }
                       { passed according to the rules of that type.       }
-                      if (trecorddef(hp.vartype.def).symtable.symindex.count = 1) and
-                         (not trecorddef(hp.vartype.def).isunion) and
-                         ((tabstractvarsym(trecorddef(hp.vartype.def).symtable.symindex.search(1)).vartype.def.deftype = floatdef) or
+                      if (trecorddef(hp.vardef).symtable.symindex.count = 1) and
+                         (not trecorddef(hp.vardef).isunion) and
+                         ((tabstractvarsym(trecorddef(hp.vardef).symtable.symindex.search(1)).vardef.deftype = floatdef) or
                           ((target_info.system = system_powerpc_darwin) and
-                           (tabstractvarsym(trecorddef(hp.vartype.def).symtable.symindex.search(1)).vartype.def.deftype in [orddef,enumdef]))) then
+                           (tabstractvarsym(trecorddef(hp.vardef).symtable.symindex.search(1)).vardef.deftype in [orddef,enumdef]))) then
                         begin
                           paradef :=
-                           tabstractvarsym(trecorddef(hp.vartype.def).symtable.symindex.search(1)).vartype.def;
+                           tabstractvarsym(trecorddef(hp.vardef).symtable.symindex.search(1)).vardef;
                           paracgsize:=def_cgsize(paradef);
                         end
                       else
@@ -568,9 +568,9 @@ unit cpupara;
                 hp.paraloc[callerside].alignment:=4;
                 paraloc:=hp.paraloc[callerside].add_location;
                 paraloc^.loc:=LOC_REFERENCE;
-                paraloc^.size:=def_cgsize(hp.vartype.def);
+                paraloc^.size:=def_cgsize(hp.vardef);
                 paraloc^.reference.index:=NR_STACK_POINTER_REG;
-                l:=push_size(hp.varspez,hp.vartype.def,p.proccalloption);
+                l:=push_size(hp.varspez,hp.vardef,p.proccalloption);
                 paraloc^.reference.offset:=parasize;
                 parasize:=parasize+l;
               end;
@@ -590,7 +590,7 @@ unit cpupara;
         case target_info.system of
           system_powerpc_morphos:
             begin
-              paracgsize:=def_cgsize(p.vartype.def);
+              paracgsize:=def_cgsize(p.vardef);
               p.paraloc[callerside].alignment:=4;
               p.paraloc[callerside].size:=paracgsize;
               p.paraloc[callerside].intsize:=tcgsize2size[paracgsize];

+ 28 - 28
compiler/powerpc/nppcadd.pas

@@ -30,7 +30,7 @@ interface
 
     type
        tppcaddnode = class(tgenppcaddnode)
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
          protected
           function use_generic_mul32to64: boolean; override;
          private
@@ -264,10 +264,10 @@ interface
         pass_left_and_right;
 
         cmpop:=false;
-        unsigned:=((left.resulttype.def.deftype=orddef) and
-                   (torddef(left.resulttype.def).typ=u64bit)) or
-                  ((right.resulttype.def.deftype=orddef) and
-                   (torddef(right.resulttype.def).typ=u64bit));
+        unsigned:=((left.resultdef.deftype=orddef) and
+                   (torddef(left.resultdef).typ=u64bit)) or
+                  ((right.resultdef.deftype=orddef) and
+                   (torddef(right.resultdef).typ=u64bit));
         case nodetype of
           addn :
             begin
@@ -295,8 +295,8 @@ interface
           muln:
             begin
               { should be handled in pass_1 (JM) }
-              if not(torddef(left.resulttype.def).typ in [U32bit,s32bit]) or
-                 (torddef(left.resulttype.def).typ <> torddef(right.resulttype.def).typ) then
+              if not(torddef(left.resultdef).typ in [U32bit,s32bit]) or
+                 (torddef(left.resultdef).typ <> torddef(right.resultdef).typ) then
                 internalerror(200109051);
               { handled separately }
               op := OP_NONE;
@@ -306,7 +306,7 @@ interface
         end;
 
         if not cmpop then
-          location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
+          location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
 
         load_left_right(cmpop,((cs_check_overflow in aktlocalswitches) and
             (nodetype in [addn,subn])) or (nodetype = muln));
@@ -460,7 +460,7 @@ interface
                     begin
                       // const64 - reg64
                       location_force_reg(current_asmdata.CurrAsmList,left.location,
-                        def_cgsize(left.resulttype.def),false);
+                        def_cgsize(left.resultdef),false);
                       cg64.a_op64_reg_reg_reg(current_asmdata.CurrAsmList,OP_SUB,location.size,
                         right.location.register64,left.location.register64,
                         location.register64);
@@ -472,7 +472,7 @@ interface
           end
         else
           begin
-            if is_signed(resulttype.def) then
+            if is_signed(resultdef) then
               begin
                 case nodetype of
                   addn:
@@ -521,12 +521,12 @@ interface
               begin
                 current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op2,location.register64.reghi,
                    right.location.register64.reghi,left.location.register64.reghi));
-                if not(is_signed(resulttype.def)) then
+                if not(is_signed(resultdef)) then
                   if nodetype = addn then
                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,location.register64.reghi,left.location.register64.reghi))
                   else
                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register64.reghi,location.register64.reghi));
-                cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+                cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
               end
             else
               begin
@@ -560,7 +560,7 @@ interface
         pass_left_and_right;
 
         cmpop:=false;
-        mmxbase:=mmx_type(left.resulttype.def);
+        mmxbase:=mmx_type(left.resultdef);
         case nodetype of
           addn :
             begin
@@ -735,7 +735,7 @@ interface
                                 pass_2
 *****************************************************************************}
 
-    procedure tppcaddnode.pass_2;
+    procedure tppcaddnode.pass_generate_code;
     { is also being used for xor, and "mul", "sub, or and comparative }
     { operators                                                }
       var
@@ -751,19 +751,19 @@ interface
       begin
          { to make it more readable, string and set (not smallset!) have their
            own procedures }
-         case left.resulttype.def.deftype of
+         case left.resultdef.deftype of
            orddef :
              begin
                { handling boolean expressions }
-               if is_boolean(left.resulttype.def) and
-                  is_boolean(right.resulttype.def) then
+               if is_boolean(left.resultdef) and
+                  is_boolean(right.resultdef) then
                  begin
                    second_addboolean;
                    exit;
                  end
                { 64bit operations }
-               else if is_64bit(resulttype.def) or
-                       is_64bit(left.resulttype.def) then
+               else if is_64bit(resultdef) or
+                       is_64bit(left.resultdef) then
                  begin
                    second_add64bit;
                    exit;
@@ -777,7 +777,7 @@ interface
            setdef :
              begin
                { normalsets are already handled in pass1 }
-               if (tsetdef(left.resulttype.def).settype<>smallset) then
+               if (tsetdef(left.resultdef).settype<>smallset) then
                 internalerror(200109041);
                second_addsmallset;
                exit;
@@ -785,7 +785,7 @@ interface
            arraydef :
              begin
 {$ifdef SUPPORT_MMX}
-               if is_mmx_able_array(left.resulttype.def) then
+               if is_mmx_able_array(left.resultdef) then
                 begin
                   second_addmmx;
                   exit;
@@ -801,8 +801,8 @@ interface
 
          { defaults }
          cmpop:=nodetype in [ltn,lten,gtn,gten,equaln,unequaln];
-         unsigned:=not(is_signed(left.resulttype.def)) or
-                   not(is_signed(right.resulttype.def));
+         unsigned:=not(is_signed(left.resultdef)) or
+                   not(is_signed(right.resultdef));
 
          pass_left_and_right;
 
@@ -815,7 +815,7 @@ interface
 
          { set result location }
          if not cmpop then
-           location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def))
+           location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
           else
            location_reset(location,LOC_FLAGS,OS_NO);
 
@@ -897,7 +897,7 @@ interface
          else
            // overflow checking is on and we have an addn, subn or muln
            begin
-             if is_signed(resulttype.def) then
+             if is_signed(resultdef) then
                begin
                  case nodetype of
                    addn:
@@ -915,7 +915,7 @@ interface
                  end;
                  current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,location.register,
                    left.location.register,right.location.register));
-                 cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+                 cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
               end
              else
               begin
@@ -925,7 +925,7 @@ interface
                       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ADD,location.register,
                         left.location.register,right.location.register));
                       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,location.register,left.location.register));
-                      cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+                      cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
                     end;
                   subn:
                     begin
@@ -934,7 +934,7 @@ interface
                       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUB,location.register,
                         left.location.register,right.location.register));
                       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register,location.register));
-                      cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+                      cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
                     end;
                   muln:
                     begin

+ 18 - 18
compiler/powerpc/nppccnv.pas

@@ -75,14 +75,14 @@ implementation
         fname: string[19];
       begin
         { converting a 64bit integer to a float requires a helper }
-        if is_64bitint(left.resulttype.def) or
-                is_currency(left.resulttype.def) then
+        if is_64bitint(left.resultdef) or
+                is_currency(left.resultdef) then
           begin
             { hack to avoid double division by 10000, as it's       }
-            { already done by resulttypepass.resulttype_int_to_real }
-            if is_currency(left.resulttype.def) then
-              left.resulttype := s64inttype;
-            if is_signed(left.resulttype.def) then
+            { already done by typecheckpass.resultdef_int_to_real }
+            if is_currency(left.resultdef) then
+              left.resultdef := s64inttype;
+            if is_signed(left.resultdef) then
               fname := 'fpc_int64_to_double'
             else
               fname := 'fpc_qword_to_double';
@@ -95,7 +95,7 @@ implementation
         else
           { other integers are supposed to be 32 bit }
           begin
-            if is_signed(left.resulttype.def) then
+            if is_signed(left.resultdef) then
               inserttypeconv(left,s32inttype)
             else
               inserttypeconv(left,u32inttype);
@@ -128,7 +128,7 @@ implementation
         size: tcgsize;
         signed : boolean;
       begin
-        location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
 
         { the code here comes from the PowerPC Compiler Writer's Guide }
 
@@ -148,7 +148,7 @@ implementation
         { fsub FR1,FR1,FR2    # subtract 0x4330000000000000 }
         tg.Gettemp(current_asmdata.CurrAsmList,8,tt_normal,ref);
 
-        signed := is_signed(left.resulttype.def);
+        signed := is_signed(left.resultdef);
 
         { we need a certain constant for the conversion, so create it here }
         if signed then
@@ -160,12 +160,12 @@ implementation
             crealconstnode.create(double(tdummyarray(dummy2)),
             pbestrealtype^);
 
-        resulttypepass(tempconst);
+        typecheckpass(tempconst);
         firstpass(tempconst);
         secondpass(tempconst);
         if (tempconst.location.loc <> LOC_CREFERENCE) or
            { has to be handled by a helper }
-           is_64bitint(left.resulttype.def) then
+           is_64bitint(left.resultdef) then
           internalerror(200110011);
 
         case left.location.loc of
@@ -190,7 +190,7 @@ implementation
                 size := OS_S32
               else
                 size := OS_32;
-              cg.a_load_ref_reg(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),
+              cg.a_load_ref_reg(current_asmdata.CurrAsmList,def_cgsize(left.resultdef),
                 size,left.location.reference,leftreg);
             end
           else
@@ -221,7 +221,7 @@ implementation
            location.register,tmpfpureg));
 
          { work around bug in some PowerPC processors }
-         if (tfloatdef(resulttype.def).typ = s32real) then
+         if (tfloatdef(resultdef).typ = s32real) then
            current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FRSP,location.register,
              location.register));
        end;
@@ -232,8 +232,8 @@ implementation
           inherited second_real_to_real;
           { work around bug in some powerpc processors where doubles aren't }
           { properly converted to singles                                   }
-          if (tfloatdef(left.resulttype.def).typ = s64real) and
-             (tfloatdef(resulttype.def).typ = s32real) then
+          if (tfloatdef(left.resultdef).typ = s64real) and
+             (tfloatdef(resultdef).typ = s32real) then
             current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FRSP,location.register,
               location.register));
        end;
@@ -260,7 +260,7 @@ implementation
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { be accepted for var parameters                            }
          if (nf_explicit in flags) and
-            (left.resulttype.def.size=resulttype.def.size) and
+            (left.resultdef.size=resultdef.size) and
             (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
            begin
               current_procinfo.CurrTrueLabel:=oldTrueLabel;
@@ -269,8 +269,8 @@ implementation
               exit;
            end;
 
-         location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
-         opsize := def_cgsize(left.resulttype.def);
+         location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
+         opsize := def_cgsize(left.resultdef);
          case left.location.loc of
             LOC_CREFERENCE,LOC_REFERENCE,LOC_REGISTER,LOC_CREGISTER :
               begin

+ 1 - 1
compiler/powerpc/nppcinl.pas

@@ -84,7 +84,7 @@ implementation
        { load the FPU into the an fpu register }
        procedure tppcinlinenode.load_fpu_location;
          begin
-           location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+           location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
            secondpass(left);
            location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
            location_copy(location,left.location);

+ 33 - 33
compiler/powerpc/nppcmat.pas

@@ -31,21 +31,21 @@ interface
     type
       tppcmoddivnode = class(tmoddivnode)
          function pass_1: tnode;override;
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
       tppcshlshrnode = class(tshlshrnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
          { everything will be handled in pass_2 }
          function first_shlshr64bitint: tnode; override;
       end;
 
       tppcunaryminusnode = class(tunaryminusnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
       tppcnotnode = class(tnotnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
       end;
 
 implementation
@@ -175,7 +175,7 @@ end;
       end;
 
 
-    procedure tppcmoddivnode.pass_2;
+    procedure tppcmoddivnode.pass_generate_code;
       const
                     { signed   overflow }
         divops: array[boolean, boolean] of tasmop =
@@ -209,7 +209,7 @@ end;
                 // note: only in the signed case possible..., may overflow
                 current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], resultreg, numerator));
              end else if (ispowerof2(tordconstnode(right).value, power)) then begin
-                if (is_signed(right.resulttype.def)) then begin
+                if (is_signed(right.resultdef)) then begin
                     { From "The PowerPC Compiler Writer's Guide", pg. 52ff          }
                     cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, power,
                         numerator, resultreg);
@@ -221,7 +221,7 @@ end;
                  { replace division by multiplication, both implementations }
                  { from "The PowerPC Compiler Writer's Guide" pg. 53ff      }
                  divreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
-                 if (is_signed(right.resulttype.def)) then begin
+                 if (is_signed(right.resultdef)) then begin
                      getmagic_signed32(tordconstnode(right).value, magic, shift);
                      // load magic value
                      cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, magic, divreg);
@@ -270,7 +270,7 @@ end;
                 // x mod +/-1 is always zero
                 cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, 0, resultreg);
              end else if (ispowerof2(tordconstnode(right).value, power)) then begin
-                 if (is_signed(right.resulttype.def)) then begin
+                 if (is_signed(right.resultdef)) then begin
                      
                      tempreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
                      maskreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
@@ -302,7 +302,7 @@ end;
          location_copy(location,left.location);
 
          { put numerator in register }
-         size:=def_cgsize(left.resulttype.def);
+         size:=def_cgsize(left.resultdef);
          location_force_reg(current_asmdata.CurrAsmList,left.location,
            size,true);
          location_copy(location,left.location);
@@ -330,14 +330,14 @@ end;
          if (not done) then begin
              { load divider in a register if necessary }
              location_force_reg(current_asmdata.CurrAsmList,right.location,
-               def_cgsize(right.resulttype.def),true);
+               def_cgsize(right.resultdef),true);
              if (right.nodetype <> ordconstn) then
                current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPWI,NR_CR1,
                  right.location.register,0));
              divider := right.location.register;
 
              { needs overflow checking, (-maxlongint-1) div (-1) overflows! }
-             op := divops[is_signed(right.resulttype.def),
+             op := divops[is_signed(right.resultdef),
                           cs_check_overflow in aktlocalswitches];
              current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,resultreg,numerator,
                divider));
@@ -364,8 +364,8 @@ end;
         { unsigned division/module can only overflow in case of division by zero }
         { (but checking this overflow flag is more convoluted than performing a  }
         {  simple comparison with 0)                                             }
-        if is_signed(right.resulttype.def) then
-          cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+        if is_signed(right.resultdef) then
+          cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
       end;
 
 
@@ -378,7 +378,7 @@ end;
         result := nil;
       end;
 
-    procedure tppcshlshrnode.pass_2;
+    procedure tppcshlshrnode.pass_generate_code;
 
       var
          resultreg, hregister1,hregister2,
@@ -391,10 +391,10 @@ end;
          secondpass(left);
          secondpass(right);
 
-         if is_64bitint(left.resulttype.def) then
+         if is_64bitint(left.resultdef) then
            begin
              location_force_reg(current_asmdata.CurrAsmList,left.location,
-               def_cgsize(left.resulttype.def),true);
+               def_cgsize(left.resultdef),true);
              location_copy(location,left.location);
              hreg64hi := location.register64.reghi;
              hreg64lo := location.register64.reglo;
@@ -512,7 +512,7 @@ end;
          else
            begin
              { load left operators in a register }
-             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true);
+             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
              location_copy(location,left.location);
              resultreg := location.register;
              hregister1 := location.register;
@@ -533,7 +533,7 @@ end;
              else
                begin
                  { load shift count in a register if necessary }
-                 location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true);
+                 location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resultdef),true);
                  hregister2 := right.location.register;
 
                  cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,location.size,hregister2,
@@ -547,7 +547,7 @@ end;
                           TPPCUNARYMINUSNODE
 *****************************************************************************}
 
-    procedure tppcunaryminusnode.pass_2;
+    procedure tppcunaryminusnode.pass_generate_code;
 
       var
         src1: tregister;
@@ -555,9 +555,9 @@ end;
 
       begin
          secondpass(left);
-         if is_64bitint(left.resulttype.def) then
+         if is_64bitint(left.resultdef) then
            begin
-             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true);
+             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
              location_copy(location,left.location);
              if (location.loc = LOC_CREGISTER) then
                begin
@@ -594,12 +594,12 @@ end;
                   end;
                 LOC_REFERENCE,LOC_CREFERENCE:
                   begin
-                     if (left.resulttype.def.deftype=floatdef) then
+                     if (left.resultdef.deftype=floatdef) then
                        begin
-                          src1 := cg.getfpuregister(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def));
+                          src1 := cg.getfpuregister(current_asmdata.CurrAsmList,def_cgsize(left.resultdef));
                           location.register := src1;
                           cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,
-                            def_cgsize(left.resulttype.def),
+                            def_cgsize(left.resultdef),
                             left.location.reference,src1);
                        end
                      else
@@ -612,7 +612,7 @@ end;
                   end;
               end;
               { choose appropriate operand }
-              if left.resulttype.def.deftype <> floatdef then
+              if left.resultdef.deftype <> floatdef then
                 begin
                   if not(cs_check_overflow in aktlocalswitches) then
                     op := A_NEG
@@ -634,7 +634,7 @@ end;
 { 32-bit before doing neg!!     }
 { So this is useless...     }
 { that's not true: -2^31 gives an overflow error if it is negated (FK) }
-        cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+        cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
       end;
 
 
@@ -642,13 +642,13 @@ end;
                                TPPCNOTNODE
 *****************************************************************************}
 
-    procedure tppcnotnode.pass_2;
+    procedure tppcnotnode.pass_generate_code;
 
       var
          hl : tasmlabel;
 
       begin
-         if is_boolean(resulttype.def) then
+         if is_boolean(resultdef) then
           begin
             { if the location is LOC_JUMP, we do the secondpass after the
               labels are allocated
@@ -679,7 +679,7 @@ end;
                   LOC_SUBSETREG, LOC_CSUBSETREG, 
                   LOC_SUBSETREF, LOC_CSUBSETREF:
                     begin
-                      location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true);
+                      location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
                       current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPWI,left.location.register,0));
                       location_reset(location,LOC_FLAGS,OS_NO);
                       location.resflags.cr:=RS_CR0;
@@ -690,10 +690,10 @@ end;
                 end;
               end;
           end
-         else if is_64bitint(left.resulttype.def) then
+         else if is_64bitint(left.resultdef) then
            begin
              secondpass(left);
-             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false);
+             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false);
              location_copy(location,left.location);
              { perform the NOT operation }
              current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NOT,location.register64.reghi,
@@ -704,12 +704,12 @@ end;
          else
            begin
              secondpass(left);
-             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true);
+             location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
              location_copy(location,left.location);
              location.loc := LOC_REGISTER;
              location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
              { perform the NOT operation }
-             cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,def_cgsize(resulttype.def),left.location.register,
+             cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,def_cgsize(resultdef),left.location.register,
                location.register);
           end;
       end;

+ 4 - 4
compiler/powerpc/nppcset.pas

@@ -144,8 +144,8 @@ implementation
           end;
 
         begin
-           if (get_min_value(left.resulttype.def) >= low(smallint)) and
-              (get_max_value(left.resulttype.def) <= high(word)) then
+           if (get_min_value(left.resultdef) >= low(smallint)) and
+              (get_max_value(left.resultdef) <= high(word)) then
              begin
                genlinearcmplist(hp);
                exit;
@@ -153,7 +153,7 @@ implementation
            if assigned(t^.less) then
              genitem(t^.less);
            { need we to test the first value }
-           if first and (t^._low>get_min_value(left.resulttype.def)) then
+           if first and (t^._low>get_min_value(left.resultdef)) then
              begin
                cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,jmp_lt,aword(t^._low),hregister,elselabel);
              end;
@@ -175,7 +175,7 @@ implementation
                 if first then
                   begin
                      { have we to ajust the first value ? }
-                     if (t^._low>get_min_value(left.resulttype.def)) then
+                     if (t^._low>get_min_value(left.resultdef)) then
                        gensub(longint(t^._low));
                   end
                 else

+ 12 - 12
compiler/powerpc64/cpupara.pas

@@ -214,24 +214,24 @@ begin
   if (p.proctypeoption = potype_constructor) then
     retcgsize := OS_ADDR
   else
-    retcgsize := def_cgsize(p.rettype.def);
+    retcgsize := def_cgsize(p.returndef);
 
   location_reset(p.funcretloc[side], LOC_INVALID, OS_NO);
   p.funcretloc[side].size := retcgsize;
   { void has no location }
-  if is_void(p.rettype.def) then begin
+  if is_void(p.returndef) then begin
     p.funcretloc[side].loc := LOC_VOID;
     exit;
   end;
 
   { Return in FPU register? }
-  if p.rettype.def.deftype = floatdef then begin
+  if p.returndef.deftype = floatdef then begin
     p.funcretloc[side].loc := LOC_FPUREGISTER;
     p.funcretloc[side].register := NR_FPU_RESULT_REG;
     p.funcretloc[side].size := retcgsize;
   end else
     { Return in register? } 
-    if not ret_in_param(p.rettype.def, p.proccalloption) then begin
+    if not ret_in_param(p.returndef, p.proccalloption) then begin
       p.funcretloc[side].loc := LOC_REGISTER;
       p.funcretloc[side].size := retcgsize;
       if side = callerside then
@@ -293,7 +293,7 @@ begin
     parashift := 0;
     hp := tparavarsym(paras[i]);
 
-    paradef := hp.vartype.def;
+    paradef := hp.vardef;
     { Syscall for Morphos can have already a paraloc set; not supported on ppc64 }
     if (vo_has_explicit_paraloc in hp.varoptions) then begin
       internalerror(200412153);
@@ -314,7 +314,7 @@ begin
       push_addr_param(hp.varspez, paradef, p.proccalloption) or
       is_open_array(paradef) or
       is_array_of_const(paradef) then begin
-      paradef := voidpointertype.def;
+      paradef := voidpointertype;
       loc := LOC_REGISTER;
       paracgsize := OS_ADDR;
       paralen := tcgsize2size[OS_ADDR];
@@ -328,11 +328,11 @@ begin
         { if a record has only one field and that field is }
         { non-composite (not array or record), it must be  }
         { passed according to the rules of that type.       }
-        if (trecorddef(hp.vartype.def).symtable.symindex.count = 1) and
-          (not trecorddef(hp.vartype.def).isunion)  and
-          (tabstractvarsym(trecorddef(hp.vartype.def).symtable.symindex.search(1)).vartype.def.deftype in [orddef, enumdef, floatdef])  then begin
+        if (trecorddef(hp.vardef).symtable.symindex.count = 1) and
+          (not trecorddef(hp.vardef).isunion)  and
+          (tabstractvarsym(trecorddef(hp.vardef).symtable.symindex.search(1)).vardef.deftype in [orddef, enumdef, floatdef])  then begin
           paradef :=
-            tabstractvarsym(trecorddef(hp.vartype.def).symtable.symindex.search(1)).vartype.def;
+            tabstractvarsym(trecorddef(hp.vardef).symtable.symindex.search(1)).vardef;
           loc := getparaloc(paradef);
           paracgsize := def_cgsize(paradef);
         end else begin
@@ -465,9 +465,9 @@ begin
       hp.paraloc[callerside].alignment := 8;
       paraloc := hp.paraloc[callerside].add_location;
       paraloc^.loc := LOC_REFERENCE;
-      paraloc^.size := def_cgsize(hp.vartype.def);
+      paraloc^.size := def_cgsize(hp.vardef);
       paraloc^.reference.index := NR_STACK_POINTER_REG;
-      l := push_size(hp.varspez, hp.vartype.def, p.proccalloption);
+      l := push_size(hp.varspez, hp.vardef, p.proccalloption);
       paraloc^.reference.offset := parasize;
       parasize := parasize + l;
     end;

+ 16 - 16
compiler/powerpc64/nppcadd.pas

@@ -30,7 +30,7 @@ uses
 
 type
   tppcaddnode = class(tgenppcaddnode)
-    procedure pass_2; override;
+    procedure pass_generate_code override;
   private
     procedure emit_compare(unsigned: boolean); override;
   end;
@@ -72,7 +72,7 @@ begin
   if (left.location.loc = LOC_CONSTANT) then
     swapleftright;
 
-  opsize := def_cgsize(left.resulttype.def);
+  opsize := def_cgsize(left.resultdef);
 
   {$IFDEF EXTDEBUG}
   current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('tppcaddnode.emit_compare ' + inttostr(ord(opsize)) + ' ' + inttostr(tcgsize2size[opsize]))));
@@ -96,7 +96,7 @@ begin
       opsize := OS_32
     else
       opsize := OS_S32;
-    cg.a_load_reg_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), opsize, 
+    cg.a_load_reg_reg(current_asmdata.CurrAsmList, def_cgsize(left.resultdef), opsize, 
       left.location.register, left.location.register); 
   end;
 
@@ -137,7 +137,7 @@ end;
                                 pass_2
 *****************************************************************************}
 
-procedure tppcaddnode.pass_2;
+procedure tppcaddnode.pass_generate_code;
 { is also being used for xor, and "mul", "sub, or and comparative }
 { operators                                                }
 var
@@ -153,12 +153,12 @@ var
 begin
   { to make it more readable, string and set (not smallset!) have their
     own procedures }
-  case left.resulttype.def.deftype of
+  case left.resultdef.deftype of
     orddef:
       begin
         { handling boolean expressions }
-        if is_boolean(left.resulttype.def) and
-          is_boolean(right.resulttype.def) then
+        if is_boolean(left.resultdef) and
+          is_boolean(right.resultdef) then
         begin
           second_addboolean;
           exit;
@@ -172,7 +172,7 @@ begin
     setdef:
       begin
         { normalsets are already handled in pass1 }
-        if (tsetdef(left.resulttype.def).settype <> smallset) then
+        if (tsetdef(left.resultdef).settype <> smallset) then
           internalerror(200109041);
         second_addsmallset;
         exit;
@@ -180,7 +180,7 @@ begin
     arraydef:
       begin
 {$IFDEF SUPPORT_MMX}
-        if is_mmx_able_array(left.resulttype.def) then
+        if is_mmx_able_array(left.resultdef) then
         begin
           second_addmmx;
           exit;
@@ -196,8 +196,8 @@ begin
 
   { defaults }
   cmpop := nodetype in [ltn, lten, gtn, gten, equaln, unequaln];
-  unsigned := not (is_signed(left.resulttype.def)) or
-    not (is_signed(right.resulttype.def));
+  unsigned := not (is_signed(left.resultdef)) or
+    not (is_signed(right.resultdef));
 
   pass_left_and_right;
 
@@ -210,7 +210,7 @@ begin
 
   { set result location }
   if not cmpop then
-    location_reset(location, LOC_REGISTER, def_cgsize(resulttype.def))
+    location_reset(location, LOC_REGISTER, def_cgsize(resultdef))
   else
     location_reset(location, LOC_FLAGS, OS_NO);
 
@@ -287,7 +287,7 @@ begin
   else
     // overflow checking is on and we have an addn, subn or muln
   begin
-    if is_signed(resulttype.def) then
+    if is_signed(resultdef) then
     begin
       case nodetype of
         addn:
@@ -305,7 +305,7 @@ begin
       end;
       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, location.register,
         left.location.register, right.location.register));
-      cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def);
+      cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resultdef);
     end
     else
     begin
@@ -316,7 +316,7 @@ begin
               left.location.register, right.location.register));
             current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLD, location.register,
               left.location.register));
-            cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def);
+            cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resultdef);
           end;
         subn:
           begin
@@ -324,7 +324,7 @@ begin
               left.location.register, right.location.register));
             current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLD,
               left.location.register, location.register));
-            cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def);
+            cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resultdef);
           end;
         muln:
           begin

+ 10 - 10
compiler/powerpc64/nppccnv.pas

@@ -71,15 +71,15 @@ uses
 
 function tppctypeconvnode.first_int_to_real: tnode;
 begin
-  if (is_currency(left.resulttype.def)) then begin
+  if (is_currency(left.resultdef)) then begin
     // hack to avoid double division by 10000, as it's
-    // already done by resulttypepass.resulttype_int_to_real
-    left.resulttype := s64inttype;
+    // already done by typecheckpass.resultdef_int_to_real
+    left.resultdef := s64inttype;
   end else begin
     // everything that is less than 64 bits is converted to a 64 bit signed
     // integer - because the int_to_real conversion is faster for 64 bit
     // signed ints compared to 64 bit unsigned ints.
-    if (not (torddef(left.resulttype.def).typ in [s64bit, u64bit, scurrency])) then begin
+    if (not (torddef(left.resultdef).typ in [s64bit, u64bit, scurrency])) then begin
       inserttypeconv(left, s64inttype);
     end;
   end;
@@ -108,7 +108,7 @@ var
   signed: boolean;
 begin
 
-  location_reset(location, LOC_FPUREGISTER, def_cgsize(resulttype.def));
+  location_reset(location, LOC_FPUREGISTER, def_cgsize(resultdef));
 
   { the code here comes from the PowerPC Compiler Writer's Guide }
   { * longint to double (works for all rounding modes) }
@@ -138,7 +138,7 @@ begin
     // allocate temp for constant value used for unsigned 64 bit ints
     tempconst :=
       crealconstnode.create(convconst, pbestrealtype^);
-    resulttypepass(tempconst);
+    typecheckpass(tempconst);
     firstpass(tempconst);
     secondpass(tempconst);
     if (tempconst.location.loc <> LOC_CREFERENCE) then
@@ -164,7 +164,7 @@ begin
           size := OS_S64
         else
           size := OS_64;
-        cg.a_load_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def),
+        cg.a_load_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resultdef),
           size, left.location.reference, leftreg);
       end
   else
@@ -244,7 +244,7 @@ begin
   { byte(boolean) or word(wordbool) or longint(longbool) must }
   { be accepted for var parameters                            }
   if (nf_explicit in flags) and
-    (left.resulttype.def.size = resulttype.def.size) and
+    (left.resultdef.size = resultdef.size) and
     (left.location.loc in [LOC_REFERENCE, LOC_CREFERENCE, LOC_CREGISTER]) then
   begin
     current_procinfo.CurrTrueLabel := oldTrueLabel;
@@ -253,8 +253,8 @@ begin
     exit;
   end;
 
-  location_reset(location, LOC_REGISTER, def_cgsize(resulttype.def));
-  opsize := def_cgsize(left.resulttype.def);
+  location_reset(location, LOC_REGISTER, def_cgsize(resultdef));
+  opsize := def_cgsize(left.resultdef);
   case left.location.loc of
     LOC_CREFERENCE, LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER:
       begin

+ 1 - 1
compiler/powerpc64/nppcinl.pas

@@ -81,7 +81,7 @@ end;
 
 procedure tppcinlinenode.load_fpu_location;
 begin
-  location_reset(location, LOC_FPUREGISTER, def_cgsize(resulttype.def));
+  location_reset(location, LOC_FPUREGISTER, def_cgsize(resultdef));
   secondpass(left);
   location_force_fpureg(current_asmdata.CurrAsmList, left.location, true);
   location_copy(location, left.location);

+ 3 - 3
compiler/powerpc64/nppcld.pas

@@ -30,7 +30,7 @@ uses
 
 type
   tppcloadnode = class(tcgloadnode)
-    procedure pass_2; override;
+    procedure pass_generate_code override;
     procedure generate_picvaraccess; override;
   end;
 
@@ -46,9 +46,9 @@ uses
   procinfo,
   nld;
 
-procedure tppcloadnode.pass_2;
+procedure tppcloadnode.pass_generate_code;
 begin
-  inherited pass_2;
+  inherited pass_generate_code;
 end;
 
 procedure tppcloadnode.generate_picvaraccess;

+ 30 - 30
compiler/powerpc64/nppcmat.pas

@@ -31,19 +31,19 @@ uses
 type
   tppcmoddivnode = class(tmoddivnode)
     function pass_1: tnode; override;
-    procedure pass_2; override;
+    procedure pass_generate_code override;
   end;
 
   tppcshlshrnode = class(tshlshrnode)
-    procedure pass_2; override;
+    procedure pass_generate_code override;
   end;
 
   tppcunaryminusnode = class(tunaryminusnode)
-    procedure pass_2; override;
+    procedure pass_generate_code override;
   end;
 
   tppcnotnode = class(tnotnode)
-    procedure pass_2; override;
+    procedure pass_generate_code override;
   end;
 
 implementation
@@ -71,7 +71,7 @@ begin
     include(current_procinfo.flags, pi_do_call);
 end;
 
-procedure tppcmoddivnode.pass_2;
+procedure tppcmoddivnode.pass_generate_code;
 const         { signed   overflow }
   divops: array[boolean, boolean] of tasmop =
     ((A_DIVDU, A_DIVDU_),(A_DIVD, A_DIVDO_));
@@ -101,7 +101,7 @@ var
       { x mod +/-1 is always zero }
       cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, 0, resultreg);
     end else if (ispowerof2(tordconstnode(right).value, power)) then begin
-      if (is_signed(right.resulttype.def)) then begin
+      if (is_signed(right.resultdef)) then begin
         tempreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
         maskreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
         modreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
@@ -120,7 +120,7 @@ var
           resultreg);
       end;
     end else begin
-      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resulttype.def)], OS_INT, 
+      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)], OS_INT, 
         tordconstnode(right).value, numerator, resultreg);
       cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tordconstnode(right).value, resultreg, 
         resultreg);
@@ -135,7 +135,7 @@ begin
   location_copy(location,left.location);
 
   { put numerator in register }
-  size:=def_cgsize(left.resulttype.def);
+  size:=def_cgsize(left.resultdef);
   location_force_reg(current_asmdata.CurrAsmList,left.location,
     size,true);
   location_copy(location,left.location);
@@ -153,7 +153,7 @@ begin
   done := false;
   if (cs_opt_level1 in aktoptimizerswitches) and (right.nodetype = ordconstn) then begin
     if (nodetype = divn) then
-      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resulttype.def)], 
+      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)], 
         size, tordconstnode(right).value, numerator, resultreg)
     else 
       genOrdConstNodeMod;
@@ -162,7 +162,7 @@ begin
 
   if (not done) then begin
     { load divider in a register if necessary }
-    location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true);
+    location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resultdef),true);
     if (right.nodetype <> ordconstn) then
       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPDI, NR_CR7,
         right.location.register, 0))
@@ -174,7 +174,7 @@ begin
 
     { select the correct opcode according to the sign of the result, whether we need
      overflow checking }
-    op := divops[is_signed(right.resulttype.def), cs_check_overflow in aktlocalswitches];
+    op := divops[is_signed(right.resultdef), cs_check_overflow in aktlocalswitches];
     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, resultreg, numerator,
       divider));
 
@@ -199,15 +199,15 @@ begin
   { unsigned division/module can only overflow in case of division by zero
    (but checking this overflow flag is more convoluted than performing a  
    simple comparison with 0)                                             }
-  if is_signed(right.resulttype.def) then
-    cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
+  if is_signed(right.resultdef) then
+    cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
 end;
 
 {*****************************************************************************
                              TPPCSHLRSHRNODE
 *****************************************************************************}
 
-procedure tppcshlshrnode.pass_2;
+procedure tppcshlshrnode.pass_generate_code;
 
 var
   resultreg, hregister1, hregister2 : tregister;
@@ -222,7 +222,7 @@ begin
 
   { load left operators in a register }
   location_force_reg(current_asmdata.CurrAsmList, left.location,
-    def_cgsize(left.resulttype.def), true);
+    def_cgsize(left.resultdef), true);
   location_copy(location, left.location);
   resultreg := location.register;
   hregister1 := location.register;
@@ -242,15 +242,15 @@ begin
   if (right.nodetype = ordconstn) then begin
     // result types with size < 32 bits have their shift values masked
     // differently... :/
-    shiftval := tordconstnode(right).value and (tcgsize2size[def_cgsize(resulttype.def)] * 8 -1);
-    cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, op, def_cgsize(resulttype.def),
+    shiftval := tordconstnode(right).value and (tcgsize2size[def_cgsize(resultdef)] * 8 -1);
+    cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, op, def_cgsize(resultdef),
       shiftval, hregister1, resultreg)
   end else begin
     { load shift count in a register if necessary }
     location_force_reg(current_asmdata.CurrAsmList, right.location,
-      def_cgsize(right.resulttype.def), true);
+      def_cgsize(right.resultdef), true);
     hregister2 := right.location.register;
-    cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, op, def_cgsize(resulttype.def), hregister2,
+    cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, op, def_cgsize(resultdef), hregister2,
       hregister1, resultreg);
   end;
 end;
@@ -259,7 +259,7 @@ end;
                           TPPCUNARYMINUSNODE
 *****************************************************************************}
 
-procedure tppcunaryminusnode.pass_2;
+procedure tppcunaryminusnode.pass_generate_code;
 
 var
   src1: tregister;
@@ -286,12 +286,12 @@ begin
         end;
       LOC_REFERENCE, LOC_CREFERENCE:
         begin
-          if (left.resulttype.def.deftype = floatdef) then begin
+          if (left.resultdef.deftype = floatdef) then begin
             src1 := cg.getfpuregister(current_asmdata.CurrAsmList,
-              def_cgsize(left.resulttype.def));
+              def_cgsize(left.resultdef));
             location.register := src1;
             cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,
-              def_cgsize(left.resulttype.def),
+              def_cgsize(left.resultdef),
               left.location.reference, src1);
           end else begin
             src1 := cg.getintregister(current_asmdata.CurrAsmList, OS_64);
@@ -302,7 +302,7 @@ begin
         end;
     end;
     { choose appropriate operand }
-    if left.resulttype.def.deftype <> floatdef then begin
+    if left.resultdef.deftype <> floatdef then begin
       if not (cs_check_overflow in aktlocalswitches) then
         op := A_NEG
       else
@@ -315,20 +315,20 @@ begin
     { emit operation }
     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op, location.register, src1));
   end;
-  cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def);
+  cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resultdef);
 end;
 
 {*****************************************************************************
                                TPPCNOTNODE
 *****************************************************************************}
 
-procedure tppcnotnode.pass_2;
+procedure tppcnotnode.pass_generate_code;
 
 var
   hl: tasmlabel;
 
 begin
-  if is_boolean(resulttype.def) then
+  if is_boolean(resultdef) then
   begin
     { if the location is LOC_JUMP, we do the secondpass after the
       labels are allocated
@@ -360,7 +360,7 @@ begin
         LOC_SUBSETREF, LOC_CSUBSETREF:
           begin
             location_force_reg(current_asmdata.CurrAsmList, left.location,
-              def_cgsize(left.resulttype.def), true);
+              def_cgsize(left.resultdef), true);
             current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPDI,
               left.location.register, 0));
             location_reset(location, LOC_FLAGS, OS_NO);
@@ -376,12 +376,12 @@ begin
   begin
     secondpass(left);
     location_force_reg(current_asmdata.CurrAsmList, left.location,
-      def_cgsize(left.resulttype.def), true);
+      def_cgsize(left.resultdef), true);
     location_copy(location, left.location);
     location.loc := LOC_REGISTER;
     location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
     { perform the NOT operation }
-    cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_NOT, def_cgsize(resulttype.def),
+    cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_NOT, def_cgsize(resultdef),
       left.location.register,
       location.register);
   end;

+ 2 - 2
compiler/powerpc64/nppcset.pas

@@ -159,7 +159,7 @@ var
     if assigned(t^.less) then
       genitem(t^.less);
     { need we to test the first value }
-    if first and (t^._low > get_min_value(left.resulttype.def)) then begin
+    if first and (t^._low > get_min_value(left.resultdef)) then begin
       cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_INT, jmp_lt, aword(t^._low),
         hregister, elselabel);
     end;
@@ -178,7 +178,7 @@ var
       { ELSE-label                                }
       if first then begin
         { have we to ajust the first value ? }
-        if (t^._low > get_min_value(left.resulttype.def)) then
+        if (t^._low > get_min_value(left.resultdef)) then
           gensub(aint(t^._low));
       end else begin
         { if there is no unused label between the last and the }

+ 20 - 20
compiler/ppcgen/ngppcadd.pas

@@ -67,10 +67,10 @@ implementation
 
     function tgenppcaddnode.pass_1: tnode;
       begin
-        resulttypepass(left);
+        typecheckpass(left);
         if (nodetype in [equaln,unequaln]) and
-           (left.resulttype.def.deftype = orddef) and
-           is_64bit(left.resulttype.def) then
+           (left.resultdef.deftype = orddef) and
+           is_64bit(left.resultdef) then
           begin
             result := nil;
             firstpass(left);
@@ -109,14 +109,14 @@ implementation
             LOC_CREGISTER:
               ;
             LOC_REFERENCE,LOC_CREFERENCE:
-              location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resulttype.def),false);
+              location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resultdef),false);
             LOC_CONSTANT:
               begin
                 if load_constants then
-                  location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resulttype.def),false);
+                  location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resultdef),false);
               end;
             else
-              location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resulttype.def),false);
+              location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resultdef),false);
           end;
         end;
 
@@ -127,7 +127,7 @@ implementation
           begin
             location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
 {$ifndef cpu64bit}
-            if is_64bit(resulttype.def) then
+            if is_64bit(resultdef) then
               location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
 {$endif cpu64bit}
          end;
@@ -136,7 +136,7 @@ implementation
 
     function tgenppcaddnode.getresflags : tresflags;
       begin
-        if (left.resulttype.def.deftype <> floatdef) then
+        if (left.resultdef.deftype <> floatdef) then
           result.cr := RS_CR0
         else
           result.cr := RS_CR1;
@@ -178,12 +178,12 @@ implementation
         firstcomplex(self);
 
         cmpop:=false;
-        if (torddef(left.resulttype.def).typ=bool8bit) or
-           (torddef(right.resulttype.def).typ=bool8bit) then
+        if (torddef(left.resultdef).typ=bool8bit) or
+           (torddef(right.resultdef).typ=bool8bit) then
          cgsize:=OS_8
         else
-          if (torddef(left.resulttype.def).typ=bool16bit) or
-             (torddef(right.resulttype.def).typ=bool16bit) then
+          if (torddef(left.resultdef).typ=bool16bit) or
+             (torddef(right.resultdef).typ=bool16bit) then
            cgsize:=OS_16
         else
            cgsize:=OS_32;
@@ -237,7 +237,7 @@ implementation
 
             { set result location }
             if not cmpop then
-              location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def))
+              location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
              else
               location_reset(location,LOC_FLAGS,OS_NO);
 
@@ -301,7 +301,7 @@ implementation
         pass_left_and_right;
 
         cmpop:=false;
-        singleprec:=tfloatdef(left.resulttype.def).typ=s32real;
+        singleprec:=tfloatdef(left.resultdef).typ=s32real;
         case nodetype of
           addn :
             if singleprec then
@@ -345,7 +345,7 @@ implementation
         // initialize de result
         if not cmpop then
           begin
-            location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+            location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
             location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
           end
         else
@@ -383,10 +383,10 @@ implementation
         pass_left_and_right;
 
         { when a setdef is passed, it has to be a smallset }
-        if ((left.resulttype.def.deftype=setdef) and
-            (tsetdef(left.resulttype.def).settype<>smallset)) or
-           ((right.resulttype.def.deftype=setdef) and
-            (tsetdef(right.resulttype.def).settype<>smallset)) then
+        if ((left.resultdef.deftype=setdef) and
+            (tsetdef(left.resultdef).settype<>smallset)) or
+           ((right.resultdef.deftype=setdef) and
+            (tsetdef(right.resultdef).settype<>smallset)) then
          internalerror(200203301);
 
         opdone := false;
@@ -394,7 +394,7 @@ implementation
 
         { set result location }
         if not cmpop then
-          location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def))
+          location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
          else
           location_reset(location,LOC_FLAGS,OS_NO);
 

+ 54 - 54
compiler/pstatmnt.pas

@@ -124,16 +124,16 @@ implementation
          consume(_CASE);
          caseexpr:=comp_expr(true);
          { determines result type }
-         do_resulttypepass(caseexpr);
+         do_typecheckpass(caseexpr);
          { variants must be accepted, but first they must be converted to integer }
-         if caseexpr.resulttype.def.deftype=variantdef then
+         if caseexpr.resultdef.deftype=variantdef then
            begin
              caseexpr:=ctypeconvnode.create_internal(caseexpr,sinttype);
-             do_resulttypepass(caseexpr);
+             do_typecheckpass(caseexpr);
            end;
          set_varstate(caseexpr,vs_read,[vsf_must_be_valid]);
          casedeferror:=false;
-         casedef:=caseexpr.resulttype.def;
+         casedef:=caseexpr.resultdef;
          if (not assigned(casedef)) or
             not(is_ordinal(casedef)) then
           begin
@@ -159,13 +159,13 @@ implementation
                     begin
                        trangenode(p).left:=ctypeconvnode.create(trangenode(p).left,cwidechartype);
                        trangenode(p).right:=ctypeconvnode.create(trangenode(p).right,cwidechartype);
-                       do_resulttypepass(trangenode(p).left);
-                       do_resulttypepass(trangenode(p).right);
+                       do_typecheckpass(trangenode(p).left);
+                       do_typecheckpass(trangenode(p).right);
                     end
                   else
                     begin
                        p:=ctypeconvnode.create(p,cwidechartype);
-                       do_resulttypepass(p);
+                       do_typecheckpass(p);
                     end;
                end;
 
@@ -174,8 +174,8 @@ implementation
              if (p.nodetype=rangen) then
                begin
                   { type checking for case statements }
-                  if is_subequal(casedef, trangenode(p).left.resulttype.def) and
-                     is_subequal(casedef, trangenode(p).right.resulttype.def) then
+                  if is_subequal(casedef, trangenode(p).left.resultdef) and
+                     is_subequal(casedef, trangenode(p).right.resultdef) then
                     begin
                       hl1:=get_ordinal_value(trangenode(p).left);
                       hl2:=get_ordinal_value(trangenode(p).right);
@@ -194,7 +194,7 @@ implementation
              else
                begin
                   { type checking for case statements }
-                  if not is_subequal(casedef, p.resulttype.def) then
+                  if not is_subequal(casedef, p.resultdef) then
                     CGMessage(parser_e_case_mismatch);
                   hl1:=get_ordinal_value(p);
                   if not casedeferror then
@@ -315,9 +315,9 @@ implementation
          loopvarsym:=nil;
 
          { variable must be an ordinal, int64 is not allowed for 32bit targets }
-         if not(is_ordinal(hloopvar.resulttype.def))
+         if not(is_ordinal(hloopvar.resultdef))
 {$ifndef cpu64bit}
-            or is_64bitint(hloopvar.resulttype.def)
+            or is_64bitint(hloopvar.resultdef)
 {$endif cpu64bit}
             then
            MessagePos(hloopvar.fileinfo,type_e_ordinal_expr_expected);
@@ -329,8 +329,8 @@ implementation
                 (
                  (m_tp7 in aktmodeswitches) and
                  (hp.nodetype=subscriptn) and
-                 ((tsubscriptnode(hp).left.resulttype.def.deftype=recorddef) or
-                  is_object(tsubscriptnode(hp).left.resulttype.def))
+                 ((tsubscriptnode(hp).left.resultdef.deftype=recorddef) or
+                  is_object(tsubscriptnode(hp).left.resultdef))
                 ) or
                 { constant array index }
                 (
@@ -418,11 +418,11 @@ implementation
            trigger a warning when it is not used yet. This
            needs to be done before the instruction block is
            parsed to have a valid hloopvar }
-         resulttypepass(hfrom);
+         typecheckpass(hfrom);
          set_varstate(hfrom,vs_read,[vsf_must_be_valid]);
-         resulttypepass(hto);
+         typecheckpass(hto);
          set_varstate(hto,vs_read,[vsf_must_be_valid]);
-         resulttypepass(hloopvar);
+         typecheckpass(hloopvar);
          set_varstate(hloopvar,vs_readwritten,[]);
 
          { ... now the instruction block }
@@ -449,7 +449,7 @@ implementation
          valuenode,
          hp,
          refnode  : tnode;
-         htype : ttype;
+         hdef : tdef;
          hasimplicitderef : boolean;
          withsymtablelist : TFPObjectList;
 
@@ -460,20 +460,20 @@ implementation
            pushobjchild(obj.childof);
            { keep the original tobjectdef as owner, because that is used for
              visibility of the symtable }
-           st:=twithsymtable.create(tobjectdef(p.resulttype.def),obj.symtable.symsearch,refnode.getcopy);
+           st:=twithsymtable.create(tobjectdef(p.resultdef),obj.symtable.symsearch,refnode.getcopy);
            symtablestack.push(st);
            withsymtablelist.add(st);
          end;
 
       begin
          p:=comp_expr(true);
-         do_resulttypepass(p);
+         do_typecheckpass(p);
 
          if (p.nodetype=vecn) and
             (nf_memseg in p.flags) then
            CGMessage(parser_e_no_with_for_variable_in_other_segments);
 
-         if (p.resulttype.def.deftype in [objectdef,recorddef]) then
+         if (p.resultdef.deftype in [objectdef,recorddef]) then
           begin
             newblock:=nil;
             valuenode:=nil;
@@ -510,23 +510,23 @@ implementation
                 { when right is a call then load it first in a temp }
                 if p.nodetype=calln then
                   begin
-                    calltempnode:=ctempcreatenode.create(p.resulttype,p.resulttype.def.size,tt_persistent,true);
+                    calltempnode:=ctempcreatenode.create(p.resultdef,p.resultdef.size,tt_persistent,true);
                     addstatement(newstatement,calltempnode);
                     addstatement(newstatement,cassignmentnode.create(
                         ctemprefnode.create(calltempnode),
                         p));
                     p:=ctemprefnode.create(calltempnode);
-                    resulttypepass(p);
+                    typecheckpass(p);
                   end;
                 { classes and interfaces have implicit dereferencing }
-                hasimplicitderef:=is_class_or_interface(p.resulttype.def);
+                hasimplicitderef:=is_class_or_interface(p.resultdef);
                 if hasimplicitderef then
-                  htype:=p.resulttype
+                  hdef:=p.resultdef
                 else
-                  htype.setdef(tpointerdef.create(p.resulttype));
+                  hdef:=tpointerdef.create(p.resultdef);
                 { load address of the value in a temp }
-                tempnode:=ctempcreatenode.create(htype,sizeof(aint),tt_persistent,true);
-                resulttypepass(tempnode);
+                tempnode:=ctempcreatenode.create(hdef,sizeof(aint),tt_persistent,true);
+                typecheckpass(tempnode);
                 valuenode:=p;
                 refnode:=ctemprefnode.create(tempnode);
                 fillchar(refnode.fileinfo,sizeof(tfileposinfo),0);
@@ -542,23 +542,23 @@ implementation
                 addstatement(newstatement,cassignmentnode.create(
                     ctemprefnode.create(tempnode),
                     valuenode));
-                resulttypepass(refnode);
+                typecheckpass(refnode);
               end;
 
             withsymtablelist:=TFPObjectList.create(true);
-            case p.resulttype.def.deftype of
+            case p.resultdef.deftype of
               objectdef :
                 begin
                    { push symtables of all parents in reverse order }
-                   pushobjchild(tobjectdef(p.resulttype.def).childof);
+                   pushobjchild(tobjectdef(p.resultdef).childof);
                    { push object symtable }
-                   st:=twithsymtable.Create(tobjectdef(p.resulttype.def),tobjectdef(p.resulttype.def).symtable.symsearch,refnode);
+                   st:=twithsymtable.Create(tobjectdef(p.resultdef),tobjectdef(p.resultdef).symtable.symsearch,refnode);
                    symtablestack.push(st);
                    withsymtablelist.add(st);
                  end;
               recorddef :
                 begin
-                   st:=twithsymtable.create(trecorddef(p.resulttype.def),trecorddef(p.resulttype.def).symtable.symsearch,refnode);
+                   st:=twithsymtable.create(trecorddef(p.resultdef),trecorddef(p.resultdef).symtable.symsearch,refnode);
                    symtablestack.push(st);
                    withsymtablelist.add(st);
                 end;
@@ -661,7 +661,7 @@ implementation
       var
          p_try_block,p_finally_block,first,last,
          p_default,p_specific,hp : tnode;
-         ot : ttype;
+         ot : tDef;
          sym : tlocalvarsym;
          old_block_type : tblock_type;
          exceptsymtable : tsymtable;
@@ -715,7 +715,7 @@ implementation
               block_type:=bt_except;
               inc(exceptblockcounter);
               aktexceptblock := exceptblockcounter;
-              ot:=generrortype;
+              ot:=generrordef;
               p_specific:=nil;
               if (idtoken=_ON) then
                 { catch specific exceptions }
@@ -735,18 +735,18 @@ implementation
                             begin
                                consume_sym(srsym,srsymtable);
                                if (srsym.typ=typesym) and
-                                  is_class(ttypesym(srsym).restype.def) then
+                                  is_class(ttypesym(srsym).typedef) then
                                  begin
-                                    ot:=ttypesym(srsym).restype;
+                                    ot:=ttypesym(srsym).typedef;
                                     sym:=tlocalvarsym.create(objrealname,vs_value,ot,[]);
                                  end
                                else
                                  begin
-                                    sym:=tlocalvarsym.create(objrealname,vs_value,generrortype,[]);
+                                    sym:=tlocalvarsym.create(objrealname,vs_value,generrordef,[]);
                                     if (srsym.typ=typesym) then
-                                      Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
+                                      Message1(type_e_class_type_expected,ttypesym(srsym).typedef.typename)
                                     else
-                                      Message1(type_e_class_type_expected,ot.def.typename);
+                                      Message1(type_e_class_type_expected,ot.typename);
                                  end;
                                exceptsymtable:=tstt_exceptsymtable.create;
                                exceptsymtable.insert(sym);
@@ -776,15 +776,15 @@ implementation
                                { check if type is valid, must be done here because
                                  with "e: Exception" the e is not necessary }
                                if (srsym.typ=typesym) and
-                                  is_class(ttypesym(srsym).restype.def) then
-                                 ot:=ttypesym(srsym).restype
+                                  is_class(ttypesym(srsym).typedef) then
+                                 ot:=ttypesym(srsym).typedef
                                else
                                  begin
-                                    ot:=generrortype;
+                                    ot:=generrordef;
                                     if (srsym.typ=typesym) then
-                                      Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
+                                      Message1(type_e_class_type_expected,ttypesym(srsym).typedef.typename)
                                     else
-                                      Message1(type_e_class_type_expected,ot.def.typename);
+                                      Message1(type_e_class_type_expected,ot.typename);
                                  end;
                                exceptsymtable:=nil;
                             end;
@@ -793,7 +793,7 @@ implementation
                        consume(_ID);
                      consume(_DO);
                      hp:=connode.create(nil,statement);
-                     if ot.def.deftype=errordef then
+                     if ot.deftype=errordef then
                        begin
                           hp.free;
                           hp:=cerrornode.create;
@@ -813,7 +813,7 @@ implementation
                      { that last and hp are errornodes (JM)                            }
                      if last.nodetype = onn then
                        begin
-                         tonnode(last).excepttype:=tobjectdef(ot.def);
+                         tonnode(last).excepttype:=tobjectdef(ot);
                          tonnode(last).exceptsymtable:=exceptsymtable;
                        end;
                      { remove exception symtable }
@@ -1044,8 +1044,8 @@ implementation
                    tlabelnode(p).left:=cnothingnode.create
                  else
                    tlabelnode(p).left:=statement();
-                 { be sure to have left also resulttypepass }
-                 resulttypepass(tlabelnode(p).left);
+                 { be sure to have left also typecheckpass }
+                 typecheckpass(tlabelnode(p).left);
                end
              else
 
@@ -1073,7 +1073,7 @@ implementation
          end;
          if assigned(code) then
            begin
-             resulttypepass(code);
+             typecheckpass(code);
              code.fileinfo:=filepos;
            end;
          statement:=code;
@@ -1136,7 +1136,7 @@ implementation
         locals : longint;
       begin
          { Rename the funcret so that recursive calls are possible }
-         if not is_void(current_procinfo.procdef.rettype.def) then
+         if not is_void(current_procinfo.procdef.returndef) then
            current_procinfo.procdef.localst.rename(current_procinfo.procdef.resultname,'$hiddenresult');
 
          { delphi uses register calling for assembler methods }
@@ -1170,10 +1170,10 @@ implementation
                 (current_procinfo.procdef.owner.symtabletype<>objectsymtable) and
                 (not assigned(current_procinfo.procdef.funcretsym) or
                  (tabstractvarsym(current_procinfo.procdef.funcretsym).refcount<=1)) and
-                not(paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
+                not(paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption)) then
                begin
                  { Only need to set the framepointer, the locals will
-                   be inserted with the correct reference in tcgasmnode.pass_2 }
+                   be inserted with the correct reference in tcgasmnode.pass_generate_code }
                  current_procinfo.framepointer:=NR_STACK_POINTER_REG;
                end;
            end;
@@ -1184,7 +1184,7 @@ implementation
           register.
         }
         if assigned(current_procinfo.procdef.funcretsym) and
-           (not paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
+           (not paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption)) then
           tabstractvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_initialised;
 
         { because the END is already read we need to get the

+ 23 - 23
compiler/psub.pas

@@ -143,8 +143,8 @@ implementation
       begin
         if (tsym(p).typ=paravarsym) and
            (tparavarsym(p).varspez=vs_value) and
-           not is_class(tparavarsym(p).vartype.def) and
-           tparavarsym(p).vartype.def.needs_inittable then
+           not is_class(tparavarsym(p).vardef) and
+           tparavarsym(p).vardef.needs_inittable then
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
 
@@ -154,8 +154,8 @@ implementation
         if (tsym(p).typ=localvarsym) and
            (tlocalvarsym(p).refs>0) and
            not(vo_is_funcret in tlocalvarsym(p).varoptions) and
-           not(is_class(tlocalvarsym(p).vartype.def)) and
-           tlocalvarsym(p).vartype.def.needs_inittable then
+           not(is_class(tlocalvarsym(p).vardef)) and
+           tlocalvarsym(p).vardef.needs_inittable then
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
 
@@ -260,7 +260,7 @@ implementation
         srsym        : tsym;
         para         : tcallparanode;
         newstatement : tstatementnode;
-        htype        : ttype;
+        hdef         : tdef;
       begin
         result:=internalstatements(newstatement);
 
@@ -296,8 +296,8 @@ implementation
                 else
                   if is_object(current_procinfo.procdef._class) then
                     begin
-                      htype.setdef(current_procinfo.procdef._class);
-                      htype.setdef(tpointerdef.create(htype));
+                      hdef:=current_procinfo.procdef._class;
+                      hdef:=tpointerdef.create(hdef);
                       { parameter 3 : vmt_offset }
                       { parameter 2 : address of pointer to vmt,
                         this is required to allow setting the vmt to -1 to indicate
@@ -475,9 +475,9 @@ implementation
           begin
             { no constructor }
             { must be the return value finalized before reraising the exception? }
-            if (not is_void(current_procinfo.procdef.rettype.def)) and
-               (current_procinfo.procdef.rettype.def.needs_inittable) and
-               (not is_class(current_procinfo.procdef.rettype.def)) then
+            if (not is_void(current_procinfo.procdef.returndef)) and
+               (current_procinfo.procdef.returndef.needs_inittable) and
+               (not is_class(current_procinfo.procdef.returndef)) then
               addstatement(newstatement,finalize_data_node(load_result_node));
           end;
       end;
@@ -628,8 +628,8 @@ implementation
          if tsym(p).typ=paravarsym then
            begin
              { check if there no parameter of the current procedure is stack dependend }
-             if is_open_array(tparavarsym(p).vartype.def) or
-               is_array_of_const(tparavarsym(p).vartype.def) then
+             if is_open_array(tparavarsym(p).vardef) or
+               is_array_of_const(tparavarsym(p).vardef) then
                pboolean(arg)^:=true;
              if assigned(p) and
                 assigned(tparavarsym(p).paraloc[calleeside].location) and
@@ -1106,8 +1106,8 @@ implementation
             { re-basing of the index, i.e. if you pass an array[1..10] as open array, }
             { you have to add 1 to all index operations if you directly inline it     }
             if ((currpara.varspez in [vs_out,vs_var,vs_const]) and
-                (currpara.vartype.def.deftype=formaldef)) or
-               is_special_array(currpara.vartype.def)  then
+                (currpara.vardef.deftype=formaldef)) or
+               is_special_array(currpara.vardef)  then
               exit;
           end;
         result:=true;
@@ -1194,12 +1194,12 @@ implementation
              entrypos:=code.fileinfo;
 
              { Finish type checking pass }
-             do_resulttypepass(code);
+             do_typecheckpass(code);
            end;
 
          { Check for unused labels, forwards, symbols for procedures. Static
            symtable is checked in pmodules.
-           The check must be done after the resulttypepass }
+           The check must be done after the typecheckpass }
          if (Errorcount=0) and
             (tstoredsymtable(procdef.localst).symtabletype<>staticsymtable) then
            begin
@@ -1263,8 +1263,8 @@ implementation
         if tsym(p).typ<>paravarsym then
          exit;
         with tparavarsym(p) do
-          if (not is_class(vartype.def) and
-             vartype.def.needs_inittable and
+          if (not is_class(vardef) and
+             vardef.needs_inittable and
              (varspez in [vs_value,vs_out])) then
             include(current_procinfo.flags,pi_do_call);
       end;
@@ -1552,8 +1552,8 @@ implementation
     procedure check_forward_class(p : tnamedindexitem;arg:pointer);
       begin
         if (tsym(p).typ=typesym) and
-           (ttypesym(p).restype.def.deftype=objectdef) and
-           (oo_is_forward in tobjectdef(ttypesym(p).restype.def).objectoptions) then
+           (ttypesym(p).typedef.deftype=objectdef) and
+           (oo_is_forward in tobjectdef(ttypesym(p).typedef).objectoptions) then
           MessagePos1(tsym(p).fileinfo,sym_e_forward_type_not_resolved,tsym(p).realname);
       end;
 
@@ -1682,13 +1682,13 @@ implementation
         oldaktfilepos : tfileposinfo;
       begin
         if not((tsym(p).typ=typesym) and
-               (ttypesym(p).restype.def.deftype=objectdef) and
-               (df_specialization in ttypesym(p).restype.def.defoptions)
+               (ttypesym(p).typedef.deftype=objectdef) and
+               (df_specialization in ttypesym(p).typedef.defoptions)
               ) then
           exit;
 
         { definitions }
-        hp:=tdef(tobjectdef(ttypesym(p).restype.def).symtable.defindex.first);
+        hp:=tdef(tobjectdef(ttypesym(p).typedef).symtable.defindex.first);
         while assigned(hp) do
          begin
            if hp.deftype=procdef then

+ 70 - 74
compiler/psystem.pas

@@ -104,95 +104,91 @@ implementation
         all the types inserted into the system unit
       }
 
-        function addtype(const s:string;const t:ttype):ttypesym;
+        function addtype(const s:string;def:tdef):ttypesym;
         begin
-          result:=ttypesym.create(s,t);
+          result:=ttypesym.create(s,def);
           systemunit.insert(result);
           { add init/final table if required }
-          if t.def.needs_inittable then
+          if def.needs_inittable then
            generate_inittable(result);
         end;
 
         procedure adddef(const s:string;def:tdef);
-        var
-          t : ttype;
         begin
-          t.setdef(def);
-          systemunit.insert(ttypesym.create(s,t));
+          systemunit.insert(ttypesym.create(s,def));
         end;
 
       var
         hrecst : trecordsymtable;
       begin
         symtablestack.push(systemunit);
-        cundefinedtype.setdef(tundefineddef.create);
-        cformaltype.setdef(tformaldef.create);
-        voidtype.setdef(torddef.create(uvoid,0,0));
-        u8inttype.setdef(torddef.create(u8bit,0,255));
-        s8inttype.setdef(torddef.create(s8bit,-128,127));
-        u16inttype.setdef(torddef.create(u16bit,0,65535));
-        s16inttype.setdef(torddef.create(s16bit,-32768,32767));
-        u32inttype.setdef(torddef.create(u32bit,0,high(longword)));
-        s32inttype.setdef(torddef.create(s32bit,low(longint),high(longint)));
-        u64inttype.setdef(torddef.create(u64bit,low(qword),TConstExprInt(high(qword))));
-        s64inttype.setdef(torddef.create(s64bit,low(int64),high(int64)));
-        booltype.setdef(torddef.create(bool8bit,0,1));
-        bool16type.setdef(torddef.create(bool16bit,0,1));
-        bool32type.setdef(torddef.create(bool32bit,0,1));
-        bool64type.setdef(torddef.create(bool64bit,0,1));
-        cchartype.setdef(torddef.create(uchar,0,255));
-        cwidechartype.setdef(torddef.create(uwidechar,0,65535));
-        cshortstringtype.setdef(tstringdef.createshort(255));
+        cundefinedtype:=tundefineddef.create;
+        cformaltype:=tformaldef.create;
+        voidtype:=torddef.create(uvoid,0,0);
+        u8inttype:=torddef.create(u8bit,0,255);
+        s8inttype:=torddef.create(s8bit,-128,127);
+        u16inttype:=torddef.create(u16bit,0,65535);
+        s16inttype:=torddef.create(s16bit,-32768,32767);
+        u32inttype:=torddef.create(u32bit,0,high(longword));
+        s32inttype:=torddef.create(s32bit,low(longint),high(longint));
+        u64inttype:=torddef.create(u64bit,low(qword),TConstExprInt(high(qword)));
+        s64inttype:=torddef.create(s64bit,low(int64),high(int64));
+        booltype:=torddef.create(bool8bit,0,1);
+        bool16type:=torddef.create(bool16bit,0,1);
+        bool32type:=torddef.create(bool32bit,0,1);
+        bool64type:=torddef.create(bool64bit,0,1);
+        cchartype:=torddef.create(uchar,0,255);
+        cwidechartype:=torddef.create(uwidechar,0,65535);
+        cshortstringtype:=tstringdef.createshort(255);
         { should we give a length to the default long and ansi string definition ?? }
-        clongstringtype.setdef(tstringdef.createlong(-1));
-        cansistringtype.setdef(tstringdef.createansi(-1));
-        cwidestringtype.setdef(tstringdef.createwide(-1));
+        clongstringtype:=tstringdef.createlong(-1);
+        cansistringtype:=tstringdef.createansi(-1);
+        cwidestringtype:=tstringdef.createwide(-1);
         { length=0 for shortstring is open string (needed for readln(string) }
-        openshortstringtype.setdef(tstringdef.createshort(0));
-        openchararraytype.setdef(tarraydef.create(0,-1,s32inttype));
-        tarraydef(openchararraytype.def).setelementtype(cchartype);
+        openshortstringtype:=tstringdef.createshort(0);
+        openchararraytype:=tarraydef.create(0,-1,s32inttype);
+        tarraydef(openchararraytype).elementdef:=cchartype;
 {$ifdef x86}
-        s32floattype.setdef(tfloatdef.create(s32real));
-        s64floattype.setdef(tfloatdef.create(s64real));
-        s80floattype.setdef(tfloatdef.create(s80real));
+        s32floattype:=tfloatdef.create(s32real);
+        s64floattype:=tfloatdef.create(s64real);
+        s80floattype:=tfloatdef.create(s80real);
         if target_info.system<>system_x86_64_win64 then
-          s64currencytype.setdef(tfloatdef.create(s64currency))
+          s64currencytype:=tfloatdef.create(s64currency)
         else
           begin
-            s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+            s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
             pbestrealtype:=@s64floattype;
           end;
-
 {$endif x86}
 {$ifdef powerpc}
-        s32floattype.setdef(tfloatdef.create(s32real));
-        s64floattype.setdef(tfloatdef.create(s64real));
-        s80floattype.setdef(tfloatdef.create(s80real));
-        s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+        s32floattype:=tfloatdef.create(s32real);
+        s64floattype:=tfloatdef.create(s64real);
+        s80floattype:=tfloatdef.create(s80real);
+        s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
 {$endif powerpc}
 {$ifdef POWERPC64}
-        s32floattype.setdef(tfloatdef.create(s32real));
-        s64floattype.setdef(tfloatdef.create(s64real));
-        s80floattype.setdef(tfloatdef.create(s80real));
-        s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+        s32floattype:=tfloatdef.create(s32real);
+        s64floattype:=tfloatdef.create(s64real);
+        s80floattype:=tfloatdef.create(s80real);
+        s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
 {$endif POWERPC64}
 {$ifdef sparc}
-        s32floattype.setdef(tfloatdef.create(s32real));
-        s64floattype.setdef(tfloatdef.create(s64real));
-        s80floattype.setdef(tfloatdef.create(s80real));
-        s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+        s32floattype:=tfloatdef.create(s32real);
+        s64floattype:=tfloatdef.create(s64real);
+        s80floattype:=tfloatdef.create(s80real);
+        s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
 {$endif sparc}
 {$ifdef m68k}
-        s32floattype.setdef(tfloatdef.create(s32real));
-        s64floattype.setdef(tfloatdef.create(s64real));
-        s80floattype.setdef(tfloatdef.create(s80real));
-        s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+        s32floattype:=tfloatdef.create(s32real);
+        s64floattype:=tfloatdef.create(s64real);
+        s80floattype:=tfloatdef.create(s80real);
+        s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
 {$endif}
 {$ifdef arm}
-        s32floattype.setdef(tfloatdef.create(s32real));
-        s64floattype.setdef(tfloatdef.create(s64real));
-        s80floattype.setdef(tfloatdef.create(s80real));
-        s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+        s32floattype:=tfloatdef.create(s32real);
+        s64floattype:=tfloatdef.create(s64real);
+        s80floattype:=tfloatdef.create(s80real);
+        s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
 {$endif arm}
 {$ifdef cpu64bit}
         uinttype:=u64inttype;
@@ -204,13 +200,13 @@ implementation
         ptrinttype:=u32inttype;
 {$endif cpu64bit}
         { some other definitions }
-        voidpointertype.setdef(tpointerdef.create(voidtype));
-        charpointertype.setdef(tpointerdef.create(cchartype));
-        widecharpointertype.setdef(tpointerdef.create(cwidechartype));
-        voidfarpointertype.setdef(tpointerdef.createfar(voidtype));
-        cfiletype.setdef(tfiledef.createuntyped);
-        cvarianttype.setdef(tvariantdef.create(vt_normalvariant));
-        colevarianttype.setdef(tvariantdef.create(vt_olevariant));
+        voidpointertype:=tpointerdef.create(voidtype);
+        charpointertype:=tpointerdef.create(cchartype);
+        widecharpointertype:=tpointerdef.create(cwidechartype);
+        voidfarpointertype:=tpointerdef.createfar(voidtype);
+        cfiletype:=tfiledef.createuntyped;
+        cvarianttype:=tvariantdef.create(vt_normalvariant);
+        colevarianttype:=tvariantdef.create(vt_olevariant);
 
 {$ifdef cpufpemu}
         { Normal types }
@@ -306,24 +302,24 @@ implementation
         addtype('$s64currency',s64currencytype);
         { Add a type for virtual method tables }
         hrecst:=trecordsymtable.create(aktpackrecords);
-        vmttype.setdef(trecorddef.create(hrecst));
-        pvmttype.setdef(tpointerdef.create(vmttype));
+        vmttype:=trecorddef.create(hrecst);
+        pvmttype:=tpointerdef.create(vmttype);
         hrecst.insertfield(tfieldvarsym.create('$parent',vs_value,pvmttype,[]));
         hrecst.insertfield(tfieldvarsym.create('$length',vs_value,s32inttype,[]));
         hrecst.insertfield(tfieldvarsym.create('$mlength',vs_value,s32inttype,[]));
-        vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
-        tarraydef(vmtarraytype.def).setelementtype(voidpointertype);
+        vmtarraytype:=tarraydef.create(0,1,s32inttype);
+        tarraydef(vmtarraytype).elementdef:=voidpointertype;
         hrecst.insertfield(tfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[]));
         addtype('$__vtbl_ptr_type',vmttype);
         addtype('$pvmt',pvmttype);
-        vmtarraytype.setdef(tarraydef.create(0,1,s32inttype));
-        tarraydef(vmtarraytype.def).setelementtype(pvmttype);
+        vmtarraytype:=tarraydef.create(0,1,s32inttype);
+        tarraydef(vmtarraytype).elementdef:=pvmttype;
         addtype('$vtblarray',vmtarraytype);
         { Add a type for methodpointers }
         hrecst:=trecordsymtable.create(1);
         hrecst.insertfield(tfieldvarsym.create('$proc',vs_value,voidpointertype,[]));
         hrecst.insertfield(tfieldvarsym.create('$self',vs_value,voidpointertype,[]));
-        methodpointertype.setdef(trecorddef.create(hrecst));
+        methodpointertype:=trecorddef.create(hrecst);
         addtype('$methodpointer',methodpointertype);
         symtablestack.pop(systemunit);
       end;
@@ -334,12 +330,12 @@ implementation
         Load all default definitions for consts from the system unit
       }
 
-        procedure loadtype(const s:string;var t:ttype);
+        procedure loadtype(const s:string;var def:tdef);
         var
           srsym : ttypesym;
         begin
           srsym:=search_system_type(s);
-          t:=srsym.restype;
+          def:=srsym.typedef;
         end;
 
       var
@@ -388,7 +384,7 @@ implementation
         loadtype('variant',cvarianttype);
         loadtype('olevariant',colevarianttype);
         loadtype('methodpointer',methodpointertype);
-        loadtype('HRESULT',hresulttype);
+        loadtype('HRESULT',hresultdef);
 {$ifdef cpu64bit}
         uinttype:=u64inttype;
         sinttype:=s64inttype;

+ 76 - 76
compiler/ptconst.pas

@@ -30,7 +30,7 @@ interface
     { this procedure reads typed constants }
     { sym is only needed for ansi strings  }
     { the assembler label is in the middle (PM) }
-    procedure readtypedconst(list:tasmlist;const t:ttype;sym : ttypedconstsym;writable : boolean);
+    procedure readtypedconst(list:tasmlist;def:tdef;sym : ttypedconstsym;writable : boolean);
 
 implementation
 
@@ -52,7 +52,7 @@ implementation
 {$maxfpuregisters 0}
 
     { this procedure reads typed constants }
-    procedure readtypedconst(list:tasmlist;const t:ttype;sym : ttypedconstsym;writable : boolean);
+    procedure readtypedconst(list:tasmlist;def:tdef;sym : ttypedconstsym;writable : boolean);
       label
          myexit;
       type
@@ -103,11 +103,11 @@ implementation
          block_type:=bt_const;
          datalist:=tasmlist.create;
 
-         case t.def.deftype of
+         case def.deftype of
             orddef:
               begin
                  p:=comp_expr(true);
-                 case torddef(t.def).typ of
+                 case torddef(def).typ of
                     bool8bit :
                       begin
                          if is_constboolnode(p) then
@@ -158,7 +158,7 @@ implementation
                          if is_constintnode(p) then
                            begin
                               datalist.concat(Tai_const.Create_8bit(byte(tordconstnode(p).value)));
-                              check_range(torddef(t.def));
+                              check_range(torddef(def));
                            end
                          else
                            Message(parser_e_illegal_expression);
@@ -169,7 +169,7 @@ implementation
                          if is_constintnode(p) then
                            begin
                              datalist.concat(Tai_const.Create_16bit(word(tordconstnode(p).value)));
-                             check_range(torddef(t.def));
+                             check_range(torddef(def));
                            end
                          else
                            Message(parser_e_illegal_expression);
@@ -180,8 +180,8 @@ implementation
                          if is_constintnode(p) then
                            begin
                               datalist.concat(Tai_const.Create_32bit(longint(tordconstnode(p).value)));
-                              if torddef(t.def).typ<>u32bit then
-                               check_range(torddef(t.def));
+                              if torddef(def).typ<>u32bit then
+                               check_range(torddef(def));
                            end
                          else
                            Message(parser_e_illegal_expression);
@@ -193,7 +193,7 @@ implementation
                          if is_constintnode(p) then
                            intvalue := tordconstnode(p).value
                          else if is_constrealnode(p) and
-                                 (torddef(t.def).typ=scurrency)
+                                 (torddef(def).typ=scurrency)
                            { allow bootstrapping }
                            then
                              begin
@@ -221,7 +221,7 @@ implementation
               else
                 Message(parser_e_illegal_expression);
 
-              case tfloatdef(t.def).typ of
+              case tfloatdef(def).typ of
                  s32real :
                    datalist.concat(Tai_real_32bit.Create(ts32real(value)));
                  s64real :
@@ -251,12 +251,12 @@ implementation
               p:=comp_expr(true);
               case p.nodetype of
                  loadvmtaddrn:
-                   with Tclassrefdef(p.resulttype.def) do
+                   with Tclassrefdef(p.resultdef) do
                      begin
-                        if not Tobjectdef(pointertype.def).is_related(Tobjectdef(pointertype.def)) then
+                        if not Tobjectdef(pointeddef).is_related(Tobjectdef(tclassrefdef(def).pointeddef)) then
                           message(parser_e_illegal_expression);
                         datalist.concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(
-                          Tobjectdef(pointertype.def).vmt_mangledname)));
+                          Tobjectdef(pointeddef).vmt_mangledname)));
                      end;
                  niln:
                    datalist.concat(Tai_const.Create_sym(nil));
@@ -269,7 +269,7 @@ implementation
               p:=comp_expr(true);
               if (p.nodetype=typeconvn) then
                 with Ttypeconvnode(p) do
-                  if (left.nodetype in [addrn,niln]) and equal_defs(t.def,p.resulttype.def) then
+                  if (left.nodetype in [addrn,niln]) and equal_defs(def,p.resultdef) then
                     begin
                       hp:=left;
                       left:=nil;
@@ -302,7 +302,7 @@ implementation
                 datalist.concat(Tai_const.Create_sym(nil))
               { maybe pchar ? }
               else
-                if is_char(tpointerdef(t.def).pointertype.def) and
+                if is_char(tpointerdef(def).pointeddef) and
                    (p.nodetype<>addrn) then
                   begin
                     current_asmdata.getdatalabel(ll);
@@ -333,7 +333,7 @@ implementation
                 end
               { maybe pwidechar ? }
               else
-                if is_widechar(tpointerdef(t.def).pointertype.def) and
+                if is_widechar(tpointerdef(def).pointeddef) and
                    (p.nodetype<>addrn) then
                   begin
                     current_asmdata.getdatalabel(ll);
@@ -362,7 +362,7 @@ implementation
                    is_procvar_load(p) then
                   begin
                     { insert typeconv }
-                    inserttypeconv(p,t);
+                    inserttypeconv(p,def);
                     hp:=p;
                     while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn]) do
                       hp:=tunarynode(hp).left;
@@ -375,7 +375,7 @@ implementation
                              case hp.nodetype of
                                vecn :
                                  begin
-                                   case tvecnode(hp).left.resulttype.def.deftype of
+                                   case tvecnode(hp).left.resultdef.deftype of
                                      stringdef :
                                        begin
                                           { this seems OK for shortstring and ansistrings PM }
@@ -385,10 +385,10 @@ implementation
                                        end;
                                      arraydef :
                                        begin
-                                          if not is_packed_array(tvecnode(hp).left.resulttype.def) then
+                                          if not is_packed_array(tvecnode(hp).left.resultdef) then
                                             begin
-                                              len:=tarraydef(tvecnode(hp).left.resulttype.def).elesize;
-                                              base:=tarraydef(tvecnode(hp).left.resulttype.def).lowrange;
+                                              len:=tarraydef(tvecnode(hp).left.resultdef).elesize;
+                                              base:=tarraydef(tvecnode(hp).left.resultdef).lowrange;
                                             end
                                           else
                                             begin
@@ -456,7 +456,7 @@ implementation
                     if (tinlinenode(p).left.nodetype=typen) then
                       begin
                         datalist.concat(Tai_const.createname(
-                          tobjectdef(tinlinenode(p).left.resulttype.def).vmt_mangledname,0));
+                          tobjectdef(tinlinenode(p).left.resultdef).vmt_mangledname,0));
                       end
                     else
                       Message(parser_e_illegal_expression);
@@ -472,7 +472,7 @@ implementation
                 begin
                    { be sure to convert to the correct result, else
                      it can generate smallset data instead of normalset (PFV) }
-                   inserttypeconv(p,t);
+                   inserttypeconv(p,def);
                    { we only allow const sets }
                    if assigned(tsetconstnode(p).left) then
                      Message(parser_e_illegal_expression)
@@ -484,14 +484,14 @@ implementation
 
                         if source_info.endian = target_info.endian then
                           begin
-                            for l:=0 to p.resulttype.def.size-1 do
+                            for l:=0 to p.resultdef.size-1 do
                               datalist.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[l]));
                           end
                         else
                           begin
                             { store as longint values in swaped format }
                             j:=0;
-                            for l:=0 to ((p.resulttype.def.size-1) div 4) do
+                            for l:=0 to ((p.resultdef.size-1) div 4) do
                               begin
                                 datalist.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+3]));
                                 datalist.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2]));
@@ -511,17 +511,17 @@ implementation
               p:=comp_expr(true);
               if p.nodetype=ordconstn then
                 begin
-                  if equal_defs(p.resulttype.def,t.def) or
-                     is_subequal(p.resulttype.def,t.def) then
+                  if equal_defs(p.resultdef,def) or
+                     is_subequal(p.resultdef,def) then
                    begin
-                     case longint(p.resulttype.def.size) of
+                     case longint(p.resultdef.size) of
                        1 : datalist.concat(Tai_const.Create_8bit(Byte(tordconstnode(p).value)));
                        2 : datalist.concat(Tai_const.Create_16bit(Word(tordconstnode(p).value)));
                        4 : datalist.concat(Tai_const.Create_32bit(Longint(tordconstnode(p).value)));
                      end;
                    end
                   else
-                   IncompatibleTypes(p.resulttype.def,t.def);
+                   IncompatibleTypes(p.resultdef,def);
                 end
               else
                 Message(parser_e_illegal_expression);
@@ -531,11 +531,11 @@ implementation
            begin
               p:=comp_expr(true);
               { load strval and strlength of the constant tree }
-              if (p.nodetype=stringconstn) or is_widestring(t.def) then
+              if (p.nodetype=stringconstn) or is_widestring(def) then
                 begin
                   { convert to the expected string type so that
                     for widestrings strval is a pcompilerwidestring }
-                  inserttypeconv(p,t);
+                  inserttypeconv(p,def);
                   strlength:=tstringconstnode(p).len;
                   strval:=tstringconstnode(p).value_str;
                 end
@@ -559,13 +559,13 @@ implementation
                 end;
               if strlength>=0 then
                begin
-                 case tstringdef(t.def).string_typ of
+                 case tstringdef(def).string_typ of
                    st_shortstring:
                      begin
-                       if strlength>=t.def.size then
+                       if strlength>=def.size then
                         begin
-                          message2(parser_w_string_too_long,strpas(strval),tostr(t.def.size-1));
-                          strlength:=t.def.size-1;
+                          message2(parser_w_string_too_long,strpas(strval),tostr(def.size-1));
+                          strlength:=def.size-1;
                         end;
                        datalist.concat(Tai_const.Create_8bit(strlength));
                        { this can also handle longer strings }
@@ -574,15 +574,15 @@ implementation
                        ca[strlength]:=#0;
                        datalist.concat(Tai_string.Create_pchar(ca,strlength));
                        { fillup with spaces if size is shorter }
-                       if t.def.size>strlength then
+                       if def.size>strlength then
                         begin
-                          getmem(ca,t.def.size-strlength);
+                          getmem(ca,def.size-strlength);
                           { def.size contains also the leading length, so we }
                           { we have to subtract one                       }
-                          fillchar(ca[0],t.def.size-strlength-1,' ');
-                          ca[t.def.size-strlength-1]:=#0;
+                          fillchar(ca[0],def.size-strlength-1,' ');
+                          ca[def.size-strlength-1]:=#0;
                           { this can also handle longer strings }
-                          datalist.concat(Tai_string.Create_pchar(ca,t.def.size-strlength-1));
+                          datalist.concat(Tai_string.Create_pchar(ca,def.size-strlength-1));
                         end;
                      end;
                    st_ansistring:
@@ -616,11 +616,11 @@ implementation
                             datalist.concat(Tai_const.Create_sym(ll));
                             current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint))));
                             if tf_winlikewidestring in target_info.flags then
-                              current_asmdata.asmlists[al_const].concat(Tai_const.Create_32bit(strlength*cwidechartype.def.size))
+                              current_asmdata.asmlists[al_const].concat(Tai_const.Create_32bit(strlength*cwidechartype.size))
                             else
                               begin
                                 current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(-1));
-                                current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(strlength*cwidechartype.def.size));
+                                current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(strlength*cwidechartype.size));
                               end;
                             current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
                             for i:=0 to strlength-1 do
@@ -640,14 +640,14 @@ implementation
          arraydef:
            begin
               { dynamic array nil }
-               if is_dynamic_array(t.def) then
+               if is_dynamic_array(def) then
                 begin
                   { Only allow nil initialization }
                   consume(_NIL);
                   datalist.concat(Tai_const.Create_sym(nil));
                 end
                { no packed array constants supported }
-               else if is_packed_array(t.def) then
+               else if is_packed_array(def) then
                  begin
                    Message(type_e_no_const_packed_array);
                    consume_all_until(_RKLAMMER);
@@ -655,17 +655,17 @@ implementation
               else
               if try_to_consume(_LKLAMMER) then
                 begin
-                  for l:=tarraydef(t.def).lowrange to tarraydef(t.def).highrange-1 do
+                  for l:=tarraydef(def).lowrange to tarraydef(def).highrange-1 do
                     begin
-                      readtypedconst(datalist,tarraydef(t.def).elementtype,nil,writable);
+                      readtypedconst(datalist,tarraydef(def).elementdef,nil,writable);
                       consume(_COMMA);
                     end;
-                  readtypedconst(datalist,tarraydef(t.def).elementtype,nil,writable);
+                  readtypedconst(datalist,tarraydef(def).elementdef,nil,writable);
                   consume(_RKLAMMER);
                 end
               else
               { if array of char then we allow also a string }
-               if is_char(tarraydef(t.def).elementtype.def) then
+               if is_char(tarraydef(def).elementdef) then
                 begin
                    p:=comp_expr(true);
                    if p.nodetype=stringconstn then
@@ -689,11 +689,11 @@ implementation
                        Message(parser_e_illegal_expression);
                        len:=0;
                      end;
-                   if len>(tarraydef(t.def).highrange-tarraydef(t.def).lowrange+1) then
+                   if len>(tarraydef(def).highrange-tarraydef(def).lowrange+1) then
                      Message(parser_e_string_larger_array);
-                   for i:=tarraydef(t.def).lowrange to tarraydef(t.def).highrange do
+                   for i:=tarraydef(def).lowrange to tarraydef(def).highrange do
                      begin
-                        if i+1-tarraydef(t.def).lowrange<=len then
+                        if i+1-tarraydef(def).lowrange<=len then
                           begin
                              datalist.concat(Tai_const.Create_8bit(byte(ca^)));
                              inc(ca);
@@ -717,7 +717,7 @@ implementation
               if token=_NIL then
                 begin
                    datalist.concat(Tai_const.Create_sym(nil));
-                   if (po_methodpointer in tprocvardef(t.def).procoptions) then
+                   if (po_methodpointer in tprocvardef(def).procoptions) then
                      datalist.concat(Tai_const.Create_sym(nil));
                    consume(_NIL);
                    goto myexit;
@@ -726,10 +726,10 @@ implementation
               { which is a "procedure of object", because this also requires }
               { address of an object/class instance, which is not known at   }
               { compile time (JM)                                            }
-              if (po_methodpointer in tprocvardef(t.def).procoptions) then
+              if (po_methodpointer in tprocvardef(def).procoptions) then
                 Message(parser_e_no_procvarobj_const);
                 { parse the rest too, so we can continue with error checking }
-              getprocvardef:=tprocvardef(t.def);
+              getprocvardef:=tprocvardef(def);
               p:=comp_expr(true);
               getprocvardef:=nil;
               if codegenerror then
@@ -738,7 +738,7 @@ implementation
                  goto myexit;
                end;
               { let type conversion check everything needed }
-              inserttypeconv(p,t);
+              inserttypeconv(p,def);
               if codegenerror then
                begin
                  p.free;
@@ -776,10 +776,10 @@ implementation
          recorddef:
            begin
               { packed record }
-              if is_packed_record_or_object(t.def) then
+              if is_packed_record_or_object(def) then
                 Message(type_e_no_const_packed_record)
               { KAZ }
-              else if (trecorddef(t.def)=rec_tguid) and
+              else if (trecorddef(def)=rec_tguid) and
                  ((token=_CSTRING) or (token=_CCHAR) or (token=_ID)) then
                 begin
                   p:=comp_expr(true);
@@ -811,7 +811,7 @@ implementation
                    consume(_LKLAMMER);
                    sorg:='';
                    aktpos:=0;
-                   srsym := tsym(trecorddef(t.def).symtable.symindex.first);
+                   srsym := tsym(trecorddef(def).symtable.symindex.first);
                    recsym := nil;
                    while token<>_RKLAMMER do
                      begin
@@ -820,7 +820,7 @@ implementation
                         consume(_ID);
                         consume(_COLON);
                         error := false;
-                        recsym := tsym(trecorddef(t.def).symtable.search(s));
+                        recsym := tsym(trecorddef(def).symtable.search(s));
                         if not assigned(recsym) then
                           begin
                             Message1(sym_e_illegal_field,sorg);
@@ -875,10 +875,10 @@ implementation
                                  datalist.concat(Tai_const.Create_8bit(0));
 
                              { new position }
-                             aktpos:=tfieldvarsym(srsym).fieldoffset+tfieldvarsym(srsym).vartype.def.size;
+                             aktpos:=tfieldvarsym(srsym).fieldoffset+tfieldvarsym(srsym).vardef.size;
 
                              { read the data }
-                             readtypedconst(datalist,tfieldvarsym(srsym).vartype,nil,writable);
+                             readtypedconst(datalist,tfieldvarsym(srsym).vardef,nil,writable);
 
                              { keep previous field for checking whether whole }
                              { record was initialized (JM)                    }
@@ -900,7 +900,7 @@ implementation
                      (tfieldvarsym(srsym).fieldoffset > tfieldvarsym(recsym).fieldoffset)) then
                    Message1(parser_w_skipped_fields_after,sorg);
 
-                 for i:=1 to t.def.size-aktpos do
+                 for i:=1 to def.size-aktpos do
                    datalist.concat(Tai_const.Create_8bit(0));
 
                  consume(_RKLAMMER);
@@ -909,7 +909,7 @@ implementation
          { reads a typed object }
          objectdef:
            begin
-              if is_class_or_interface(t.def) then
+              if is_class_or_interface(def) then
                 begin
                   p:=comp_expr(true);
                   if p.nodetype<>niln then
@@ -924,11 +924,11 @@ implementation
                   p.free;
                 end
               { for objects we allow it only if it doesn't contain a vmt }
-              else if (oo_has_vmt in tobjectdef(t.def).objectoptions) and
+              else if (oo_has_vmt in tobjectdef(def).objectoptions) and
                       (m_fpc in aktmodeswitches) then
                  Message(parser_e_type_const_not_possible)
               { packed object }
-              else if is_packed_record_or_object(t.def) then
+              else if is_packed_record_or_object(def) then
                 Message(type_e_no_const_packed_record)
               else
                 begin
@@ -941,7 +941,7 @@ implementation
                         consume(_ID);
                         consume(_COLON);
                         srsym:=nil;
-                        obj:=tobjectdef(t.def);
+                        obj:=tobjectdef(def);
                         symt:=obj.symtable;
                         while (srsym=nil) and assigned(symt) do
                           begin
@@ -967,7 +967,7 @@ implementation
                                  message(parser_e_invalid_record_const);
 
                                { check in VMT needs to be added for TP mode }
-                               with Tobjectdef(t.def) do
+                               with Tobjectdef(def) do
                                  if not(m_fpc in aktmodeswitches) and
                                     (oo_has_vmt in objectoptions) and
                                     (vmt_offset<fieldoffset) then
@@ -985,26 +985,26 @@ implementation
                                    datalist.concat(Tai_const.Create_8bit(0));
 
                                { new position }
-                               aktpos:=fieldoffset+vartype.def.size;
+                               aktpos:=fieldoffset+vardef.size;
 
                                { read the data }
-                               readtypedconst(datalist,vartype,nil,writable);
+                               readtypedconst(datalist,vardef,nil,writable);
 
                                if not try_to_consume(_SEMICOLON) then
                                  break;
                           end;
                      end;
                    if not(m_fpc in aktmodeswitches) and
-                      (oo_has_vmt in tobjectdef(t.def).objectoptions) and
-                      (tobjectdef(t.def).vmt_offset>=aktpos) then
+                      (oo_has_vmt in tobjectdef(def).objectoptions) and
+                      (tobjectdef(def).vmt_offset>=aktpos) then
                      begin
-                       for i:=1 to tobjectdef(t.def).vmt_offset-aktpos do
+                       for i:=1 to tobjectdef(def).vmt_offset-aktpos do
                          datalist.concat(tai_const.create_8bit(0));
-                       datalist.concat(tai_const.createname(tobjectdef(t.def).vmt_mangledname,0));
+                       datalist.concat(tai_const.createname(tobjectdef(def).vmt_mangledname,0));
                        { this is more general }
-                       aktpos:=tobjectdef(t.def).vmt_offset + sizeof(aint);
+                       aktpos:=tobjectdef(def).vmt_offset + sizeof(aint);
                      end;
-                   for i:=1 to t.def.size-aktpos do
+                   for i:=1 to def.size-aktpos do
                      datalist.concat(Tai_const.Create_8bit(0));
                    consume(_RKLAMMER);
                 end;
@@ -1051,7 +1051,7 @@ implementation
              else
                cursectype:=sec_rodata;
              maybe_new_object_file(list);
-             new_section(list,cursectype,lower(sym.mangledname),const_align(t.def.alignment));
+             new_section(list,cursectype,lower(sym.mangledname),const_align(def.alignment));
              if (sym.owner.symtabletype=globalsymtable) or
                 maybe_smartlink_symbol or
                 (assigned(current_procinfo) and

+ 116 - 116
compiler/ptype.pas

@@ -39,15 +39,15 @@ interface
 
     { reads a string, file type or a type id and returns a name and }
     { tdef }
-    procedure single_type(var tt:ttype;isforwarddef:boolean);
+    procedure single_type(var def:tdef;isforwarddef:boolean);
 
-    procedure read_named_type(var tt:ttype;const name : stringid;genericdef:tstoreddef;genericlist:TFPObjectList;parseprocvardir:boolean);
-    procedure read_anon_type(var tt : ttype;parseprocvardir:boolean);
+    procedure read_named_type(var def:tdef;const name : stringid;genericdef:tstoreddef;genericlist:TFPObjectList;parseprocvardir:boolean);
+    procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
 
     { reads a type definition }
     { to a appropriating tdef, s gets the name of   }
     { the type to allow name mangling          }
-    procedure id_type(var tt : ttype;isforwarddef:boolean);
+    procedure id_type(var def : tdef;isforwarddef:boolean);
 
 
 implementation
@@ -83,12 +83,12 @@ implementation
         generictypelist : TFPObjectList;
       begin
         { retrieve generic def that we are going to replace }
-        genericdef:=tstoreddef(pt1.resulttype.def);
-        pt1.resulttype.reset;
+        genericdef:=tstoreddef(pt1.resultdef);
+        pt1.resultdef:=nil;
         if not(df_generic in genericdef.defoptions) then
           begin
             Comment(V_Error,'Specialization is only supported for generic types');
-            pt1.resulttype:=generrortype;
+            pt1.resultdef:=generrordef;
             { recover }
             consume(_LSHARPBRACKET);
             repeat
@@ -118,7 +118,7 @@ implementation
         while assigned(sym) do
           begin
             if (sym.typ=typesym) and
-               (ttypesym(sym).restype.def.deftype=undefineddef) then
+               (ttypesym(sym).typedef.deftype=undefineddef) then
               begin
                 if not first then
                   begin
@@ -128,7 +128,7 @@ implementation
                 pt2:=factor(false);
                 if pt2.nodetype=typen then
                   begin
-                    generictype:=ttypesym.create(sym.realname,pt2.resulttype);
+                    generictype:=ttypesym.create(sym.realname,pt2.resultdef);
                     generictypelist.add(generictype);
                   end
                 else
@@ -146,7 +146,7 @@ implementation
             if not assigned(genericdef.generictokenbuf) then
               internalerror(200511171);
             current_scanner.startreplaytokens(genericdef.generictokenbuf);
-            read_named_type(pt1.resulttype,name,genericdef,generictypelist,false);
+            read_named_type(pt1.resultdef,name,genericdef,generictypelist,false);
             { Consume the semicolon if it is also recorded }
             try_to_consume(_SEMICOLON);
           end;
@@ -155,7 +155,7 @@ implementation
       end;
 
 
-    procedure id_type(var tt : ttype;isforwarddef:boolean);
+    procedure id_type(var def : tdef;isforwarddef:boolean);
     { reads a type definition }
     { to a appropriating tdef, s gets the name of   }
     { the type to allow name mangling          }
@@ -180,7 +180,7 @@ implementation
             )then
            begin
              consume(_ID);
-             tt.setdef(aktobjectdef);
+             def:=aktobjectdef;
              exit;
            end;
          { Use the special searchsym_type that ignores records,objects and
@@ -195,54 +195,54 @@ implementation
            table as forwarddef are not resolved directly }
          if assigned(srsym) and
             (srsym.typ=typesym) and
-            (ttypesym(srsym).restype.def.deftype=errordef) then
+            (ttypesym(srsym).typedef.deftype=errordef) then
           begin
             Message1(type_e_type_is_not_completly_defined,ttypesym(srsym).realname);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
           end;
          { are we parsing a possible forward def ? }
          if isforwarddef and
             not(is_unit_specific) then
           begin
-            tt.setdef(tforwarddef.create(s,pos));
+            def:=tforwarddef.create(s,pos);
             exit;
           end;
          { unknown sym ? }
          if not assigned(srsym) then
           begin
             Message1(sym_e_id_not_found,sorg);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
           end;
          { type sym ? }
          if (srsym.typ<>typesym) then
           begin
             Message(type_e_type_id_expected);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
           end;
          { Give an error when referring to an errordef }
-         if (ttypesym(srsym).restype.def.deftype=errordef) then
+         if (ttypesym(srsym).typedef.deftype=errordef) then
           begin
             Message(sym_e_error_in_type_def);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
           end;
-        tt.setdef(ttypesym(srsym).restype.def);
+        def:=ttypesym(srsym).typedef;
       end;
 
 
-    procedure single_type(var tt:ttype;isforwarddef:boolean);
+    procedure single_type(var def:tdef;isforwarddef:boolean);
        var
-         t2 : ttype;
+         t2 : tdef;
          again : boolean;
        begin
          repeat
            again:=false;
              case token of
                _STRING:
-                 string_dec(tt);
+                 string_dec(def);
 
                _FILE:
                  begin
@@ -250,10 +250,10 @@ implementation
                     if try_to_consume(_OF) then
                       begin
                          single_type(t2,false);
-                         tt.setdef(tfiledef.createtyped(t2));
+                         def:=tfiledef.createtyped(t2);
                       end
                     else
-                      tt:=cfiletype;
+                      def:=cfiletype;
                  end;
 
                _ID:
@@ -264,13 +264,13 @@ implementation
                        again:=true;
                      end
                    else
-                     id_type(tt,isforwarddef);
+                     id_type(def,isforwarddef);
                  end;
 
                else
                  begin
                    message(type_e_type_id_expected);
-                   tt:=generrortype;
+                   def:=generrordef;
                  end;
             end;
         until not again;
@@ -312,12 +312,11 @@ implementation
 
 
     { reads a type definition and returns a pointer to it }
-    procedure read_named_type(var tt : ttype;const name : stringid;genericdef:tstoreddef;genericlist:TFPObjectList;parseprocvardir:boolean);
+    procedure read_named_type(var def : tdef;const name : stringid;genericdef:tstoreddef;genericlist:TFPObjectList;parseprocvardir:boolean);
       var
         pt : tnode;
-        tt2 : ttype;
+        tt2 : tdef;
         aktenumdef : tenumdef;
-        ap : tarraydef;
         s : stringid;
         l,v : TConstExprInt;
         oldaktpackrecords : longint;
@@ -342,7 +341,7 @@ implementation
               )then
              begin
                consume(_ID);
-               tt.setdef(aktobjectdef);
+               def:=aktobjectdef;
                exit;
              end;
            { Generate a specialization? }
@@ -359,8 +358,8 @@ implementation
                  done when both are integer values, because typecasting
                  between -3200..3200 will result in a signed-unsigned
                  conflict and give a range check error (PFV) }
-               if not(is_integer(pt1.resulttype.def) and is_integer(pt2.resulttype.def)) then
-                 inserttypeconv(pt1,pt2.resulttype);
+               if not(is_integer(pt1.resultdef) and is_integer(pt2.resultdef)) then
+                 inserttypeconv(pt1,pt2.resultdef);
                { both must be evaluated to constants now }
                if (pt1.nodetype=ordconstn) and
                   (pt2.nodetype=ordconstn) then
@@ -373,18 +372,18 @@ implementation
                    else
                      begin
                        { All checks passed, create the new def }
-                       case pt1.resulttype.def.deftype of
+                       case pt1.resultdef.deftype of
                          enumdef :
-                           tt.setdef(tenumdef.create_subrange(tenumdef(pt1.resulttype.def),lv,hv));
+                           def:=tenumdef.create_subrange(tenumdef(pt1.resultdef),lv,hv);
                          orddef :
                            begin
-                             if is_char(pt1.resulttype.def) then
-                               tt.setdef(torddef.create(uchar,lv,hv))
+                             if is_char(pt1.resultdef) then
+                               def:=torddef.create(uchar,lv,hv)
                              else
-                               if is_boolean(pt1.resulttype.def) then
-                                 tt.setdef(torddef.create(bool8bit,lv,hv))
+                               if is_boolean(pt1.resultdef) then
+                                 def:=torddef.create(bool8bit,lv,hv)
                                else
-                                 tt.setdef(torddef.create(range_to_basetype(lv,hv),lv,hv));
+                                 def:=torddef.create(range_to_basetype(lv,hv),lv,hv);
                            end;
                        end;
                      end;
@@ -400,7 +399,7 @@ implementation
                  begin
                    if (block_type=bt_specialize) then
                      generate_specialization(pt1,name);
-                   tt:=ttypenode(pt1).resulttype;
+                   def:=ttypenode(pt1).resultdef;
                  end
                else
                  Message(sym_e_error_in_type_def);
@@ -415,22 +414,22 @@ implementation
           consume(_SET);
           consume(_OF);
           read_anon_type(tt2,true);
-          if assigned(tt2.def) then
+          if assigned(tt2) then
            begin
-             case tt2.def.deftype of
+             case tt2.deftype of
                { don't forget that min can be negativ  PM }
                enumdef :
-                 if tenumdef(tt2.def).min>=0 then
-                  // !! tt.setdef(tsetdef.create(tt2,tenumdef(tt2.def).min,tenumdef(tt2.def).max))
-                  tt.setdef(tsetdef.create(tt2,tenumdef(tt2.def).max))
+                 if tenumdef(tt2).min>=0 then
+                  // !! def:=tsetdef.create(tt2,tenumdef(tt2.def).min,tenumdef(tt2.def).max))
+                  def:=tsetdef.create(tt2,tenumdef(tt2).max)
                  else
                   Message(sym_e_ill_type_decl_set);
                orddef :
                  begin
-                   if (torddef(tt2.def).typ<>uvoid) and
-                      (torddef(tt2.def).low>=0) then
-                     // !! tt.setdef(tsetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high))
-                     tt.setdef(tsetdef.create(tt2,torddef(tt2.def).high))
+                   if (torddef(tt2).typ<>uvoid) and
+                      (torddef(tt2).low>=0) then
+                     // !! def:=tsetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high))
+                     def:=tsetdef.create(tt2,torddef(tt2).high)
                    else
                      Message(sym_e_ill_type_decl_set);
                  end;
@@ -439,7 +438,7 @@ implementation
              end;
            end
           else
-           tt:=generrortype;
+           def:=generrordef;
         end;
 
 
@@ -447,24 +446,25 @@ implementation
         var
           lowval,
           highval   : TConstExprInt;
-          arraytype : ttype;
-          ht        : ttype;
+          indexdef  : tdef;
+          hdef      : tdef;
+          arrdef    : tarraydef;
 
-          procedure setdefdecl(const t:ttype);
+          procedure setdefdecl(def:tdef);
           begin
-            case t.def.deftype of
+            case def.deftype of
               enumdef :
                 begin
-                  lowval:=tenumdef(t.def).min;
-                  highval:=tenumdef(t.def).max;
+                  lowval:=tenumdef(def).min;
+                  highval:=tenumdef(def).max;
                   if (m_fpc in aktmodeswitches) and
-                     (tenumdef(t.def).has_jumps) then
+                     (tenumdef(def).has_jumps) then
                    Message(type_e_array_index_enums_with_assign_not_possible);
-                  arraytype:=t;
+                  indexdef:=def;
                 end;
               orddef :
                 begin
-                  if torddef(t.def).typ in [uchar,
+                  if torddef(def).typ in [uchar,
                     u8bit,u16bit,
                     s8bit,s16bit,s32bit,
 {$ifdef cpu64bit}
@@ -473,12 +473,12 @@ implementation
                     bool8bit,bool16bit,bool32bit,bool64bit,
                     uwidechar] then
                     begin
-                       lowval:=torddef(t.def).low;
-                       highval:=torddef(t.def).high;
-                       arraytype:=t;
+                       lowval:=torddef(def).low;
+                       highval:=torddef(def).high;
+                       indexdef:=def;
                     end
                   else
-                    Message1(parser_e_type_cant_be_used_in_array_index,t.def.gettypename);
+                    Message1(parser_e_type_cant_be_used_in_array_index,def.GetTypeName);
                 end;
               else
                 Message(sym_e_error_in_type_def);
@@ -486,30 +486,29 @@ implementation
           end;
 
         begin
+           arrdef:=nil;
            consume(_ARRAY);
            { open array? }
-           if token=_LECKKLAMMER then
+           if try_to_consume(_LECKKLAMMER) then
              begin
-                consume(_LECKKLAMMER);
                 { defaults }
-                arraytype:=generrortype;
+                indexdef:=generrordef;
                 lowval:=low(aint);
                 highval:=high(aint);
-                tt.reset;
                 repeat
                   { read the expression and check it, check apart if the
                     declaration is an enum declaration because that needs to
                     be parsed by readtype (PFV) }
                   if token=_LKLAMMER then
                    begin
-                     read_anon_type(ht,true);
-                     setdefdecl(ht);
+                     read_anon_type(hdef,true);
+                     setdefdecl(hdef);
                    end
                   else
                    begin
                      pt:=expr;
                      if pt.nodetype=typen then
-                      setdefdecl(pt.resulttype)
+                      setdefdecl(pt.resultdef)
                      else
                        begin
                           if (pt.nodetype=rangen) then
@@ -521,8 +520,8 @@ implementation
                                   done when both are integer values, because typecasting
                                   between -3200..3200 will result in a signed-unsigned
                                   conflict and give a range check error (PFV) }
-                                if not(is_integer(trangenode(pt).left.resulttype.def) and is_integer(trangenode(pt).left.resulttype.def)) then
-                                  inserttypeconv(trangenode(pt).left,trangenode(pt).right.resulttype);
+                                if not(is_integer(trangenode(pt).left.resultdef) and is_integer(trangenode(pt).left.resultdef)) then
+                                  inserttypeconv(trangenode(pt).left,trangenode(pt).right.resultdef);
                                 lowval:=tordconstnode(trangenode(pt).left).value;
                                 highval:=tordconstnode(trangenode(pt).right).value;
                                 if highval<lowval then
@@ -537,10 +536,10 @@ implementation
                                     lowval :=0;
                                     highval:=0;
                                   end;
-                                if is_integer(trangenode(pt).left.resulttype.def) then
-                                  range_to_type(lowval,highval,arraytype)
+                                if is_integer(trangenode(pt).left.resultdef) then
+                                  range_to_type(lowval,highval,indexdef)
                                 else
-                                  arraytype:=trangenode(pt).left.resulttype;
+                                  indexdef:=trangenode(pt).left.resultdef;
                               end
                              else
                               Message(type_e_cant_eval_constant_expr);
@@ -551,19 +550,20 @@ implementation
                      pt.free;
                    end;
 
-                { create arraydef }
-                  if not assigned(tt.def) then
-                   begin
-                     ap:=tarraydef.create(lowval,highval,arraytype);
-                     tt.setdef(ap);
-                   end
+                  { if the array is already created add the new arrray
+                    as element of the existing array, otherwise create a new array }
+                  if assigned(arrdef) then
+                    begin
+                      arrdef.elementdef:=tarraydef.create(lowval,highval,indexdef);
+                      arrdef:=tarraydef(arrdef.elementdef);
+                    end
                   else
-                   begin
-                     ap.elementtype.setdef(tarraydef.create(lowval,highval,arraytype));
-                     ap:=tarraydef(ap.elementtype.def);
-                   end;
-                 if is_packed then
-                   include(ap.arrayoptions,ado_IsBitPacked);
+                    begin
+                      arrdef:=tarraydef.create(lowval,highval,indexdef);
+                      def:=arrdef;
+                    end;
+                  if is_packed then
+                    include(arrdef.arrayoptions,ado_IsBitPacked);
 
                   if token=_COMMA then
                     consume(_COMMA)
@@ -576,18 +576,18 @@ implementation
              begin
                 if is_packed then
                   Message(parser_e_packed_dynamic_open_array);
-                ap:=tarraydef.create(0,-1,s32inttype);
-                include(ap.arrayoptions,ado_IsDynamicArray);
-                tt.setdef(ap);
+                arrdef:=tarraydef.create(0,-1,s32inttype);
+                include(arrdef.arrayoptions,ado_IsDynamicArray);
+                def:=arrdef;
              end;
            consume(_OF);
            read_anon_type(tt2,true);
-           { if no error, set element type }
-           if assigned(ap) then
+           { set element type of the last array definition }
+           if assigned(arrdef) then
              begin
-               ap.setelementtype(tt2);
+               arrdef.elementdef:=tt2;
                if is_packed and
-                  tt2.def.needs_inittable then
+                  tt2.needs_inittable then
                  Message(type_e_no_packed_inittable);
              end;
         end;
@@ -601,11 +601,11 @@ implementation
         oldlocalswitches : tlocalswitches;
         bitpacking: boolean;
       begin
-         tt.reset;
+         def:=nil;
          case token of
             _STRING,_FILE:
               begin
-                single_type(tt,false);
+                single_type(def,false);
               end;
            _LKLAMMER:
               begin
@@ -637,12 +637,12 @@ implementation
                         begin
                           { we expect an integer or an enum of the
                             same type }
-                          if is_integer(p.resulttype.def) or
-                             is_char(p.resulttype.def) or
-                             equal_defs(p.resulttype.def,aktenumdef) then
+                          if is_integer(p.resultdef) or
+                             is_char(p.resultdef) or
+                             equal_defs(p.resultdef,aktenumdef) then
                            v:=tordconstnode(p).value
                           else
-                           IncompatibleTypes(p.resulttype.def,s32inttype.def);
+                           IncompatibleTypes(p.resultdef,s32inttype);
                         end
                        else
                         Message(parser_e_illegal_expression);
@@ -664,7 +664,7 @@ implementation
                   tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l));
                   akttokenpos:=storepos;
                 until not try_to_consume(_COMMA);
-                tt.setdef(aktenumdef);
+                def:=aktenumdef;
                 consume(_RKLAMMER);
               end;
             _ARRAY:
@@ -679,11 +679,11 @@ implementation
               begin
                 consume(_CARET);
                 single_type(tt2,typecanbeforward);
-                tt.setdef(tpointerdef.create(tt2));
+                def:=tpointerdef.create(tt2);
               end;
             _RECORD:
               begin
-                tt.setdef(record_dec);
+                def:=record_dec;
               end;
             _PACKED,
             _BITPACKED:
@@ -705,9 +705,9 @@ implementation
                     else
                       aktpackrecords:=bit_alignment;
                     if token in [_CLASS,_OBJECT] then
-                      tt.setdef(object_dec(name,genericdef,genericlist,nil))
+                      def:=object_dec(name,genericdef,genericlist,nil)
                     else
-                      tt.setdef(record_dec);
+                      def:=record_dec;
                     aktpackrecords:=oldaktpackrecords;
                   end;
               end;
@@ -717,7 +717,7 @@ implementation
             _INTERFACE,
             _OBJECT:
               begin
-                tt.setdef(object_dec(name,genericdef,genericlist,nil));
+                def:=object_dec(name,genericdef,genericlist,nil);
               end;
             _PROCEDURE,
             _FUNCTION:
@@ -730,7 +730,7 @@ implementation
                 if is_func then
                  begin
                    consume(_COLON);
-                   single_type(pd.rettype,false);
+                   single_type(pd.returndef,false);
                  end;
                 if token=_OF then
                   begin
@@ -738,16 +738,16 @@ implementation
                     consume(_OBJECT);
                     include(pd.procoptions,po_methodpointer);
                   end;
-                tt.def:=pd;
+                def:=pd;
                 { possible proc directives }
                 if parseprocvardir then
                   begin
                     if check_proc_directive(true) then
                       begin
-                         newtype:=ttypesym.create('unnamed',tt);
+                         newtype:=ttypesym.create('unnamed',def);
                          parse_var_proc_directives(tsym(newtype));
-                         newtype.restype.def:=nil;
-                         tt.def.typesym:=nil;
+                         newtype.typedef:=nil;
+                         def.typesym:=nil;
                          newtype.free;
                       end;
                     { Add implicit hidden parameters and function result }
@@ -757,14 +757,14 @@ implementation
             else
               expr_type;
          end;
-         if tt.def=nil then
-          tt:=generrortype;
+         if def=nil then
+          def:=generrordef;
       end;
 
 
-    procedure read_anon_type(var tt : ttype;parseprocvardir:boolean);
+    procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
       begin
-        read_named_type(tt,'',nil,nil,parseprocvardir);
+        read_named_type(def,'',nil,nil,parseprocvardir);
       end;
 
 

+ 2 - 2
compiler/raatt.pas

@@ -1365,7 +1365,7 @@ unit raatt;
                            typedconstsym :
                              l:=ttypedconstsym(sym).getsize;
                            typesym :
-                             l:=ttypesym(sym).restype.def.size;
+                             l:=ttypesym(sym).typedef.size;
                            else
                              Message(asmr_e_wrong_sym_type);
                          end;
@@ -1426,7 +1426,7 @@ unit raatt;
                                end;
                            typesym :
                              begin
-                               if not(ttypesym(sym).restype.def.deftype in [recorddef,objectdef]) then
+                               if not(ttypesym(sym).typedef.deftype in [recorddef,objectdef]) then
                                 Message(asmr_e_wrong_sym_type);
                              end;
                            else

+ 43 - 44
compiler/rautils.pas

@@ -677,10 +677,10 @@ begin
   SetupResult:=false;
   { replace by correct offset. }
   with current_procinfo.procdef do
-    if (not is_void(rettype.def)) then
+    if (not is_void(returndef)) then
       begin
         if (m_tp7 in aktmodeswitches) and
-          (not paramanager.ret_in_param(rettype.def,proccalloption)) then
+          (not paramanager.ret_in_param(returndef,proccalloption)) then
           begin
             message(asmr_e_cannot_use_RESULT_here);
             exit;
@@ -841,11 +841,11 @@ Begin
               opr.localindexreg:=indexreg;
               opr.localscale:=0;
               opr.localgetoffset:=GetOffset;
-              if paramanager.push_addr_param(tabstractvarsym(sym).varspez,tabstractvarsym(sym).vartype.def,current_procinfo.procdef.proccalloption) then
+              if paramanager.push_addr_param(tabstractvarsym(sym).varspez,tabstractvarsym(sym).vardef,current_procinfo.procdef.proccalloption) then
                 SetSize(sizeof(aint),false);
             end;
         end;
-        case tabstractvarsym(sym).vartype.def.deftype of
+        case tabstractvarsym(sym).vardef.deftype of
           orddef,
           enumdef,
           pointerdef,
@@ -857,10 +857,10 @@ Begin
             begin
               { for arrays try to get the element size, take care of
                 multiple indexes }
-              harrdef:=tarraydef(tabstractvarsym(sym).vartype.def);
-              while assigned(harrdef.elementtype.def) and
-                    (harrdef.elementtype.def.deftype=arraydef) do
-               harrdef:=tarraydef(harrdef.elementtype.def);
+              harrdef:=tarraydef(tabstractvarsym(sym).vardef);
+              while assigned(harrdef.elementdef) and
+                    (harrdef.elementdef.deftype=arraydef) do
+               harrdef:=tarraydef(harrdef.elementdef);
               SetSize(harrdef.elesize,false);
             end;
           *)
@@ -873,7 +873,7 @@ Begin
       begin
         initref;
         opr.ref.symbol:=current_asmdata.RefAsmSymbol(ttypedconstsym(sym).mangledname);
-        case ttypedconstsym(sym).typedconsttype.def.deftype of
+        case ttypedconstsym(sym).typedconstdef.deftype of
           orddef,
           enumdef,
           pointerdef,
@@ -883,10 +883,10 @@ Begin
             begin
               { for arrays try to get the element size, take care of
                 multiple indexes }
-              harrdef:=tarraydef(ttypedconstsym(sym).typedconsttype.def);
-              while assigned(harrdef.elementtype.def) and
-                    (harrdef.elementtype.def.deftype=arraydef) do
-               harrdef:=tarraydef(harrdef.elementtype.def);
+              harrdef:=tarraydef(ttypedconstsym(sym).typedconstdef);
+              while assigned(harrdef.elementdef) and
+                    (harrdef.elementdef.deftype=arraydef) do
+               harrdef:=tarraydef(harrdef.elementdef);
               if not is_packed_array(harrdef) then
                 SetSize(harrdef.elesize,false)
                else
@@ -912,7 +912,7 @@ Begin
       end;
     typesym :
       begin
-        if ttypesym(sym).restype.def.deftype in [recorddef,objectdef] then
+        if ttypesym(sym).typedef.deftype in [recorddef,objectdef] then
          begin
            setconst(0);
            SetupVar:=TRUE;
@@ -1198,7 +1198,7 @@ begin
   if assigned(srsym) and
      (srsym.typ=typesym) then
     begin
-      size:=ttypesym(srsym).restype.def.size;
+      size:=ttypesym(srsym).typedef.size;
       result:=true;
     end;
 end;
@@ -1218,7 +1218,7 @@ Begin
      case srsym.typ of
        typesym :
          begin
-           if ttypesym(srsym).restype.def.deftype in [recorddef,objectdef] then
+           if ttypesym(srsym).typedef.deftype in [recorddef,objectdef] then
             begin
               SearchRecordType:=true;
               exit;
@@ -1314,11 +1314,11 @@ Begin
          globalvarsym,
          localvarsym,
          paravarsym :
-           st:=Tabstractvarsym(sym).vartype.def.getsymtable(gs_record);
+           st:=Tabstractvarsym(sym).vardef.getsymtable(gs_record);
          typesym :
-           st:=Ttypesym(sym).restype.def.getsymtable(gs_record);
+           st:=Ttypesym(sym).typedef.getsymtable(gs_record);
          typedconstsym :
-           st:=Ttypedconstsym(sym).typedconsttype.def.getsymtable(gs_record);
+           st:=Ttypedconstsym(sym).typedconstdef.getsymtable(gs_record);
        end
      else
        s:='';
@@ -1348,30 +1348,29 @@ Begin
            begin
              inc(Offset,fieldoffset);
              size:=getsize;
-             with vartype do
-               case def.deftype of
-                 arraydef :
-                   begin
-                     { for arrays try to get the element size, take care of
-                       multiple indexes }
-                     harrdef:=tarraydef(def);
-                     while assigned(harrdef.elementtype.def) and
-                           (harrdef.elementtype.def.deftype=arraydef) do
-                      harrdef:=tarraydef(harrdef.elementtype.def);
-                     if not is_packed_array(harrdef) then
-                       size:=harrdef.elesize
-                     else
-                       begin
-                         if (harrdef.elepackedbitsize mod 8) <> 0 then
-                           Message(asmr_e_packed_element);
-                         size := (harrdef.elepackedbitsize + 7) div 8;
-                       end;
-                   end;
-                 recorddef :
-                   st:=trecorddef(def).symtable;
-                 objectdef :
-                   st:=tobjectdef(def).symtable;
-               end;
+             case vardef.deftype of
+               arraydef :
+                 begin
+                   { for arrays try to get the element size, take care of
+                     multiple indexes }
+                   harrdef:=tarraydef(vardef);
+                   while assigned(harrdef.elementdef) and
+                         (harrdef.elementdef.deftype=arraydef) do
+                    harrdef:=tarraydef(harrdef.elementdef);
+                   if not is_packed_array(harrdef) then
+                     size:=harrdef.elesize
+                   else
+                     begin
+                       if (harrdef.elepackedbitsize mod 8) <> 0 then
+                         Message(asmr_e_packed_element);
+                       size := (harrdef.elepackedbitsize + 7) div 8;
+                     end;
+                 end;
+               recorddef :
+                 st:=trecorddef(vardef).symtable;
+               objectdef :
+                 st:=tobjectdef(vardef).symtable;
+             end;
            end;
      end;
    end;
@@ -1381,7 +1380,7 @@ Begin
        asmsearchsym(s,sym,srsymtable);
        if assigned(sym) and (sym.typ=typesym) then
          begin
-           size:=ttypesym(sym).restype.def.size;
+           size:=ttypesym(sym).typedef.size;
            s:=''
          end;
      end;

+ 13 - 13
compiler/regvars.pas

@@ -70,8 +70,8 @@ implementation
          parasym:=pboolean(arg)^;
          if (tsym(p).typ=varsym) and ((tvarsym(p).varregable <> vr_none) or
              ((tvarsym(p).varspez in [vs_var,vs_const,vs_out]) and
-              paramanager.push_addr_param(tvarsym(p).varspez,tvarsym(p).vartype.def,current_procinfo.procdef.proccalloption))) and
-            not tvarsym(p).vartype.def.needs_inittable then
+              paramanager.push_addr_param(tvarsym(p).varspez,tvarsym(p).vardef,current_procinfo.procdef.proccalloption))) and
+            not tvarsym(p).vardef.needs_inittable then
            begin
               j:=tvarsym(p).refs;
               { walk through all momentary register variables }
@@ -184,15 +184,15 @@ implementation
                       { unused                                }
 
                       { call by reference/const ? }
-                      if paramanager.push_addr_param(tvarsym(regvarinfo^.regvars[i]).varspez,tvarsym(regvarinfo^.regvars[i]).vartype.def,current_procinfo.procdef.proccalloption) then
+                      if paramanager.push_addr_param(tvarsym(regvarinfo^.regvars[i]).varspez,tvarsym(regvarinfo^.regvars[i]).vardef,current_procinfo.procdef.proccalloption) then
                         siz:=OS_32
                       else
-                       if (tvarsym(regvarinfo^.regvars[i]).vartype.def.deftype in [orddef,enumdef]) and
-                          (tvarsym(regvarinfo^.regvars[i]).vartype.def.size=1) then
+                       if (tvarsym(regvarinfo^.regvars[i]).vardef.deftype in [orddef,enumdef]) and
+                          (tvarsym(regvarinfo^.regvars[i]).vardef.size=1) then
                         siz:=OS_8
                       else
-                       if (tvarsym(regvarinfo^.regvars[i]).vartype.def.deftype in [orddef,enumdef]) and
-                          (tvarsym(regvarinfo^.regvars[i]).vartype.def.size=2) then
+                       if (tvarsym(regvarinfo^.regvars[i]).vardef.deftype in [orddef,enumdef]) and
+                          (tvarsym(regvarinfo^.regvars[i]).vardef.size=2) then
                         siz:=OS_16
                       else
                         siz:=OS_32;
@@ -308,7 +308,7 @@ implementation
                       begin
 {$warning FIXME Check vsym.localloc for regvars}
 //                        reference_reset_base(hr,current_procinfo.framepointer,vsym.adjusted_address);
-                        cgsize:=def_cgsize(vsym.vartype.def);
+                        cgsize:=def_cgsize(vsym.vardef);
                         cg.a_load_reg_ref(asml,cgsize,cgsize,vsym.localloc.register,hr);
                       end;
                     asml.concat(tai_regalloc.dealloc(vsym.localloc.register));
@@ -338,7 +338,7 @@ implementation
                           begin
 {$warning FIXME Check vsym.localloc for regvars}
 //                            reference_reset_base(hr,current_procinfo.framepointer,vsym.adjusted_address);
-                            cgsize:=def_cgsize(vsym.vartype.def);
+                            cgsize:=def_cgsize(vsym.vardef);
                             cg.a_load_reg_ref(asml,cgsize,cgsize,vsym.localloc.register,hr);
                           end;
                         asml.concat(tai_regalloc.dealloc(vsym.localloc.register));
@@ -374,10 +374,10 @@ implementation
               asml.concat(tai_regalloc.alloc(reg));
 {$warning FIXME Check vsym.localloc for regvars}
 //              reference_reset_base(hr,current_procinfo.framepointer,vsym.adjusted_address);
-              if paramanager.push_addr_param(vsym.varspez,vsym.vartype.def,current_procinfo.procdef.proccalloption) then
+              if paramanager.push_addr_param(vsym.varspez,vsym.vardef,current_procinfo.procdef.proccalloption) then
                 opsize := OS_ADDR
               else
-                opsize := def_cgsize(vsym.vartype.def);
+                opsize := def_cgsize(vsym.vardef);
               cg.a_load_ref_reg(asml,opsize,opsize,hr,reg);
               include(rg.regvar_loaded_int,getsupreg(reg));
             end;
@@ -391,10 +391,10 @@ implementation
               asml.concat(tai_regalloc.alloc(reg));
 {$warning FIXME Check vsym.localloc for regvars}
 //              reference_reset_base(hr,current_procinfo.framepointer,vsym.adjusted_address);
-              if paramanager.push_addr_param(vsym.varspez,vsym.vartype.def,current_procinfo.procdef.proccalloption) then
+              if paramanager.push_addr_param(vsym.varspez,vsym.vardef,current_procinfo.procdef.proccalloption) then
                 opsize := OS_ADDR
               else
-                opsize := def_cgsize(vsym.vartype.def);
+                opsize := def_cgsize(vsym.vardef);
               cg.a_load_ref_reg(asml,opsize,opsize,hr,reg);
               rg.regvar_loaded_other[regidx] := true;
             end;

+ 7 - 7
compiler/scanner.pas

@@ -563,7 +563,7 @@ In case not, the value returned can be arbitrary.
         'BOOLEAN','INTEGER','STRING','SET');
 
       {Subset of types which can be elements in sets.}
-      setElementTypes = [ctetBoolean, ctetInteger, ctetString];
+      setelementdefs = [ctetBoolean, ctetInteger, ctetString];
 
 
     function GetCTETypeName(t: TCTETypeSet): String;
@@ -835,7 +835,7 @@ In case not, the value returned can be arbitrary.
                             typedconstsym :
                               l:=ttypedconstsym(srsym).getsize;
                             typesym:
-                              l:=ttypesym(srsym).restype.def.size;
+                              l:=ttypesym(srsym).typedef.size;
                             else
                               Message(scan_e_error_in_preproc_expr);
                           end;
@@ -933,20 +933,20 @@ In case not, the value returned can be arbitrary.
                                     case consttyp of
                                       constord :
                                         begin
-                                          case consttype.def.deftype of
+                                          case constdef.deftype of
                                             orddef:
                                               begin
-                                                if is_integer(consttype.def) then
+                                                if is_integer(constdef) then
                                                   begin
                                                     read_factor:=tostr(value.valueord);
                                                     factorType:= [ctetInteger];
                                                   end
-                                                else if is_boolean(consttype.def) then
+                                                else if is_boolean(constdef) then
                                                   begin
                                                     read_factor:=tostr(value.valueord);
                                                     factorType:= [ctetBoolean];
                                                   end
-                                                else if is_char(consttype.def) then
+                                                else if is_char(constdef) then
                                                   begin
                                                     read_factor:=chr(value.valueord);
                                                     factorType:= [ctetString];
@@ -1134,7 +1134,7 @@ In case not, the value returned can be arbitrary.
                    if exprType2 <> [ctetSet] then
                      CTEError(exprType2, [ctetSet], 'IN');
                    if exprType = [ctetSet] then
-                     CTEError(exprType, setElementTypes, 'IN');
+                     CTEError(exprType, setelementdefs, 'IN');
 
                   if is_number(hs1) and is_number(hs2) then
                     Message(scan_e_preproc_syntax_error)

+ 1 - 1
compiler/sparc/cgcpu.pas

@@ -1029,7 +1029,7 @@ implementation
       var
         hr : treference;
       begin
-        if paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption) then
+        if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef.proccalloption) then
           begin
             reference_reset(hr);
             hr.offset:=12;

+ 7 - 7
compiler/sparc/cpupara.pas

@@ -146,19 +146,19 @@ implementation
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         p.funcretloc[side].size:=retcgsize;
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
             p.funcretloc[side].loc:=LOC_VOID;
             exit;
           end;
 
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -168,7 +168,7 @@ implementation
           end
         else
          { Return in register? }
-         if not ret_in_param(p.rettype.def,p.proccalloption) then
+         if not ret_in_param(p.returndef,p.proccalloption) then
           begin
 {$ifndef cpu64bit}
             if retcgsize in [OS_64,OS_S64] then
@@ -224,7 +224,7 @@ implementation
             { currently only support C-style array of const,
               there should be no location assigned to the vararg array itself }
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
-               is_array_of_const(hp.vartype.def) then
+               is_array_of_const(hp.vardef) then
               begin
                 paraloc:=hp.paraloc[side].add_location;
                 { hack: the paraloc must be valid, but is not actually used }
@@ -234,11 +234,11 @@ implementation
                 break;
               end;
 
-            if push_addr_param(hp.varspez,hp.vartype.def,p.proccalloption) then
+            if push_addr_param(hp.varspez,hp.vardef,p.proccalloption) then
               paracgsize:=OS_ADDR
             else
               begin
-                paracgsize:=def_cgSize(hp.vartype.def);
+                paracgsize:=def_cgSize(hp.vardef);
                 if paracgsize=OS_NO then
                   paracgsize:=OS_ADDR;
               end;

+ 5 - 5
compiler/sparc/ncpuadd.pas

@@ -169,7 +169,7 @@ interface
         location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
         location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER));
 
-        location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+        location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
         if left.location.loc<>LOC_CFPUREGISTER then
           location.register:=left.location.register
         else
@@ -340,8 +340,8 @@ interface
         pass_left_right;
         force_reg_left_right(false,false);
 
-        unsigned:=not(is_signed(left.resulttype.def)) or
-                  not(is_signed(right.resulttype.def));
+        unsigned:=not(is_signed(left.resultdef)) or
+                  not(is_signed(right.resultdef));
 
         location_reset(location,LOC_JUMP,OS_NO);
 
@@ -359,8 +359,8 @@ interface
         pass_left_right;
         force_reg_left_right(true,true);
 
-        unsigned:=not(is_signed(left.resulttype.def)) or
-                  not(is_signed(right.resulttype.def));
+        unsigned:=not(is_signed(left.resultdef)) or
+                  not(is_signed(right.resultdef));
 
         if right.location.loc = LOC_CONSTANT then
           tcgsparc(cg).handle_reg_const_reg(current_asmdata.CurrAsmList,A_SUBcc,left.location.register,right.location.value,NR_G0)

+ 2 - 2
compiler/sparc/ncpucall.pas

@@ -46,8 +46,8 @@ implementation
 
     procedure tsparccallnode.extra_post_call_code;
       begin
-        if paramanager.ret_in_param(procdefinition.rettype.def,procdefinition.proccalloption) then
-          current_asmdata.CurrAsmList.concat(taicpu.op_const(A_UNIMP,procdefinition.rettype.def.size and $fff));
+        if paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) then
+          current_asmdata.CurrAsmList.concat(taicpu.op_const(A_UNIMP,procdefinition.returndef.size and $fff));
       end;
 
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.