Răsfoiți Sursa

* 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 ani în urmă
părinte
comite
3078a1927f
100 a modificat fișierele cu 3574 adăugiri și 3588 ștergeri
  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_ref    : (ref:preference);
           top_const  : (val:aint);
           top_const  : (val:aint);
           top_bool   : (b:boolean);
           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);
           top_local  : (localoper:plocaloper);
       {$ifdef arm}
       {$ifdef arm}
           top_regset : (regset:^tcpuregisterset);
           top_regset : (regset:^tcpuregisterset);

+ 4 - 4
compiler/aggas.pas

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

+ 5 - 5
compiler/alpha/cpupara.pas

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

+ 4 - 4
compiler/alpha/radirect.pas

@@ -88,10 +88,10 @@ interface
        ende:=false;
        ende:=false;
        s:='';
        s:='';
        if assigned(aktprocdef.funcretsym) and
        if assigned(aktprocdef.funcretsym) and
-          is_fpu(aktprocdef.rettype.def) then
+          is_fpu(aktprocdef.returndef) then
          tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_initialised;
          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]+')')
          retstr:=upper(tostr(procinfo^.return_offset)+'('+gas_reg2str[procinfo^.framepointer]+')')
        else
        else
        }
        }
@@ -146,7 +146,7 @@ interface
                                 { char ?                                   }
                                 { char ?                                   }
                                 { !!!
                                 { !!!
                                 if (s[length(s)]='%') and
                                 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('AX',upper(hs))>0) or
                                    (pos('AL',upper(hs))>0)) then
                                    (pos('AL',upper(hs))>0)) then
                                   tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_initialised;
                                   tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_initialised;
@@ -247,7 +247,7 @@ interface
                                                  end
                                                  end
                                                else if upper(hs)='__RESULT' then
                                                else if upper(hs)='__RESULT' then
                                                  begin
                                                  begin
-                                                    if (not is_void(aktprocdef.rettype.def)) then
+                                                    if (not is_void(aktprocdef.returndef)) then
                                                       hs:=retstr
                                                       hs:=retstr
                                                     else
                                                     else
                                                       Message(asmr_e_void_function);
                                                       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,
             { currently only support C-style array of const,
               there should be no location assigned to the vararg array itself }
               there should be no location assigned to the vararg array itself }
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
             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
               begin
                 paraloc:=hp.paraloc[side].add_location;
                 paraloc:=hp.paraloc[side].add_location;
                 { hack: the paraloc must be valid, but is not actually used }
                 { hack: the paraloc must be valid, but is not actually used }
@@ -245,11 +245,11 @@ unit cpupara;
                 break;
                 break;
               end;
               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
               paracgsize:=OS_ADDR
             else
             else
               begin
               begin
-                paracgsize:=def_cgSize(hp.vartype.def);
+                paracgsize:=def_cgSize(hp.vardef);
                 if paracgsize=OS_NO then
                 if paracgsize=OS_NO then
                   paracgsize:=OS_ADDR;
                   paracgsize:=OS_ADDR;
               end;
               end;
@@ -260,12 +260,12 @@ unit cpupara;
 
 
              if (hp.varspez in [vs_var,vs_out]) then
              if (hp.varspez in [vs_var,vs_out]) then
                begin
                begin
-                 paradef:=voidpointertype.def;
+                 paradef:=voidpointertype;
                  loc:=LOC_REGISTER;
                  loc:=LOC_REGISTER;
                end
                end
              else
              else
                begin
                begin
-                 paradef:=hp.vartype.def;
+                 paradef:=hp.vardef;
                  loc:=getparaloc(p.proccalloption,paradef);
                  loc:=getparaloc(p.proccalloption,paradef);
                end;
                end;
 
 
@@ -355,7 +355,7 @@ unit cpupara;
                              paraloc^.loc:=LOC_REFERENCE;
                              paraloc^.loc:=LOC_REFERENCE;
                              paraloc^.reference.index:=NR_STACK_POINTER_REG;
                              paraloc^.reference.index:=NR_STACK_POINTER_REG;
                              paraloc^.reference.offset:=stack_offset;
                              paraloc^.reference.offset:=stack_offset;
-                             inc(stack_offset,hp.vartype.def.size);
+                             inc(stack_offset,hp.vardef.size);
                           end;
                           end;
                       end;
                       end;
                     else
                     else
@@ -372,7 +372,7 @@ unit cpupara;
                  dec(paralen,tcgsize2size[paraloc^.size]);
                  dec(paralen,tcgsize2size[paraloc^.size]);
                end;
                end;
              { hack to swap doubles in int registers }
              { 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
                (hp.paraloc[side].location^.loc=LOC_REGISTER) then
                begin
                begin
                  paraloc:=hp.paraloc[side].location;
                  paraloc:=hp.paraloc[side].location;
@@ -403,20 +403,20 @@ unit cpupara;
         if (p.proctypeoption=potype_constructor) then
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
           retcgsize:=OS_ADDR
         else
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         p.funcretloc[side].size:=retcgsize;
         p.funcretloc[side].size:=retcgsize;
 
 
         { void has no location }
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
           begin
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             exit;
             exit;
           end;
           end;
 
 
         { Return in FPU register? }
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
           begin
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or (cs_fp_emulation in aktmoduleswitches) then
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or (cs_fp_emulation in aktmoduleswitches) then
               begin
               begin
@@ -448,7 +448,7 @@ unit cpupara;
               end;
               end;
           end
           end
           { Return in register? }
           { 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
           begin
             if retcgsize in [OS_64,OS_S64] then
             if retcgsize in [OS_64,OS_S64] then
               begin
               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,left.location,true);
               location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER));
               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
               if left.location.loc<>LOC_CFPUREGISTER then
                 location.register:=left.location.register
                 location.register:=left.location.register
               else
               else
@@ -159,7 +159,7 @@ interface
 
 
               current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op,
               current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op,
                  location.register,left.location.register,right.location.register),
                  location.register,left.location.register,right.location.register),
-                 cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
+                 cgsize2fpuoppostfix[def_cgsize(resultdef)]));
 
 
               location.loc:=LOC_FPUREGISTER;
               location.loc:=LOC_FPUREGISTER;
             end;
             end;
@@ -189,11 +189,11 @@ interface
         if nodetype in [equaln,unequaln] then
         if nodetype in [equaln,unequaln] then
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF,
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF,
              left.location.register,right.location.register),
              left.location.register,right.location.register),
-             cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
+             cgsize2fpuoppostfix[def_cgsize(resultdef)]))
         else
         else
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE,
           current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE,
              left.location.register,right.location.register),
              left.location.register,right.location.register),
-             cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
+             cgsize2fpuoppostfix[def_cgsize(resultdef)]));
 
 
         location_reset(location,LOC_FLAGS,OS_NO);
         location_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(false);
         location.resflags:=getresflags(false);
@@ -249,8 +249,8 @@ interface
         pass_left_right;
         pass_left_right;
         force_reg_left_right(false,false);
         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 ? }
         { operation requiring proper N, Z and C flags ? }
         if unsigned or (nodetype in [equaln,unequaln]) then
         if unsigned or (nodetype in [equaln,unequaln]) then
@@ -308,9 +308,9 @@ interface
         { handling boolean expressions }
         { handling boolean expressions }
         if not(assigned(result)) and
         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
            ) then
           expectloc:=LOC_FLAGS;
           expectloc:=LOC_FLAGS;
       end;
       end;
@@ -325,8 +325,8 @@ interface
         pass_left_right;
         pass_left_right;
         force_reg_left_right(true,true);
         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
         if right.location.loc = LOC_CONSTANT then
           begin
           begin

+ 27 - 27
compiler/arm/narmcnv.pas

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

+ 4 - 4
compiler/arm/narmcon.pas

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

+ 7 - 7
compiler/arm/narminl.pas

@@ -165,21 +165,21 @@ implementation
     procedure tarminlinenode.second_abs_real;
     procedure tarminlinenode.second_abs_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_sqr_real;
     procedure tarminlinenode.second_sqr_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_sqrt_real;
     procedure tarminlinenode.second_sqrt_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
@@ -187,27 +187,27 @@ implementation
     procedure tarminlinenode.second_arctan_real;
     procedure tarminlinenode.second_arctan_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_ln_real;
     procedure tarminlinenode.second_ln_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
     procedure tarminlinenode.second_cos_real;
     procedure tarminlinenode.second_cos_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_sin_real;
     procedure tarminlinenode.second_sin_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
     }
     }
 
 

+ 3 - 3
compiler/arm/narmmat.pas

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

+ 44 - 44
compiler/browcol.pas

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

+ 10 - 10
compiler/browlog.pas

@@ -339,12 +339,12 @@ implementation
               case sym.typ of
               case sym.typ of
                 typesym :
                 typesym :
                   begin
                   begin
-                     if ttypesym(sym).restype.def.deftype in [recorddef,objectdef] then
+                     if ttypesym(sym).typedef.deftype in [recorddef,objectdef] then
                        begin
                        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
                           else
-                            symt:=tobjectdef(ttypesym(sym).restype.def).symtable;
+                            symt:=tobjectdef(ttypesym(sym).typedef).symtable;
                           sym:=tstoredsym(symt.search(ss));
                           sym:=tstoredsym(symt.search(ss));
                           if sym=nil then
                           if sym=nil then
                             sym:=tstoredsym(symt.search(upper(ss)));
                             sym:=tstoredsym(symt.search(upper(ss)));
@@ -355,9 +355,9 @@ implementation
                 paravarsym,
                 paravarsym,
                 fieldvarsym :
                 fieldvarsym :
                   begin
                   begin
-                     if tabstractvarsym(sym).vartype.def.deftype in [recorddef,objectdef] then
+                     if tabstractvarsym(sym).vardef.deftype in [recorddef,objectdef] then
                        begin
                        begin
-                          symt:=tabstractvarsym(sym).vartype.def.getsymtable(gs_record);
+                          symt:=tabstractvarsym(sym).vardef.getsymtable(gs_record);
                           sym:=tstoredsym(symt.search(ss));
                           sym:=tstoredsym(symt.search(ss));
                           if sym=nil then
                           if sym=nil then
                             sym:=tstoredsym(symt.search(upper(ss)));
                             sym:=tstoredsym(symt.search(upper(ss)));
@@ -453,10 +453,10 @@ implementation
               case hp.typ of
               case hp.typ of
                 typesym :
                 typesym :
                   begin
                   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;
                   end;
                 procsym :
                 procsym :
                     Tprocsym(hp).foreach_procdef_static(@writelocalsymtables,nil);
                     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);
     procedure tcg.g_rangecheck(list: TAsmList; const l:tlocation;fromdef,todef: tdef);
     { generate range checking code for the value at location p. The type     }
     { 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   }
     { is the original type used at that location. When both defs are equal   }
     { the check is also insert (needed for succ,pref,inc,dec)                }
     { the check is also insert (needed for succ,pref,inc,dec)                }
       const
       const
@@ -2642,10 +2642,10 @@ implementation
         getrange(todef,lto,hto);
         getrange(todef,lto,hto);
         from_signed := is_signed(fromdef);
         from_signed := is_signed(fromdef);
         to_signed := is_signed(todef);
         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)   }
         { (only change now, since getrange needs the arraydef)   }
         if (todef.deftype = arraydef) then
         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 }
         { 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          }
         { (if we have a 32bit processor) or int64/qword, since such          }

+ 2 - 2
compiler/dbgbase.pas

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

+ 37 - 37
compiler/dbgdwarf.pas

@@ -1158,7 +1158,7 @@ end;
             DW_AT_byte_size,DW_FORM_udata,size,
             DW_AT_byte_size,DW_FORM_udata,size,
             DW_AT_stride_size,DW_FORM_udata,elesize
             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
         if is_dynamic_array(def) then
           begin
           begin
             { !!! FIXME !!! }
             { !!! FIXME !!! }
@@ -1177,7 +1177,7 @@ end;
               DW_AT_lower_bound,DW_FORM_udata,0,
               DW_AT_lower_bound,DW_FORM_udata,0,
               DW_AT_upper_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;
             finish_entry;
           end
           end
         else
         else
@@ -1188,7 +1188,7 @@ end;
               DW_AT_lower_bound,DW_FORM_sdata,def.lowrange,
               DW_AT_lower_bound,DW_FORM_sdata,def.lowrange,
               DW_AT_upper_bound,DW_FORM_sdata,def.highrange
               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;
             finish_entry;
           end;
           end;
         finish_children;
         finish_children;
@@ -1216,7 +1216,7 @@ end;
       begin
       begin
         append_entry(DW_TAG_pointer_type,false,[]);
         append_entry(DW_TAG_pointer_type,false,[]);
         if not(is_voidpointer(def)) then
         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;
         finish_entry;
       end;
       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_8bit(ord(DW_OP_plus_uconst)));
               current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(0));
               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;
               finish_entry;
 
 
               { string data entry }
               { string data entry }
@@ -1270,22 +1270,22 @@ end;
                 DW_AT_byte_size,DW_FORM_udata,def.size,
                 DW_AT_byte_size,DW_FORM_udata,def.size,
                 DW_AT_stride_size,DW_FORM_udata,1*8
                 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;
               finish_entry;
               append_entry(DW_TAG_subrange_type,false,[
               append_entry(DW_TAG_subrange_type,false,[
                 DW_AT_lower_bound,DW_FORM_udata,0,
                 DW_AT_lower_bound,DW_FORM_udata,0,
                 DW_AT_upper_bound,DW_FORM_udata,slen
                 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_entry;
               finish_children;
               finish_children;
             end;
             end;
           st_longstring:
           st_longstring:
             begin
             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;;',
               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]);
                           [tostr(def.len+5),longst,tostr(def.len),charst,tostr(def.len*8),bytest]);
             }
             }
@@ -1294,14 +1294,14 @@ end;
            begin
            begin
              { looks like a pchar }
              { looks like a pchar }
              append_entry(DW_TAG_pointer_type,false,[]);
              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;
              finish_entry;
            end;
            end;
          st_widestring:
          st_widestring:
            begin
            begin
              { looks like a pwidechar }
              { looks like a pwidechar }
              append_entry(DW_TAG_pointer_type,false,[]);
              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;
              finish_entry;
            end;
            end;
         end;
         end;
@@ -1322,8 +1322,8 @@ end;
             append_entry(DW_TAG_subroutine_type,true,[
             append_entry(DW_TAG_subroutine_type,true,[
               DW_AT_prototyped,DW_FORM_flag,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;
           finish_entry;
 
 
           { write parameters }
           { write parameters }
@@ -1332,7 +1332,7 @@ end;
               append_entry(DW_TAG_formal_parameter,false,[
               append_entry(DW_TAG_formal_parameter,false,[
                 DW_AT_name,DW_FORM_string,symname(tsym(def.paras[i]))+#0
                 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;
               finish_entry;
             end;
             end;
 
 
@@ -1423,7 +1423,7 @@ end;
           variantdef :
           variantdef :
             appenddef_variant(tvariantdef(def));
             appenddef_variant(tvariantdef(def));
           classrefdef :
           classrefdef :
-            appenddef_pointer(tpointerdef(pvmttype.def));
+            appenddef_pointer(tpointerdef(pvmttype));
           setdef :
           setdef :
             appenddef_set(tsetdef(def));
             appenddef_set(tsetdef(def));
           formaldef :
           formaldef :
@@ -1507,8 +1507,8 @@ end;
             { append block data }
             { append block data }
             { current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(dwarf_reg(pd.))); }
             { 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 }
             { mark end of procedure }
             current_asmdata.getlabel(procendlabel,alt_dbgtype);
             current_asmdata.getlabel(procendlabel,alt_dbgtype);
@@ -1524,16 +1524,16 @@ end;
                 if tabstractnormalvarsym(pd.funcretsym).localloc.loc=LOC_REFERENCE then
                 if tabstractnormalvarsym(pd.funcretsym).localloc.loc=LOC_REFERENCE then
                   begin
                   begin
 {$warning Need to add gdb support for ret in param register calling}
 {$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*'
                       hs:='X*'
                     else
                     else
                       hs:='X';
                       hs:='X';
                     templist.concat(Tai_stab.create(stab_stabs,strpnew(
                     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))));
                        tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset))));
                     if (m_result in aktmodeswitches) then
                     if (m_result in aktmodeswitches) then
                       templist.concat(Tai_stab.create(stab_stabs,strpnew(
                       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))));
                          tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset))));
                   end;
                   end;
               end;
               end;
@@ -1647,7 +1647,7 @@ end;
             ]);
             ]);
           { append block data }
           { append block data }
           current_asmdata.asmlists[al_dwarf_info].concatlist(templist);
           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;
           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_8bit(ord(DW_OP_plus_uconst)));
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(sym.fieldoffset));
           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;
           finish_entry;
         end;
         end;
 
 
@@ -1675,9 +1675,9 @@ end;
           append_entry(DW_TAG_constant,false,[
           append_entry(DW_TAG_constant,false,[
             DW_AT_name,DW_FORM_string,symname(sym)+#0
             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
           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)));
           current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_AT_const_value)));
           case sym.consttyp of
           case sym.consttyp of
             conststring:
             conststring:
@@ -1730,7 +1730,7 @@ end;
             constreal:
             constreal:
               begin
               begin
                 current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_block1)));
                 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:
                   s32real:
                     begin
                     begin
                       current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4));
                       current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4));
@@ -1773,7 +1773,7 @@ end;
           { append block data }
           { append block data }
           current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(3));
           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));
           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;
           finish_entry;
         end;
         end;
@@ -1803,13 +1803,13 @@ end;
           append_entry(DW_TAG_typedef,false,[
           append_entry(DW_TAG_typedef,false,[
             DW_AT_name,DW_FORM_string,symname(sym)+#0
             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;
           finish_entry;
 
 
           { Moved fom append sym, do we need this (MWE)
           { Moved fom append sym, do we need this (MWE)
           { For object types write also the symtable entries }
           { 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;
         end;
 
 
@@ -1871,7 +1871,7 @@ end;
             ]);
             ]);
           { append block data }
           { append block data }
           current_asmdata.asmlists[al_dwarf_info].concatlist(templist);
           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;
           templist.free;
 
 
@@ -2160,10 +2160,10 @@ end;
         deftowritelist:=TFPObjectList.create(false);
         deftowritelist:=TFPObjectList.create(false);
 
 
         { not exported (FK)
         { 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 }
         { write start labels }
         current_asmdata.asmlists[al_dwarf_info].concat(tai_section.create(sec_debug_info,'',0));
         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
             DW_AT_byte_size,DW_FORM_data2,def.size
             ]);
             ]);
         if tfiledef(def).filetyp=ft_typed then
         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;
         finish_entry;
       end;
       end;
 
 
@@ -2686,8 +2686,8 @@ end;
           append_entry(DW_TAG_set_type,false,[
           append_entry(DW_TAG_set_type,false,[
             DW_AT_byte_size,DW_FORM_data2,def.size
             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;
         finish_entry;
       end;
       end;
 
 

+ 68 - 68
compiler/dbgstabs.pas

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

+ 55 - 55
compiler/defcmp.pas

@@ -491,13 +491,13 @@ implementation
                          ([m_tp7,m_delphi] * aktmodeswitches = [])) and
                          ([m_tp7,m_delphi] * aktmodeswitches = [])) and
                         (is_integer(def_from) or
                         (is_integer(def_from) or
                          (is_currency(def_from) and
                          (is_currency(def_from) and
-                          (s64currencytype.def.deftype = floatdef))) then
+                          (s64currencytype.deftype = floatdef))) then
                        begin
                        begin
                          doconv:=tc_int_2_real;
                          doconv:=tc_int_2_real;
                          eq:=te_convert_l1;
                          eq:=te_convert_l1;
                        end
                        end
                      else if is_currency(def_from)
                      else if is_currency(def_from)
-                             { and (s64currencytype.def.deftype = orddef)) } then
+                             { and (s64currencytype.deftype = orddef)) } then
                        begin
                        begin
                          { prefer conversion to orddef in this case, unless    }
                          { prefer conversion to orddef in this case, unless    }
                          { the orddef < currency (then it will get convert l3, }
                          { 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
                  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. }
                  true if the def types are not the same, for example with dynarray to pointer. }
                if is_open_array(def_to) and
                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
                 begin
                   doconv:=tc_equal;
                   doconv:=tc_equal;
                   eq:=te_convert_l1;
                   eq:=te_convert_l1;
@@ -628,7 +628,7 @@ implementation
                         { to dynamic array }
                         { to dynamic array }
                         else if is_dynamic_array(def_to) then
                         else if is_dynamic_array(def_to) then
                          begin
                          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
                              begin
                                { dynamic array -> dynamic array }
                                { dynamic array -> dynamic array }
                                if is_dynamic_array(def_from) then
                                if is_dynamic_array(def_from) then
@@ -650,15 +650,15 @@ implementation
                             { array constructor -> open array }
                             { array constructor -> open array }
                             if is_array_constructor(def_from) then
                             if is_array_constructor(def_from) then
                              begin
                              begin
-                               if is_void(tarraydef(def_from).elementtype.def) then
+                               if is_void(tarraydef(def_from).elementdef) then
                                 begin
                                 begin
                                   doconv:=tc_equal;
                                   doconv:=tc_equal;
                                   eq:=te_convert_l1;
                                   eq:=te_convert_l1;
                                 end
                                 end
                                else
                                else
                                 begin
                                 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]);
                                                        arrayconstructorn,hct,hpd,[cdo_check_operator]);
                                   if (subeq>=te_equal) then
                                   if (subeq>=te_equal) then
                                     begin
                                     begin
@@ -676,7 +676,7 @@ implementation
                             else
                             else
                              { dynamic array -> open array }
                              { dynamic array -> open array }
                              if is_dynamic_array(def_from) and
                              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
                                begin
                                  doconv:=tc_dynarray_2_openarray;
                                  doconv:=tc_dynarray_2_openarray;
                                  eq:=te_convert_l2;
                                  eq:=te_convert_l2;
@@ -684,12 +684,12 @@ implementation
                             else
                             else
                              { open array -> open array }
                              { open array -> open array }
                              if is_open_array(def_from) and
                              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
                                eq:=te_equal
                             else
                             else
                              { array -> open array }
                              { array -> open array }
                              if not(cdo_parameter in cdoptions) and
                              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;
                                eq:=te_equal;
                           end
                           end
                         else
                         else
@@ -703,7 +703,7 @@ implementation
                              end
                              end
                             else
                             else
                              { array of tvarrec -> array of const }
                              { 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
                               begin
                                 doconv:=tc_equal;
                                 doconv:=tc_equal;
                                 eq:=te_convert_l1;
                                 eq:=te_convert_l1;
@@ -724,7 +724,7 @@ implementation
                             { open array -> array }
                             { open array -> array }
                             if not(cdo_parameter in cdoptions) and
                             if not(cdo_parameter in cdoptions) and
                                is_open_array(def_from) 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
                               begin
                                 eq:=te_equal
                                 eq:=te_equal
                               end
                               end
@@ -734,8 +734,8 @@ implementation
                                 not(m_delphi in aktmodeswitches) and
                                 not(m_delphi in aktmodeswitches) and
                                 (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and
                                 (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and
                                 (tarraydef(def_from).highrange=tarraydef(def_to).highrange) 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
                               begin
                                 eq:=te_equal
                                 eq:=te_equal
                               end;
                               end;
@@ -753,7 +753,7 @@ implementation
                          end
                          end
                         else
                         else
                          if is_zero_based_array(def_to) and
                          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
                           begin
                             doconv:=tc_pointer_2_array;
                             doconv:=tc_pointer_2_array;
                             eq:=te_convert_l1;
                             eq:=te_convert_l1;
@@ -763,8 +763,8 @@ implementation
                       begin
                       begin
                         { string to char array }
                         { string to char array }
                         if (not is_special_array(def_to)) and
                         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
                          begin
                            doconv:=tc_string_2_chararray;
                            doconv:=tc_string_2_chararray;
                            eq:=te_convert_l1;
                            eq:=te_convert_l1;
@@ -783,7 +783,7 @@ implementation
                       begin
                       begin
                         { tvarrec -> array of const }
                         { tvarrec -> array of const }
                          if is_array_of_const(def_to) and
                          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
                           begin
                             doconv:=tc_equal;
                             doconv:=tc_equal;
                             eq:=te_convert_l1;
                             eq:=te_convert_l1;
@@ -913,7 +913,7 @@ implementation
                       { chararray to pointer }
                       { chararray to pointer }
                       if (is_zero_based_array(def_from) or
                       if (is_zero_based_array(def_from) or
                           is_open_array(def_from)) and
                           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
                         begin
                           doconv:=tc_array_2_pointer;
                           doconv:=tc_array_2_pointer;
                           { don't prefer the pchar overload when a constant
                           { don't prefer the pchar overload when a constant
@@ -941,24 +941,24 @@ implementation
                      else
                      else
                       { the types can be forward type, handle before normal type check !! }
                       { the types can be forward type, handle before normal type check !! }
                       if assigned(def_to.typesym) and
                       if assigned(def_to.typesym) and
-                         (tpointerdef(def_to).pointertype.def.deftype=forwarddef) then
+                         (tpointerdef(def_to).pointeddef.deftype=forwarddef) then
                        begin
                        begin
                          if (def_from.typesym=def_to.typesym) then
                          if (def_from.typesym=def_to.typesym) then
                           eq:=te_equal
                           eq:=te_equal
                        end
                        end
                      else
                      else
                       { same types }
                       { 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
                        begin
                          eq:=te_equal
                          eq:=te_equal
                        end
                        end
                      else
                      else
                       { child class pointer can be assigned to anchestor pointers }
                       { child class pointer can be assigned to anchestor pointers }
                       if (
                       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
                          ) then
                        begin
                        begin
                          doconv:=tc_equal;
                          doconv:=tc_equal;
@@ -966,7 +966,7 @@ implementation
                        end
                        end
                      else
                      else
                       { all pointers can be assigned to void-pointer }
                       { 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
                        begin
                          doconv:=tc_equal;
                          doconv:=tc_equal;
                          { give pwidechar,pchar a penalty so it prefers
                          { give pwidechar,pchar a penalty so it prefers
@@ -979,10 +979,10 @@ implementation
                        end
                        end
                      else
                      else
                       { all pointers can be assigned from void-pointer }
                       { 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
                       { all pointers can be assigned from void-pointer or formaldef pointer, check
                         tw3777.pp if you change this }
                         tw3777.pp if you change this }
-                        (tpointerdef(def_from).pointertype.def.deftype=formaldef) then
+                        (tpointerdef(def_from).pointeddef.deftype=formaldef) then
                        begin
                        begin
                          doconv:=tc_equal;
                          doconv:=tc_equal;
                          { give pwidechar a penalty so it prefers
                          { give pwidechar a penalty so it prefers
@@ -997,7 +997,7 @@ implementation
                    begin
                    begin
                      { procedure variable can be assigned to an void pointer,
                      { procedure variable can be assigned to an void pointer,
                        this not allowed for methodpointers }
                        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
                          (m_mac_procvar in aktmodeswitches)) and
                         tprocvardef(def_from).is_addressonly then
                         tprocvardef(def_from).is_addressonly then
                       begin
                       begin
@@ -1026,8 +1026,8 @@ implementation
                          is_class_or_interface(def_from) or
                          is_class_or_interface(def_from) or
                          (def_from.deftype=classrefdef)
                          (def_from.deftype=classrefdef)
                         ) and
                         ) 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
                        begin
                          doconv:=tc_equal;
                          doconv:=tc_equal;
                          eq:=te_convert_l2;
                          eq:=te_convert_l2;
@@ -1041,11 +1041,11 @@ implementation
                case def_from.deftype of
                case def_from.deftype of
                  setdef :
                  setdef :
                    begin
                    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
                       begin
                         { sets with the same element base type are equal }
                         { 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;
                          eq:=te_equal;
                       end
                       end
                      else
                      else
@@ -1098,7 +1098,7 @@ implementation
                       { for example delphi allows the assignement from pointers }
                       { for example delphi allows the assignement from pointers }
                       { to procedure variables                                  }
                       { to procedure variables                                  }
                       if (m_pointer_2_procedure in aktmodeswitches) and
                       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
                          tprocvardef(def_to).is_addressonly then
                        begin
                        begin
                          doconv:=tc_equal;
                          doconv:=tc_equal;
@@ -1185,7 +1185,7 @@ implementation
              begin
              begin
                { similar to pointerdef wrt forwards }
                { similar to pointerdef wrt forwards }
                if assigned(def_to.typesym) and
                if assigned(def_to.typesym) and
-                  (tclassrefdef(def_to).pointertype.def.deftype=forwarddef) then
+                  (tclassrefdef(def_to).pointeddef.deftype=forwarddef) then
                  begin
                  begin
                    if (def_from.typesym=def_to.typesym) then
                    if (def_from.typesym=def_to.typesym) then
                     eq:=te_equal;
                     eq:=te_equal;
@@ -1194,7 +1194,7 @@ implementation
                 { class reference types }
                 { class reference types }
                 if (def_from.deftype=classrefdef) then
                 if (def_from.deftype=classrefdef) then
                  begin
                  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
                     begin
                       eq:=te_equal;
                       eq:=te_equal;
                     end
                     end
@@ -1202,8 +1202,8 @@ implementation
                     begin
                     begin
                       doconv:=tc_equal;
                       doconv:=tc_equal;
                       if (cdo_explicit in cdoptions) or
                       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;
                         eq:=te_convert_l1;
                     end;
                     end;
                  end
                  end
@@ -1231,20 +1231,20 @@ implementation
                    begin
                    begin
                      if
                      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
                         ) 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
                         ) or
                         (
                         (
                          (tfiledef(def_from).filetyp = ft_typed) and
                          (tfiledef(def_from).filetyp = ft_typed) and
                          (tfiledef(def_to).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
                         ) then
                       begin
                       begin
@@ -1414,8 +1414,8 @@ implementation
              currpara2:=tparavarsym(para2[i2]);
              currpara2:=tparavarsym(para2[i2]);
 
 
              { Unique types must match exact }
              { 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;
                exit;
 
 
              { Handle hidden parameters separately, because self is
              { Handle hidden parameters separately, because self is
@@ -1432,7 +1432,7 @@ implementation
                  begin
                  begin
                    if (currpara1.varspez<>currpara2.varspez) then
                    if (currpara1.varspez<>currpara2.varspez) then
                     exit;
                     exit;
-                   eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                   eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                         convtype,hpd,cdoptions);
                                         convtype,hpd,cdoptions);
                  end;
                  end;
               end
               end
@@ -1447,28 +1447,28 @@ implementation
                             (currpara2.varspez in [vs_var,vs_out]))
                             (currpara2.varspez in [vs_var,vs_out]))
                           ) then
                           ) then
                          exit;
                          exit;
-                       eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                       eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                             convtype,hpd,cdoptions);
                                             convtype,hpd,cdoptions);
                     end;
                     end;
                   cp_all :
                   cp_all :
                     begin
                     begin
                        if (currpara1.varspez<>currpara2.varspez) then
                        if (currpara1.varspez<>currpara2.varspez) then
                          exit;
                          exit;
-                       eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                       eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                             convtype,hpd,cdoptions);
                                             convtype,hpd,cdoptions);
                     end;
                     end;
                   cp_procvar :
                   cp_procvar :
                     begin
                     begin
                        if (currpara1.varspez<>currpara2.varspez) then
                        if (currpara1.varspez<>currpara2.varspez) then
                          exit;
                          exit;
-                       eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                       eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                             convtype,hpd,cdoptions);
                                             convtype,hpd,cdoptions);
                        { Parameters must be at least equal otherwise the are incompatible }
                        { Parameters must be at least equal otherwise the are incompatible }
                        if (eq<te_equal) then
                        if (eq<te_equal) then
                          eq:=te_incompatible;
                          eq:=te_incompatible;
                     end;
                     end;
                   else
                   else
-                    eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
+                    eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn,
                                          convtype,hpd,cdoptions);
                                          convtype,hpd,cdoptions);
                  end;
                  end;
                end;
                end;
