浏览代码

* add "doregister" parameter to tsetdef.create, and don't register temporary
defs created in the scanner for evaluating compile time expressions

git-svn-id: trunk@32048 -

Jonas Maebe 9 年之前
父节点
当前提交
b22e2ef400
共有 5 个文件被更改,包括 11 次插入11 次删除
  1. 1 1
      compiler/nadd.pas
  2. 1 1
      compiler/ncnv.pas
  3. 4 4
      compiler/ptype.pas
  4. 1 1
      compiler/scanner.pas
  5. 4 4
      compiler/symdef.pas

+ 1 - 1
compiler/nadd.pas

@@ -1658,7 +1658,7 @@ implementation
                         llow:=rlow;
                         llow:=rlow;
                         lhigh:=rhigh;
                         lhigh:=rhigh;
                       end;
                       end;
-                    nd:=csetdef.create(tsetdef(ld).elementdef,min(llow,rlow).svalue,max(lhigh,rhigh).svalue);
+                    nd:=csetdef.create(tsetdef(ld).elementdef,min(llow,rlow).svalue,max(lhigh,rhigh).svalue,true);
                     inserttypeconv(left,nd);
                     inserttypeconv(left,nd);
                     if (rd.typ=setdef) then
                     if (rd.typ=setdef) then
                       inserttypeconv(right,nd)
                       inserttypeconv(right,nd)

+ 1 - 1
compiler/ncnv.pas

@@ -643,7 +643,7 @@ implementation
            p.free;
            p.free;
          end;
          end;
         { set the initial set type }
         { set the initial set type }
-        constp.resultdef:=csetdef.create(hdef,constsetlo.svalue,constsethi.svalue);
+        constp.resultdef:=csetdef.create(hdef,constsetlo.svalue,constsethi.svalue,true);
         { determine the resultdef for the tree }
         { determine the resultdef for the tree }
         typecheckpass(buildp);
         typecheckpass(buildp);
         { set the new tree }
         { set the new tree }

+ 4 - 4
compiler/ptype.pas

@@ -1213,8 +1213,8 @@ implementation
                enumdef :
                enumdef :
                  if (tenumdef(tt2).min>=0) and
                  if (tenumdef(tt2).min>=0) and
                     (tenumdef(tt2).max<=255) then
                     (tenumdef(tt2).max<=255) then
-                  // !! def:=csetdef.create(tt2,tenumdef(tt2.def).min,tenumdef(tt2.def).max))
-                  def:=csetdef.create(tt2,tenumdef(tt2).min,tenumdef(tt2).max)
+                  // !! def:=csetdef.create(tt2,tenumdef(tt2.def).min,tenumdef(tt2.def).max),true)
+                  def:=csetdef.create(tt2,tenumdef(tt2).min,tenumdef(tt2).max,true)
                  else
                  else
                   Message(sym_e_ill_type_decl_set);
                   Message(sym_e_ill_type_decl_set);
                orddef :
                orddef :
@@ -1222,11 +1222,11 @@ implementation
                    if (torddef(tt2).ordtype<>uvoid) and
                    if (torddef(tt2).ordtype<>uvoid) and
                       (torddef(tt2).ordtype<>uwidechar) and
                       (torddef(tt2).ordtype<>uwidechar) and
                       (torddef(tt2).low>=0) then
                       (torddef(tt2).low>=0) then
-                     // !! def:=csetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high))
+                     // !! def:=csetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high),true)
                      if Torddef(tt2).high>int64(high(byte)) then
                      if Torddef(tt2).high>int64(high(byte)) then
                        message(sym_e_ill_type_decl_set)
                        message(sym_e_ill_type_decl_set)
                      else
                      else
-                       def:=csetdef.create(tt2,torddef(tt2).low.svalue,torddef(tt2).high.svalue)
+                       def:=csetdef.create(tt2,torddef(tt2).low.svalue,torddef(tt2).high.svalue,true)
                    else
                    else
                      Message(sym_e_ill_type_decl_set);
                      Message(sym_e_ill_type_decl_set);
                  end;
                  end;

+ 1 - 1
compiler/scanner.pas

@@ -922,7 +922,7 @@ type
       uintdef:=torddef.create(u64bit,low(qword),high(qword),false);
       uintdef:=torddef.create(u64bit,low(qword),high(qword),false);
       booldef:=torddef.create(pasbool8,0,1,false);
       booldef:=torddef.create(pasbool8,0,1,false);
       strdef:=tstringdef.createansi(0,false);
       strdef:=tstringdef.createansi(0,false);
-      setdef:=tsetdef.create(sintdef,0,255);
+      setdef:=tsetdef.create(sintdef,0,255,false);
       realdef:=tfloatdef.create(s80real);
       realdef:=tfloatdef.create(s80real);
     end;
     end;
 
 

+ 4 - 4
compiler/symdef.pas

@@ -896,7 +896,7 @@ interface
           elementdefderef : tderef;
           elementdefderef : tderef;
           setbase,
           setbase,
           setmax   : asizeint;
           setmax   : asizeint;
-          constructor create(def:tdef;low, high : asizeint);virtual;
+          constructor create(def: tdef; low, high: asizeint; doregister: boolean);virtual;
           constructor ppuload(ppufile:tcompilerppufile);
           constructor ppuload(ppufile:tcompilerppufile);
           function getcopy : tstoreddef;override;
           function getcopy : tstoreddef;override;
           { do not override this routine in platform-specific subclasses,
           { do not override this routine in platform-specific subclasses,
@@ -3326,13 +3326,13 @@ implementation
                                    TSETDEF
                                    TSETDEF
 ***************************************************************************}
 ***************************************************************************}
 
 
-    constructor tsetdef.create(def:tdef;low, high : asizeint);
+    constructor tsetdef.create(def: tdef; low, high: asizeint; doregister: boolean);
       var
       var
         setallocbits: aint;
         setallocbits: aint;
         packedsavesize: aint;
         packedsavesize: aint;
         actual_setalloc: ShortInt;
         actual_setalloc: ShortInt;
       begin
       begin
-         inherited create(setdef,true);
+         inherited create(setdef,doregister);
          elementdef:=def;
          elementdef:=def;
          setmax:=high;
          setmax:=high;
          actual_setalloc:=current_settings.setalloc;
          actual_setalloc:=current_settings.setalloc;
@@ -3377,7 +3377,7 @@ implementation
 
 
     function tsetdef.getcopy : tstoreddef;
     function tsetdef.getcopy : tstoreddef;
       begin
       begin
-        result:=csetdef.create(elementdef,setbase,setmax);
+        result:=csetdef.create(elementdef,setbase,setmax,true);
         { the copy might have been created with a different setalloc setting }
         { the copy might have been created with a different setalloc setting }
         tsetdef(result).savesize:=savesize;
         tsetdef(result).savesize:=savesize;
       end;
       end;