Browse Source

+ support of passing variants to "array of const"

florian 23 years ago
parent
commit
457e32728d
2 changed files with 27 additions and 9 deletions
  1. 22 8
      compiler/ncgld.pas
  2. 5 1
      compiler/nld.pas

+ 22 - 8
compiler/ncgld.pas

@@ -817,8 +817,15 @@ implementation
                          if is_boolean(lt) then
                          if is_boolean(lt) then
                            vtype:=vtBoolean
                            vtype:=vtBoolean
                          else
                          else
-                           if (lt.deftype=orddef) and (torddef(lt).typ=uchar) then
-                             vtype:=vtChar;
+                           if (lt.deftype=orddef) then
+                             begin
+                               case torddef(lt).typ of
+                                 uchar:
+                                   vtype:=vtChar;
+                                 uwidechar:
+                                   vtype:=vtWideChar;
+                               end;
+                             end;
                      end;
                      end;
                    floatdef :
                    floatdef :
                      begin
                      begin
@@ -834,12 +841,16 @@ implementation
                        else
                        else
                          vtype:=vtPointer;
                          vtype:=vtPointer;
                      end;
                      end;
+                   variantdef :
+                     begin
+                        vtype:=vtVariant;
+                        vaddr:=true;
+                        freetemp:=false;
+                     end;
                    classrefdef :
                    classrefdef :
                      vtype:=vtClass;
                      vtype:=vtClass;
                    objectdef :
                    objectdef :
-                     begin
-                       vtype:=vtObject;
-                     end;
+                     vtype:=vtObject;
                    stringdef :
                    stringdef :
                      begin
                      begin
                        if is_shortstring(lt) then
                        if is_shortstring(lt) then
@@ -873,7 +884,7 @@ implementation
                        cg.a_paramaddr_ref(exprasmlist,hp.left.location.reference,paralocdummy);
                        cg.a_paramaddr_ref(exprasmlist,hp.left.location.reference,paralocdummy);
                        location_release(exprasmlist,hp.left.location);
                        location_release(exprasmlist,hp.left.location);
                        if freetemp then
                        if freetemp then
-                        location_freetemp(exprasmlist,hp.left.location);
+                         location_freetemp(exprasmlist,hp.left.location);
                      end
                      end
                     else
                     else
                      cg.a_param_loc(exprasmlist,hp.left.location,paralocdummy);
                      cg.a_param_loc(exprasmlist,hp.left.location,paralocdummy);
@@ -892,7 +903,7 @@ implementation
                        cg.free_scratch_reg(exprasmlist,tmpreg);
                        cg.free_scratch_reg(exprasmlist,tmpreg);
                        location_release(exprasmlist,hp.left.location);
                        location_release(exprasmlist,hp.left.location);
                        if freetemp then
                        if freetemp then
-                        location_freetemp(exprasmlist,hp.left.location);
+                         location_freetemp(exprasmlist,hp.left.location);
                      end
                      end
                     else
                     else
                      begin
                      begin
@@ -946,7 +957,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.30  2002-09-17 18:54:02  jonas
+  Revision 1.31  2002-09-26 15:02:05  florian
+    + support of passing variants to "array of const"
+
+  Revision 1.30  2002/09/17 18:54:02  jonas
     * a_load_reg_reg() now has two size parameters: source and dest. This
     * a_load_reg_reg() now has two size parameters: source and dest. This
       allows some optimizations on architectures that don't encode the
       allows some optimizations on architectures that don't encode the
       register size in the register name.
       register size in the register name.

+ 5 - 1
compiler/nld.pas

@@ -936,6 +936,7 @@ implementation
                        hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
                        hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
                        firstpass(hp.left);
                        firstpass(hp.left);
                      end;
                      end;
+                   variantdef,
                    pointerdef,
                    pointerdef,
                    classrefdef,
                    classrefdef,
                    objectdef : ;
                    objectdef : ;
@@ -1143,7 +1144,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.58  2002-09-07 15:25:03  peter
+  Revision 1.59  2002-09-26 15:02:05  florian
+    + support of passing variants to "array of const"
+
+  Revision 1.58  2002/09/07 15:25:03  peter
     * old logs removed and tabs fixed
     * old logs removed and tabs fixed
 
 
   Revision 1.57  2002/09/03 16:26:26  daniel
   Revision 1.57  2002/09/03 16:26:26  daniel