@@ -1527,7 +1527,7 @@ implementation
            exclude(po_comp,po_varargs);
            exclude(po_comp,po_varargs);
          if (def1.proccalloption=def2.proccalloption) and
          if (def1.proccalloption=def2.proccalloption) and
             ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) 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
           begin
             { return equal type based on the parameters, but a proc->procvar
             { return equal type based on the parameters, but a proc->procvar
               is never exact, so map an exact match of the parameters to
               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 }
     {# Returns basetype of the specified integer range }
     function range_to_basetype(l,h:TConstExprInt):tbasetype;
     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 }
     {# Returns true, if definition defines an integer type }
     function is_integer(def : tdef) : boolean;
     function is_integer(def : tdef) : boolean;
@@ -245,13 +245,13 @@ implementation
     { returns true, if def is a currency type }
     { returns true, if def is a currency type }
     function is_currency(def : tdef) : boolean;
     function is_currency(def : tdef) : boolean;
       begin
       begin
-         case s64currencytype.def.deftype of
+         case s64currencytype.deftype of
            orddef :
            orddef :
              result:=(def.deftype=orddef) and
              result:=(def.deftype=orddef) and
-                     (torddef(s64currencytype.def).typ=torddef(def).typ);
+                     (torddef(s64currencytype).typ=torddef(def).typ);
            floatdef :
            floatdef :
              result:=(def.deftype=floatdef) and
              result:=(def.deftype=floatdef) and
-                     (tfloatdef(s64currencytype.def).typ=tfloatdef(def).typ);
+                     (tfloatdef(s64currencytype).typ=tfloatdef(def).typ);
            else
            else
              internalerror(200304222);
              internalerror(200304222);
          end;
          end;
@@ -309,29 +309,29 @@ implementation
       end;
       end;
 
 
 
 
-    procedure range_to_type(l,h:TConstExprInt;var tt:ttype);
+    procedure range_to_type(l,h:TConstExprInt;var def:tdef);
       begin
       begin
         { prefer signed over unsigned }
         { prefer signed over unsigned }
         if (l>=-128) and (h<=127) then
         if (l>=-128) and (h<=127) then
-         tt:=s8inttype
+         def:=s8inttype
         else if (l>=0) and (h<=255) then
         else if (l>=0) and (h<=255) then
-         tt:=u8inttype
+         def:=u8inttype
         else if (l>=-32768) and (h<=32767) then
         else if (l>=-32768) and (h<=32767) then
-         tt:=s16inttype
+         def:=s16inttype
         else if (l>=0) and (h<=65535) then
         else if (l>=0) and (h<=65535) then
-         tt:=u16inttype
+         def:=u16inttype
         else if (l>=low(longint)) and (h<=high(longint)) then
         else if (l>=low(longint)) and (h<=high(longint)) then
-         tt:=s32inttype
+         def:=s32inttype
         else if (l>=low(cardinal)) and (h<=high(cardinal)) then
         else if (l>=low(cardinal)) and (h<=high(cardinal)) then
-         tt:=u32inttype
+         def:=u32inttype
         else
         else
-         tt:=s64inttype;
+         def:=s64inttype;
       end;
       end;
 
 
 
 
-    procedure int_to_type(v:TConstExprInt;var tt:ttype);
+    procedure int_to_type(v:TConstExprInt;var def:tdef);
       begin
       begin
-        range_to_type(v,v,tt);
+        range_to_type(v,v,def);
       end;
       end;
 
 
 
 
@@ -440,7 +440,7 @@ implementation
            enumdef :
            enumdef :
              is_signed:=tenumdef(def).min < 0;
              is_signed:=tenumdef(def).min < 0;
            arraydef :
            arraydef :
-             is_signed:=is_signed(tarraydef(def).rangetype.def);
+             is_signed:=is_signed(tarraydef(def).rangedef);
            else
            else
              is_signed:=false;
              is_signed:=false;
          end;
          end;
@@ -518,7 +518,7 @@ implementation
          { check for s32inttype is needed, because for u32bit the high
          { check for s32inttype is needed, because for u32bit the high
            range is also -1 ! (PFV) }
            range is also -1 ! (PFV) }
          result:=(p.deftype=arraydef) and
          result:=(p.deftype=arraydef) and
-                 (tarraydef(p).rangetype.def=s32inttype.def) and
+                 (tarraydef(p).rangedef=s32inttype) and
                  (tarraydef(p).lowrange=0) and
                  (tarraydef(p).lowrange=0) and
                  (tarraydef(p).highrange=-1) and
                  (tarraydef(p).highrange=-1) and
                  ((tarraydef(p).arrayoptions * [ado_IsVariant,ado_IsArrayOfConst,ado_IsConstructor,ado_IsDynamicArray])=[]);
                  ((tarraydef(p).arrayoptions * [ado_IsVariant,ado_IsArrayOfConst,ado_IsConstructor,ado_IsDynamicArray])=[]);
@@ -608,7 +608,7 @@ implementation
     function is_chararray(p : tdef) : boolean;
     function is_chararray(p : tdef) : boolean;
       begin
       begin
         is_chararray:=(p.deftype=arraydef) and
         is_chararray:=(p.deftype=arraydef) and
-                      is_char(tarraydef(p).elementtype.def) and
+                      is_char(tarraydef(p).elementdef) and
                       not(is_special_array(p));
                       not(is_special_array(p));
       end;
       end;
 
 
@@ -616,7 +616,7 @@ implementation
     function is_widechararray(p : tdef) : boolean;
     function is_widechararray(p : tdef) : boolean;
       begin
       begin
         is_widechararray:=(p.deftype=arraydef) and
         is_widechararray:=(p.deftype=arraydef) and
-                          is_widechar(tarraydef(p).elementtype.def) and
+                          is_widechar(tarraydef(p).elementdef) and
                           not(is_special_array(p));
                           not(is_special_array(p));
       end;
       end;
 
 
@@ -625,32 +625,32 @@ implementation
     function is_open_chararray(p : tdef) : boolean;
     function is_open_chararray(p : tdef) : boolean;
       begin
       begin
         is_open_chararray:= is_open_array(p) and
         is_open_chararray:= is_open_array(p) and
-                            is_char(tarraydef(p).elementtype.def);
+                            is_char(tarraydef(p).elementdef);
       end;
       end;
 
 
     { true if p is a open wide char array def }
     { true if p is a open wide char array def }
     function is_open_widechararray(p : tdef) : boolean;
     function is_open_widechararray(p : tdef) : boolean;
       begin
       begin
         is_open_widechararray:= is_open_array(p) and
         is_open_widechararray:= is_open_array(p) and
-                                is_widechar(tarraydef(p).elementtype.def);
+                                is_widechar(tarraydef(p).elementdef);
       end;
       end;
 
 
     { true if p is a pchar def }
     { true if p is a pchar def }
     function is_pchar(p : tdef) : boolean;
     function is_pchar(p : tdef) : boolean;
       begin
       begin
         is_pchar:=(p.deftype=pointerdef) and
         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;
       end;
 
 
     { true if p is a pchar def }
     { true if p is a pchar def }
     function is_pwidechar(p : tdef) : boolean;
     function is_pwidechar(p : tdef) : boolean;
       begin
       begin
         is_pwidechar:=(p.deftype=pointerdef) and
         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;
       end;
 
 
 
 
@@ -658,8 +658,8 @@ implementation
     function is_voidpointer(p : tdef) : boolean;
     function is_voidpointer(p : tdef) : boolean;
       begin
       begin
         is_voidpointer:=(p.deftype=pointerdef) and
         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;
       end;
 
 
 
 
@@ -790,13 +790,13 @@ implementation
          mmx_type:=mmxno;
          mmx_type:=mmxno;
          if is_mmx_able_array(p) then
          if is_mmx_able_array(p) then
            begin
            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:
                   s32real:
                     mmx_type:=mmxsingle;
                     mmx_type:=mmxsingle;
                 end
                 end
               else
               else
-                case torddef(tarraydef(p).elementtype.def).typ of
+                case torddef(tarraydef(p).elementdef).typ of
                    u8bit:
                    u8bit:
                      mmx_type:=mmxu8bit;
                      mmx_type:=mmxu8bit;
                    s8bit:
                    s8bit:
@@ -818,7 +818,7 @@ implementation
       begin
       begin
         result:=(p.deftype=arraydef) and
         result:=(p.deftype=arraydef) and
                 not(is_special_array(p)) 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;
       end;
 
 
 
 
@@ -828,20 +828,20 @@ implementation
 {$ifdef x86}
 {$ifdef x86}
         result:= is_vector(p) and
         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).lowrange=0) and
                    (tarraydef(p).highrange=3) and
                    (tarraydef(p).highrange=3) and
-                   (tfloatdef(tarraydef(p).elementtype.def).typ=s32real)
+                   (tfloatdef(tarraydef(p).elementdef).typ=s32real)
                   )
                   )
                  ) or
                  ) or
 
 
                  (
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=1) and
                    (tarraydef(p).highrange=1) and
-                   (tfloatdef(tarraydef(p).elementtype.def).typ=s64real)
+                   (tfloatdef(tarraydef(p).elementdef).typ=s64real)
                   )
                   )
                  );
                  );
 {$else x86}
 {$else x86}
@@ -859,29 +859,29 @@ implementation
                 not(is_special_array(p)) and
                 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).lowrange=0) and
                     (tarraydef(p).highrange=1) and
                     (tarraydef(p).highrange=1) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u32bit,s32bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u32bit,s32bit])
                    )
                    )
                    or
                    or
                    (
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=3) and
                     (tarraydef(p).highrange=3) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u16bit,s16bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u16bit,s16bit])
                    )
                    )
                   )
                   )
                  )
                  )
                  or
                  or
                 (
                 (
                  (
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=1) 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
               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).lowrange=0) and
                     (tarraydef(p).highrange=1) and
                     (tarraydef(p).highrange=1) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u32bit,s32bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u32bit,s32bit])
                    )
                    )
                    or
                    or
                    (
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=3) and
                     (tarraydef(p).highrange=3) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u16bit,s16bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u16bit,s16bit])
                    )
                    )
                    or
                    or
                    (
                    (
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).lowrange=0) and
                     (tarraydef(p).highrange=7) and
                     (tarraydef(p).highrange=7) and
-                    (torddef(tarraydef(p).elementtype.def).typ in [u8bit,s8bit])
+                    (torddef(tarraydef(p).elementdef).typ in [u8bit,s8bit])
                    )
                    )
                   )
                   )
                  )
                  )
                  or
                  or
                  (
                  (
-                  (tarraydef(p).elementtype.def.deftype=floatdef) and
+                  (tarraydef(p).elementdef.deftype=floatdef) and
                   (
                   (
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).lowrange=0) and
                    (tarraydef(p).highrange=1) 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;
         result:=false;
         case pf.parast.symindex.count of
         case pf.parast.symindex.count of
           1 : begin
           1 : begin
-                ld:=tparavarsym(pf.parast.symindex.first).vartype.def;
+                ld:=tparavarsym(pf.parast.symindex.first).vardef;
                 { assignment is a special case }
                 { assignment is a special case }
                 if optoken=_ASSIGNMENT then
                 if optoken=_ASSIGNMENT then
                   begin
                   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);
                     result:=(eq=te_incompatible);
                   end
                   end
                 else
                 else
@@ -385,8 +385,8 @@ implementation
                 for i:=1 to tok2nodes do
                 for i:=1 to tok2nodes do
                   if tok2node[i].tok=optoken then
                   if tok2node[i].tok=optoken then
                     begin
                     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:=
                       result:=
                         tok2node[i].op_overloading_supported and
                         tok2node[i].op_overloading_supported and
                         isbinaryoperatoroverloadable(tok2node[i].nod,ld,nothingn,rd,nothingn);
                         isbinaryoperatoroverloadable(tok2node[i].nod,ld,nothingn,rd,nothingn);
@@ -410,7 +410,7 @@ implementation
         operpd:=nil;
         operpd:=nil;
 
 
         { load easier access variables }
         { load easier access variables }
-        ld:=tunarynode(t).left.resulttype.def;
+        ld:=tunarynode(t).left.resultdef;
         if not isunaryoperatoroverloadable(t.nodetype,ld) then
         if not isunaryoperatoroverloadable(t.nodetype,ld) then
           exit;
           exit;
 
 
@@ -484,7 +484,7 @@ implementation
         t:=ccallnode.create(ppn,Tprocsym(operpd.procsym),nil,nil,[]);
         t:=ccallnode.create(ppn,Tprocsym(operpd.procsym),nil,nil,[]);
 
 
         { we already know the procdef to use, so it can
         { 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;
         tcallnode(t).procdefinition:=operpd;
       end;
       end;
 
 
@@ -502,8 +502,8 @@ implementation
         isbinaryoverloaded:=false;
         isbinaryoverloaded:=false;
         operpd:=nil;
         operpd:=nil;
         { load easier access variables }
         { 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
         if not isbinaryoperatoroverloadable(t.nodetype,ld,tbinarynode(t).left.nodetype,rd,tbinarynode(t).right.nodetype) then
           exit;
           exit;
 
 
@@ -630,7 +630,7 @@ implementation
         ht:=ccallnode.create(ppn,Tprocsym(operpd.procsym),nil,nil,[]);
         ht:=ccallnode.create(ppn,Tprocsym(operpd.procsym),nil,nil,[]);
 
 
         { we already know the procdef to use, so it can
         { 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;
         tcallnode(ht).procdefinition:=operpd;
 
 
         if t.nodetype=unequaln then
         if t.nodetype=unequaln then
@@ -650,7 +650,7 @@ implementation
              subscriptn:
              subscriptn:
                make_not_regable_intern(tsubscriptnode(p).left,how,true);
                make_not_regable_intern(tsubscriptnode(p).left,how,true);
             typeconvn :
             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)
                  make_not_regable_intern(ttypeconvnode(p).left,how,false)
                else
                else
                  make_not_regable_intern(ttypeconvnode(p).left,how,records_only);
                  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
               if (tloadnode(p).symtableentry.typ in [globalvarsym,localvarsym,paravarsym]) and
                  (tabstractvarsym(tloadnode(p).symtableentry).varregable <> vr_none) and
                  (tabstractvarsym(tloadnode(p).symtableentry).varregable <> vr_none) and
                  ((not records_only) or
                  ((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
                 if (tloadnode(p).symtableentry.typ = paravarsym) then
                   tabstractvarsym(tloadnode(p).symtableentry).varregable:=how
                   tabstractvarsym(tloadnode(p).symtableentry).varregable:=how
                 else
                 else
@@ -666,7 +666,7 @@ implementation
             temprefn :
             temprefn :
               if (ttemprefnode(p).tempinfo^.may_be_in_reg) and
               if (ttemprefnode(p).tempinfo^.may_be_in_reg) and
                  ((not records_only) or
                  ((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;
                 ttemprefnode(p).tempinfo^.may_be_in_reg:=false;
          end;
          end;
       end;
       end;
@@ -745,7 +745,7 @@ implementation
         if ((m_tp_procvar in aktmodeswitches) or
         if ((m_tp_procvar in aktmodeswitches) or
             (m_mac_procvar in aktmodeswitches)) and
             (m_mac_procvar in aktmodeswitches)) and
            (p.nodetype=typeconvn) and
            (p.nodetype=typeconvn) and
-           is_voidpointer(p.resulttype.def) then
+           is_voidpointer(p.resultdef) then
           p:=tunarynode(p).left;
           p:=tunarynode(p).left;
         result:=(p.nodetype=typeconvn) and
         result:=(p.nodetype=typeconvn) and
                 (ttypeconvnode(p).convtype=tc_proc_2_procvar);
                 (ttypeconvnode(p).convtype=tc_proc_2_procvar);
@@ -799,7 +799,7 @@ implementation
                end;
                end;
              subscriptn :
              subscriptn :
                begin
                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;
                    newstate := vs_read;
                  p:=tunarynode(p).left;
                  p:=tunarynode(p).left;
                end;
                end;
@@ -807,7 +807,7 @@ implementation
                begin
                begin
                  set_varstate(tbinarynode(p).right,vs_read,[vsf_must_be_valid]);
                  set_varstate(tbinarynode(p).right,vs_read,[vsf_must_be_valid]);
                  if (newstate in [vs_read,vs_readwritten]) or
                  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)
                    include(varstateflags,vsf_must_be_valid)
                  else if (newstate = vs_written) then
                  else if (newstate = vs_written) then
                    exclude(varstateflags,vsf_must_be_valid);
                    exclude(varstateflags,vsf_must_be_valid);
@@ -923,7 +923,7 @@ implementation
         gotstring:=false;
         gotstring:=false;
         hp:=p;
         hp:=p;
         if not(valid_void in opts) and
         if not(valid_void in opts) and
-           is_void(hp.resulttype.def) then
+           is_void(hp.resultdef) then
          begin
          begin
            if report_errors then
            if report_errors then
              CGMessagePos(hp.fileinfo,errmsg);
              CGMessagePos(hp.fileinfo,errmsg);
@@ -937,11 +937,11 @@ implementation
               if (hp.nodetype=calln) then
               if (hp.nodetype=calln) then
                 begin
                 begin
                   { check return type }
                   { check return type }
-                  case hp.resulttype.def.deftype of
+                  case hp.resultdef.deftype of
                     pointerdef :
                     pointerdef :
                       gotpointer:=true;
                       gotpointer:=true;
                     objectdef :
                     objectdef :
-                      gotclass:=is_class_or_interface(hp.resulttype.def);
+                      gotclass:=is_class_or_interface(hp.resultdef);
                     recorddef :
                     recorddef :
                       gotrecord:=true;
                       gotrecord:=true;
                     classrefdef :
                     classrefdef :
@@ -1016,8 +1016,8 @@ implementation
                    - from void
                    - from void
                    - from/to open array
                    - from/to open array
                    - typecast from pointer to 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
                  if not((nf_absolute in ttypeconvnode(hp).flags) or
                         (fromdef.deftype=formaldef) or
                         (fromdef.deftype=formaldef) or
                         is_void(fromdef) or
                         is_void(fromdef) or
@@ -1045,18 +1045,18 @@ implementation
                        CGMessagePos(hp.fileinfo,errmsg);
                        CGMessagePos(hp.fileinfo,errmsg);
                      exit;
                      exit;
                    end;
                    end;
-                 case hp.resulttype.def.deftype of
+                 case hp.resultdef.deftype of
                    pointerdef :
                    pointerdef :
                      gotpointer:=true;
                      gotpointer:=true;
                    objectdef :
                    objectdef :
-                     gotclass:=is_class_or_interface(hp.resulttype.def);
+                     gotclass:=is_class_or_interface(hp.resultdef);
                    classrefdef :
                    classrefdef :
                      gotclass:=true;
                      gotclass:=true;
                    arraydef :
                    arraydef :
                      begin
                      begin
                        { pointer -> array conversion is done then we need to see it
                        { pointer -> array conversion is done then we need to see it
                          as a deref, because a ^ is then not required anymore }
                          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;
                         gotderef:=true;
                      end;
                      end;
                  end;
                  end;
@@ -1067,9 +1067,9 @@ implementation
                  if { only check for first (= outermost) vec node }
                  if { only check for first (= outermost) vec node }
                     not gotvec and
                     not gotvec and
                     not(valid_packed in opts) 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
                    begin
                      if report_errors then
                      if report_errors then
                        if (valid_property in opts) then
                        if (valid_property in opts) then
@@ -1080,7 +1080,7 @@ implementation
                    end;
                    end;
                  gotvec:=true;
                  gotvec:=true;
                  { accesses to dyn. arrays override read only access in delphi }
                  { 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;
                    gotdynarray:=true;
                  hp:=tunarynode(hp).left;
                  hp:=tunarynode(hp).left;
                end;
                end;
@@ -1101,7 +1101,7 @@ implementation
                  { only check first (= outermost) subscriptn }
                  { only check first (= outermost) subscriptn }
                  if not gotsubscript and
                  if not gotsubscript and
                     not(valid_packed in opts) 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
                    begin
                      if report_errors then
                      if report_errors then
                        if (valid_property in opts) then
                        if (valid_property in opts) then
@@ -1123,7 +1123,7 @@ implementation
                  { a class/interface access is an implicit }
                  { a class/interface access is an implicit }
                  { dereferencing                           }
                  { dereferencing                           }
                  hp:=tsubscriptnode(hp).left;
                  hp:=tsubscriptnode(hp).left;
-                 if is_class_or_interface(hp.resulttype.def) then
+                 if is_class_or_interface(hp.resultdef) then
                    gotderef:=true;
                    gotderef:=true;
                end;
                end;
              muln,
              muln,
@@ -1137,8 +1137,8 @@ implementation
                begin
                begin
                  { Allow operators on a pointer, or an integer
                  { Allow operators on a pointer, or an integer
                    and a pointer typecast and deref has been found }
                    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
                     gotderef then
                   result:=true
                   result:=true
                  else
                  else
@@ -1147,7 +1147,7 @@ implementation
                    if (m_delphi in aktmodeswitches) and
                    if (m_delphi in aktmodeswitches) and
                       ((valid_addr in opts) or
                       ((valid_addr in opts) or
                        (valid_const in opts)) and
                        (valid_const in opts)) and
-                      (hp.resulttype.def.deftype=stringdef) then
+                      (hp.resultdef.deftype=stringdef) then
                      result:=true
                      result:=true
                  else
                  else
                   if report_errors then
                   if report_errors then
@@ -1177,12 +1177,12 @@ implementation
              calln :
              calln :
                begin
                begin
                  { check return type }
                  { check return type }
-                 case hp.resulttype.def.deftype of
+                 case hp.resultdef.deftype of
                    arraydef :
                    arraydef :
                      begin
                      begin
                        { dynamic arrays are allowed when there is also a
                        { dynamic arrays are allowed when there is also a
                          vec node }
                          vec node }
-                       if is_dynamic_array(hp.resulttype.def) and
+                       if is_dynamic_array(hp.resultdef) and
                           gotvec then
                           gotvec then
                         begin
                         begin
                           gotderef:=true;
                           gotderef:=true;
@@ -1192,7 +1192,7 @@ implementation
                    pointerdef :
                    pointerdef :
                      gotpointer:=true;
                      gotpointer:=true;
                    objectdef :
                    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 }
                    recorddef, { handle record like class it needs a subscription }
                    classrefdef :
                    classrefdef :
                      gotclass:=true;
                      gotclass:=true;
@@ -1211,7 +1211,7 @@ implementation
                    delphi only }
                    delphi only }
                    if (m_delphi in aktmodeswitches) and
                    if (m_delphi in aktmodeswitches) and
                       (valid_addr in opts) and
                       (valid_addr in opts) and
-                      (hp.resulttype.def.deftype=stringdef) then
+                      (hp.resultdef.deftype=stringdef) then
                      result:=true
                      result:=true
                  else
                  else
                    if ([valid_const,valid_addr] * opts = [valid_const]) then
                    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;
     function  valid_for_formal_const(p : tnode; report_errors: boolean) : boolean;
       begin
       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);
           valid_for_assign(p,[valid_void,valid_const],report_errors);
       end;
       end;
 
 
@@ -1385,10 +1385,10 @@ implementation
               if is_open_array(def_to) then
               if is_open_array(def_to) then
                 begin
                 begin
                   if is_dynamic_array(def_from) and
                   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
                     eq:=te_convert_l2
                   else
                   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;
                       eq:=te_convert_l2;
                 end;
                 end;
             end;
             end;
@@ -1449,19 +1449,19 @@ implementation
               { to support ansi/long/wide strings in a proper way }
               { to support ansi/long/wide strings in a proper way }
               { string and string[10] are assumed as equal }
               { string and string[10] are assumed as equal }
               { when searching the correct overloaded procedure   }
               { 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
                 eq:=te_equal
               else
               else
               { Passing a constant char to ansistring or shortstring or
               { Passing a constant char to ansistring or shortstring or
                 a widechar to widestring then handle it as equal. }
                 a widechar to widestring then handle it as equal. }
                if (p.left.nodetype=ordconstn) and
                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))
                    (is_shortstring(def_to) or is_ansistring(def_to))
                   ) or
                   ) or
                   (
                   (
-                   is_widechar(p.resulttype.def) and
+                   is_widechar(p.resultdef) and
                    is_widestring(def_to)
                    is_widestring(def_to)
                   ) then
                   ) then
                 eq:=te_equal
                 eq:=te_equal
@@ -1469,9 +1469,9 @@ implementation
           setdef :
           setdef :
             begin
             begin
               { set can also be a not yet converted array constructor }
               { 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;
                 eq:=te_equal;
             end;
             end;
           procvardef :
           procvardef :
@@ -1686,7 +1686,7 @@ implementation
         FParalength:=0;
         FParalength:=0;
         while assigned(pt) do
         while assigned(pt) do
          begin
          begin
-           if pt.resulttype.def.deftype=variantdef then
+           if pt.resultdef.deftype=variantdef then
              FAllowVariant:=true;
              FAllowVariant:=true;
            inc(FParalength);
            inc(FParalength);
            pt:=tcallparanode(pt.right);
            pt:=tcallparanode(pt.right);
@@ -1812,7 +1812,7 @@ implementation
            begin
            begin
              if result<>'' then
              if result<>'' then
               result:=','+result;
               result:=','+result;
-             result:=p.resulttype.def.typename+result;
+             result:=p.resultdef.typename+result;
              p:=tcallparanode(p.right);
              p:=tcallparanode(p.right);
            end;
            end;
         end;
         end;
@@ -1845,7 +1845,7 @@ implementation
                begin
                begin
                  currpara:=tparavarsym(hp^.data.paras[i]);
                  currpara:=tparavarsym(hp^.data.paras[i]);
                  if not(vo_is_hidden_para in currpara.varoptions) then
                  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;
             end;
             end;
            hp:=hp^.next;
            hp:=hp^.next;
@@ -1897,8 +1897,8 @@ implementation
               releasecurrpt:=false;
               releasecurrpt:=false;
               { retrieve current parameter definitions to compares }
               { retrieve current parameter definitions to compares }
               eq:=te_incompatible;
               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
               if not(assigned(def_from)) then
                internalerror(200212091);
                internalerror(200212091);
               if not(
               if not(
@@ -1910,14 +1910,14 @@ implementation
 
 
               { Convert tp procvars when not expecting a procvar }
               { Convert tp procvars when not expecting a procvar }
               if (def_to.deftype<>procvardef) and
               if (def_to.deftype<>procvardef) and
-                 (currpt.left.resulttype.def.deftype=procvardef) then
+                 (currpt.left.resultdef.deftype=procvardef) then
                 begin
                 begin
                   releasecurrpt:=true;
                   releasecurrpt:=true;
                   currpt:=tcallparanode(pt.getcopy);
                   currpt:=tcallparanode(pt.getcopy);
                   if maybe_call_procvar(currpt.left,true) then
                   if maybe_call_procvar(currpt.left,true) then
                     begin
                     begin
-                      currpt.resulttype:=currpt.left.resulttype;
-                      def_from:=currpt.left.resulttype.def;
+                      currpt.resultdef:=currpt.left.resultdef;
+                      def_from:=currpt.left.resultdef;
                     end;
                     end;
                 end;
                 end;
 
 
@@ -1927,14 +1927,14 @@ implementation
                temporary returned the first procdef (PFV) }
                temporary returned the first procdef (PFV) }
              if (def_to.deftype=procvardef) and
              if (def_to.deftype=procvardef) and
                 (currpt.left.nodetype=loadn) and
                 (currpt.left.nodetype=loadn) and
-                (currpt.left.resulttype.def.deftype=procdef) then
+                (currpt.left.resultdef.deftype=procdef) then
                begin
                begin
                  pdtemp:=tprocsym(Tloadnode(currpt.left).symtableentry).search_procdef_byprocvardef(Tprocvardef(def_to));
                  pdtemp:=tprocsym(Tloadnode(currpt.left).symtableentry).search_procdef_byprocvardef(Tprocvardef(def_to));
                  if assigned(pdtemp) then
                  if assigned(pdtemp) then
                    begin
                    begin
                      tloadnode(currpt.left).setprocdef(pdtemp);
                      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;
                end;
                end;
 
 
@@ -2041,7 +2041,7 @@ implementation
                         eq:=te_incompatible;
                         eq:=te_incompatible;
                         { var_para_allowed will return te_equal and te_convert_l1 to
                         { var_para_allowed will return te_equal and te_convert_l1 to
                           make a difference for best matching }
                           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
                       end
                     else
                     else
                       para_allowed(eq,currpt,def_to);
                       para_allowed(eq,currpt,def_to);
@@ -2276,18 +2276,18 @@ implementation
         if wrongpara.varspez in [vs_var,vs_out] then
         if wrongpara.varspez in [vs_var,vs_out] then
           begin
           begin
             { Maybe passing the correct type but passing a const to var parameter }
             { 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
                not valid_for_var(pt.left,true) then
               CGMessagePos(pt.left.fileinfo,type_e_variable_id_expected)
               CGMessagePos(pt.left.fileinfo,type_e_variable_id_expected)
             else
             else
               CGMessagePos3(pt.left.fileinfo,parser_e_call_by_ref_without_typeconv,tostr(hp^.wrongparanr),
               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
           end
         else
         else
           CGMessagePos3(pt.left.fileinfo,type_e_wrong_parameter_type,tostr(hp^.wrongparanr),
           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;
       end;
 
 
 
 
@@ -2312,12 +2312,12 @@ implementation
         if assigned(destdef) and
         if assigned(destdef) and
           (destdef.deftype in [enumdef,orddef,floatdef]) and
           (destdef.deftype in [enumdef,orddef,floatdef]) and
           not is_boolean(destdef) 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
           not is_constrealnode(source) then
          begin
          begin
-           if (destdef.size < source.resulttype.def.size) then
+           if (destdef.size < source.resultdef.size) then
              begin
              begin
                if (cs_check_range in aktlocalswitches) then
                if (cs_check_range in aktlocalswitches) then
                  MessagePos(location,type_w_smaller_possible_range_check)
                  MessagePos(location,type_w_smaller_possible_range_check)

+ 1 - 1
compiler/i386/aopt386.pas

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

+ 1 - 1
compiler/i386/cgcpu.pas

@@ -309,7 +309,7 @@ unit cgcpu;
                 (not use_fixed_stack)  then
                 (not use_fixed_stack)  then
          begin
          begin
            { complex return values are removed from stack in C code PM }
            { 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
                                        current_procinfo.procdef.proccalloption) then
              list.concat(Taicpu.Op_const(A_RET,S_W,sizeof(aint)))
              list.concat(Taicpu.Op_const(A_RET,S_W,sizeof(aint)))
            else
            else

+ 11 - 11
compiler/i386/cpupara.pas

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

+ 10 - 10
compiler/i386/daopt386.pas

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

+ 8 - 8
compiler/i386/n386add.pas

@@ -69,10 +69,10 @@ interface
         op2:=A_NONE;
         op2:=A_NONE;
         mboverflow:=false;
         mboverflow:=false;
         opsize:=S_L;
         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
         case nodetype of
           addn :
           addn :
             begin
             begin
@@ -261,10 +261,10 @@ interface
 
 
         pass_left_right;
         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?  }
         { left and right no register?  }
         { then one must be demanded    }
         { then one must be demanded    }

+ 7 - 7
compiler/i386/n386mat.pas

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

+ 10 - 10
compiler/i386/n386mem.pas

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

+ 2 - 2
compiler/i386/n386set.pas

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

+ 1 - 1
compiler/m68k/cgcpu.pas

@@ -1053,7 +1053,7 @@ unit cgcpu;
          if current_procinfo.procdef.proccalloption in clearstack_pocalls then
          if current_procinfo.procdef.proccalloption in clearstack_pocalls then
            begin
            begin
              { complex return values are removed from stack in C code PM }
              { 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))
                list.concat(taicpu.op_const(A_RTD,S_NO,4))
              else
              else
                list.concat(taicpu.op_none(A_RTS,S_NO));
                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
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
           retcgsize:=OS_ADDR
         else
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
 
 
@@ -202,13 +202,13 @@ unit cpupara;
          end;
          end;
 
 
         { void has no location }
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
           begin
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             location_reset(p.funcretloc[side],LOC_VOID,OS_NO);
             exit;
             exit;
           end;
           end;
         { Return in FPU register? }
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -216,7 +216,7 @@ unit cpupara;
           end
           end
         else
         else
          { Return in register? }
          { 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
           begin
             if retcgsize in [OS_64,OS_S64] then
             if retcgsize in [OS_64,OS_S64] then
              begin
              begin
@@ -288,7 +288,7 @@ unit cpupara;
         for i:=0 to p.paras.count-1 do
         for i:=0 to p.paras.count-1 do
           begin
           begin
             hp:=tparavarsym(paras[i]);
             hp:=tparavarsym(paras[i]);
-	    paradef:=hp.vartype.def;
+	    paradef:=hp.vardef;
 	
 	
 	    { syscall for AmigaOS can have already a paraloc set }
 	    { syscall for AmigaOS can have already a paraloc set }
             if (vo_has_explicit_paraloc in hp.varoptions) then
             if (vo_has_explicit_paraloc in hp.varoptions) then
@@ -316,7 +316,7 @@ unit cpupara;
                is_open_array(paradef) or
                is_open_array(paradef) or
                is_array_of_const(paradef) then
                is_array_of_const(paradef) then
               begin
               begin
-                paradef:=voidpointertype.def;
+                paradef:=voidpointertype;
                 loc:=LOC_REGISTER;
                 loc:=LOC_REGISTER;
                 paracgsize := OS_ADDR;
                 paracgsize := OS_ADDR;
                 paralen := tcgsize2size[OS_ADDR];
                 paralen := tcgsize2size[OS_ADDR];
@@ -489,7 +489,7 @@ unit cpupara;
               p.paraloc[callerside].alignment:=4;
               p.paraloc[callerside].alignment:=4;
               paraloc:=p.paraloc[callerside].add_location;
               paraloc:=p.paraloc[callerside].add_location;
               paraloc^.loc:=LOC_REGISTER;
               paraloc^.loc:=LOC_REGISTER;
-              paraloc^.size:=def_cgsize(p.vartype.def);
+              paraloc^.size:=def_cgsize(p.vardef);
               { pattern is always uppercase'd }
               { pattern is always uppercase'd }
               if s='D0' then
               if s='D0' then
                 paraloc^.register:=NR_D0
                 paraloc^.register:=NR_D0

+ 9 - 9
compiler/m68k/n68kadd.pas

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

+ 12 - 12
compiler/m68k/n68kcnv.pas

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

+ 12 - 12
compiler/m68k/n68kmat.pas

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

+ 1 - 1
compiler/m68k/ra68kmot.pas

@@ -710,7 +710,7 @@ const
                                end;
                                end;
                              typesym :
                              typesym :
                                begin
                                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);
                                       Message(asmr_e_wrong_sym_type);
                                end;
                                end;
                              else
                              else

Fișier diff suprimat deoarece este prea mare
+ 187 - 187
compiler/nadd.pas


+ 70 - 69
compiler/nbas.pas

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

+ 160 - 160
compiler/ncal.pas

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

+ 22 - 22
compiler/ncgadd.pas

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

+ 27 - 27
compiler/ncgbas.pas

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

+ 39 - 39
compiler/ncgcal.pas

@@ -67,7 +67,7 @@ interface
           procedure extra_post_call_code;virtual;
           procedure extra_post_call_code;virtual;
           procedure do_syscall;virtual;abstract;
           procedure do_syscall;virtual;abstract;
        public
        public
-          procedure pass_2;override;
+          procedure pass_generate_code;override;
        end;
        end;
 
 
 
 
@@ -123,15 +123,15 @@ implementation
 {$endif i386}
 {$endif i386}
       begin
       begin
         { we've nothing to push when the size of the parameter is 0 }
         { 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;
           exit;
 
 
         { Move flags and jump in register to make it less complex }
         { 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
         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 }
         { 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
          begin
 {$ifdef i386}
 {$ifdef i386}
            if tempcgpara.location^.loc<>LOC_REFERENCE then
            if tempcgpara.location^.loc<>LOC_REFERENCE then
@@ -153,7 +153,7 @@ implementation
              LOC_MMREGISTER,
              LOC_MMREGISTER,
              LOC_CMMREGISTER:
              LOC_CMMREGISTER:
                begin
                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
                  if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
                    begin
                    begin
                      cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
                      cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
@@ -166,7 +166,7 @@ implementation
              LOC_REFERENCE,
              LOC_REFERENCE,
              LOC_CREFERENCE :
              LOC_CREFERENCE :
                begin
                begin
-                 size:=align(left.resulttype.def.size,tempcgpara.alignment);
+                 size:=align(left.resultdef.size,tempcgpara.alignment);
                  if (not use_fixed_stack) and
                  if (not use_fixed_stack) and
                     (tempcgpara.location^.reference.index=NR_STACK_POINTER_REG) then
                     (tempcgpara.location^.reference.index=NR_STACK_POINTER_REG) then
                    cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
                    cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
@@ -324,7 +324,7 @@ implementation
                begin
                begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                  { use cg64 only for int64, not for 8 byte records }
                  { 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)
                    cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara)
                  else
                  else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -375,10 +375,10 @@ implementation
 
 
              { release memory for refcnt out parameters }
              { release memory for refcnt out parameters }
              if (parasym.varspez=vs_out) and
              if (parasym.varspez=vs_out) and
-                (left.resulttype.def.needs_inittable) then
+                (left.resultdef.needs_inittable) then
                begin
                begin
                  location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false);
                  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;
                end;
 
 
              paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
              paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
@@ -386,7 +386,7 @@ implementation
              { handle varargs first, because parasym is not valid }
              { handle varargs first, because parasym is not valid }
              if (cpf_varargs_para in callparaflags) then
              if (cpf_varargs_para in callparaflags) then
                begin
                begin
-                 if paramanager.push_addr_param(vs_value,left.resulttype.def,
+                 if paramanager.push_addr_param(vs_value,left.resultdef,
                         aktcallnode.procdefinition.proccalloption) then
                         aktcallnode.procdefinition.proccalloption) then
                    push_addr_para
                    push_addr_para
                  else
                  else
@@ -398,15 +398,15 @@ implementation
                  { don't push a node that already generated a pointer type
                  { don't push a node that already generated a pointer type
                    by address for implicit hidden parameters }
                    by address for implicit hidden parameters }
                  if (vo_is_funcret in parasym.varoptions) or
                  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
                          aktcallnode.procdefinition.proccalloption)) then
                    push_addr_para
                    push_addr_para
                  else
                  else
                    push_value_para;
                    push_value_para;
                end
                end
              { formal def }
              { formal def }
-             else if (parasym.vartype.def.deftype=formaldef) then
+             else if (parasym.vardef.deftype=formaldef) then
                begin
                begin
                   { allow passing of a constant to a const formaldef }
                   { allow passing of a constant to a const formaldef }
                   if (parasym.varspez=vs_const) and
                   if (parasym.varspez=vs_const) and
@@ -421,14 +421,14 @@ implementation
                    by address for implicit hidden parameters }
                    by address for implicit hidden parameters }
                  if (not(
                  if (not(
                          (vo_is_hidden_para in parasym.varoptions) and
                          (vo_is_hidden_para in parasym.varoptions) and
-                         (left.resulttype.def.deftype in [pointerdef,classrefdef])
+                         (left.resultdef.deftype in [pointerdef,classrefdef])
                         ) and
                         ) and
-                     paramanager.push_addr_param(parasym.varspez,parasym.vartype.def,
+                     paramanager.push_addr_param(parasym.varspez,parasym.vardef,
                          aktcallnode.procdefinition.proccalloption)) and
                          aktcallnode.procdefinition.proccalloption)) and
                      { dyn. arrays passed to an array of const must be passed by value, see tests/webtbs/tw4219.pp }
                      { dyn. arrays passed to an array of const must be passed by value, see tests/webtbs/tw4219.pp }
                      not(
                      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
                         ) then
                    begin
                    begin
                       { Passing a var parameter to a var parameter, we can
                       { Passing a var parameter to a var parameter, we can
@@ -504,7 +504,7 @@ implementation
         { structured results are easy to handle....
         { structured results are easy to handle....
           needed also when result_no_used !! }
           needed also when result_no_used !! }
         if (procdefinition.proctypeoption<>potype_constructor) and
         if (procdefinition.proctypeoption<>potype_constructor) and
-           paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
+           paramanager.ret_in_param(resultdef,procdefinition.proccalloption) then
           begin
           begin
             { Location should be setup by the funcret para }
             { Location should be setup by the funcret para }
             if location.loc<>LOC_REFERENCE then
             if location.loc<>LOC_REFERENCE then
@@ -512,7 +512,7 @@ implementation
           end
           end
         else
         else
           { ansi/widestrings must be registered, so we can dispose them }
           { ansi/widestrings must be registered, so we can dispose them }
-          if resulttype.def.needs_inittable then
+          if resultdef.needs_inittable then
             begin
             begin
               if procdefinition.funcretloc[callerside].loc<>LOC_REGISTER then
               if procdefinition.funcretloc[callerside].loc<>LOC_REGISTER then
                 internalerror(200409261);
                 internalerror(200409261);
@@ -539,10 +539,10 @@ implementation
                   { original funcretnode isn't touched -> make sure it's    }
                   { original funcretnode isn't touched -> make sure it's    }
                   { the same here (not sure if it's necessary)              }
                   { the same here (not sure if it's necessary)              }
                   tempnode := funcretnode.getcopy;
                   tempnode := funcretnode.getcopy;
-                  tempnode.pass_2;
+                  tempnode.pass_generate_code;
                   location := tempnode.location;
                   location := tempnode.location;
                   tempnode.free;
                   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);
                   cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
                end;
                end;
             end
             end
@@ -595,15 +595,15 @@ implementation
                             begin
                             begin
                               { change register size after the unget because the
                               { change register size after the unget because the
                                 getregister was done for the full register
                                 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 }
                                 it could be a constructor call }
                               if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
                               if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
                                 cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
                                 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;
                             end;
 {$ifdef arm}
 {$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
                             begin
                               location_force_mem(current_asmdata.CurrAsmList,location);
                               location_force_mem(current_asmdata.CurrAsmList,location);
                             end;
                             end;
@@ -611,7 +611,7 @@ implementation
                         end
                         end
                        else
                        else
                         begin
                         begin
-                          if resulttype.def.size>0 then
+                          if resultdef.size>0 then
                             internalerror(200305131);
                             internalerror(200305131);
                         end;
                         end;
                      end;
                      end;
@@ -648,8 +648,8 @@ implementation
           begin
           begin
             if location.loc=LOC_REFERENCE then
             if location.loc=LOC_REFERENCE then
               begin
               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)
                 tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference)
               end;
               end;
           end;
           end;
@@ -811,7 +811,7 @@ implementation
 
 
 
 
 
 
-    procedure tcgcallnode.pass_2;
+    procedure tcgcallnode.pass_generate_code;
       var
       var
         regs_to_save_int,
         regs_to_save_int,
         regs_to_save_fpu,
         regs_to_save_fpu,
@@ -833,15 +833,15 @@ implementation
          if assigned(methodpointerinit) then
          if assigned(methodpointerinit) then
            secondpass(methodpointerinit);
            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
             not assigned(funcretnode) then
            begin
            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 }
              { finalize instead of only decrref,  because if the called }
              { function throws an exception this temp will be decrref'd }
              { function throws an exception this temp will be decrref'd }
              { again (tw7100)                                           }
              { again (tw7100)                                           }
-             cg.g_finalize(current_asmdata.CurrAsmList,resulttype.def,refcountedtemp);
+             cg.g_finalize(current_asmdata.CurrAsmList,resultdef,refcountedtemp);
            end;
            end;
 
 
          regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
          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);
          regs_to_save_mm:=paramanager.get_volatile_registers_mm(procdefinition.proccalloption);
 
 
          { Include Function result registers }
          { Include Function result registers }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
           begin
           begin
             case procdefinition.funcretloc[callerside].loc of
             case procdefinition.funcretloc[callerside].loc of
               LOC_REGISTER,
               LOC_REGISTER,
@@ -894,8 +894,8 @@ implementation
                  secondpass(methodpointer);
                  secondpass(methodpointer);
 
 
                  { Load VMT from self }
                  { 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
                  else
                    begin
                    begin
                      { Load VMT value in register }
                      { Load VMT value in register }
@@ -1024,7 +1024,7 @@ implementation
             pop_size:=pushedparasize;
             pop_size:=pushedparasize;
             { for Cdecl functions we don't need to pop the funcret when it
             { for Cdecl functions we don't need to pop the funcret when it
               was pushed by para }
               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));
               dec(pop_size,sizeof(aint));
             { Remove parameters/alignment from the stack }
             { Remove parameters/alignment from the stack }
             pop_parasize(pop_size);
             pop_parasize(pop_size);
@@ -1032,7 +1032,7 @@ implementation
 
 
          { Release registers, but not the registers that contain the
          { Release registers, but not the registers that contain the
            function result }
            function result }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
            begin
            begin
              case procdefinition.funcretloc[callerside].loc of
              case procdefinition.funcretloc[callerside].loc of
                LOC_REGISTER,
                LOC_REGISTER,
@@ -1081,7 +1081,7 @@ implementation
          cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
          cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
 
 
          { handle function results }
          { handle function results }
-         if (not is_void(resulttype.def)) then
+         if (not is_void(resultdef)) then
            handle_return_value
            handle_return_value
          else
          else
            location_reset(location,LOC_VOID,OS_NO);
            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_class_to_intf;override;
          procedure second_char_to_char;override;
          procedure second_char_to_char;override;
          procedure second_nothing;override;
          procedure second_nothing;override;
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
        end;
        end;
 
 
        tcgasnode = class(tasnode)
        tcgasnode = class(tasnode)
-         procedure pass_2;override;
+         procedure pass_generate_code;override;
        end;
        end;
 
 
   implementation
   implementation
@@ -76,19 +76,19 @@ interface
         ressize,
         ressize,
         leftsize : longint;
         leftsize : longint;
       begin
       begin
-        newsize:=def_cgsize(resulttype.def);
+        newsize:=def_cgsize(resultdef);
 
 
         { insert range check if not explicit conversion }
         { insert range check if not explicit conversion }
         if not(nf_explicit in flags) then
         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
         { is the result size smaller? when typecasting from void
           we always reuse the current location, because there is
           we always reuse the current location, because there is
           nothing that we can load in a register }
           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
         if (ressize<>leftsize) and
-           not is_void(left.resulttype.def) then
+           not is_void(left.resultdef) then
           begin
           begin
             location_copy(location,left.location);
             location_copy(location,left.location);
             { reuse a loc_reference when the newsize is smaller than
             { reuse a loc_reference when the newsize is smaller than
@@ -103,7 +103,7 @@ interface
             else
             else
               location_force_reg(current_asmdata.CurrAsmList,location,newsize,false);
               location_force_reg(current_asmdata.CurrAsmList,location,newsize,false);
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
-            // if is_signed(left.resulttype) and
+            // if is_signed(left.resultdef) and
 {$endif cpu64bit}
 {$endif cpu64bit}
           end
           end
         else
         else
@@ -116,7 +116,7 @@ interface
             { which don't have 8bit register components etc) (JM)    }
             { which don't have 8bit register components etc) (JM)    }
             location_copy(location,left.location);
             location_copy(location,left.location);
             location.size:=newsize;
             location.size:=newsize;
-            orgsize := def_cgsize(left.resulttype.def);
+            orgsize := def_cgsize(left.resultdef);
             if (ressize < tcgsize2size[OS_INT]) and
             if (ressize < tcgsize2size[OS_INT]) and
                (location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
                (location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
                (orgsize <> newsize) then
                (orgsize <> newsize) then
@@ -200,12 +200,12 @@ interface
 
 
     procedure tcgtypeconvnode.second_string_to_chararray;
     procedure tcgtypeconvnode.second_string_to_chararray;
       begin
       begin
-        if is_chararray(left.resulttype.def) then
+        if is_chararray(left.resultdef) then
           begin
           begin
             location_copy(location,left.location);
             location_copy(location,left.location);
             exit;
             exit;
           end;
           end;
-        { should be handled already in resulttype pass (JM) }
+        { should be handled already in resultdef pass (JM) }
         internalerror(200108292);
         internalerror(200108292);
       end;
       end;
 
 
@@ -260,7 +260,7 @@ interface
     procedure tcgtypeconvnode.second_char_to_string;
     procedure tcgtypeconvnode.second_char_to_string;
       begin
       begin
          location_reset(location,LOC_REFERENCE,OS_NO);
          location_reset(location,LOC_REFERENCE,OS_NO);
-         case tstringdef(resulttype.def).string_typ of
+         case tstringdef(resultdef).string_typ of
            st_shortstring :
            st_shortstring :
              begin
              begin
                tg.GetTemp(current_asmdata.CurrAsmList,256,tt_normal,location.reference);
                tg.GetTemp(current_asmdata.CurrAsmList,256,tt_normal,location.reference);
@@ -268,7 +268,7 @@ interface
                  location.reference);
                  location.reference);
                location_freetemp(current_asmdata.CurrAsmList,left.location);
                location_freetemp(current_asmdata.CurrAsmList,left.location);
              end;
              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
            else
             internalerror(4179);
             internalerror(4179);
         end;
         end;
@@ -277,7 +277,7 @@ interface
 
 
     procedure tcgtypeconvnode.second_real_to_real;
     procedure tcgtypeconvnode.second_real_to_real;
       begin
       begin
-         location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+         location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
 {$ifdef x86}
 {$ifdef x86}
          { extended types in memory which should be loaded into the sse unit
          { 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
            must be converted by the fpu first, so force them to be loaded into
@@ -292,7 +292,7 @@ interface
             LOC_CFPUREGISTER:
             LOC_CFPUREGISTER:
               begin
               begin
                 location_copy(location,left.location);
                 location_copy(location,left.location);
-                location.size:=def_cgsize(resulttype.def);
+                location.size:=def_cgsize(resultdef);
                 case expectloc of
                 case expectloc of
                   LOC_FPUREGISTER:
                   LOC_FPUREGISTER:
                     ;
                     ;
@@ -308,7 +308,7 @@ interface
               begin
               begin
                  if expectloc=LOC_MMREGISTER then
                  if expectloc=LOC_MMREGISTER then
                    begin
                    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);
                      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)
                      cg.a_loadmm_loc_reg(current_asmdata.CurrAsmList,location.size,left.location,location.register,mms_movescalar)
                    end
                    end
@@ -327,7 +327,7 @@ interface
                   LOC_FPUREGISTER:
                   LOC_FPUREGISTER:
                     begin
                     begin
                       location_force_fpureg(current_asmdata.CurrAsmList,location,false);
                       location_force_fpureg(current_asmdata.CurrAsmList,location,false);
-                      location.size:=def_cgsize(resulttype.def);
+                      location.size:=def_cgsize(resultdef);
                     end;
                     end;
                   LOC_MMREGISTER:
                   LOC_MMREGISTER:
                     ;
                     ;
@@ -351,7 +351,7 @@ interface
 
 
     procedure tcgtypeconvnode.second_proc_to_procvar;
     procedure tcgtypeconvnode.second_proc_to_procvar;
       begin
       begin
-        if tabstractprocdef(resulttype.def).is_addressonly then
+        if tabstractprocdef(resultdef).is_addressonly then
           begin
           begin
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
             location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
@@ -375,9 +375,9 @@ interface
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { be accepted for var parameters                            }
          { be accepted for var parameters                            }
          if not((nf_explicit in flags) and
          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
                 (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.CurrTrueLabel:=oldTrueLabel;
          current_procinfo.CurrFalseLabel:=oldFalseLabel;
          current_procinfo.CurrFalseLabel:=oldFalseLabel;
       end;
       end;
@@ -400,7 +400,7 @@ interface
             location_copy(location,left.location);
             location_copy(location,left.location);
           end
           end
          else
          else
-           if resulttype.def.size<left.resulttype.def.size then
+           if resultdef.size<left.resultdef.size then
              second_int_to_bool
              second_int_to_bool
            else
            else
              second_bool_to_int;
              second_bool_to_int;
@@ -470,14 +470,14 @@ interface
          end;
          end;
          current_asmdata.getjumplabel(l1);
          current_asmdata.getjumplabel(l1);
          cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,location.register,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
          while assigned(hd) do
            begin
            begin
-              if hd.implementedinterfaces.searchintf(resulttype.def)<>-1 then
+              if hd.implementedinterfaces.searchintf(resultdef)<>-1 then
                 begin
                 begin
                    cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR,
                    cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR,
                      hd.implementedinterfaces.ioffsets(
                      hd.implementedinterfaces.ioffsets(
-                       hd.implementedinterfaces.searchintf(resulttype.def)),location.register);
+                       hd.implementedinterfaces.searchintf(resultdef)),location.register);
                    break;
                    break;
                 end;
                 end;
               hd:=hd.childof;
               hd:=hd.childof;
@@ -509,17 +509,17 @@ interface
           or the other way round, move to memory first to prevent
           or the other way round, move to memory first to prevent
           invalid LOC_FPUREGISTER locations }
           invalid LOC_FPUREGISTER locations }
         if (
         if (
-            (resulttype.def.deftype=floatdef) and
+            (resultdef.deftype=floatdef) and
             (location.loc=LOC_CONSTANT)
             (location.loc=LOC_CONSTANT)
            ) or
            ) or
            (
            (
-            (left.resulttype.def.deftype=floatdef) xor
-            (resulttype.def.deftype=floatdef)
+            (left.resultdef.deftype=floatdef) xor
+            (resultdef.deftype=floatdef)
            ) then
            ) then
           location_force_mem(current_asmdata.CurrAsmList,location);
           location_force_mem(current_asmdata.CurrAsmList,location);
 
 
         { but use the new size, but we don't know the size of all arrays }
         { 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;
         location.size:=newsize;
       end;
       end;
 
 
@@ -532,7 +532,7 @@ interface
 {$endif TESTOBJEXT2}
 {$endif TESTOBJEXT2}
 
 
 
 
-    procedure tcgtypeconvnode.pass_2;
+    procedure tcgtypeconvnode.pass_generate_code;
       begin
       begin
         { the boolean routines can be called with LOC_JUMP and
         { the boolean routines can be called with LOC_JUMP and
           call secondpass themselves in the helper }
           call secondpass themselves in the helper }
@@ -548,17 +548,17 @@ interface
 {$ifdef TESTOBJEXT2}
 {$ifdef TESTOBJEXT2}
          { Check explicit conversions to objects pointers !! }
          { Check explicit conversions to objects pointers !! }
          if p^.explizit and
          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
             (cs_check_range in aktlocalswitches) then
            checkobject;
            checkobject;
 {$endif TESTOBJEXT2}
 {$endif TESTOBJEXT2}
       end;
       end;
 
 
 
 
-    procedure tcgasnode.pass_2;
+    procedure tcgasnode.pass_generate_code;
       begin
       begin
         secondpass(call);
         secondpass(call);
         location_copy(location,call.location);
         location_copy(location,call.location);

+ 25 - 25
compiler/ncgcon.pas

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

+ 27 - 27
compiler/ncgflw.pas

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

+ 27 - 27
compiler/ncginl.pas

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

+ 48 - 48
compiler/ncgld.pas

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

+ 31 - 31
compiler/ncgmat.pas

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

+ 82 - 82
compiler/ncgmem.pas

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

+ 13 - 13
compiler/ncgopt.pas

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

+ 16 - 16
compiler/ncgset.pas

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

+ 52 - 52
compiler/ncgutil.pas

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

Fișier diff suprimat deoarece este prea mare
+ 219 - 218
compiler/ncnv.pas


+ 105 - 101
compiler/ncon.pas

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

+ 100 - 100
compiler/nflw.pas

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

Fișier diff suprimat deoarece este prea mare
+ 188 - 188
compiler/ninl.pas


+ 145 - 144
compiler/nld.pas

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

+ 88 - 88
compiler/nmat.pas

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

+ 103 - 103
compiler/nmem.pas

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

+ 7 - 7
compiler/nobj.pas

@@ -704,13 +704,13 @@ implementation
                                         end;
                                         end;
 
 
                                      { error, if the return types aren't equal }
                                      { 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
                                        begin
                                          if not((m_delphi in aktmodeswitches) and
                                          if not((m_delphi in aktmodeswitches) and
                                                 is_interface(_class)) then
                                                 is_interface(_class)) then

+ 34 - 33
compiler/node.pas

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

+ 28 - 28
compiler/nopt.pas

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

+ 47 - 47
compiler/nset.pas

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

+ 23 - 23
compiler/nutils.pas

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

+ 3 - 3
compiler/optcse.pas

@@ -60,12 +60,12 @@ unit optcse;
                   - temp. creation
                   - temp. creation
                   - expression calculation
                   - expression calculation
                   - assignment of expression to temp. }
                   - 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,tempnode);
                 addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                 addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
                       caddrnode.create_internal(para.left)));
                       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));
                     addstatement(deletestatement,ctempdeletenode.create(tempnode));
 
 
                 { replace next nodes by loading the temp. reference }
                 { replace next nodes by loading the temp. reference }

+ 2 - 2
compiler/opttail.pas

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

+ 1 - 1
compiler/paramgr.pas

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

+ 20 - 20
compiler/pass_1.pas

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

+ 1 - 1
compiler/pass_2.pas

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

+ 63 - 63
compiler/pdecl.pas

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

+ 29 - 30
compiler/pdecobj.pas

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

+ 85 - 90
compiler/pdecsub.pas

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

+ 102 - 104
compiler/pdecvar.pas

@@ -92,7 +92,7 @@ implementation
                         if not(sp_private in current_object_option) then
                         if not(sp_private in current_object_option) then
                           addsymref(sym);
                           addsymref(sym);
                         pl.addsym(sl_load,sym);
                         pl.addsym(sl_load,sym);
-                        def:=tfieldvarsym(sym).vartype.def;
+                        def:=tfieldvarsym(sym).vardef;
                       end;
                       end;
                     procsym :
                     procsym :
                       begin
                       begin
@@ -134,7 +134,7 @@ implementation
                                 pl.addsym(sl_subscript,sym);
                                 pl.addsym(sl_subscript,sym);
                                 case sym.typ of
                                 case sym.typ of
                                   fieldvarsym :
                                   fieldvarsym :
-                                    def:=tfieldvarsym(sym).vartype.def;
+                                    def:=tfieldvarsym(sym).vardef;
                                   else
                                   else
                                     begin
                                     begin
                                       Message1(sym_e_illegal_field,orgpattern);
                                       Message1(sym_e_illegal_field,orgpattern);
@@ -173,17 +173,17 @@ implementation
                              begin
                              begin
                                if (p.nodetype=ordconstn) then
                                if (p.nodetype=ordconstn) then
                                  begin
                                  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
                                      idx:=tordconstnode(p).value
                                    else
                                    else
-                                     IncompatibleTypes(p.resulttype.def,tarraydef(def).rangetype.def);
+                                     IncompatibleTypes(p.resultdef,tarraydef(def).rangedef);
                                  end
                                  end
                                else
                                else
                                 Message(type_e_ordinal_expr_expected)
                                 Message(type_e_ordinal_expr_expected)
                              end;
                              end;
                             p.free;
                             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
                           end
                          else
                          else
                           begin
                           begin
@@ -214,8 +214,8 @@ implementation
          p : tpropertysym;
          p : tpropertysym;
          overriden : tsym;
          overriden : tsym;
          varspez : tvarspez;
          varspez : tvarspez;
-         tt : ttype;
-         arraytype : ttype;
+         hdef : tdef;
+         arraytype : tdef;
          def : tdef;
          def : tdef;
          pt : tnode;
          pt : tnode;
          sc : TFPObjectList;
          sc : TFPObjectList;
@@ -244,7 +244,7 @@ implementation
            end;
            end;
 
 
          { method for stored must return boolean }
          { method for stored must return boolean }
-         storedprocdef.rettype:=booltype;
+         storedprocdef.returndef:=booltype;
 
 
          if token<>_ID then
          if token<>_ID then
            begin
            begin
@@ -278,7 +278,7 @@ implementation
                 sc.clear;
                 sc.clear;
                 repeat
                 repeat
                   inc(paranr);
                   inc(paranr);
-                  hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrortype,[]);
+                  hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrordef,[]);
                   readprocdef.parast.insert(hreadparavs);
                   readprocdef.parast.insert(hreadparavs);
                   sc.add(hreadparavs);
                   sc.add(hreadparavs);
                   consume(_ID);
                   consume(_ID);
@@ -289,22 +289,22 @@ implementation
                       begin
                       begin
                         consume(_OF);
                         consume(_OF);
                         { define range and type of range }
                         { define range and type of range }
-                        tt.setdef(tarraydef.create(0,-1,s32inttype));
+                        hdef:=tarraydef.create(0,-1,s32inttype);
                         { define field type }
                         { define field type }
                         single_type(arraytype,false);
                         single_type(arraytype,false);
-                        tarraydef(tt.def).setelementtype(arraytype);
+                        tarraydef(hdef).elementdef:=arraytype;
                       end
                       end
                     else
                     else
-                      single_type(tt,false);
+                      single_type(hdef,false);
                   end
                   end
                 else
                 else
-                  tt:=cformaltype;
+                  hdef:=cformaltype;
                 for i:=0 to sc.count-1 do
                 for i:=0 to sc.count-1 do
                   begin
                   begin
                     hreadparavs:=tparavarsym(sc[i]);
                     hreadparavs:=tparavarsym(sc[i]);
-                    hreadparavs.vartype:=tt;
+                    hreadparavs.vardef:=hdef;
                     { also update the writeprocdef }
                     { 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);
                     writeprocdef.parast.insert(hparavs);
                   end;
                   end;
               until not try_to_consume(_SEMICOLON);
               until not try_to_consume(_SEMICOLON);
@@ -325,7 +325,7 @@ implementation
          if (token=_COLON) or (paranr>0) or (aclass=nil) then
          if (token=_COLON) or (paranr>0) or (aclass=nil) then
            begin
            begin
               consume(_COLON);
               consume(_COLON);
-              single_type(p.proptype,false);
+              single_type(p.propdef,false);
               if (idtoken=_INDEX) then
               if (idtoken=_INDEX) then
                 begin
                 begin
                    consume(_INDEX);
                    consume(_INDEX);
@@ -334,13 +334,13 @@ implementation
                      values to s32int to be compatible with delphi, because the
                      values to s32int to be compatible with delphi, because the
                      procedure matching requires equal parameters }
                      procedure matching requires equal parameters }
                    if is_constnode(pt) and
                    if is_constnode(pt) and
-                      is_ordinal(pt.resulttype.def)
+                      is_ordinal(pt.resultdef)
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
-                      and (not is_64bitint(pt.resulttype.def))
+                      and (not is_64bitint(pt.resultdef))
 {$endif cpu64bit}
 {$endif cpu64bit}
                       then
                       then
                      begin
                      begin
-                       if is_integer(pt.resulttype.def) then
+                       if is_integer(pt.resultdef) then
                          inserttypeconv_internal(pt,s32inttype);
                          inserttypeconv_internal(pt,s32inttype);
                        p.index:=tordconstnode(pt).value;
                        p.index:=tordconstnode(pt).value;
                      end
                      end
@@ -349,15 +349,15 @@ implementation
                        Message(parser_e_invalid_property_index_value);
                        Message(parser_e_invalid_property_index_value);
                        p.index:=0;
                        p.index:=0;
                      end;
                      end;
-                   p.indextype:=pt.resulttype;
+                   p.indexdef:=pt.resultdef;
                    include(p.propoptions,ppo_indexed);
                    include(p.propoptions,ppo_indexed);
                    { concat a longint to the para templates }
                    { concat a longint to the para templates }
                    inc(paranr);
                    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);
                    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);
                    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);
                    storedprocdef.parast.insert(hparavs);
                    pt.free;
                    pt.free;
                 end;
                 end;
@@ -372,20 +372,20 @@ implementation
                 begin
                 begin
                   p.overridenpropsym:=tpropertysym(overriden);
                   p.overridenpropsym:=tpropertysym(overriden);
                   { inherit all type related entries }
                   { 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.index:=tpropertysym(overriden).index;
                   p.default:=tpropertysym(overriden).default;
                   p.default:=tpropertysym(overriden).default;
                   p.propoptions:=tpropertysym(overriden).propoptions;
                   p.propoptions:=tpropertysym(overriden).propoptions;
                 end
                 end
               else
               else
                 begin
                 begin
-                  p.proptype:=generrortype;
+                  p.propdef:=generrordef;
                   message(parser_e_no_property_found_to_override);
                   message(parser_e_no_property_found_to_override);
                 end;
                 end;
            end;
            end;
          if ((sp_published in current_object_option) or is_dispinterface(aclass)) and
          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);
            Message(parser_e_cant_publish_that_property);
 
 
          if not(is_dispinterface(aclass)) then
          if not(is_dispinterface(aclass)) then
@@ -400,14 +400,14 @@ implementation
                       procsym :
                       procsym :
                         begin
                         begin
                           { read is function returning the type of the property }
                           { read is function returning the type of the property }
-                          readprocdef.rettype:=p.proptype;
+                          readprocdef.returndef:=p.propdef;
                           { Insert hidden parameters }
                           { Insert hidden parameters }
                           handle_calling_convention(readprocdef);
                           handle_calling_convention(readprocdef);
                           { search procdefs matching readprocdef }
                           { search procdefs matching readprocdef }
                           { we ignore hidden stuff here because the property access symbol might have
                           { we ignore hidden stuff here because the property access symbol might have
                             non default calling conventions which might change the hidden stuff;
                             non default calling conventions which might change the hidden stuff;
                             see tw3216.pp (FK) }
                             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
                           if not assigned(p.readaccess.procdef) then
                             Message(parser_e_ill_property_access_sym);
                             Message(parser_e_ill_property_access_sym);
                         end;
                         end;
@@ -415,7 +415,7 @@ implementation
                         begin
                         begin
                           if not assigned(def) then
                           if not assigned(def) then
                             internalerror(200310071);
                             internalerror(200310071);
-                          if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
+                          if compare_defs(def,p.propdef,nothingn)>=te_equal then
                            begin
                            begin
                              { property parameters are allowed if this is
                              { property parameters are allowed if this is
                                an indexed property, because the index is then
                                an indexed property, because the index is then
@@ -426,7 +426,7 @@ implementation
                               Message(parser_e_ill_property_access_sym);
                               Message(parser_e_ill_property_access_sym);
                            end
                            end
                           else
                           else
-                           IncompatibleTypes(def,p.proptype.def);
+                           IncompatibleTypes(def,p.propdef);
                         end;
                         end;
                       else
                       else
                         Message(parser_e_ill_property_access_sym);
                         Message(parser_e_ill_property_access_sym);
@@ -444,14 +444,14 @@ implementation
                         begin
                         begin
                           { write is a procedure with an extra value parameter
                           { write is a procedure with an extra value parameter
                             of the of the property }
                             of the of the property }
-                          writeprocdef.rettype:=voidtype;
+                          writeprocdef.returndef:=voidtype;
                           inc(paranr);
                           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);
                           writeprocdef.parast.insert(hparavs);
                           { Insert hidden parameters }
                           { Insert hidden parameters }
                           handle_calling_convention(writeprocdef);
                           handle_calling_convention(writeprocdef);
                           { search procdefs matching 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
                           if not assigned(p.writeaccess.procdef) then
                             Message(parser_e_ill_property_access_sym);
                             Message(parser_e_ill_property_access_sym);
                         end;
                         end;
@@ -459,7 +459,7 @@ implementation
                         begin
                         begin
                           if not assigned(def) then
                           if not assigned(def) then
                             internalerror(200310072);
                             internalerror(200310072);
-                          if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
+                          if compare_defs(def,p.propdef,nothingn)>=te_equal then
                            begin
                            begin
                              { property parameters are allowed if this is
                              { property parameters are allowed if this is
                                an indexed property, because the index is then
                                an indexed property, because the index is then
@@ -470,7 +470,7 @@ implementation
                               Message(parser_e_ill_property_access_sym);
                               Message(parser_e_ill_property_access_sym);
                            end
                            end
                           else
                           else
-                           IncompatibleTypes(def,p.proptype.def);
+                           IncompatibleTypes(def,p.propdef);
                         end;
                         end;
                       else
                       else
                         Message(parser_e_ill_property_access_sym);
                         Message(parser_e_ill_property_access_sym);
@@ -523,7 +523,7 @@ implementation
                                 begin
                                 begin
                                    { Insert hidden parameters }
                                    { Insert hidden parameters }
                                    handle_calling_convention(storedprocdef);
                                    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
                                    if not assigned(p.storedaccess.procdef) then
                                      message(parser_e_ill_property_storage_sym);
                                      message(parser_e_ill_property_storage_sym);
                                 end;
                                 end;
@@ -556,16 +556,16 @@ implementation
            end;
            end;
          if try_to_consume(_DEFAULT) then
          if try_to_consume(_DEFAULT) then
            begin
            begin
-              if not(is_ordinal(p.proptype.def) or
+              if not(is_ordinal(p.propdef) or
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
-                     is_64bitint(p.proptype.def) or
+                     is_64bitint(p.propdef) or
 {$endif cpu64bit}
 {$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_indexed in p.propoptions)) or
                  (ppo_hasparameters in p.propoptions) then
                  (ppo_hasparameters in p.propoptions) then
                 begin
                 begin
@@ -579,13 +579,13 @@ implementation
                   { Get the result of the default, the firstpass is
                   { Get the result of the default, the firstpass is
                     needed to support values like -1 }
                     needed to support values like -1 }
                   pt:=comp_expr(true);
                   pt:=comp_expr(true);
-                  if (p.proptype.def.deftype=setdef) and
+                  if (p.propdef.deftype=setdef) and
                      (pt.nodetype=arrayconstructorn) then
                      (pt.nodetype=arrayconstructorn) then
                     begin
                     begin
                       arrayconstructor_to_set(pt);
                       arrayconstructor_to_set(pt);
-                      do_resulttypepass(pt);
+                      do_typecheckpass(pt);
                     end;
                     end;
-                  inserttypeconv(pt,p.proptype);
+                  inserttypeconv(pt,p.propdef);
                   if not(is_constnode(pt)) then
                   if not(is_constnode(pt)) then
                     Message(parser_e_property_default_value_must_const);
                     Message(parser_e_property_default_value_must_const);
                   { Set default value }
                   { Set default value }
@@ -611,12 +611,12 @@ implementation
          begin
          begin
            consume(_ID);
            consume(_ID);
            {$message warn unlocalized string}
            {$message warn unlocalized string}
-           if not is_interface(p.proptype.def) then
+           if not is_interface(p.propdef) then
            begin
            begin
              writeln('Implements property must have interface type');
              writeln('Implements property must have interface type');
              Message1(sym_e_illegal_field, pattern);
              Message1(sym_e_illegal_field, pattern);
            end;
            end;
-           if pattern <> p.proptype.def.mangledparaname() then
+           if pattern <> p.propdef.mangledparaname() then
            begin
            begin
              writeln('Implements-property must implement interface of correct type');
              writeln('Implements-property must implement interface of correct type');
              Message1(sym_e_illegal_field, pattern);
              Message1(sym_e_illegal_field, pattern);
@@ -649,20 +649,20 @@ implementation
       end;
       end;
 
 
 
 
-     function maybe_parse_proc_directives(const tt:ttype):boolean;
+     function maybe_parse_proc_directives(def:tdef):boolean;
        var
        var
          newtype : ttypesym;
          newtype : ttypesym;
        begin
        begin
          result:=false;
          result:=false;
          { Process procvar directives before = and ; }
          { 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
             check_proc_directive(true) then
            begin
            begin
-              newtype:=ttypesym.create('unnamed',tt);
+              newtype:=ttypesym.create('unnamed',def);
               parse_var_proc_directives(tsym(newtype));
               parse_var_proc_directives(tsym(newtype));
-              newtype.restype.def:=nil;
-              tt.def.typesym:=nil;
+              newtype.typedef:=nil;
+              def.typesym:=nil;
               newtype.free;
               newtype.free;
               result:=true;
               result:=true;
            end;
            end;
@@ -674,7 +674,7 @@ implementation
 
 
     procedure read_var_decls(options:Tvar_dec_options);
     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
         var
           vs : tabstractnormalvarsym;
           vs : tabstractnormalvarsym;
           tcsym : ttypedconstsym;
           tcsym : ttypedconstsym;
@@ -687,22 +687,22 @@ implementation
           if symtablestack.top.symtabletype=localsymtable then
           if symtablestack.top.symtabletype=localsymtable then
             begin
             begin
               consume(_EQUAL);
               consume(_EQUAL);
-              tcsym:=ttypedconstsym.createtype('$default'+vs.realname,tt,false);
+              tcsym:=ttypedconstsym.create('$default'+vs.realname,def,false);
               include(tcsym.symoptions,sp_internal);
               include(tcsym.symoptions,sp_internal);
               vs.defaultconstsym:=tcsym;
               vs.defaultconstsym:=tcsym;
               symtablestack.top.insert(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 }
               { The variable has a value assigned }
               vs.varstate:=vs_initialised;
               vs.varstate:=vs_initialised;
             end
             end
           else
           else
             begin
             begin
-              tcsym:=ttypedconstsym.createtype(vs.realname,tt,true);
+              tcsym:=ttypedconstsym.create(vs.realname,def,true);
               tcsym.fileinfo:=vs.fileinfo;
               tcsym.fileinfo:=vs.fileinfo;
               symtablestack.top.replace(vs,tcsym);
               symtablestack.top.replace(vs,tcsym);
               vs.free;
               vs.free;
               consume(_EQUAL);
               consume(_EQUAL);
-              readtypedconst(current_asmdata.asmlists[al_typedconsts],tt,tcsym,true);
+              readtypedconst(current_asmdata.asmlists[al_typedconsts],def,tcsym,true);
             end;
             end;
         end;
         end;
 
 
@@ -720,7 +720,7 @@ implementation
          extern_var,export_var : boolean;
          extern_var,export_var : boolean;
          old_current_object_option : tsymoptions;
          old_current_object_option : tsymoptions;
          hs,sorg,C_name,dll_name : string;
          hs,sorg,C_name,dll_name : string;
-         tt : ttype;
+         hdef : tdef;
          hp,pt : tnode;
          hp,pt : tnode;
          vs    : tabstractvarsym;
          vs    : tabstractvarsym;
          hintsymoptions : tsymoptions;
          hintsymoptions : tsymoptions;
@@ -749,10 +749,10 @@ implementation
                  begin
                  begin
                    case symtablestack.top.symtabletype of
                    case symtablestack.top.symtabletype of
                      localsymtable :
                      localsymtable :
-                       vs:=tlocalvarsym.create(orgpattern,vs_value,generrortype,[]);
+                       vs:=tlocalvarsym.create(orgpattern,vs_value,generrordef,[]);
                      staticsymtable,
                      staticsymtable,
                      globalsymtable :
                      globalsymtable :
-                       vs:=tglobalvarsym.create(orgpattern,vs_value,generrortype,[]);
+                       vs:=tglobalvarsym.create(orgpattern,vs_value,generrordef,[]);
                      else
                      else
                        internalerror(200411064);
                        internalerror(200411064);
                    end;
                    end;
@@ -775,11 +775,11 @@ implementation
              { this is needed for Delphi mode at least
              { this is needed for Delphi mode at least
                but should be OK for all modes !! (PM) }
                but should be OK for all modes !! (PM) }
              ignore_equal:=true;
              ignore_equal:=true;
-             read_anon_type(tt,false);
+             read_anon_type(hdef,false);
              ignore_equal:=false;
              ignore_equal:=false;
 
 
              { Process procvar directives }
              { Process procvar directives }
-             if maybe_parse_proc_directives(tt) then
+             if maybe_parse_proc_directives(hdef) then
                semicoloneaten:=true;
                semicoloneaten:=true;
 
 
              if is_gpc_name then
              if is_gpc_name then
@@ -787,7 +787,7 @@ implementation
                   vs:=tabstractvarsym(sc[0]);
                   vs:=tabstractvarsym(sc[0]);
                   if sc.count>1 then
                   if sc.count>1 then
                     Message(parser_e_absolute_only_one_var);
                     Message(parser_e_absolute_only_one_var);
-                  vs.vartype:=tt;
+                  vs.vardef:=hdef;
                   if vs.typ=globalvarsym then
                   if vs.typ=globalvarsym then
                     begin
                     begin
                       tglobalvarsym(vs).set_mangledname(target_info.Cprefix+sorg);
                       tglobalvarsym(vs).set_mangledname(target_info.Cprefix+sorg);
@@ -814,7 +814,7 @@ implementation
                 if (pt.nodetype=stringconstn) or
                 if (pt.nodetype=stringconstn) or
                    (is_constcharnode(pt)) then
                    (is_constcharnode(pt)) then
                  begin
                  begin
-                   abssym:=tabsolutevarsym.create(vs.realname,tt);
+                   abssym:=tabsolutevarsym.create(vs.realname,hdef);
                    abssym.fileinfo:=vs.fileinfo;
                    abssym.fileinfo:=vs.fileinfo;
                    if pt.nodetype=stringconstn then
                    if pt.nodetype=stringconstn then
                      hs:=strpas(tstringconstnode(pt).value_str)
                      hs:=strpas(tstringconstnode(pt).value_str)
@@ -836,7 +836,7 @@ implementation
                          (m_objfpc in aktmodeswitches) or
                          (m_objfpc in aktmodeswitches) or
                          (m_delphi in aktmodeswitches)) then
                          (m_delphi in aktmodeswitches)) then
                  begin
                  begin
-                   abssym:=tabsolutevarsym.create(vs.realname,tt);
+                   abssym:=tabsolutevarsym.create(vs.realname,hdef);
                    abssym.fileinfo:=vs.fileinfo;
                    abssym.fileinfo:=vs.fileinfo;
                    abssym.abstyp:=toaddr;
                    abssym.abstyp:=toaddr;
                    abssym.addroffset:=tordconstnode(pt).value;
                    abssym.addroffset:=tordconstnode(pt).value;
@@ -872,7 +872,7 @@ implementation
                        if not (tloadnode(hp).symtableentry.typ in [fieldvarsym,globalvarsym,localvarsym,
                        if not (tloadnode(hp).symtableentry.typ in [fieldvarsym,globalvarsym,localvarsym,
                                                                    paravarsym,typedconstsym]) then
                                                                    paravarsym,typedconstsym]) then
                          Message(parser_e_absolute_only_to_var_or_const);
                          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.fileinfo:=vs.fileinfo;
                        abssym.abstyp:=tovar;
                        abssym.abstyp:=tovar;
                        abssym.ref:=node_to_propaccesslist(pt);
                        abssym.ref:=node_to_propaccesslist(pt);
@@ -903,10 +903,10 @@ implementation
                 (symtablestack.top.symtabletype<>parasymtable) then
                 (symtablestack.top.symtabletype<>parasymtable) then
                begin
                begin
                  { Add calling convention for procvar }
                  { 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);
                  consume(_SEMICOLON);
                  { for locals we've created typedconstsym with a different name }
                  { for locals we've created typedconstsym with a different name }
                  if symtablestack.top.symtabletype<>localsymtable then
                  if symtablestack.top.symtabletype<>localsymtable then
@@ -921,19 +921,19 @@ implementation
 
 
              { Support calling convention for procvars after semicolon }
              { Support calling convention for procvars after semicolon }
              if not(hasdefaultvalue) and
              if not(hasdefaultvalue) and
-                (tt.def.deftype=procvardef) and
-                (tt.def.typesym=nil) then
+                (hdef.deftype=procvardef) and
+                (hdef.typesym=nil) then
                begin
                begin
                  { Parse procvar directives after ; }
                  { Parse procvar directives after ; }
-                 maybe_parse_proc_directives(tt);
+                 maybe_parse_proc_directives(hdef);
                  { Add calling convention for procvar }
                  { Add calling convention for procvar }
-                 handle_calling_convention(tprocvardef(tt.def));
+                 handle_calling_convention(tprocvardef(hdef));
                  { Handling of Delphi typed const = initialized vars }
                  { Handling of Delphi typed const = initialized vars }
                  if (token=_EQUAL) and
                  if (token=_EQUAL) and
                     not(m_tp7 in aktmodeswitches) and
                     not(m_tp7 in aktmodeswitches) and
                     (symtablestack.top.symtabletype<>parasymtable) then
                     (symtablestack.top.symtabletype<>parasymtable) then
                    begin
                    begin
-                     read_default_value(sc,tt,vd_threadvar in options);
+                     read_default_value(sc,hdef,vd_threadvar in options);
                      consume(_SEMICOLON);
                      consume(_SEMICOLON);
                      symdone:=true;
                      symdone:=true;
                      hasdefaultvalue:=true;
                      hasdefaultvalue:=true;
@@ -958,7 +958,7 @@ implementation
                    if sc.count>1 then
                    if sc.count>1 then
                      Message(parser_e_absolute_only_one_var);
                      Message(parser_e_absolute_only_one_var);
                    { set type of the var }
                    { set type of the var }
-                   vs.vartype:=tt;
+                   vs.vardef:=hdef;
                    vs.symoptions := vs.symoptions + hintsymoptions;
                    vs.symoptions := vs.symoptions + hintsymoptions;
                    { defaults }
                    { defaults }
                    is_dll:=false;
                    is_dll:=false;
@@ -1079,7 +1079,7 @@ implementation
                  for i:=0 to sc.count-1 do
                  for i:=0 to sc.count-1 do
                    begin
                    begin
                      vs:=tabstractvarsym(sc[i]);
                      vs:=tabstractvarsym(sc[i]);
-                     vs.vartype:=tt;
+                     vs.vardef:=hdef;
                      { insert any additional hint directives }
                      { insert any additional hint directives }
                      vs.symoptions := vs.symoptions + hintsymoptions;
                      vs.symoptions := vs.symoptions + hintsymoptions;
                      if vd_threadvar in options then
                      if vd_threadvar in options then
@@ -1104,7 +1104,7 @@ implementation
          old_block_type : tblock_type;
          old_block_type : tblock_type;
          old_current_object_option : tsymoptions;
          old_current_object_option : tsymoptions;
          hs,sorg : string;
          hs,sorg : string;
-         tt,casetype : ttype;
+         hdef,casetype : tdef;
          { maxsize contains the max. size of a variant }
          { maxsize contains the max. size of a variant }
          { startvarrec contains the start of the variant part of a record }
          { startvarrec contains the start of the variant part of a record }
          maxsize, startvarrecsize : longint;
          maxsize, startvarrecsize : longint;
@@ -1122,7 +1122,6 @@ implementation
          offset : longint;
          offset : longint;
          uniondef : trecorddef;
          uniondef : trecorddef;
          unionsym : tfieldvarsym;
          unionsym : tfieldvarsym;
-         uniontype : ttype;
          hintsymoptions : tsymoptions;
          hintsymoptions : tsymoptions;
          semicoloneaten: boolean;
          semicoloneaten: boolean;
 {$ifdef powerpc}
 {$ifdef powerpc}
@@ -1155,7 +1154,7 @@ implementation
              repeat
              repeat
                if try_to_consume(_ID) then
                if try_to_consume(_ID) then
                  begin
                  begin
-                   vs:=tfieldvarsym.create(orgpattern,vs_value,generrortype,[]);
+                   vs:=tfieldvarsym.create(orgpattern,vs_value,generrordef,[]);
                    sc.add(vs);
                    sc.add(vs);
                    recst.insert(vs);
                    recst.insert(vs);
                  end;
                  end;
@@ -1166,13 +1165,13 @@ implementation
              if ([df_generic,df_specialization]*tdef(recst.defowner).defoptions=[]) then
              if ([df_generic,df_specialization]*tdef(recst.defowner).defoptions=[]) then
                symtablestack.pop(recst);
                symtablestack.pop(recst);
              ignore_equal:=true;
              ignore_equal:=true;
-             read_anon_type(tt,false);
+             read_anon_type(hdef,false);
              ignore_equal:=false;
              ignore_equal:=false;
              if ([df_generic,df_specialization]*tdef(recst.defowner).defoptions=[]) then
              if ([df_generic,df_specialization]*tdef(recst.defowner).defoptions=[]) then
                symtablestack.push(recst);
                symtablestack.push(recst);
 
 
              { Process procvar directives }
              { Process procvar directives }
-             if maybe_parse_proc_directives(tt) then
+             if maybe_parse_proc_directives(hdef) then
                semicoloneaten:=true;
                semicoloneaten:=true;
 
 
 {$ifdef powerpc}
 {$ifdef powerpc}
@@ -1191,9 +1190,9 @@ implementation
                 (symtablestack.top.symtabletype = recordsymtable) and
                 (symtablestack.top.symtabletype = recordsymtable) and
                 (trecordsymtable(symtablestack.top).usefieldalignment = -1) then
                 (trecordsymtable(symtablestack.top).usefieldalignment = -1) then
                begin
                begin
-                 tempdef := tt.def;
+                 tempdef := hdef;
                  while tempdef.deftype = arraydef do
                  while tempdef.deftype = arraydef do
-                   tempdef := tarraydef(tempdef).elementtype.def;
+                   tempdef := tarraydef(tempdef).elementdef;
                  if tempdef.deftype <> recorddef then
                  if tempdef.deftype <> recorddef then
                    maxpadalign := tempdef.alignment
                    maxpadalign := tempdef.alignment
                  else
                  else
@@ -1209,7 +1208,7 @@ implementation
              { types that use init/final are not allowed in variant parts, but
              { types that use init/final are not allowed in variant parts, but
                classes are allowed }
                classes are allowed }
              if (variantrecordlevel>0) and
              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);
                Message(parser_e_cant_use_inittable_here);
 
 
              { try to parse the hint directives }
              { try to parse the hint directives }
@@ -1223,12 +1222,12 @@ implementation
                consume(_SEMICOLON);
                consume(_SEMICOLON);
 
 
              { Parse procvar directives after ; }
              { Parse procvar directives after ; }
-             maybe_parse_proc_directives(tt);
+             maybe_parse_proc_directives(hdef);
 
 
              { Add calling convention for procvar }
              { 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 }
              { Check for STATIC directive }
              if (vd_object in options) and
              if (vd_object in options) and
@@ -1240,7 +1239,7 @@ implementation
                end;
                end;
 
 
              if (sp_published in current_object_option) and
              if (sp_published in current_object_option) and
-                not(is_class(tt.def)) then
+                not(is_class(hdef)) then
                begin
                begin
                  Message(parser_e_cant_publish_that);
                  Message(parser_e_cant_publish_that);
                  exclude(current_object_option,sp_published);
                  exclude(current_object_option,sp_published);
@@ -1254,7 +1253,7 @@ implementation
                end
                end
              else
              else
               if (sp_published in current_object_option) and
               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
                begin
                  Message(parser_e_only_publishable_classes_can__be_published);
                  Message(parser_e_only_publishable_classes_can__be_published);
                  exclude(current_object_option,sp_published);
                  exclude(current_object_option,sp_published);
@@ -1264,7 +1263,7 @@ implementation
              for i:=0 to sc.count-1 do
              for i:=0 to sc.count-1 do
                begin
                begin
                  fieldvs:=tfieldvarsym(sc[i]);
                  fieldvs:=tfieldvarsym(sc[i]);
-                 fieldvs.vartype:=tt;
+                 fieldvs.vardef:=hdef;
                  { insert any additional hint directives }
                  { insert any additional hint directives }
                  fieldvs.symoptions := fieldvs.symoptions + hintsymoptions;
                  fieldvs.symoptions := fieldvs.symoptions + hintsymoptions;
                  if (sp_static in current_object_option) then
                  if (sp_static in current_object_option) then
@@ -1272,7 +1271,7 @@ implementation
                  { static data fields are inserted in the globalsymtable }
                  { static data fields are inserted in the globalsymtable }
                  if (sp_static in current_object_option) then
                  if (sp_static in current_object_option) then
                    begin
                    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);
                       recst.defowner.owner.insert(hstaticvs);
                       insertbssdata(hstaticvs);
                       insertbssdata(hstaticvs);
                    end
                    end
@@ -1301,18 +1300,18 @@ implementation
                 begin
                 begin
                   consume(_ID);
                   consume(_ID);
                   consume(_COLON);
                   consume(_COLON);
-                  fieldvs:=tfieldvarsym.create(sorg,vs_value,generrortype,[]);
+                  fieldvs:=tfieldvarsym.create(sorg,vs_value,generrordef,[]);
                   symtablestack.top.insert(fieldvs);
                   symtablestack.top.insert(fieldvs);
                 end;
                 end;
               read_anon_type(casetype,true);
               read_anon_type(casetype,true);
               if assigned(fieldvs) then
               if assigned(fieldvs) then
                 begin
                 begin
-                  fieldvs.vartype:=casetype;
+                  fieldvs.vardef:=casetype;
                   recst.addfield(fieldvs);
                   recst.addfield(fieldvs);
                 end;
                 end;
-              if not(is_ordinal(casetype.def))
+              if not(is_ordinal(casetype))
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
-                 or is_64bitint(casetype.def)
+                 or is_64bitint(casetype)
 {$endif cpu64bit}
 {$endif cpu64bit}
                  then
                  then
                 Message(type_e_ordinal_expr_expected);
                 Message(type_e_ordinal_expr_expected);
@@ -1363,8 +1362,7 @@ implementation
               { at last set the record size to that of the biggest variant }
               { at last set the record size to that of the biggest variant }
               unionsymtable.datasize:=maxsize;
               unionsymtable.datasize:=maxsize;
               unionsymtable.fieldalignment:=maxalignment;
               unionsymtable.fieldalignment:=maxalignment;
-              uniontype.def:=uniondef;
-              UnionSym:=tfieldvarsym.create('$case',vs_value,uniontype,[]);
+              UnionSym:=tfieldvarsym.create('$case',vs_value,uniondef,[]);
               unionsymtable.addalignmentpadding;
               unionsymtable.addalignmentpadding;
 {$ifdef powerpc}
 {$ifdef powerpc}
               { parent inherits the alignment padding if the variant is the first "field" of the parent record/variant }
               { 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 }
     { reads a single factor }
     function factor(getaddr : boolean) : tnode;
     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);
     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 }
        { last def found, only used by anon. inherited calls to insert proper type casts }
        srdef : tdef = nil;
        srdef : tdef = nil;
 
 
-    procedure string_dec(var t: ttype);
+    procedure string_dec(var def:tdef);
     { reads a string type with optional length }
     { reads a string type with optional length }
     { and returns a pointer to the string      }
     { and returns a pointer to the string      }
     { definition                               }
     { definition                               }
       var
       var
          p : tnode;
          p : tnode;
       begin
       begin
-         t:=cshortstringtype;
+         def:=cshortstringtype;
          consume(_STRING);
          consume(_STRING);
          if try_to_consume(_LECKKLAMMER) then
          if try_to_consume(_LECKKLAMMER) then
            begin
            begin
@@ -120,23 +120,23 @@ implementation
                  if tordconstnode(p).value>255 then
                  if tordconstnode(p).value>255 then
                   begin
                   begin
                     { longstring is currently unsupported (CEC)! }
                     { longstring is currently unsupported (CEC)! }
-{                   t.setdef(tstringdef.createlong(tordconstnode(p).value))}
+{                   t:=tstringdef.createlong(tordconstnode(p).value))}
                      Message(parser_e_invalid_string_size);
                      Message(parser_e_invalid_string_size);
                      tordconstnode(p).value:=255;
                      tordconstnode(p).value:=255;
-                     t.setdef(tstringdef.createshort(tordconstnode(p).value));
+                     def:=tstringdef.createshort(tordconstnode(p).value);
                   end
                   end
                  else
                  else
                    if tordconstnode(p).value<>255 then
                    if tordconstnode(p).value<>255 then
-                     t.setdef(tstringdef.createshort(tordconstnode(p).value));
+                     def:=tstringdef.createshort(tordconstnode(p).value);
                end;
                end;
               p.free;
               p.free;
            end
            end
           else
           else
             begin
             begin
                if cs_ansistrings in aktlocalswitches then
                if cs_ansistrings in aktlocalswitches then
-                 t:=cansistringtype
+                 def:=cansistringtype
                else
                else
-                 t:=cshortstringtype;
+                 def:=cshortstringtype;
             end;
             end;
        end;
        end;
 
 
@@ -178,14 +178,14 @@ implementation
                  p1:=csubscriptnode.create(plist^.sym,p1);
                  p1:=csubscriptnode.create(plist^.sym,p1);
                end;
                end;
              sl_typeconv :
              sl_typeconv :
-               p1:=ctypeconvnode.create_explicit(p1,plist^.tt);
+               p1:=ctypeconvnode.create_explicit(p1,plist^.def);
              sl_absolutetype :
              sl_absolutetype :
                begin
                begin
-                 p1:=ctypeconvnode.create(p1,plist^.tt);
+                 p1:=ctypeconvnode.create(p1,plist^.def);
                  include(p1.flags,nf_absolute);
                  include(p1.flags,nf_absolute);
                end;
                end;
              sl_vec :
              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
              else
                internalerror(200110205);
                internalerror(200110205);
            end;
            end;
@@ -210,20 +210,20 @@ implementation
               begin
               begin
                 addnode(ttypeconvnode(p).left);
                 addnode(ttypeconvnode(p).left);
                 if nf_absolute in ttypeconvnode(p).flags then
                 if nf_absolute in ttypeconvnode(p).flags then
-                  sl.addtype(sl_absolutetype,ttypeconvnode(p).totype)
+                  sl.addtype(sl_absolutetype,ttypeconvnode(p).totypedef)
                 else
                 else
-                  sl.addtype(sl_typeconv,ttypeconvnode(p).totype);
+                  sl.addtype(sl_typeconv,ttypeconvnode(p).totypedef);
               end;
               end;
             vecn :
             vecn :
               begin
               begin
                 addnode(tvecnode(p).left);
                 addnode(tvecnode(p).left);
                 if tvecnode(p).right.nodetype=ordconstn then
                 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
                 else
                   begin
                   begin
                     Message(parser_e_illegal_expression);
                     Message(parser_e_illegal_expression);
                     { recovery }
                     { recovery }
-                    sl.addconst(sl_vec,0,tvecnode(p).right.resulttype);
+                    sl.addconst(sl_vec,0,tvecnode(p).right.resultdef);
                   end;
                   end;
              end;
              end;
             loadn :
             loadn :
@@ -287,7 +287,7 @@ implementation
      function gen_c_style_operator(ntyp:tnodetype;p1,p2:tnode) : tnode;
      function gen_c_style_operator(ntyp:tnodetype;p1,p2:tnode) : tnode;
        var
        var
          hp    : tnode;
          hp    : tnode;
-         htype : ttype;
+         hdef  : tdef;
          temp  : ttempcreatenode;
          temp  : ttempcreatenode;
          newstatement : tstatementnode;
          newstatement : tstatementnode;
        begin
        begin
@@ -309,10 +309,10 @@ implementation
            internalerror(200410121);
            internalerror(200410121);
          if (hp.nodetype=calln) then
          if (hp.nodetype=calln) then
            begin
            begin
-             resulttypepass(p1);
+             typecheckpass(p1);
              result:=internalstatements(newstatement);
              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,temp);
              addstatement(newstatement,cassignmentnode.create(ctemprefnode.create(temp),caddrnode.create_internal(p1)));
              addstatement(newstatement,cassignmentnode.create(ctemprefnode.create(temp),caddrnode.create_internal(p1)));
              addstatement(newstatement,cassignmentnode.create(
              addstatement(newstatement,cassignmentnode.create(
@@ -377,7 +377,7 @@ implementation
                               p1:=nil;
                               p1:=nil;
                             end
                             end
                           else if (not assigned(current_procinfo) or
                           else if (not assigned(current_procinfo) or
-                              is_void(current_procinfo.procdef.rettype.def)) then
+                              is_void(current_procinfo.procdef.returndef)) then
                             begin
                             begin
                               Message(parser_e_void_function);
                               Message(parser_e_void_function);
                               { recovery }
                               { recovery }
@@ -456,11 +456,11 @@ implementation
                 ttypenode(p1).allowed:=true;
                 ttypenode(p1).allowed:=true;
               { Allow classrefdef, which is required for
               { Allow classrefdef, which is required for
                 Typeof(self) in static class methods }
                 Typeof(self) in static class methods }
-              if (p1.resulttype.def.deftype = objectdef) or
+              if (p1.resultdef.deftype = objectdef) or
                  (assigned(current_procinfo) and
                  (assigned(current_procinfo) and
                   ((po_classmethod in current_procinfo.procdef.procoptions) or
                   ((po_classmethod in current_procinfo.procdef.procoptions) or
                    (po_staticmethod in current_procinfo.procdef.procoptions)) and
                    (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)
                statement_syssym:=geninlinenode(in_typeof_x,false,p1)
               else
               else
                begin
                begin
@@ -479,11 +479,11 @@ implementation
               consume(_RKLAMMER);
               consume(_RKLAMMER);
               if (p1.nodetype<>typen) and
               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
                  ) then
                 begin
                 begin
                   statement_syssym:=geninlinenode(in_sizeof_x,false,p1);
                   statement_syssym:=geninlinenode(in_sizeof_x,false,p1);
@@ -495,16 +495,16 @@ implementation
                begin
                begin
                  if (l = in_sizeof_x) or
                  if (l = in_sizeof_x) or
                     (not((p1.nodetype = vecn) and
                     (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
                      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
                    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
                      if (l = in_bitsizeof_x) then
                        statement_syssym:=caddnode.create(muln,statement_syssym,cordconstnode.create(8,sinttype,true));
                        statement_syssym:=caddnode.create(muln,statement_syssym,cordconstnode.create(8,sinttype,true));
                    end
                    end
                  else
                  else
-                   statement_syssym:=cordconstnode.create(p1.resulttype.def.packedbitsize,sinttype,true);
+                   statement_syssym:=cordconstnode.create(p1.resultdef.packedbitsize,sinttype,true);
                  { p1 not needed !}
                  { p1 not needed !}
                  p1.destroy;
                  p1.destroy;
                end;
                end;
@@ -568,19 +568,19 @@ implementation
                 end;
                 end;
               if not codegenerror then
               if not codegenerror then
                begin
                begin
-                 case p1.resulttype.def.deftype of
+                 case p1.resultdef.deftype of
                    procdef, { procvar }
                    procdef, { procvar }
                    pointerdef,
                    pointerdef,
                    procvardef,
                    procvardef,
                    classrefdef : ;
                    classrefdef : ;
                    objectdef :
                    objectdef :
-                     if not is_class_or_interface(p1.resulttype.def) then
+                     if not is_class_or_interface(p1.resultdef) then
                        begin
                        begin
                          Message(parser_e_illegal_parameter_list);
                          Message(parser_e_illegal_parameter_list);
                          err:=true;
                          err:=true;
                        end;
                        end;
                    arraydef :
                    arraydef :
-                     if not is_dynamic_array(p1.resulttype.def) then
+                     if not is_dynamic_array(p1.resultdef) then
                        begin
                        begin
                          Message(parser_e_illegal_parameter_list);
                          Message(parser_e_illegal_parameter_list);
                          err:=true;
                          err:=true;
@@ -626,9 +626,9 @@ implementation
               in_args:=true;
               in_args:=true;
               p1:=comp_expr(true);
               p1:=comp_expr(true);
               p1:=caddrnode.create(p1);
               p1:=caddrnode.create(p1);
-              do_resulttypepass(p1);
+              do_typecheckpass(p1);
               { Ofs() returns a cardinal/qword, not a pointer }
               { Ofs() returns a cardinal/qword, not a pointer }
-              p1.resulttype:=uinttype;
+              p1.resultdef:=uinttype;
               consume(_RKLAMMER);
               consume(_RKLAMMER);
               statement_syssym:=p1;
               statement_syssym:=p1;
             end;
             end;
@@ -739,9 +739,9 @@ implementation
                   begin
                   begin
                     { Force string type if it isn't yet }
                     { Force string type if it isn't yet }
                     if not(
                     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
                           ) then
                       inserttypeconv(p1,cshortstringtype);
                       inserttypeconv(p1,cshortstringtype);
                     p2:=p1;
                     p2:=p1;
@@ -997,7 +997,7 @@ implementation
                           { anonymous inherited via msgid calls only require a var parameter for
                           { anonymous inherited via msgid calls only require a var parameter for
                             both methods, so we need some type casting here }
                             both methods, so we need some type casting here }
                           para:=ccallparanode.create(ctypeconvnode.create_internal(ctypeconvnode.create_internal(
                           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)
                           para)
                         else
                         else
                           para:=ccallparanode.create(cloadnode.create(currpara,currpara.owner),para);
                           para:=ccallparanode.create(cloadnode.create(currpara,currpara.owner),para);
@@ -1093,7 +1093,7 @@ implementation
          { indexed property }
          { indexed property }
          if (ppo_indexed in propsym.propoptions) then
          if (ppo_indexed in propsym.propoptions) then
            begin
            begin
-             p2:=cordconstnode.create(propsym.index,propsym.indextype,true);
+             p2:=cordconstnode.create(propsym.index,propsym.indexdef,true);
              paras:=ccallparanode.create(p2,paras);
              paras:=ccallparanode.create(p2,paras);
            end;
            end;
          { we need only a write property if a := follows }
          { we need only a write property if a := follows }
@@ -1123,8 +1123,8 @@ implementation
                          paras:=nil;
                          paras:=nil;
                          consume(_ASSIGNMENT);
                          consume(_ASSIGNMENT);
                          { read the expression }
                          { 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);
                          p2:=comp_expr(true);
                          if assigned(getprocvardef) then
                          if assigned(getprocvardef) then
                            handle_procvar(getprocvardef,p2);
                            handle_procvar(getprocvardef,p2);
@@ -1227,9 +1227,9 @@ implementation
            begin
            begin
               if assigned(p1) then
               if assigned(p1) then
                begin
                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
                end
               else
               else
                isclassref:=false;
                isclassref:=false;
@@ -1243,7 +1243,7 @@ implementation
                                    (getaddr and not(token in [_CARET,_POINT])),
                                    (getaddr and not(token in [_CARET,_POINT])),
                                    again,p1,callflags);
                                    again,p1,callflags);
                       { we need to know which procedure is called }
                       { we need to know which procedure is called }
-                      do_resulttypepass(p1);
+                      do_typecheckpass(p1);
                       { calling using classref? }
                       { calling using classref? }
                       if isclassref and
                       if isclassref and
                          (p1.nodetype=calln) and
                          (p1.nodetype=calln) and
@@ -1302,7 +1302,6 @@ implementation
            possible_error : boolean;
            possible_error : boolean;
            srsymtable : tsymtable;
            srsymtable : tsymtable;
            hdef  : tdef;
            hdef  : tdef;
-           htype : ttype;
            static_name : string;
            static_name : string;
          begin
          begin
            { allow post fix operators }
            { allow post fix operators }
@@ -1334,16 +1333,6 @@ implementation
                   srsym:=generrorsym;
                   srsym:=generrorsym;
                 end;
                 end;
               srsymtable:=srsym.owner;
               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;
             end;
 
 
             begin
             begin
@@ -1354,7 +1343,7 @@ implementation
                       begin
                       begin
                         p1:=nil;
                         p1:=nil;
                         propaccesslist_to_node(p1,nil,tabsolutevarsym(srsym).ref);
                         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);
                         include(p1.flags,nf_absolute);
                       end
                       end
                     else
                     else
@@ -1413,15 +1402,15 @@ implementation
 
 
                 typesym :
                 typesym :
                   begin
                   begin
-                    htype:=ttypesym(srsym).restype;
-                    if not assigned(htype.def) then
+                    hdef:=ttypesym(srsym).typedef;
+                    if not assigned(hdef) then
                      begin
                      begin
                        again:=false;
                        again:=false;
                      end
                      end
                     else
                     else
                      begin
                      begin
                        { We need to know if this unit uses Variants }
                        { 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
                           not(cs_compilesystem in aktmoduleswitches) then
                          current_module.flags:=current_module.flags or uf_uses_variants;
                          current_module.flags:=current_module.flags or uf_uses_variants;
                        if (block_type<>bt_specialize) and
                        if (block_type<>bt_specialize) and
@@ -1429,26 +1418,26 @@ implementation
                         begin
                         begin
                           p1:=comp_expr(true);
                           p1:=comp_expr(true);
                           consume(_RKLAMMER);
                           consume(_RKLAMMER);
-                          p1:=ctypeconvnode.create_explicit(p1,htype);
+                          p1:=ctypeconvnode.create_explicit(p1,hdef);
                         end
                         end
                        else { not LKLAMMER }
                        else { not LKLAMMER }
                         if (token=_POINT) and
                         if (token=_POINT) and
-                           is_object(htype.def) then
+                           is_object(hdef) then
                          begin
                          begin
                            consume(_POINT);
                            consume(_POINT);
                            if assigned(current_procinfo) and
                            if assigned(current_procinfo) and
                               assigned(current_procinfo.procdef._class) and
                               assigned(current_procinfo.procdef._class) and
                               not(getaddr) then
                               not(getaddr) then
                             begin
                             begin
-                              if current_procinfo.procdef._class.is_related(tobjectdef(htype.def)) then
+                              if current_procinfo.procdef._class.is_related(tobjectdef(hdef)) then
                                begin
                                begin
-                                 p1:=ctypenode.create(htype);
+                                 p1:=ctypenode.create(hdef);
                                  { search also in inherited methods }
                                  { 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
                                  if assigned(srsym) then
                                    check_hints(srsym,srsym.symoptions);
                                    check_hints(srsym,srsym.symoptions);
                                  consume(_ID);
                                  consume(_ID);
-                                 do_member_read(tobjectdef(htype.def),false,srsym,p1,again,[]);
+                                 do_member_read(tobjectdef(hdef),false,srsym,p1,again,[]);
                                end
                                end
                               else
                               else
                                begin
                                begin
@@ -1460,10 +1449,10 @@ implementation
                             begin
                             begin
                               { allows @TObject.Load }
                               { allows @TObject.Load }
                               { also allows static methods and variables }
                               { also allows static methods and variables }
-                              p1:=ctypenode.create(htype);
+                              p1:=ctypenode.create(hdef);
                               { TP allows also @TMenu.Load if Load is only }
                               { TP allows also @TMenu.Load if Load is only }
                               { defined in an anchestor class              }
                               { defined in an anchestor class              }
-                              srsym:=search_class_member(tobjectdef(htype.def),pattern);
+                              srsym:=search_class_member(tobjectdef(hdef),pattern);
                               if assigned(srsym) then
                               if assigned(srsym) then
                                 begin
                                 begin
                                   check_hints(srsym,srsym.symoptions);
                                   check_hints(srsym,srsym.symoptions);
@@ -1472,7 +1461,7 @@ implementation
                                   else
                                   else
                                     begin
                                     begin
                                       consume(_ID);
                                       consume(_ID);
-                                      do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
+                                      do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[]);
                                     end;
                                     end;
                                 end
                                 end
                               else
                               else
@@ -1482,22 +1471,22 @@ implementation
                        else
                        else
                         begin
                         begin
                           { class reference ? }
                           { class reference ? }
-                          if is_class(htype.def) then
+                          if is_class(hdef) then
                            begin
                            begin
                              if getaddr and (token=_POINT) then
                              if getaddr and (token=_POINT) then
                               begin
                               begin
                                 consume(_POINT);
                                 consume(_POINT);
                                 { allows @Object.Method }
                                 { allows @Object.Method }
                                 { also allows static methods and variables }
                                 { also allows static methods and variables }
-                                p1:=ctypenode.create(htype);
+                                p1:=ctypenode.create(hdef);
                                 { TP allows also @TMenu.Load if Load is only }
                                 { TP allows also @TMenu.Load if Load is only }
                                 { defined in an anchestor class              }
                                 { defined in an anchestor class              }
-                                srsym:=search_class_member(tobjectdef(htype.def),pattern);
+                                srsym:=search_class_member(tobjectdef(hdef),pattern);
                                 if assigned(srsym) then
                                 if assigned(srsym) then
                                  begin
                                  begin
                                    check_hints(srsym,srsym.symoptions);
                                    check_hints(srsym,srsym.symoptions);
                                    consume(_ID);
                                    consume(_ID);
-                                   do_member_read(tobjectdef(htype.def),getaddr,srsym,p1,again,[]);
+                                   do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[]);
                                  end
                                  end
                                 else
                                 else
                                  begin
                                  begin
@@ -1507,7 +1496,7 @@ implementation
                               end
                               end
                              else
                              else
                               begin
                               begin
-                                p1:=ctypenode.create(htype);
+                                p1:=ctypenode.create(hdef);
                                 { For a type block we simply return only
                                 { For a type block we simply return only
                                   the type. For all other blocks we return
                                   the type. For all other blocks we return
                                   a loadvmt node }
                                   a loadvmt node }
@@ -1516,7 +1505,7 @@ implementation
                               end;
                               end;
                            end
                            end
                           else
                           else
-                           p1:=ctypenode.create(htype);
+                           p1:=ctypenode.create(hdef);
                         end;
                         end;
                      end;
                      end;
                   end;
                   end;
@@ -1531,9 +1520,9 @@ implementation
                     case tconstsym(srsym).consttyp of
                     case tconstsym(srsym).consttyp of
                       constord :
                       constord :
                         begin
                         begin
-                          if tconstsym(srsym).consttype.def=nil then
+                          if tconstsym(srsym).constdef=nil then
                             internalerror(200403232);
                             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;
                         end;
                       conststring :
                       conststring :
                         begin
                         begin
@@ -1550,16 +1539,16 @@ implementation
                       constreal :
                       constreal :
                         p1:=crealconstnode.create(pbestreal(tconstsym(srsym).value.valueptr)^,pbestrealtype^);
                         p1:=crealconstnode.create(pbestreal(tconstsym(srsym).value.valueptr)^,pbestrealtype^);
                       constset :
                       constset :
-                        p1:=csetconstnode.create(pconstset(tconstsym(srsym).value.valueptr),tconstsym(srsym).consttype);
+                        p1:=csetconstnode.create(pconstset(tconstsym(srsym).value.valueptr),tconstsym(srsym).constdef);
                       constpointer :
                       constpointer :
-                        p1:=cpointerconstnode.create(tconstsym(srsym).value.valueordptr,tconstsym(srsym).consttype);
+                        p1:=cpointerconstnode.create(tconstsym(srsym).value.valueordptr,tconstsym(srsym).constdef);
                       constnil :
                       constnil :
                         p1:=cnilnode.create;
                         p1:=cnilnode.create;
                       constresourcestring:
                       constresourcestring:
                         begin
                         begin
                           p1:=cloadnode.create(srsym,srsymtable);
                           p1:=cloadnode.create(srsym,srsymtable);
-                          do_resulttypepass(p1);
-                          p1.resulttype:=cansistringtype;
+                          do_typecheckpass(p1);
+                          p1.resultdef:=cansistringtype;
                         end;
                         end;
                       constguid :
                       constguid :
                         p1:=cguidconstnode.create(pguid(tconstsym(srsym).value.valueptr)^);
                         p1:=cguidconstnode.create(pguid(tconstsym(srsym).value.valueptr)^);
@@ -1582,7 +1571,7 @@ implementation
                     { we need to know which procedure is called }
                     { we need to know which procedure is called }
                     if possible_error then
                     if possible_error then
                      begin
                      begin
-                       do_resulttypepass(p1);
+                       do_typecheckpass(p1);
                        if (p1.nodetype=calln) and
                        if (p1.nodetype=calln) and
                           assigned(tcallnode(p1).procdefinition) and
                           assigned(tcallnode(p1).procdefinition) and
                           not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) and
                           not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) and
@@ -1730,12 +1719,12 @@ implementation
               p4:=comp_expr(true);
               p4:=comp_expr(true);
 
 
               addstatement(newstatement,cassignmentnode.create(
               addstatement(newstatement,cassignmentnode.create(
-                ctemprefnode.create_offset(temp,countindices*sinttype.def.size),p4));
+                ctemprefnode.create_offset(temp,countindices*sinttype.size),p4));
                inc(countindices);
                inc(countindices);
             until not try_to_consume(_COMMA);
             until not try_to_consume(_COMMA);
 
 
             { set real size }
             { set real size }
-            temp.size:=countindices*sinttype.def.size;
+            temp.size:=countindices*sinttype.size;
 
 
             consume(_RECKKLAMMER);
             consume(_RECKKLAMMER);
 
 
@@ -1760,7 +1749,7 @@ implementation
             else
             else
               begin
               begin
                 { create temp for result }
                 { 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);
                 addstatement(newstatement,tempresultvariant);
 
 
                 { create call to fpc_vararray_get }
                 { create call to fpc_vararray_get }
@@ -1800,8 +1789,8 @@ implementation
           again:=true;
           again:=true;
           while again do
           while again do
            begin
            begin
-             { we need the resulttype }
-             do_resulttypepass(p1);
+             { we need the resultdef }
+             do_typecheckpass(p1);
 
 
              if codegenerror then
              if codegenerror then
               begin
               begin
@@ -1818,14 +1807,14 @@ implementation
                       pointer type }
                       pointer type }
                     if ((m_tp_procvar in aktmodeswitches) or
                     if ((m_tp_procvar in aktmodeswitches) or
                         (m_mac_procvar in aktmodeswitches)) and
                         (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
                       begin
                         p1:=ccallnode.create_procvar(nil,p1);
                         p1:=ccallnode.create_procvar(nil,p1);
-                        resulttypepass(p1);
+                        typecheckpass(p1);
                       end;
                       end;
 
 
-                    if (p1.resulttype.def.deftype<>pointerdef) then
+                    if (p1.resultdef.deftype<>pointerdef) then
                       begin
                       begin
                          { ^ as binary operator is a problem!!!! (FK) }
                          { ^ as binary operator is a problem!!!! (FK) }
                          again:=false;
                          again:=false;
@@ -1840,10 +1829,10 @@ implementation
 
 
                _LECKKLAMMER:
                _LECKKLAMMER:
                   begin
                   begin
-                    if is_class_or_interface(p1.resulttype.def) then
+                    if is_class_or_interface(p1.resultdef) then
                       begin
                       begin
                         { default property }
                         { default property }
-                        protsym:=search_default_property(tobjectdef(p1.resulttype.def));
+                        protsym:=search_default_property(tobjectdef(p1.resultdef));
                         if not(assigned(protsym)) then
                         if not(assigned(protsym)) then
                           begin
                           begin
                              p1.destroy;
                              p1.destroy;
@@ -1863,16 +1852,16 @@ implementation
                         consume(_LECKKLAMMER);
                         consume(_LECKKLAMMER);
                         repeat
                         repeat
                           ok := true;
                           ok := true;
-                          case p1.resulttype.def.deftype of
+                          case p1.resultdef.deftype of
                             pointerdef:
                             pointerdef:
                               begin
                               begin
                                  { support delphi autoderef }
                                  { 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
                                     (m_autoderef in aktmodeswitches) then
                                    p1:=cderefnode.create(p1);
                                    p1:=cderefnode.create(p1);
                                  p2:=comp_expr(true);
                                  p2:=comp_expr(true);
+                                 { Support Pbytevar[0..9] which returns array [0..9].}
                                  if try_to_consume(_POINTPOINT) then
                                  if try_to_consume(_POINTPOINT) then
-                                   { Support Pbytevar[0..9] which returns array [0..9].}
                                    p2:=crangenode.create(p2,comp_expr(true));
                                    p2:=crangenode.create(p2,comp_expr(true));
                                  p1:=cvecnode.create(p1,p2);
                                  p1:=cvecnode.create(p1,p2);
                               end;
                               end;
@@ -1885,8 +1874,8 @@ implementation
                             stringdef :
                             stringdef :
                               begin
                               begin
                                 p2:=comp_expr(true);
                                 p2:=comp_expr(true);
+                                { Support string[0..9] which returns array [0..9] of char.}
                                 if try_to_consume(_POINTPOINT) then
                                 if try_to_consume(_POINTPOINT) then
-                                  { Support string[0..9] which returns array [0..9] of char.}
                                   p2:=crangenode.create(p2,comp_expr(true));
                                   p2:=crangenode.create(p2,comp_expr(true));
                                 p1:=cvecnode.create(p1,p2);
                                 p1:=cvecnode.create(p1,p2);
                               end;
                               end;
@@ -1897,13 +1886,15 @@ implementation
                                 { an array[1..4] of char. The                  }
                                 { an array[1..4] of char. The                  }
                                 { FPC_Internal_Four_Char_Array is defined in   }
                                 { FPC_Internal_Four_Char_Array is defined in   }
                                 { the macpas unit                              }
                                 { 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
                                 if ok then
                                   begin
                                   begin
                                     p2:=comp_expr(true);
                                     p2:=comp_expr(true);
@@ -1958,7 +1949,7 @@ implementation
                               comp_expr(true);
                               comp_expr(true);
                               again:=false;
                               again:=false;
                             end;
                             end;
-                          do_resulttypepass(p1);
+                          do_typecheckpass(p1);
                         until not try_to_consume(_COMMA);
                         until not try_to_consume(_COMMA);
                         consume(_RECKKLAMMER);
                         consume(_RECKKLAMMER);
                         { handle_variantarray eats the RECKKLAMMER and jumps here }
                         { handle_variantarray eats the RECKKLAMMER and jumps here }
@@ -1969,18 +1960,18 @@ implementation
                _POINT :
                _POINT :
                   begin
                   begin
                     consume(_POINT);
                     consume(_POINT);
-                    if (p1.resulttype.def.deftype=pointerdef) and
+                    if (p1.resultdef.deftype=pointerdef) and
                        (m_autoderef in aktmodeswitches) then
                        (m_autoderef in aktmodeswitches) then
                       begin
                       begin
                         p1:=cderefnode.create(p1);
                         p1:=cderefnode.create(p1);
-                        do_resulttypepass(p1);
+                        do_typecheckpass(p1);
                       end;
                       end;
-                    case p1.resulttype.def.deftype of
+                    case p1.resultdef.deftype of
                       recorddef:
                       recorddef:
                         begin
                         begin
                           if token=_ID then
                           if token=_ID then
                             begin
                             begin
-                              srsym:=tsym(trecorddef(p1.resulttype.def).symtable.search(pattern));
+                              srsym:=tsym(trecorddef(p1.resultdef).symtable.search(pattern));
                               if assigned(srsym) and
                               if assigned(srsym) and
                                  (srsym.typ=fieldvarsym) then
                                  (srsym.typ=fieldvarsym) then
                                 begin
                                 begin
@@ -2003,7 +1994,7 @@ implementation
                          begin
                          begin
                            if token=_ID then
                            if token=_ID then
                              begin
                              begin
-                               classh:=tobjectdef(tclassrefdef(p1.resulttype.def).pointertype.def);
+                               classh:=tobjectdef(tclassrefdef(p1.resultdef).pointeddef);
                                searchsym_in_class(classh,classh,pattern,srsym,srsymtable);
                                searchsym_in_class(classh,classh,pattern,srsym,srsymtable);
                                if assigned(srsym) then
                                if assigned(srsym) then
                                  begin
                                  begin
@@ -2029,7 +2020,7 @@ implementation
                              begin
                              begin
                                store_static:=allow_only_static;
                                store_static:=allow_only_static;
                                allow_only_static:=false;
                                allow_only_static:=false;
-                               classh:=tobjectdef(p1.resulttype.def);
+                               classh:=tobjectdef(p1.resultdef);
                                searchsym_in_class(classh,classh,pattern,srsym,srsymtable);
                                searchsym_in_class(classh,classh,pattern,srsym,srsymtable);
                                allow_only_static:=store_static;
                                allow_only_static:=store_static;
                                if assigned(srsym) then
                                if assigned(srsym) then
@@ -2053,7 +2044,7 @@ implementation
                        pointerdef:
                        pointerdef:
                          begin
                          begin
                            Message(parser_e_invalid_qualifier);
                            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);
                              Message(parser_h_maybe_deref_caret_missing);
                          end;
                          end;
                        else
                        else
@@ -2070,11 +2061,11 @@ implementation
                else
                else
                  begin
                  begin
                    { is this a procedure variable ? }
                    { 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
                      begin
                        if assigned(getprocvardef) and
                        if assigned(getprocvardef) and
-                          equal_defs(p1.resulttype.def,getprocvardef) then
+                          equal_defs(p1.resultdef,getprocvardef) then
                          again:=false
                          again:=false
                        else
                        else
                          begin
                          begin
@@ -2122,10 +2113,10 @@ implementation
          srsym      : tsym;
          srsym      : tsym;
          srsymtable : tsymtable;
          srsymtable : tsymtable;
          pd         : tprocdef;
          pd         : tprocdef;
-         classh     : tobjectdef;
+         hclassdef     : tobjectdef;
          d          : bestreal;
          d          : bestreal;
          hs,hsorg   : string;
          hs,hsorg   : string;
-         htype      : ttype;
+         hdef       : tdef;
          filepos    : tfileposinfo;
          filepos    : tfileposinfo;
       begin
       begin
         oldp1:=nil;
         oldp1:=nil;
@@ -2178,7 +2169,7 @@ implementation
                if assigned(current_procinfo) and
                if assigned(current_procinfo) and
                   assigned(current_procinfo.procdef._class) then
                   assigned(current_procinfo.procdef._class) then
                 begin
                 begin
-                  classh:=current_procinfo.procdef._class.childof;
+                  hclassdef:=current_procinfo.procdef._class.childof;
                   { if inherited; only then we need the method with
                   { if inherited; only then we need the method with
                     the same name }
                     the same name }
                   if token in endtokens then
                   if token in endtokens then
@@ -2191,12 +2182,12 @@ implementation
                      pd:=tprocsym(current_procinfo.procdef.procsym).first_procdef;
                      pd:=tprocsym(current_procinfo.procdef.procsym).first_procdef;
                      srdef:=nil;
                      srdef:=nil;
                      if (po_msgint in pd.procoptions) then
                      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
                      else
                       if (po_msgstr in pd.procoptions) then
                       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
                      else
-                       searchsym_in_class(classh,current_procinfo.procdef._class,hs,srsym,srsymtable);
+                       searchsym_in_class(hclassdef,current_procinfo.procdef._class,hs,srsym,srsymtable);
                    end
                    end
                   else
                   else
                    begin
                    begin
@@ -2204,7 +2195,7 @@ implementation
                      hsorg:=orgpattern;
                      hsorg:=orgpattern;
                      consume(_ID);
                      consume(_ID);
                      anon_inherited:=false;
                      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;
                    end;
                   if assigned(srsym) then
                   if assigned(srsym) then
                    begin
                    begin
@@ -2215,11 +2206,11 @@ implementation
                       begin
                       begin
                         if (srsym.typ = procsym) then
                         if (srsym.typ = procsym) then
                           begin
                           begin
-                            htype.setdef(classh);
+                            hdef:=hclassdef;
                             if (po_classmethod in current_procinfo.procdef.procoptions) or
                             if (po_classmethod in current_procinfo.procdef.procoptions) or
                                (po_staticmethod in current_procinfo.procdef.procoptions) then
                                (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;
                       end
                       end
                      else
                      else
@@ -2227,7 +2218,7 @@ implementation
                         Message(parser_e_methode_id_expected);
                         Message(parser_e_methode_id_expected);
                         p1:=cerrornode.create;
                         p1:=cerrornode.create;
                       end;
                       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
                    end
                   else
                   else
                    begin
                    begin
@@ -2237,12 +2228,12 @@ implementation
                         if (po_msgint in pd.procoptions) or
                         if (po_msgint in pd.procoptions) or
                            (po_msgstr in pd.procoptions) then
                            (po_msgstr in pd.procoptions) then
                           begin
                           begin
-                            searchsym_in_class(classh,classh,'DEFAULTHANDLER',srsym,srsymtable);
+                            searchsym_in_class(hclassdef,hclassdef,'DEFAULTHANDLER',srsym,srsymtable);
                             if not assigned(srsym) or
                             if not assigned(srsym) or
                                (srsym.typ<>procsym) then
                                (srsym.typ<>procsym) then
                               internalerror(200303171);
                               internalerror(200303171);
                             p1:=nil;
                             p1:=nil;
-                            do_proc_call(srsym,srsym.owner,classh,false,again,p1,[]);
+                            do_proc_call(srsym,srsym.owner,hclassdef,false,again,p1,[]);
                           end
                           end
                         else
                         else
                           begin
                           begin
@@ -2279,8 +2270,8 @@ implementation
                if code=0 then
                if code=0 then
                  begin
                  begin
                     consume(_INTCONST);
                     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
                  end
                else
                else
                  begin
                  begin
@@ -2289,8 +2280,8 @@ implementation
                    if code=0 then
                    if code=0 then
                      begin
                      begin
                         consume(_INTCONST);
                         consume(_INTCONST);
-                        htype:=u64inttype;
-                        p1:=cordconstnode.create(qc,htype,true);
+                        hdef:=u64inttype;
+                        p1:=cordconstnode.create(qc,hdef,true);
                      end;
                      end;
                  end;
                  end;
 {$else}
 {$else}
@@ -2299,8 +2290,8 @@ implementation
                if code=0 then
                if code=0 then
                  begin
                  begin
                     consume(_INTCONST);
                     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
                  end
                else
                else
                  begin
                  begin
@@ -2309,8 +2300,8 @@ implementation
                    if code = 0 then
                    if code = 0 then
                      begin
                      begin
                        consume(_INTCONST);
                        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
                      end
                    else
                    else
                      begin
                      begin
@@ -2319,8 +2310,8 @@ implementation
                        if code=0 then
                        if code=0 then
                          begin
                          begin
                             consume(_INTCONST);
                             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
                          end
                        else
                        else
                          begin
                          begin
@@ -2329,8 +2320,8 @@ implementation
                            if code=0 then
                            if code=0 then
                              begin
                              begin
                                 consume(_INTCONST);
                                 consume(_INTCONST);
-                                htype:=u64inttype;
-                                p1:=cordconstnode.create(tconstexprint(qc),htype,true);
+                                hdef:=u64inttype;
+                                p1:=cordconstnode.create(tconstexprint(qc),hdef,true);
                              end;
                              end;
                          end;
                          end;
                      end;
                      end;
@@ -2369,38 +2360,38 @@ implementation
 
 
            _STRING :
            _STRING :
              begin
              begin
-               string_dec(htype);
+               string_dec(hdef);
                { STRING can be also a type cast }
                { STRING can be also a type cast }
                if try_to_consume(_LKLAMMER) then
                if try_to_consume(_LKLAMMER) then
                 begin
                 begin
                   p1:=comp_expr(true);
                   p1:=comp_expr(true);
                   consume(_RKLAMMER);
                   consume(_RKLAMMER);
-                  p1:=ctypeconvnode.create_explicit(p1,htype);
+                  p1:=ctypeconvnode.create_explicit(p1,hdef);
                   { handle postfix operators here e.g. string(a)[10] }
                   { handle postfix operators here e.g. string(a)[10] }
                   again:=true;
                   again:=true;
                   postfixoperators(p1,again);
                   postfixoperators(p1,again);
                 end
                 end
                else
                else
-                p1:=ctypenode.create(htype);
+                p1:=ctypenode.create(hdef);
              end;
              end;
 
 
            _FILE :
            _FILE :
              begin
              begin
-               htype:=cfiletype;
+               hdef:=cfiletype;
                consume(_FILE);
                consume(_FILE);
                { FILE can be also a type cast }
                { FILE can be also a type cast }
                if try_to_consume(_LKLAMMER) then
                if try_to_consume(_LKLAMMER) then
                 begin
                 begin
                   p1:=comp_expr(true);
                   p1:=comp_expr(true);
                   consume(_RKLAMMER);
                   consume(_RKLAMMER);
-                  p1:=ctypeconvnode.create_explicit(p1,htype);
+                  p1:=ctypeconvnode.create_explicit(p1,hdef);
                   { handle postfix operators here e.g. string(a)[10] }
                   { handle postfix operators here e.g. string(a)[10] }
                   again:=true;
                   again:=true;
                   postfixoperators(p1,again);
                   postfixoperators(p1,again);
                 end
                 end
                else
                else
                 begin
                 begin
-                  p1:=ctypenode.create(htype);
+                  p1:=ctypenode.create(hdef);
                 end;
                 end;
              end;
              end;
 
 
@@ -2576,9 +2567,9 @@ implementation
            p1:=cerrornode.create;
            p1:=cerrornode.create;
          end;
          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
         if assigned(p1) and
            (p1<>oldp1) then
            (p1<>oldp1) then
@@ -2702,9 +2693,9 @@ implementation
          oldafterassignment:=afterassignment;
          oldafterassignment:=afterassignment;
          afterassignment:=true;
          afterassignment:=true;
          p1:=sub_expr(opcompare,accept_equal);
          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;
          afterassignment:=oldafterassignment;
          comp_expr:=p1;
          comp_expr:=p1;
       end;
       end;
@@ -2721,9 +2712,9 @@ implementation
       begin
       begin
          oldafterassignment:=afterassignment;
          oldafterassignment:=afterassignment;
          p1:=sub_expr(opcompare,true);
          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;
          filepos:=akttokenpos;
          if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
          if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
            afterassignment:=true;
            afterassignment:=true;
@@ -2738,8 +2729,8 @@ implementation
            _ASSIGNMENT :
            _ASSIGNMENT :
              begin
              begin
                 consume(_ASSIGNMENT);
                 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);
                 p2:=sub_expr(opcompare,true);
                 if assigned(getprocvardef) then
                 if assigned(getprocvardef) then
                   handle_procvar(getprocvardef,p2);
                   handle_procvar(getprocvardef,p2);
@@ -2771,9 +2762,9 @@ implementation
                p1:=gen_c_style_operator(slashn,p1,p2);
                p1:=gen_c_style_operator(slashn,p1,p2);
             end;
             end;
          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;
          afterassignment:=oldafterassignment;
          if p1<>oldp1 then
          if p1<>oldp1 then
            p1.fileinfo:=filepos;
            p1.fileinfo:=filepos;
@@ -2791,7 +2782,7 @@ implementation
       if not codegenerror then
       if not codegenerror then
        begin
        begin
          if (p.nodetype<>ordconstn) or
          if (p.nodetype<>ordconstn) or
-            not(is_integer(p.resulttype.def)) then
+            not(is_integer(p.resultdef)) then
           Message(parser_e_illegal_expression)
           Message(parser_e_illegal_expression)
          else
          else
           result:=tordconstnode(p).value;
           result:=tordconstnode(p).value;
@@ -2810,7 +2801,7 @@ implementation
       p:=comp_expr(true);
       p:=comp_expr(true);
       if p.nodetype<>stringconstn then
       if p.nodetype<>stringconstn then
         begin
         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)
             get_stringconst:=char(tordconstnode(p).value)
           else
           else
             Message(parser_e_illegal_expression);
             Message(parser_e_illegal_expression);

+ 51 - 51
compiler/pinline.pas

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

+ 1 - 1
compiler/pmodules.pas

@@ -479,7 +479,7 @@ implementation
         { Set the owner of errorsym and errortype to symtable to
         { Set the owner of errorsym and errortype to symtable to
           prevent crashes when accessing .owner }
           prevent crashes when accessing .owner }
         generrorsym.owner:=systemunit;
         generrorsym.owner:=systemunit;
-        generrortype.def.owner:=systemunit;
+        generrordef.owner:=systemunit;
 
 
         { Units only required for main module }
         { Units only required for main module }
         if not(current_module.is_unit) then
         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
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
           retcgsize:=OS_ADDR
         else
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         p.funcretloc[side].size:=retcgsize;
         p.funcretloc[side].size:=retcgsize;
         { void has no location }
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
           begin
             p.funcretloc[side].loc:=LOC_VOID;
             p.funcretloc[side].loc:=LOC_VOID;
             exit;
             exit;
           end;
           end;
 
 
         { Return in FPU register? }
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -256,7 +256,7 @@ unit cpupara;
           end
           end
         else
         else
          { Return in register? }
          { 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
           begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             if retcgsize in [OS_64,OS_S64] then
             if retcgsize in [OS_64,OS_S64] then
@@ -342,7 +342,7 @@ unit cpupara;
           for i:=0 to paras.count-1 do
           for i:=0 to paras.count-1 do
             begin
             begin
               hp:=tparavarsym(paras[i]);
               hp:=tparavarsym(paras[i]);
-              paradef := hp.vartype.def;
+              paradef := hp.vardef;
               { Syscall for Morphos can have already a paraloc set }
               { Syscall for Morphos can have already a paraloc set }
               if (vo_has_explicit_paraloc in hp.varoptions) then
               if (vo_has_explicit_paraloc in hp.varoptions) then
                 begin
                 begin
@@ -368,7 +368,7 @@ unit cpupara;
                  is_open_array(paradef) or
                  is_open_array(paradef) or
                  is_array_of_const(paradef) then
                  is_array_of_const(paradef) then
                 begin
                 begin
-                  paradef:=voidpointertype.def;
+                  paradef:=voidpointertype;
                   loc:=LOC_REGISTER;
                   loc:=LOC_REGISTER;
                   paracgsize := OS_ADDR;
                   paracgsize := OS_ADDR;
                   paralen := tcgsize2size[OS_ADDR];
                   paralen := tcgsize2size[OS_ADDR];
@@ -387,14 +387,14 @@ unit cpupara;
                       { if a record has only one field and that field is }
                       { if a record has only one field and that field is }
                       { non-composite (not array or record), it must be  }
                       { non-composite (not array or record), it must be  }
                       { passed according to the rules of that type.       }
                       { 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
                           ((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
                         begin
                           paradef :=
                           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);
                           paracgsize:=def_cgsize(paradef);
                         end
                         end
                       else
                       else
@@ -568,9 +568,9 @@ unit cpupara;
                 hp.paraloc[callerside].alignment:=4;
                 hp.paraloc[callerside].alignment:=4;
                 paraloc:=hp.paraloc[callerside].add_location;
                 paraloc:=hp.paraloc[callerside].add_location;
                 paraloc^.loc:=LOC_REFERENCE;
                 paraloc^.loc:=LOC_REFERENCE;
-                paraloc^.size:=def_cgsize(hp.vartype.def);
+                paraloc^.size:=def_cgsize(hp.vardef);
                 paraloc^.reference.index:=NR_STACK_POINTER_REG;
                 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;
                 paraloc^.reference.offset:=parasize;
                 parasize:=parasize+l;
                 parasize:=parasize+l;
               end;
               end;
@@ -590,7 +590,7 @@ unit cpupara;
         case target_info.system of
         case target_info.system of
           system_powerpc_morphos:
           system_powerpc_morphos:
             begin
             begin
-              paracgsize:=def_cgsize(p.vartype.def);
+              paracgsize:=def_cgsize(p.vardef);
               p.paraloc[callerside].alignment:=4;
               p.paraloc[callerside].alignment:=4;
               p.paraloc[callerside].size:=paracgsize;
               p.paraloc[callerside].size:=paracgsize;
               p.paraloc[callerside].intsize:=tcgsize2size[paracgsize];
               p.paraloc[callerside].intsize:=tcgsize2size[paracgsize];

+ 28 - 28
compiler/powerpc/nppcadd.pas

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

+ 18 - 18
compiler/powerpc/nppccnv.pas

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

+ 1 - 1
compiler/powerpc/nppcinl.pas

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

+ 33 - 33
compiler/powerpc/nppcmat.pas

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

+ 4 - 4
compiler/powerpc/nppcset.pas

@@ -144,8 +144,8 @@ implementation
           end;
           end;
 
 
         begin
         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
              begin
                genlinearcmplist(hp);
                genlinearcmplist(hp);
                exit;
                exit;
@@ -153,7 +153,7 @@ implementation
            if assigned(t^.less) then
            if assigned(t^.less) then
              genitem(t^.less);
              genitem(t^.less);
            { need we to test the first value }
            { 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
              begin
                cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,jmp_lt,aword(t^._low),hregister,elselabel);
                cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,jmp_lt,aword(t^._low),hregister,elselabel);
              end;
              end;
@@ -175,7 +175,7 @@ implementation
                 if first then
                 if first then
                   begin
                   begin
                      { have we to ajust the first value ? }
                      { 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));
                        gensub(longint(t^._low));
                   end
                   end
                 else
                 else

+ 12 - 12
compiler/powerpc64/cpupara.pas

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

+ 16 - 16
compiler/powerpc64/nppcadd.pas

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

+ 10 - 10
compiler/powerpc64/nppccnv.pas

@@ -71,15 +71,15 @@ uses
 
 
 function tppctypeconvnode.first_int_to_real: tnode;
 function tppctypeconvnode.first_int_to_real: tnode;
 begin
 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
     // 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
   end else begin
     // everything that is less than 64 bits is converted to a 64 bit signed
     // 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
     // integer - because the int_to_real conversion is faster for 64 bit
     // signed ints compared to 64 bit unsigned ints.
     // 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);
       inserttypeconv(left, s64inttype);
     end;
     end;
   end;
   end;
@@ -108,7 +108,7 @@ var
   signed: boolean;
   signed: boolean;
 begin
 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 }
   { the code here comes from the PowerPC Compiler Writer's Guide }
   { * longint to double (works for all rounding modes) }
   { * longint to double (works for all rounding modes) }
@@ -138,7 +138,7 @@ begin
     // allocate temp for constant value used for unsigned 64 bit ints
     // allocate temp for constant value used for unsigned 64 bit ints
     tempconst :=
     tempconst :=
       crealconstnode.create(convconst, pbestrealtype^);
       crealconstnode.create(convconst, pbestrealtype^);
-    resulttypepass(tempconst);
+    typecheckpass(tempconst);
     firstpass(tempconst);
     firstpass(tempconst);
     secondpass(tempconst);
     secondpass(tempconst);
     if (tempconst.location.loc <> LOC_CREFERENCE) then
     if (tempconst.location.loc <> LOC_CREFERENCE) then
@@ -164,7 +164,7 @@ begin
           size := OS_S64
           size := OS_S64
         else
         else
           size := OS_64;
           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);
           size, left.location.reference, leftreg);
       end
       end
   else
   else
@@ -244,7 +244,7 @@ begin
   { byte(boolean) or word(wordbool) or longint(longbool) must }
   { byte(boolean) or word(wordbool) or longint(longbool) must }
   { be accepted for var parameters                            }
   { be accepted for var parameters                            }
   if (nf_explicit in flags) and
   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
     (left.location.loc in [LOC_REFERENCE, LOC_CREFERENCE, LOC_CREGISTER]) then
   begin
   begin
     current_procinfo.CurrTrueLabel := oldTrueLabel;
     current_procinfo.CurrTrueLabel := oldTrueLabel;
@@ -253,8 +253,8 @@ begin
     exit;
     exit;
   end;
   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
   case left.location.loc of
     LOC_CREFERENCE, LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER:
     LOC_CREFERENCE, LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER:
       begin
       begin

+ 1 - 1
compiler/powerpc64/nppcinl.pas

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

+ 3 - 3
compiler/powerpc64/nppcld.pas

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

+ 30 - 30
compiler/powerpc64/nppcmat.pas

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

+ 2 - 2
compiler/powerpc64/nppcset.pas

@@ -159,7 +159,7 @@ var
     if assigned(t^.less) then
     if assigned(t^.less) then
       genitem(t^.less);
       genitem(t^.less);
     { need we to test the first value }
     { 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),
       cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_INT, jmp_lt, aword(t^._low),
         hregister, elselabel);
         hregister, elselabel);
     end;
     end;
@@ -178,7 +178,7 @@ var
       { ELSE-label                                }
       { ELSE-label                                }
       if first then begin
       if first then begin
         { have we to ajust the first value ? }
         { 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));
           gensub(aint(t^._low));
       end else begin
       end else begin
         { if there is no unused label between the last and the }
         { 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;
     function tgenppcaddnode.pass_1: tnode;
       begin
       begin
-        resulttypepass(left);
+        typecheckpass(left);
         if (nodetype in [equaln,unequaln]) and
         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
           begin
             result := nil;
             result := nil;
             firstpass(left);
             firstpass(left);
@@ -109,14 +109,14 @@ implementation
             LOC_CREGISTER:
             LOC_CREGISTER:
               ;
               ;
             LOC_REFERENCE,LOC_CREFERENCE:
             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:
             LOC_CONSTANT:
               begin
               begin
                 if load_constants then
                 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;
               end;
             else
             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;
         end;
         end;
 
 
@@ -127,7 +127,7 @@ implementation
           begin
           begin
             location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
             location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
-            if is_64bit(resulttype.def) then
+            if is_64bit(resultdef) then
               location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
               location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
 {$endif cpu64bit}
 {$endif cpu64bit}
          end;
          end;
@@ -136,7 +136,7 @@ implementation
 
 
     function tgenppcaddnode.getresflags : tresflags;
     function tgenppcaddnode.getresflags : tresflags;
       begin
       begin
-        if (left.resulttype.def.deftype <> floatdef) then
+        if (left.resultdef.deftype <> floatdef) then
           result.cr := RS_CR0
           result.cr := RS_CR0
         else
         else
           result.cr := RS_CR1;
           result.cr := RS_CR1;
@@ -178,12 +178,12 @@ implementation
         firstcomplex(self);
         firstcomplex(self);
 
 
         cmpop:=false;
         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
          cgsize:=OS_8
         else
         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
            cgsize:=OS_16
         else
         else
            cgsize:=OS_32;
            cgsize:=OS_32;
@@ -237,7 +237,7 @@ implementation
 
 
             { set result location }
             { set result location }
             if not cmpop then
             if not cmpop then
-              location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def))
+              location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
              else
              else
               location_reset(location,LOC_FLAGS,OS_NO);
               location_reset(location,LOC_FLAGS,OS_NO);
 
 
@@ -301,7 +301,7 @@ implementation
         pass_left_and_right;
         pass_left_and_right;
 
 
         cmpop:=false;
         cmpop:=false;
-        singleprec:=tfloatdef(left.resulttype.def).typ=s32real;
+        singleprec:=tfloatdef(left.resultdef).typ=s32real;
         case nodetype of
         case nodetype of
           addn :
           addn :
             if singleprec then
             if singleprec then
@@ -345,7 +345,7 @@ implementation
         // initialize de result
         // initialize de result
         if not cmpop then
         if not cmpop then
           begin
           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);
             location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
           end
           end
         else
         else
@@ -383,10 +383,10 @@ implementation
         pass_left_and_right;
         pass_left_and_right;
 
 
         { when a setdef is passed, it has to be a smallset }
         { 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);
          internalerror(200203301);
 
 
         opdone := false;
         opdone := false;
@@ -394,7 +394,7 @@ implementation
 
 
         { set result location }
         { set result location }
         if not cmpop then
         if not cmpop then
-          location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def))
+          location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
          else
          else
           location_reset(location,LOC_FLAGS,OS_NO);
           location_reset(location,LOC_FLAGS,OS_NO);
 
 

+ 54 - 54
compiler/pstatmnt.pas

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

+ 23 - 23
compiler/psub.pas

@@ -143,8 +143,8 @@ implementation
       begin
       begin
         if (tsym(p).typ=paravarsym) and
         if (tsym(p).typ=paravarsym) and
            (tparavarsym(p).varspez=vs_value) 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);
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
       end;
 
 
@@ -154,8 +154,8 @@ implementation
         if (tsym(p).typ=localvarsym) and
         if (tsym(p).typ=localvarsym) and
            (tlocalvarsym(p).refs>0) and
            (tlocalvarsym(p).refs>0) and
            not(vo_is_funcret 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
           include(current_procinfo.flags,pi_needs_implicit_finally);
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
       end;
 
 
@@ -260,7 +260,7 @@ implementation
         srsym        : tsym;
         srsym        : tsym;
         para         : tcallparanode;
         para         : tcallparanode;
         newstatement : tstatementnode;
         newstatement : tstatementnode;
-        htype        : ttype;
+        hdef         : tdef;
       begin
       begin
         result:=internalstatements(newstatement);
         result:=internalstatements(newstatement);
 
 
@@ -296,8 +296,8 @@ implementation
                 else
                 else
                   if is_object(current_procinfo.procdef._class) then
                   if is_object(current_procinfo.procdef._class) then
                     begin
                     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 3 : vmt_offset }
                       { parameter 2 : address of pointer to vmt,
                       { parameter 2 : address of pointer to vmt,
                         this is required to allow setting the vmt to -1 to indicate
                         this is required to allow setting the vmt to -1 to indicate
@@ -475,9 +475,9 @@ implementation
           begin
           begin
             { no constructor }
             { no constructor }
             { must be the return value finalized before reraising the exception? }
             { 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));
               addstatement(newstatement,finalize_data_node(load_result_node));
           end;
           end;
       end;
       end;
@@ -628,8 +628,8 @@ implementation
          if tsym(p).typ=paravarsym then
          if tsym(p).typ=paravarsym then
            begin
            begin
              { check if there no parameter of the current procedure is stack dependend }
              { 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;
                pboolean(arg)^:=true;
              if assigned(p) and
              if assigned(p) and
                 assigned(tparavarsym(p).paraloc[calleeside].location) 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, }
             { 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     }
             { 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
             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;
               exit;
           end;
           end;
         result:=true;
         result:=true;
@@ -1194,12 +1194,12 @@ implementation
              entrypos:=code.fileinfo;
              entrypos:=code.fileinfo;
 
 
              { Finish type checking pass }
              { Finish type checking pass }
-             do_resulttypepass(code);
+             do_typecheckpass(code);
            end;
            end;
 
 
          { Check for unused labels, forwards, symbols for procedures. Static
          { Check for unused labels, forwards, symbols for procedures. Static
            symtable is checked in pmodules.
            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
          if (Errorcount=0) and
             (tstoredsymtable(procdef.localst).symtabletype<>staticsymtable) then
             (tstoredsymtable(procdef.localst).symtabletype<>staticsymtable) then
            begin
            begin
@@ -1263,8 +1263,8 @@ implementation
         if tsym(p).typ<>paravarsym then
         if tsym(p).typ<>paravarsym then
          exit;
          exit;
         with tparavarsym(p) do
         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
              (varspez in [vs_value,vs_out])) then
             include(current_procinfo.flags,pi_do_call);
             include(current_procinfo.flags,pi_do_call);
       end;
       end;
@@ -1552,8 +1552,8 @@ implementation
     procedure check_forward_class(p : tnamedindexitem;arg:pointer);
     procedure check_forward_class(p : tnamedindexitem;arg:pointer);
       begin
       begin
         if (tsym(p).typ=typesym) and
         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);
           MessagePos1(tsym(p).fileinfo,sym_e_forward_type_not_resolved,tsym(p).realname);
       end;
       end;
 
 
@@ -1682,13 +1682,13 @@ implementation
         oldaktfilepos : tfileposinfo;
         oldaktfilepos : tfileposinfo;
       begin
       begin
         if not((tsym(p).typ=typesym) and
         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
               ) then
           exit;
           exit;
 
 
         { definitions }
         { definitions }
-        hp:=tdef(tobjectdef(ttypesym(p).restype.def).symtable.defindex.first);
+        hp:=tdef(tobjectdef(ttypesym(p).typedef).symtable.defindex.first);
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
            if hp.deftype=procdef then
            if hp.deftype=procdef then

+ 70 - 74
compiler/psystem.pas

@@ -104,95 +104,91 @@ implementation
         all the types inserted into the system unit
         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
         begin
-          result:=ttypesym.create(s,t);
+          result:=ttypesym.create(s,def);
           systemunit.insert(result);
           systemunit.insert(result);
           { add init/final table if required }
           { add init/final table if required }
-          if t.def.needs_inittable then
+          if def.needs_inittable then
            generate_inittable(result);
            generate_inittable(result);
         end;
         end;
 
 
         procedure adddef(const s:string;def:tdef);
         procedure adddef(const s:string;def:tdef);
-        var
-          t : ttype;
         begin
         begin
-          t.setdef(def);
-          systemunit.insert(ttypesym.create(s,t));
+          systemunit.insert(ttypesym.create(s,def));
         end;
         end;
 
 
       var
       var
         hrecst : trecordsymtable;
         hrecst : trecordsymtable;
       begin
       begin
         symtablestack.push(systemunit);
         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 ?? }
         { 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) }
         { 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}
 {$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
         if target_info.system<>system_x86_64_win64 then
-          s64currencytype.setdef(tfloatdef.create(s64currency))
+          s64currencytype:=tfloatdef.create(s64currency)
         else
         else
           begin
           begin
-            s64currencytype.setdef(torddef.create(scurrency,low(int64),high(int64)));
+            s64currencytype:=torddef.create(scurrency,low(int64),high(int64));
             pbestrealtype:=@s64floattype;
             pbestrealtype:=@s64floattype;
           end;
           end;
-
 {$endif x86}
 {$endif x86}
 {$ifdef powerpc}
 {$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}
 {$endif powerpc}
 {$ifdef POWERPC64}
 {$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}
 {$endif POWERPC64}
 {$ifdef sparc}
 {$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}
 {$endif sparc}
 {$ifdef m68k}
 {$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}
 {$endif}
 {$ifdef arm}
 {$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}
 {$endif arm}
 {$ifdef cpu64bit}
 {$ifdef cpu64bit}
         uinttype:=u64inttype;
         uinttype:=u64inttype;
@@ -204,13 +200,13 @@ implementation
         ptrinttype:=u32inttype;
         ptrinttype:=u32inttype;
 {$endif cpu64bit}
 {$endif cpu64bit}
         { some other definitions }
         { 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}
 {$ifdef cpufpemu}
         { Normal types }
         { Normal types }
@@ -306,24 +302,24 @@ implementation
         addtype('$s64currency',s64currencytype);
         addtype('$s64currency',s64currencytype);
         { Add a type for virtual method tables }
         { Add a type for virtual method tables }
         hrecst:=trecordsymtable.create(aktpackrecords);
         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('$parent',vs_value,pvmttype,[]));
         hrecst.insertfield(tfieldvarsym.create('$length',vs_value,s32inttype,[]));
         hrecst.insertfield(tfieldvarsym.create('$length',vs_value,s32inttype,[]));
         hrecst.insertfield(tfieldvarsym.create('$mlength',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,[]));
         hrecst.insertfield(tfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[]));
         addtype('$__vtbl_ptr_type',vmttype);
         addtype('$__vtbl_ptr_type',vmttype);
         addtype('$pvmt',pvmttype);
         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);
         addtype('$vtblarray',vmtarraytype);
         { Add a type for methodpointers }
         { Add a type for methodpointers }
         hrecst:=trecordsymtable.create(1);
         hrecst:=trecordsymtable.create(1);
         hrecst.insertfield(tfieldvarsym.create('$proc',vs_value,voidpointertype,[]));
         hrecst.insertfield(tfieldvarsym.create('$proc',vs_value,voidpointertype,[]));
         hrecst.insertfield(tfieldvarsym.create('$self',vs_value,voidpointertype,[]));
         hrecst.insertfield(tfieldvarsym.create('$self',vs_value,voidpointertype,[]));
-        methodpointertype.setdef(trecorddef.create(hrecst));
+        methodpointertype:=trecorddef.create(hrecst);
         addtype('$methodpointer',methodpointertype);
         addtype('$methodpointer',methodpointertype);
         symtablestack.pop(systemunit);
         symtablestack.pop(systemunit);
       end;
       end;
@@ -334,12 +330,12 @@ implementation
         Load all default definitions for consts from the system unit
         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
         var
           srsym : ttypesym;
           srsym : ttypesym;
         begin
         begin
           srsym:=search_system_type(s);
           srsym:=search_system_type(s);
-          t:=srsym.restype;
+          def:=srsym.typedef;
         end;
         end;
 
 
       var
       var
@@ -388,7 +384,7 @@ implementation
         loadtype('variant',cvarianttype);
         loadtype('variant',cvarianttype);
         loadtype('olevariant',colevarianttype);
         loadtype('olevariant',colevarianttype);
         loadtype('methodpointer',methodpointertype);
         loadtype('methodpointer',methodpointertype);
-        loadtype('HRESULT',hresulttype);
+        loadtype('HRESULT',hresultdef);
 {$ifdef cpu64bit}
 {$ifdef cpu64bit}
         uinttype:=u64inttype;
         uinttype:=u64inttype;
         sinttype:=s64inttype;
         sinttype:=s64inttype;

+ 76 - 76
compiler/ptconst.pas

@@ -30,7 +30,7 @@ interface
     { this procedure reads typed constants }
     { this procedure reads typed constants }
     { sym is only needed for ansi strings  }
     { sym is only needed for ansi strings  }
     { the assembler label is in the middle (PM) }
     { 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
 implementation
 
 
@@ -52,7 +52,7 @@ implementation
 {$maxfpuregisters 0}
 {$maxfpuregisters 0}
 
 
     { this procedure reads typed constants }
     { 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
       label
          myexit;
          myexit;
       type
       type
@@ -103,11 +103,11 @@ implementation
          block_type:=bt_const;
          block_type:=bt_const;
          datalist:=tasmlist.create;
          datalist:=tasmlist.create;
 
 
-         case t.def.deftype of
+         case def.deftype of
             orddef:
             orddef:
               begin
               begin
                  p:=comp_expr(true);
                  p:=comp_expr(true);
-                 case torddef(t.def).typ of
+                 case torddef(def).typ of
                     bool8bit :
                     bool8bit :
                       begin
                       begin
                          if is_constboolnode(p) then
                          if is_constboolnode(p) then
@@ -158,7 +158,7 @@ implementation
                          if is_constintnode(p) then
                          if is_constintnode(p) then
                            begin
                            begin
                               datalist.concat(Tai_const.Create_8bit(byte(tordconstnode(p).value)));
                               datalist.concat(Tai_const.Create_8bit(byte(tordconstnode(p).value)));
-                              check_range(torddef(t.def));
+                              check_range(torddef(def));
                            end
                            end
                          else
                          else
                            Message(parser_e_illegal_expression);
                            Message(parser_e_illegal_expression);
@@ -169,7 +169,7 @@ implementation
                          if is_constintnode(p) then
                          if is_constintnode(p) then
                            begin
                            begin
                              datalist.concat(Tai_const.Create_16bit(word(tordconstnode(p).value)));
                              datalist.concat(Tai_const.Create_16bit(word(tordconstnode(p).value)));
-                             check_range(torddef(t.def));
+                             check_range(torddef(def));
                            end
                            end
                          else
                          else
                            Message(parser_e_illegal_expression);
                            Message(parser_e_illegal_expression);
@@ -180,8 +180,8 @@ implementation
                          if is_constintnode(p) then
                          if is_constintnode(p) then
                            begin
                            begin
                               datalist.concat(Tai_const.Create_32bit(longint(tordconstnode(p).value)));
                               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
                            end
                          else
                          else
                            Message(parser_e_illegal_expression);
                            Message(parser_e_illegal_expression);
@@ -193,7 +193,7 @@ implementation
                          if is_constintnode(p) then
                          if is_constintnode(p) then
                            intvalue := tordconstnode(p).value
                            intvalue := tordconstnode(p).value
                          else if is_constrealnode(p) and
                          else if is_constrealnode(p) and
-                                 (torddef(t.def).typ=scurrency)
+                                 (torddef(def).typ=scurrency)
                            { allow bootstrapping }
                            { allow bootstrapping }
                            then
                            then
                              begin
                              begin
@@ -221,7 +221,7 @@ implementation
               else
               else
                 Message(parser_e_illegal_expression);
                 Message(parser_e_illegal_expression);
 
 
-              case tfloatdef(t.def).typ of
+              case tfloatdef(def).typ of
                  s32real :
                  s32real :
                    datalist.concat(Tai_real_32bit.Create(ts32real(value)));
                    datalist.concat(Tai_real_32bit.Create(ts32real(value)));
                  s64real :
                  s64real :
@@ -251,12 +251,12 @@ implementation
               p:=comp_expr(true);
               p:=comp_expr(true);
               case p.nodetype of
               case p.nodetype of
                  loadvmtaddrn:
                  loadvmtaddrn:
-                   with Tclassrefdef(p.resulttype.def) do
+                   with Tclassrefdef(p.resultdef) do
                      begin
                      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);
                           message(parser_e_illegal_expression);
                         datalist.concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(
                         datalist.concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(
-                          Tobjectdef(pointertype.def).vmt_mangledname)));
+                          Tobjectdef(pointeddef).vmt_mangledname)));
                      end;
                      end;
                  niln:
                  niln:
                    datalist.concat(Tai_const.Create_sym(nil));
                    datalist.concat(Tai_const.Create_sym(nil));
@@ -269,7 +269,7 @@ implementation
               p:=comp_expr(true);
               p:=comp_expr(true);
               if (p.nodetype=typeconvn) then
               if (p.nodetype=typeconvn) then
                 with Ttypeconvnode(p) do
                 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
                     begin
                       hp:=left;
                       hp:=left;
                       left:=nil;
                       left:=nil;
@@ -302,7 +302,7 @@ implementation
                 datalist.concat(Tai_const.Create_sym(nil))
                 datalist.concat(Tai_const.Create_sym(nil))
               { maybe pchar ? }
               { maybe pchar ? }
               else
               else
-                if is_char(tpointerdef(t.def).pointertype.def) and
+                if is_char(tpointerdef(def).pointeddef) and
                    (p.nodetype<>addrn) then
                    (p.nodetype<>addrn) then
                   begin
                   begin
                     current_asmdata.getdatalabel(ll);
                     current_asmdata.getdatalabel(ll);
@@ -333,7 +333,7 @@ implementation
                 end
                 end
               { maybe pwidechar ? }
               { maybe pwidechar ? }
               else
               else
-                if is_widechar(tpointerdef(t.def).pointertype.def) and
+                if is_widechar(tpointerdef(def).pointeddef) and
                    (p.nodetype<>addrn) then
                    (p.nodetype<>addrn) then
                   begin
                   begin
                     current_asmdata.getdatalabel(ll);
                     current_asmdata.getdatalabel(ll);
@@ -362,7 +362,7 @@ implementation
                    is_procvar_load(p) then
                    is_procvar_load(p) then
                   begin
                   begin
                     { insert typeconv }
                     { insert typeconv }
-                    inserttypeconv(p,t);
+                    inserttypeconv(p,def);
                     hp:=p;
                     hp:=p;
                     while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn]) do
                     while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn]) do
                       hp:=tunarynode(hp).left;
                       hp:=tunarynode(hp).left;
@@ -375,7 +375,7 @@ implementation
                              case hp.nodetype of
                              case hp.nodetype of
                                vecn :
                                vecn :
                                  begin
                                  begin
-                                   case tvecnode(hp).left.resulttype.def.deftype of
+                                   case tvecnode(hp).left.resultdef.deftype of
                                      stringdef :
                                      stringdef :
                                        begin
                                        begin
                                           { this seems OK for shortstring and ansistrings PM }
                                           { this seems OK for shortstring and ansistrings PM }
@@ -385,10 +385,10 @@ implementation
                                        end;
                                        end;
                                      arraydef :
                                      arraydef :
                                        begin
                                        begin
-                                          if not is_packed_array(tvecnode(hp).left.resulttype.def) then
+                                          if not is_packed_array(tvecnode(hp).left.resultdef) then
                                             begin
                                             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
                                             end
                                           else
                                           else
                                             begin
                                             begin
@@ -456,7 +456,7 @@ implementation
                     if (tinlinenode(p).left.nodetype=typen) then
                     if (tinlinenode(p).left.nodetype=typen) then
                       begin
                       begin
                         datalist.concat(Tai_const.createname(
                         datalist.concat(Tai_const.createname(
-                          tobjectdef(tinlinenode(p).left.resulttype.def).vmt_mangledname,0));
+                          tobjectdef(tinlinenode(p).left.resultdef).vmt_mangledname,0));
                       end
                       end
                     else
                     else
                       Message(parser_e_illegal_expression);
                       Message(parser_e_illegal_expression);
@@ -472,7 +472,7 @@ implementation
                 begin
                 begin
                    { be sure to convert to the correct result, else
                    { be sure to convert to the correct result, else
                      it can generate smallset data instead of normalset (PFV) }
                      it can generate smallset data instead of normalset (PFV) }
-                   inserttypeconv(p,t);
+                   inserttypeconv(p,def);
                    { we only allow const sets }
                    { we only allow const sets }
                    if assigned(tsetconstnode(p).left) then
                    if assigned(tsetconstnode(p).left) then
                      Message(parser_e_illegal_expression)
                      Message(parser_e_illegal_expression)
@@ -484,14 +484,14 @@ implementation
 
 
                         if source_info.endian = target_info.endian then
                         if source_info.endian = target_info.endian then
                           begin
                           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]));
                               datalist.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[l]));
                           end
                           end
                         else
                         else
                           begin
                           begin
                             { store as longint values in swaped format }
                             { store as longint values in swaped format }
                             j:=0;
                             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
                               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+3]));
                                 datalist.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2]));
                                 datalist.concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2]));
@@ -511,17 +511,17 @@ implementation
               p:=comp_expr(true);
               p:=comp_expr(true);
               if p.nodetype=ordconstn then
               if p.nodetype=ordconstn then
                 begin
                 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
                    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)));
                        1 : datalist.concat(Tai_const.Create_8bit(Byte(tordconstnode(p).value)));
                        2 : datalist.concat(Tai_const.Create_16bit(Word(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)));
                        4 : datalist.concat(Tai_const.Create_32bit(Longint(tordconstnode(p).value)));
                      end;
                      end;
                    end
                    end
                   else
                   else
-                   IncompatibleTypes(p.resulttype.def,t.def);
+                   IncompatibleTypes(p.resultdef,def);
                 end
                 end
               else
               else
                 Message(parser_e_illegal_expression);
                 Message(parser_e_illegal_expression);
@@ -531,11 +531,11 @@ implementation
            begin
            begin
               p:=comp_expr(true);
               p:=comp_expr(true);
               { load strval and strlength of the constant tree }
               { 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
                 begin
                   { convert to the expected string type so that
                   { convert to the expected string type so that
                     for widestrings strval is a pcompilerwidestring }
                     for widestrings strval is a pcompilerwidestring }
-                  inserttypeconv(p,t);
+                  inserttypeconv(p,def);
                   strlength:=tstringconstnode(p).len;
                   strlength:=tstringconstnode(p).len;
                   strval:=tstringconstnode(p).value_str;
                   strval:=tstringconstnode(p).value_str;
                 end
                 end
@@ -559,13 +559,13 @@ implementation
                 end;
                 end;
               if strlength>=0 then
               if strlength>=0 then
                begin
                begin
-                 case tstringdef(t.def).string_typ of
+                 case tstringdef(def).string_typ of
                    st_shortstring:
                    st_shortstring:
                      begin
                      begin
-                       if strlength>=t.def.size then
+                       if strlength>=def.size then
                         begin
                         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;
                         end;
                        datalist.concat(Tai_const.Create_8bit(strlength));
                        datalist.concat(Tai_const.Create_8bit(strlength));
                        { this can also handle longer strings }
                        { this can also handle longer strings }
@@ -574,15 +574,15 @@ implementation
                        ca[strlength]:=#0;
                        ca[strlength]:=#0;
                        datalist.concat(Tai_string.Create_pchar(ca,strlength));
                        datalist.concat(Tai_string.Create_pchar(ca,strlength));
                        { fillup with spaces if size is shorter }
                        { fillup with spaces if size is shorter }
-                       if t.def.size>strlength then
+                       if def.size>strlength then
                         begin
                         begin
-                          getmem(ca,t.def.size-strlength);
+                          getmem(ca,def.size-strlength);
                           { def.size contains also the leading length, so we }
                           { def.size contains also the leading length, so we }
                           { we have to subtract one                       }
                           { 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 }
                           { 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;
                      end;
                      end;
                    st_ansistring:
                    st_ansistring:
@@ -616,11 +616,11 @@ implementation
                             datalist.concat(Tai_const.Create_sym(ll));
                             datalist.concat(Tai_const.Create_sym(ll));
                             current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint))));
                             current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint))));
                             if tf_winlikewidestring in target_info.flags then
                             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
                             else
                               begin
                               begin
                                 current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(-1));
                                 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;
                               end;
                             current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
                             current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll));
                             for i:=0 to strlength-1 do
                             for i:=0 to strlength-1 do
@@ -640,14 +640,14 @@ implementation
          arraydef:
          arraydef:
            begin
            begin
               { dynamic array nil }
               { dynamic array nil }
-               if is_dynamic_array(t.def) then
+               if is_dynamic_array(def) then
                 begin
                 begin
                   { Only allow nil initialization }
                   { Only allow nil initialization }
                   consume(_NIL);
                   consume(_NIL);
                   datalist.concat(Tai_const.Create_sym(nil));
                   datalist.concat(Tai_const.Create_sym(nil));
                 end
                 end
                { no packed array constants supported }
                { no packed array constants supported }
-               else if is_packed_array(t.def) then
+               else if is_packed_array(def) then
                  begin
                  begin
                    Message(type_e_no_const_packed_array);
                    Message(type_e_no_const_packed_array);
                    consume_all_until(_RKLAMMER);
                    consume_all_until(_RKLAMMER);
@@ -655,17 +655,17 @@ implementation
               else
               else
               if try_to_consume(_LKLAMMER) then
               if try_to_consume(_LKLAMMER) then
                 begin
                 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
                     begin
-                      readtypedconst(datalist,tarraydef(t.def).elementtype,nil,writable);
+                      readtypedconst(datalist,tarraydef(def).elementdef,nil,writable);
                       consume(_COMMA);
                       consume(_COMMA);
                     end;
                     end;
-                  readtypedconst(datalist,tarraydef(t.def).elementtype,nil,writable);
+                  readtypedconst(datalist,tarraydef(def).elementdef,nil,writable);
                   consume(_RKLAMMER);
                   consume(_RKLAMMER);
                 end
                 end
               else
               else
               { if array of char then we allow also a string }
               { 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
                 begin
                    p:=comp_expr(true);
                    p:=comp_expr(true);
                    if p.nodetype=stringconstn then
                    if p.nodetype=stringconstn then
@@ -689,11 +689,11 @@ implementation
                        Message(parser_e_illegal_expression);
                        Message(parser_e_illegal_expression);
                        len:=0;
                        len:=0;
                      end;
                      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);
                      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
                      begin
-                        if i+1-tarraydef(t.def).lowrange<=len then
+                        if i+1-tarraydef(def).lowrange<=len then
                           begin
                           begin
                              datalist.concat(Tai_const.Create_8bit(byte(ca^)));
                              datalist.concat(Tai_const.Create_8bit(byte(ca^)));
                              inc(ca);
                              inc(ca);
@@ -717,7 +717,7 @@ implementation
               if token=_NIL then
               if token=_NIL then
                 begin
                 begin
                    datalist.concat(Tai_const.Create_sym(nil));
                    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));
                      datalist.concat(Tai_const.Create_sym(nil));
                    consume(_NIL);
                    consume(_NIL);
                    goto myexit;
                    goto myexit;
@@ -726,10 +726,10 @@ implementation
               { which is a "procedure of object", because this also requires }
               { which is a "procedure of object", because this also requires }
               { address of an object/class instance, which is not known at   }
               { address of an object/class instance, which is not known at   }
               { compile time (JM)                                            }
               { 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);
                 Message(parser_e_no_procvarobj_const);
                 { parse the rest too, so we can continue with error checking }
                 { parse the rest too, so we can continue with error checking }
-              getprocvardef:=tprocvardef(t.def);
+              getprocvardef:=tprocvardef(def);
               p:=comp_expr(true);
               p:=comp_expr(true);
               getprocvardef:=nil;
               getprocvardef:=nil;
               if codegenerror then
               if codegenerror then
@@ -738,7 +738,7 @@ implementation
                  goto myexit;
                  goto myexit;
                end;
                end;
               { let type conversion check everything needed }
               { let type conversion check everything needed }
-              inserttypeconv(p,t);
+              inserttypeconv(p,def);
               if codegenerror then
               if codegenerror then
                begin
                begin
                  p.free;
                  p.free;
@@ -776,10 +776,10 @@ implementation
          recorddef:
          recorddef:
            begin
            begin
               { packed record }
               { 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)
                 Message(type_e_no_const_packed_record)
               { KAZ }
               { 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
                  ((token=_CSTRING) or (token=_CCHAR) or (token=_ID)) then
                 begin
                 begin
                   p:=comp_expr(true);
                   p:=comp_expr(true);
@@ -811,7 +811,7 @@ implementation
                    consume(_LKLAMMER);
                    consume(_LKLAMMER);
                    sorg:='';
                    sorg:='';
                    aktpos:=0;
                    aktpos:=0;
-                   srsym := tsym(trecorddef(t.def).symtable.symindex.first);
+                   srsym := tsym(trecorddef(def).symtable.symindex.first);
                    recsym := nil;
                    recsym := nil;
                    while token<>_RKLAMMER do
                    while token<>_RKLAMMER do
                      begin
                      begin
@@ -820,7 +820,7 @@ implementation
                         consume(_ID);
                         consume(_ID);
                         consume(_COLON);
                         consume(_COLON);
                         error := false;
                         error := false;
-                        recsym := tsym(trecorddef(t.def).symtable.search(s));
+                        recsym := tsym(trecorddef(def).symtable.search(s));
                         if not assigned(recsym) then
                         if not assigned(recsym) then
                           begin
                           begin
                             Message1(sym_e_illegal_field,sorg);
                             Message1(sym_e_illegal_field,sorg);
@@ -875,10 +875,10 @@ implementation
                                  datalist.concat(Tai_const.Create_8bit(0));
                                  datalist.concat(Tai_const.Create_8bit(0));
 
 
                              { new position }
                              { new position }
-                             aktpos:=tfieldvarsym(srsym).fieldoffset+tfieldvarsym(srsym).vartype.def.size;
+                             aktpos:=tfieldvarsym(srsym).fieldoffset+tfieldvarsym(srsym).vardef.size;
 
 
                              { read the data }
                              { read the data }
-                             readtypedconst(datalist,tfieldvarsym(srsym).vartype,nil,writable);
+                             readtypedconst(datalist,tfieldvarsym(srsym).vardef,nil,writable);
 
 
                              { keep previous field for checking whether whole }
                              { keep previous field for checking whether whole }
                              { record was initialized (JM)                    }
                              { record was initialized (JM)                    }
@@ -900,7 +900,7 @@ implementation
                      (tfieldvarsym(srsym).fieldoffset > tfieldvarsym(recsym).fieldoffset)) then
                      (tfieldvarsym(srsym).fieldoffset > tfieldvarsym(recsym).fieldoffset)) then
                    Message1(parser_w_skipped_fields_after,sorg);
                    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));
                    datalist.concat(Tai_const.Create_8bit(0));
 
 
                  consume(_RKLAMMER);
                  consume(_RKLAMMER);
@@ -909,7 +909,7 @@ implementation
          { reads a typed object }
          { reads a typed object }
          objectdef:
          objectdef:
            begin
            begin
-              if is_class_or_interface(t.def) then
+              if is_class_or_interface(def) then
                 begin
                 begin
                   p:=comp_expr(true);
                   p:=comp_expr(true);
                   if p.nodetype<>niln then
                   if p.nodetype<>niln then
@@ -924,11 +924,11 @@ implementation
                   p.free;
                   p.free;
                 end
                 end
               { for objects we allow it only if it doesn't contain a vmt }
               { 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
                       (m_fpc in aktmodeswitches) then
                  Message(parser_e_type_const_not_possible)
                  Message(parser_e_type_const_not_possible)
               { packed object }
               { 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)
                 Message(type_e_no_const_packed_record)
               else
               else
                 begin
                 begin
@@ -941,7 +941,7 @@ implementation
                         consume(_ID);
                         consume(_ID);
                         consume(_COLON);
                         consume(_COLON);
                         srsym:=nil;
                         srsym:=nil;
-                        obj:=tobjectdef(t.def);
+                        obj:=tobjectdef(def);
                         symt:=obj.symtable;
                         symt:=obj.symtable;
                         while (srsym=nil) and assigned(symt) do
                         while (srsym=nil) and assigned(symt) do
                           begin
                           begin
@@ -967,7 +967,7 @@ implementation
                                  message(parser_e_invalid_record_const);
                                  message(parser_e_invalid_record_const);
 
 
                                { check in VMT needs to be added for TP mode }
                                { 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
                                  if not(m_fpc in aktmodeswitches) and
                                     (oo_has_vmt in objectoptions) and
                                     (oo_has_vmt in objectoptions) and
                                     (vmt_offset<fieldoffset) then
                                     (vmt_offset<fieldoffset) then
@@ -985,26 +985,26 @@ implementation
                                    datalist.concat(Tai_const.Create_8bit(0));
                                    datalist.concat(Tai_const.Create_8bit(0));
 
 
                                { new position }
                                { new position }
-                               aktpos:=fieldoffset+vartype.def.size;
+                               aktpos:=fieldoffset+vardef.size;
 
 
                                { read the data }
                                { read the data }
-                               readtypedconst(datalist,vartype,nil,writable);
+                               readtypedconst(datalist,vardef,nil,writable);
 
 
                                if not try_to_consume(_SEMICOLON) then
                                if not try_to_consume(_SEMICOLON) then
                                  break;
                                  break;
                           end;
                           end;
                      end;
                      end;
                    if not(m_fpc in aktmodeswitches) and
                    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
                      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.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 }
                        { this is more general }
-                       aktpos:=tobjectdef(t.def).vmt_offset + sizeof(aint);
+                       aktpos:=tobjectdef(def).vmt_offset + sizeof(aint);
                      end;
                      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));
                      datalist.concat(Tai_const.Create_8bit(0));
                    consume(_RKLAMMER);
                    consume(_RKLAMMER);
                 end;
                 end;
@@ -1051,7 +1051,7 @@ implementation
              else
              else
                cursectype:=sec_rodata;
                cursectype:=sec_rodata;
              maybe_new_object_file(list);
              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
              if (sym.owner.symtabletype=globalsymtable) or
                 maybe_smartlink_symbol or
                 maybe_smartlink_symbol or
                 (assigned(current_procinfo) and
                 (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 }
     { reads a string, file type or a type id and returns a name and }
     { tdef }
     { 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 }
     { reads a type definition }
     { to a appropriating tdef, s gets the name of   }
     { to a appropriating tdef, s gets the name of   }
     { the type to allow name mangling          }
     { the type to allow name mangling          }
-    procedure id_type(var tt : ttype;isforwarddef:boolean);
+    procedure id_type(var def : tdef;isforwarddef:boolean);
 
 
 
 
 implementation
 implementation
@@ -83,12 +83,12 @@ implementation
         generictypelist : TFPObjectList;
         generictypelist : TFPObjectList;
       begin
       begin
         { retrieve generic def that we are going to replace }
         { 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
         if not(df_generic in genericdef.defoptions) then
           begin
           begin
             Comment(V_Error,'Specialization is only supported for generic types');
             Comment(V_Error,'Specialization is only supported for generic types');
-            pt1.resulttype:=generrortype;
+            pt1.resultdef:=generrordef;
             { recover }
             { recover }
             consume(_LSHARPBRACKET);
             consume(_LSHARPBRACKET);
             repeat
             repeat
@@ -118,7 +118,7 @@ implementation
         while assigned(sym) do
         while assigned(sym) do
           begin
           begin
             if (sym.typ=typesym) and
             if (sym.typ=typesym) and
-               (ttypesym(sym).restype.def.deftype=undefineddef) then
+               (ttypesym(sym).typedef.deftype=undefineddef) then
               begin
               begin
                 if not first then
                 if not first then
                   begin
                   begin
@@ -128,7 +128,7 @@ implementation
                 pt2:=factor(false);
                 pt2:=factor(false);
                 if pt2.nodetype=typen then
                 if pt2.nodetype=typen then
                   begin
                   begin
-                    generictype:=ttypesym.create(sym.realname,pt2.resulttype);
+                    generictype:=ttypesym.create(sym.realname,pt2.resultdef);
                     generictypelist.add(generictype);
                     generictypelist.add(generictype);
                   end
                   end
                 else
                 else
@@ -146,7 +146,7 @@ implementation
             if not assigned(genericdef.generictokenbuf) then
             if not assigned(genericdef.generictokenbuf) then
               internalerror(200511171);
               internalerror(200511171);
             current_scanner.startreplaytokens(genericdef.generictokenbuf);
             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 }
             { Consume the semicolon if it is also recorded }
             try_to_consume(_SEMICOLON);
             try_to_consume(_SEMICOLON);
           end;
           end;
@@ -155,7 +155,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure id_type(var tt : ttype;isforwarddef:boolean);
+    procedure id_type(var def : tdef;isforwarddef:boolean);
     { reads a type definition }
     { reads a type definition }
     { to a appropriating tdef, s gets the name of   }
     { to a appropriating tdef, s gets the name of   }
     { the type to allow name mangling          }
     { the type to allow name mangling          }
@@ -180,7 +180,7 @@ implementation
             )then
             )then
            begin
            begin
              consume(_ID);
              consume(_ID);
-             tt.setdef(aktobjectdef);
+             def:=aktobjectdef;
              exit;
              exit;
            end;
            end;
          { Use the special searchsym_type that ignores records,objects and
          { Use the special searchsym_type that ignores records,objects and
@@ -195,54 +195,54 @@ implementation
            table as forwarddef are not resolved directly }
            table as forwarddef are not resolved directly }
          if assigned(srsym) and
          if assigned(srsym) and
             (srsym.typ=typesym) and
             (srsym.typ=typesym) and
-            (ttypesym(srsym).restype.def.deftype=errordef) then
+            (ttypesym(srsym).typedef.deftype=errordef) then
           begin
           begin
             Message1(type_e_type_is_not_completly_defined,ttypesym(srsym).realname);
             Message1(type_e_type_is_not_completly_defined,ttypesym(srsym).realname);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
             exit;
           end;
           end;
          { are we parsing a possible forward def ? }
          { are we parsing a possible forward def ? }
          if isforwarddef and
          if isforwarddef and
             not(is_unit_specific) then
             not(is_unit_specific) then
           begin
           begin
-            tt.setdef(tforwarddef.create(s,pos));
+            def:=tforwarddef.create(s,pos);
             exit;
             exit;
           end;
           end;
          { unknown sym ? }
          { unknown sym ? }
          if not assigned(srsym) then
          if not assigned(srsym) then
           begin
           begin
             Message1(sym_e_id_not_found,sorg);
             Message1(sym_e_id_not_found,sorg);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
             exit;
           end;
           end;
          { type sym ? }
          { type sym ? }
          if (srsym.typ<>typesym) then
          if (srsym.typ<>typesym) then
           begin
           begin
             Message(type_e_type_id_expected);
             Message(type_e_type_id_expected);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
             exit;
           end;
           end;
          { Give an error when referring to an errordef }
          { Give an error when referring to an errordef }
-         if (ttypesym(srsym).restype.def.deftype=errordef) then
+         if (ttypesym(srsym).typedef.deftype=errordef) then
           begin
           begin
             Message(sym_e_error_in_type_def);
             Message(sym_e_error_in_type_def);
-            tt:=generrortype;
+            def:=generrordef;
             exit;
             exit;
           end;
           end;
-        tt.setdef(ttypesym(srsym).restype.def);
+        def:=ttypesym(srsym).typedef;
       end;
       end;
 
 
 
 
-    procedure single_type(var tt:ttype;isforwarddef:boolean);
+    procedure single_type(var def:tdef;isforwarddef:boolean);
        var
        var
-         t2 : ttype;
+         t2 : tdef;
          again : boolean;
          again : boolean;
        begin
        begin
          repeat
          repeat
            again:=false;
            again:=false;
              case token of
              case token of
                _STRING:
                _STRING:
-                 string_dec(tt);
+                 string_dec(def);
 
 
                _FILE:
                _FILE:
                  begin
                  begin
@@ -250,10 +250,10 @@ implementation
                     if try_to_consume(_OF) then
                     if try_to_consume(_OF) then
                       begin
                       begin
                          single_type(t2,false);
                          single_type(t2,false);
-                         tt.setdef(tfiledef.createtyped(t2));
+                         def:=tfiledef.createtyped(t2);
                       end
                       end
                     else
                     else
-                      tt:=cfiletype;
+                      def:=cfiletype;
                  end;
                  end;
 
 
                _ID:
                _ID:
@@ -264,13 +264,13 @@ implementation
                        again:=true;
                        again:=true;
                      end
                      end
                    else
                    else
-                     id_type(tt,isforwarddef);
+                     id_type(def,isforwarddef);
                  end;
                  end;
 
 
                else
                else
                  begin
                  begin
                    message(type_e_type_id_expected);
                    message(type_e_type_id_expected);
-                   tt:=generrortype;
+                   def:=generrordef;
                  end;
                  end;
             end;
             end;
         until not again;
         until not again;
@@ -312,12 +312,11 @@ implementation
 
 
 
 
     { reads a type definition and returns a pointer to it }
     { 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
       var
         pt : tnode;
         pt : tnode;
-        tt2 : ttype;
+        tt2 : tdef;
         aktenumdef : tenumdef;
         aktenumdef : tenumdef;
-        ap : tarraydef;
         s : stringid;
         s : stringid;
         l,v : TConstExprInt;
         l,v : TConstExprInt;
         oldaktpackrecords : longint;
         oldaktpackrecords : longint;
@@ -342,7 +341,7 @@ implementation
               )then
               )then
              begin
              begin
                consume(_ID);
                consume(_ID);
-               tt.setdef(aktobjectdef);
+               def:=aktobjectdef;
                exit;
                exit;
              end;
              end;
            { Generate a specialization? }
            { Generate a specialization? }
@@ -359,8 +358,8 @@ implementation
                  done when both are integer values, because typecasting
                  done when both are integer values, because typecasting
                  between -3200..3200 will result in a signed-unsigned
                  between -3200..3200 will result in a signed-unsigned
                  conflict and give a range check error (PFV) }
                  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 }
                { both must be evaluated to constants now }
                if (pt1.nodetype=ordconstn) and
                if (pt1.nodetype=ordconstn) and
                   (pt2.nodetype=ordconstn) then
                   (pt2.nodetype=ordconstn) then
@@ -373,18 +372,18 @@ implementation
                    else
                    else
                      begin
                      begin
                        { All checks passed, create the new def }
                        { All checks passed, create the new def }
-                       case pt1.resulttype.def.deftype of
+                       case pt1.resultdef.deftype of
                          enumdef :
                          enumdef :
-                           tt.setdef(tenumdef.create_subrange(tenumdef(pt1.resulttype.def),lv,hv));
+                           def:=tenumdef.create_subrange(tenumdef(pt1.resultdef),lv,hv);
                          orddef :
                          orddef :
                            begin
                            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
                              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
                                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;
                        end;
                      end;
                      end;
@@ -400,7 +399,7 @@ implementation
                  begin
                  begin
                    if (block_type=bt_specialize) then
                    if (block_type=bt_specialize) then
                      generate_specialization(pt1,name);
                      generate_specialization(pt1,name);
-                   tt:=ttypenode(pt1).resulttype;
+                   def:=ttypenode(pt1).resultdef;
                  end
                  end
                else
                else
                  Message(sym_e_error_in_type_def);
                  Message(sym_e_error_in_type_def);
@@ -415,22 +414,22 @@ implementation
           consume(_SET);
           consume(_SET);
           consume(_OF);
           consume(_OF);
           read_anon_type(tt2,true);
           read_anon_type(tt2,true);
-          if assigned(tt2.def) then
+          if assigned(tt2) then
            begin
            begin
-             case tt2.def.deftype of
+             case tt2.deftype of
                { don't forget that min can be negativ  PM }
                { don't forget that min can be negativ  PM }
                enumdef :
                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
                  else
                   Message(sym_e_ill_type_decl_set);
                   Message(sym_e_ill_type_decl_set);
                orddef :
                orddef :
                  begin
                  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
                    else
                      Message(sym_e_ill_type_decl_set);
                      Message(sym_e_ill_type_decl_set);
                  end;
                  end;
@@ -439,7 +438,7 @@ implementation
              end;
              end;
            end
            end
           else
           else
-           tt:=generrortype;
+           def:=generrordef;
         end;
         end;
 
 
 
 
@@ -447,24 +446,25 @@ implementation
         var
         var
           lowval,
           lowval,
           highval   : TConstExprInt;
           highval   : TConstExprInt;
-          arraytype : ttype;
-          ht        : ttype;
+          indexdef  : tdef;
+          hdef      : tdef;
+          arrdef    : tarraydef;
 
 
-          procedure setdefdecl(const t:ttype);
+          procedure setdefdecl(def:tdef);
           begin
           begin
-            case t.def.deftype of
+            case def.deftype of
               enumdef :
               enumdef :
                 begin
                 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
                   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);
                    Message(type_e_array_index_enums_with_assign_not_possible);
-                  arraytype:=t;
+                  indexdef:=def;
                 end;
                 end;
               orddef :
               orddef :
                 begin
                 begin
-                  if torddef(t.def).typ in [uchar,
+                  if torddef(def).typ in [uchar,
                     u8bit,u16bit,
                     u8bit,u16bit,
                     s8bit,s16bit,s32bit,
                     s8bit,s16bit,s32bit,
 {$ifdef cpu64bit}
 {$ifdef cpu64bit}
@@ -473,12 +473,12 @@ implementation
                     bool8bit,bool16bit,bool32bit,bool64bit,
                     bool8bit,bool16bit,bool32bit,bool64bit,
                     uwidechar] then
                     uwidechar] then
                     begin
                     begin
-                       lowval:=torddef(t.def).low;
-                       highval:=torddef(t.def).high;
-                       arraytype:=t;
+                       lowval:=torddef(def).low;
+                       highval:=torddef(def).high;
+                       indexdef:=def;
                     end
                     end
                   else
                   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;
                 end;
               else
               else
                 Message(sym_e_error_in_type_def);
                 Message(sym_e_error_in_type_def);
@@ -486,30 +486,29 @@ implementation
           end;
           end;
 
 
         begin
         begin
+           arrdef:=nil;
            consume(_ARRAY);
            consume(_ARRAY);
            { open array? }
            { open array? }
-           if token=_LECKKLAMMER then
+           if try_to_consume(_LECKKLAMMER) then
              begin
              begin
-                consume(_LECKKLAMMER);
                 { defaults }
                 { defaults }
-                arraytype:=generrortype;
+                indexdef:=generrordef;
                 lowval:=low(aint);
                 lowval:=low(aint);
                 highval:=high(aint);
                 highval:=high(aint);
-                tt.reset;
                 repeat
                 repeat
                   { read the expression and check it, check apart if the
                   { read the expression and check it, check apart if the
                     declaration is an enum declaration because that needs to
                     declaration is an enum declaration because that needs to
                     be parsed by readtype (PFV) }
                     be parsed by readtype (PFV) }
                   if token=_LKLAMMER then
                   if token=_LKLAMMER then
                    begin
                    begin
-                     read_anon_type(ht,true);
-                     setdefdecl(ht);
+                     read_anon_type(hdef,true);
+                     setdefdecl(hdef);
                    end
                    end
                   else
                   else
                    begin
                    begin
                      pt:=expr;
                      pt:=expr;
                      if pt.nodetype=typen then
                      if pt.nodetype=typen then
-                      setdefdecl(pt.resulttype)
+                      setdefdecl(pt.resultdef)
                      else
                      else
                        begin
                        begin
                           if (pt.nodetype=rangen) then
                           if (pt.nodetype=rangen) then
@@ -521,8 +520,8 @@ implementation
                                   done when both are integer values, because typecasting
                                   done when both are integer values, because typecasting
                                   between -3200..3200 will result in a signed-unsigned
                                   between -3200..3200 will result in a signed-unsigned
                                   conflict and give a range check error (PFV) }
                                   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;
                                 lowval:=tordconstnode(trangenode(pt).left).value;
                                 highval:=tordconstnode(trangenode(pt).right).value;
                                 highval:=tordconstnode(trangenode(pt).right).value;
                                 if highval<lowval then
                                 if highval<lowval then
@@ -537,10 +536,10 @@ implementation
                                     lowval :=0;
                                     lowval :=0;
                                     highval:=0;
                                     highval:=0;
                                   end;
                                   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
                                 else
-                                  arraytype:=trangenode(pt).left.resulttype;
+                                  indexdef:=trangenode(pt).left.resultdef;
                               end
                               end
                              else
                              else
                               Message(type_e_cant_eval_constant_expr);
                               Message(type_e_cant_eval_constant_expr);
@@ -551,19 +550,20 @@ implementation
                      pt.free;
                      pt.free;
                    end;
                    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
                   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
                   if token=_COMMA then
                     consume(_COMMA)
                     consume(_COMMA)
@@ -576,18 +576,18 @@ implementation
              begin
              begin
                 if is_packed then
                 if is_packed then
                   Message(parser_e_packed_dynamic_open_array);
                   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;
              end;
            consume(_OF);
            consume(_OF);
            read_anon_type(tt2,true);
            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
              begin
-               ap.setelementtype(tt2);
+               arrdef.elementdef:=tt2;
                if is_packed and
                if is_packed and
-                  tt2.def.needs_inittable then
+                  tt2.needs_inittable then
                  Message(type_e_no_packed_inittable);
                  Message(type_e_no_packed_inittable);
              end;
              end;
         end;
         end;
@@ -601,11 +601,11 @@ implementation
         oldlocalswitches : tlocalswitches;
         oldlocalswitches : tlocalswitches;
         bitpacking: boolean;
         bitpacking: boolean;
       begin
       begin
-         tt.reset;
+         def:=nil;
          case token of
          case token of
             _STRING,_FILE:
             _STRING,_FILE:
               begin
               begin
-                single_type(tt,false);
+                single_type(def,false);
               end;
               end;
            _LKLAMMER:
            _LKLAMMER:
               begin
               begin
@@ -637,12 +637,12 @@ implementation
                         begin
                         begin
                           { we expect an integer or an enum of the
                           { we expect an integer or an enum of the
                             same type }
                             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
                            v:=tordconstnode(p).value
                           else
                           else
-                           IncompatibleTypes(p.resulttype.def,s32inttype.def);
+                           IncompatibleTypes(p.resultdef,s32inttype);
                         end
                         end
                        else
                        else
                         Message(parser_e_illegal_expression);
                         Message(parser_e_illegal_expression);
@@ -664,7 +664,7 @@ implementation
                   tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l));
                   tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l));
                   akttokenpos:=storepos;
                   akttokenpos:=storepos;
                 until not try_to_consume(_COMMA);
                 until not try_to_consume(_COMMA);
-                tt.setdef(aktenumdef);
+                def:=aktenumdef;
                 consume(_RKLAMMER);
                 consume(_RKLAMMER);
               end;
               end;
             _ARRAY:
             _ARRAY:
@@ -679,11 +679,11 @@ implementation
               begin
               begin
                 consume(_CARET);
                 consume(_CARET);
                 single_type(tt2,typecanbeforward);
                 single_type(tt2,typecanbeforward);
-                tt.setdef(tpointerdef.create(tt2));
+                def:=tpointerdef.create(tt2);
               end;
               end;
             _RECORD:
             _RECORD:
               begin
               begin
-                tt.setdef(record_dec);
+                def:=record_dec;
               end;
               end;
             _PACKED,
             _PACKED,
             _BITPACKED:
             _BITPACKED:
@@ -705,9 +705,9 @@ implementation
                     else
                     else
                       aktpackrecords:=bit_alignment;
                       aktpackrecords:=bit_alignment;
                     if token in [_CLASS,_OBJECT] then
                     if token in [_CLASS,_OBJECT] then
-                      tt.setdef(object_dec(name,genericdef,genericlist,nil))
+                      def:=object_dec(name,genericdef,genericlist,nil)
                     else
                     else
-                      tt.setdef(record_dec);
+                      def:=record_dec;
                     aktpackrecords:=oldaktpackrecords;
                     aktpackrecords:=oldaktpackrecords;
                   end;
                   end;
               end;
               end;
@@ -717,7 +717,7 @@ implementation
             _INTERFACE,
             _INTERFACE,
             _OBJECT:
             _OBJECT:
               begin
               begin
-                tt.setdef(object_dec(name,genericdef,genericlist,nil));
+                def:=object_dec(name,genericdef,genericlist,nil);
               end;
               end;
             _PROCEDURE,
             _PROCEDURE,
             _FUNCTION:
             _FUNCTION:
@@ -730,7 +730,7 @@ implementation
                 if is_func then
                 if is_func then
                  begin
                  begin
                    consume(_COLON);
                    consume(_COLON);
-                   single_type(pd.rettype,false);
+                   single_type(pd.returndef,false);
                  end;
                  end;
                 if token=_OF then
                 if token=_OF then
                   begin
                   begin
@@ -738,16 +738,16 @@ implementation
                     consume(_OBJECT);
                     consume(_OBJECT);
                     include(pd.procoptions,po_methodpointer);
                     include(pd.procoptions,po_methodpointer);
                   end;
                   end;
-                tt.def:=pd;
+                def:=pd;
                 { possible proc directives }
                 { possible proc directives }
                 if parseprocvardir then
                 if parseprocvardir then
                   begin
                   begin
                     if check_proc_directive(true) then
                     if check_proc_directive(true) then
                       begin
                       begin
-                         newtype:=ttypesym.create('unnamed',tt);
+                         newtype:=ttypesym.create('unnamed',def);
                          parse_var_proc_directives(tsym(newtype));
                          parse_var_proc_directives(tsym(newtype));
-                         newtype.restype.def:=nil;
-                         tt.def.typesym:=nil;
+                         newtype.typedef:=nil;
+                         def.typesym:=nil;
                          newtype.free;
                          newtype.free;
                       end;
                       end;
                     { Add implicit hidden parameters and function result }
                     { Add implicit hidden parameters and function result }
@@ -757,14 +757,14 @@ implementation
             else
             else
               expr_type;
               expr_type;
          end;
          end;
-         if tt.def=nil then
-          tt:=generrortype;
+         if def=nil then
+          def:=generrordef;
       end;
       end;
 
 
 
 
-    procedure read_anon_type(var tt : ttype;parseprocvardir:boolean);
+    procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
       begin
       begin
-        read_named_type(tt,'',nil,nil,parseprocvardir);
+        read_named_type(def,'',nil,nil,parseprocvardir);
       end;
       end;
 
 
 
 

+ 2 - 2
compiler/raatt.pas

@@ -1365,7 +1365,7 @@ unit raatt;
                            typedconstsym :
                            typedconstsym :
                              l:=ttypedconstsym(sym).getsize;
                              l:=ttypedconstsym(sym).getsize;
                            typesym :
                            typesym :
-                             l:=ttypesym(sym).restype.def.size;
+                             l:=ttypesym(sym).typedef.size;
                            else
                            else
                              Message(asmr_e_wrong_sym_type);
                              Message(asmr_e_wrong_sym_type);
                          end;
                          end;
@@ -1426,7 +1426,7 @@ unit raatt;
                                end;
                                end;
                            typesym :
                            typesym :
                              begin
                              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);
                                 Message(asmr_e_wrong_sym_type);
                              end;
                              end;
                            else
                            else

+ 43 - 44
compiler/rautils.pas

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

+ 13 - 13
compiler/regvars.pas

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

+ 7 - 7
compiler/scanner.pas

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

+ 1 - 1
compiler/sparc/cgcpu.pas

@@ -1029,7 +1029,7 @@ implementation
       var
       var
         hr : treference;
         hr : treference;
       begin
       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
           begin
             reference_reset(hr);
             reference_reset(hr);
             hr.offset:=12;
             hr.offset:=12;

+ 7 - 7
compiler/sparc/cpupara.pas

@@ -146,19 +146,19 @@ implementation
         if (p.proctypeoption=potype_constructor) then
         if (p.proctypeoption=potype_constructor) then
           retcgsize:=OS_ADDR
           retcgsize:=OS_ADDR
         else
         else
-          retcgsize:=def_cgsize(p.rettype.def);
+          retcgsize:=def_cgsize(p.returndef);
 
 
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
         p.funcretloc[side].size:=retcgsize;
         p.funcretloc[side].size:=retcgsize;
         { void has no location }
         { void has no location }
-        if is_void(p.rettype.def) then
+        if is_void(p.returndef) then
           begin
           begin
             p.funcretloc[side].loc:=LOC_VOID;
             p.funcretloc[side].loc:=LOC_VOID;
             exit;
             exit;
           end;
           end;
 
 
         { Return in FPU register? }
         { Return in FPU register? }
-        if p.rettype.def.deftype=floatdef then
+        if p.returndef.deftype=floatdef then
           begin
           begin
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].loc:=LOC_FPUREGISTER;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
             p.funcretloc[side].register:=NR_FPU_RESULT_REG;
@@ -168,7 +168,7 @@ implementation
           end
           end
         else
         else
          { Return in register? }
          { 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
           begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             if retcgsize in [OS_64,OS_S64] then
             if retcgsize in [OS_64,OS_S64] then
@@ -224,7 +224,7 @@ implementation
             { currently only support C-style array of const,
             { currently only support C-style array of const,
               there should be no location assigned to the vararg array itself }
               there should be no location assigned to the vararg array itself }
             if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
             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
               begin
                 paraloc:=hp.paraloc[side].add_location;
                 paraloc:=hp.paraloc[side].add_location;
                 { hack: the paraloc must be valid, but is not actually used }
                 { hack: the paraloc must be valid, but is not actually used }
@@ -234,11 +234,11 @@ implementation
                 break;
                 break;
               end;
               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
               paracgsize:=OS_ADDR
             else
             else
               begin
               begin
-                paracgsize:=def_cgSize(hp.vartype.def);
+                paracgsize:=def_cgSize(hp.vardef);
                 if paracgsize=OS_NO then
                 if paracgsize=OS_NO then
                   paracgsize:=OS_ADDR;
                   paracgsize:=OS_ADDR;
               end;
               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,left.location,true);
         location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER));
         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
         if left.location.loc<>LOC_CFPUREGISTER then
           location.register:=left.location.register
           location.register:=left.location.register
         else
         else
@@ -340,8 +340,8 @@ interface
         pass_left_right;
         pass_left_right;
         force_reg_left_right(false,false);
         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);
         location_reset(location,LOC_JUMP,OS_NO);
 
 
@@ -359,8 +359,8 @@ interface
         pass_left_right;
         pass_left_right;
         force_reg_left_right(true,true);
         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
         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)
           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;
     procedure tsparccallnode.extra_post_call_code;
       begin
       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;
       end;
 
 
 
 

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff