Sfoglia il codice sorgente

Convert the Boolean parameters accept_equal, typeonly and hadspecialize of comp_expr(), sub_expr() and factor() to a set parameter and adjust all calls.

pexpr.pas:
  + new enum texprflag and corresponding set texprflags
  * comp_expr: replace accept_equal and typeonly with texprflags parameter
  * factor: replace typeonly and hadspecialize with texprflags parameter
  * sub_expr: replace accept_equal and typeonly with texprflags parameter
  * adjust calls to comp_expr(), factor() and sub_expr()
other units:
  * adjust calls to comp_expr(), factor() and sub_expr() 

git-svn-id: trunk@32269 -
svenbarth 9 anni fa
parent
commit
0ff87336aa

+ 18 - 18
compiler/ngtcon.pas

@@ -182,7 +182,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           n : tnode;
         begin
-           n:=comp_expr(true,false);
+           n:=comp_expr([ef_accept_equal]);
            { for C-style booleans, true=-1 and false=0) }
            if is_cbool(def) then
              inserttypeconv(n,def);
@@ -194,7 +194,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           n : tnode;
         begin
-          n:=comp_expr(true,false);
+          n:=comp_expr([ef_accept_equal]);
           tc_emit_floatdef(def,n);
           n.free;
         end;
@@ -203,7 +203,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           n : tnode;
         begin
-          n:=comp_expr(true,false);
+          n:=comp_expr([ef_accept_equal]);
           case n.nodetype of
             loadvmtaddrn:
               begin
@@ -222,7 +222,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           p: tnode;
         begin
-          p:=comp_expr(true,false);
+          p:=comp_expr([ef_accept_equal]);
           tc_emit_pointerdef(def,p);
           p.free;
         end;
@@ -231,7 +231,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           p : tnode;
         begin
-          p:=comp_expr(true,false);
+          p:=comp_expr([ef_accept_equal]);
           tc_emit_setdef(def,p);
           p.free;
         end;
@@ -240,7 +240,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           p : tnode;
         begin
-          p:=comp_expr(true,false);
+          p:=comp_expr([ef_accept_equal]);
           tc_emit_enumdef(def,p);
           p.free;
         end;
@@ -249,7 +249,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         var
           n : tnode;
         begin
-          n:=comp_expr(true,false);
+          n:=comp_expr([ef_accept_equal]);
           tc_emit_stringdef(def,n);
           n.free;
         end;
@@ -1060,7 +1060,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         node: tnode;
       begin
         result:=true;
-        node:=comp_expr(true,false);
+        node:=comp_expr([ef_accept_equal]);
         if (node.nodetype <> ordconstn) or
            (not equal_defs(node.resultdef,def) and
             not is_subequal(node.resultdef,def)) then
@@ -1199,7 +1199,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
           begin
              ftcb.maybe_begin_aggregate(def);
              char_size:=def.elementdef.size;
-             n:=comp_expr(true,false);
+             n:=comp_expr([ef_accept_equal]);
              if n.nodetype=stringconstn then
                begin
                  len:=tstringconstnode(n).len;
@@ -1331,7 +1331,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
           Message(parser_e_no_procvarobj_const);
         { parse the rest too, so we can continue with error checking }
         getprocvardef:=def;
-        n:=comp_expr(true,false);
+        n:=comp_expr([ef_accept_equal]);
         getprocvardef:=nil;
         if codegenerror then
           begin
@@ -1445,7 +1445,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { GUID }
         if (def=rec_tguid) and (token=_ID) then
           begin
-            n:=comp_expr(true,false);
+            n:=comp_expr([ef_accept_equal]);
             if n.nodetype=stringconstn then
               handle_stringconstn
             else
@@ -1461,7 +1461,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
           end;
         if (def=rec_tguid) and ((token=_CSTRING) or (token=_CCHAR)) then
           begin
-            n:=comp_expr(true,false);
+            n:=comp_expr([ef_accept_equal]);
             inserttypeconv(n,cshortstringtype);
             if n.nodetype=stringconstn then
               handle_stringconstn
@@ -1659,7 +1659,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { only allow nil for implicit pointer object types }
         if is_implicit_pointer_object_type(def) then
           begin
-            n:=comp_expr(true,false);
+            n:=comp_expr([ef_accept_equal]);
             if n.nodetype<>niln then
               begin
                 Message(parser_e_type_const_not_possible);
@@ -1810,7 +1810,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { if array of char then we allow also a string }
         else if is_anychar(def.elementdef) then
           begin
-             n:=comp_expr(true,false);
+             n:=comp_expr([ef_accept_equal]);
              addstatement(statmnt,cassignmentnode.create_internal(basenode,n));
              basenode:=nil;
           end
@@ -1824,7 +1824,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
 
     procedure tnodetreetypedconstbuilder.parse_procvardef(def: tprocvardef);
       begin
-        addstatement(statmnt,cassignmentnode.create_internal(basenode,comp_expr(true,false)));
+        addstatement(statmnt,cassignmentnode.create_internal(basenode,comp_expr([ef_accept_equal])));
         basenode:=nil;
       end;
 
@@ -1853,7 +1853,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { GUID }
         if (def=rec_tguid) and (token=_ID) then
           begin
-            n:=comp_expr(true,false);
+            n:=comp_expr([ef_accept_equal]);
             if n.nodetype=stringconstn then
               handle_stringconstn
             else
@@ -1874,7 +1874,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
           end;
         if (def=rec_tguid) and ((token=_CSTRING) or (token=_CCHAR)) then
           begin
-            n:=comp_expr(true,false);
+            n:=comp_expr([ef_accept_equal]);
             inserttypeconv(n,cshortstringtype);
             if n.nodetype=stringconstn then
               handle_stringconstn
@@ -2020,7 +2020,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { only allow nil for implicit pointer object types }
         if is_implicit_pointer_object_type(def) then
           begin
-            n:=comp_expr(true,false);
+            n:=comp_expr([ef_accept_equal]);
             if n.nodetype<>niln then
               begin
                 Message(parser_e_type_const_not_possible);

+ 3 - 3
compiler/pdecl.pas

@@ -85,7 +85,7 @@ implementation
         if orgname='' then
          internalerror(9584582);
         hp:=nil;
-        p:=comp_expr(true,false);
+        p:=comp_expr([ef_accept_equal]);
         nodetype:=p.nodetype;
         storetokenpos:=current_tokenpos;
         current_tokenpos:=filepos;
@@ -666,7 +666,7 @@ implementation
                       { check if it is an ansistirng(codepage) declaration }
                       if is_ansistring(hdef) and try_to_consume(_LKLAMMER) then
                         begin
-                          p:=comp_expr(true,false);
+                          p:=comp_expr([ef_accept_equal]);
                           consume(_RKLAMMER);
                           if not is_constintnode(p) then
                             begin
@@ -989,7 +989,7 @@ implementation
              _EQ:
                 begin
                    consume(_EQ);
-                   p:=comp_expr(true,false);
+                   p:=comp_expr([ef_accept_equal]);
                    storetokenpos:=current_tokenpos;
                    current_tokenpos:=filepos;
                    sym:=nil;

+ 1 - 1
compiler/pdecobj.pas

@@ -399,7 +399,7 @@ implementation
         p : tnode;
         valid : boolean;
       begin
-        p:=comp_expr(true,false);
+        p:=comp_expr([ef_accept_equal]);
         if p.nodetype=stringconstn then
           begin
             stringdispose(current_objectdef.iidstr);

+ 3 - 3
compiler/pdecsub.pas

@@ -818,7 +818,7 @@ implementation
           var
             node : tnode;
           begin
-            node:=factor(false,true,true);
+            node:=factor(false,[ef_type_only,ef_had_specialize]);
             if node.nodetype=typen then
               begin
                 sp:=ttypenode(node).typedef.typesym.name;
@@ -1865,7 +1865,7 @@ var pt:Tnode;
 begin
   if pd.typ<>procdef then
     internalerror(200604301);
-  pt:=comp_expr(true,false);
+  pt:=comp_expr([ef_accept_equal]);
   if is_constintnode(pt) then
     if (Tordconstnode(pt).value<int64(low(longint))) or (Tordconstnode(pt).value>int64(high(longint))) then
       message3(type_e_range_check_error_bounds,tostr(Tordconstnode(pt).value),tostr(low(longint)),tostr(high(longint)))
@@ -1950,7 +1950,7 @@ begin
       if paracnt<>1 then
         Message(parser_e_ill_msg_param);
     end;
-  pt:=comp_expr(true,false);
+  pt:=comp_expr([ef_accept_equal]);
   { message is 1-character long }
   if is_constcharnode(pt) then
     begin

+ 7 - 7
compiler/pdecvar.pas

@@ -181,7 +181,7 @@ implementation
                          if def.typ=arraydef then
                           begin
                             idx:=0;
-                            p:=comp_expr(true,false);
+                            p:=comp_expr([ef_accept_equal]);
                             if (not codegenerror) then
                              begin
                                if (p.nodetype=ordconstn) then
@@ -284,7 +284,7 @@ implementation
 
               if try_to_consume(_DISPID) then
                 begin
-                  pt:=comp_expr(true,false);
+                  pt:=comp_expr([ef_accept_equal]);
                   if is_constintnode(pt) then
                     if (Tordconstnode(pt).value<int64(low(longint))) or (Tordconstnode(pt).value>int64(high(longint))) then
                       message3(type_e_range_check_error_bounds,tostr(Tordconstnode(pt).value),tostr(low(longint)),tostr(high(longint)))
@@ -448,7 +448,7 @@ implementation
               if (idtoken=_INDEX) then
                 begin
                    consume(_INDEX);
-                   pt:=comp_expr(true,false);
+                   pt:=comp_expr([ef_accept_equal]);
                    { Only allow enum and integer indexes. Convert all integer
                      values to objpas.integer (s32int on 32- and 64-bit targets,
                      s16int on 16- and 8-bit) to be compatible with delphi,
@@ -661,14 +661,14 @@ implementation
                 begin
                   Message(parser_e_property_cant_have_a_default_value);
                   { Error recovery }
-                  pt:=comp_expr(true,false);
+                  pt:=comp_expr([ef_accept_equal]);
                   pt.free;
                 end
               else
                 begin
                   { Get the result of the default, the firstpass is
                     needed to support values like -1 }
-                  pt:=comp_expr(true,false);
+                  pt:=comp_expr([ef_accept_equal]);
                   if (p.propdef.typ=setdef) and
                      (pt.nodetype=arrayconstructorn) then
                     begin
@@ -1773,12 +1773,12 @@ implementation
                 fillchar(variantdesc^^.branches[high(variantdesc^^.branches)],
                   sizeof(variantdesc^^.branches[high(variantdesc^^.branches)]),0);
                 repeat
-                  pt:=comp_expr(true,false);
+                  pt:=comp_expr([ef_accept_equal]);
                   if not(pt.nodetype=ordconstn) then
                     Message(parser_e_illegal_expression);
                   { iso pascal does not support ranges in variant record definitions }
                   if not(m_iso in current_settings.modeswitches) and try_to_consume(_POINTPOINT) then
-                    pt:=crangenode.create(pt,comp_expr(true,false))
+                    pt:=crangenode.create(pt,comp_expr([ef_accept_equal]))
                   else
                     begin
                       with variantdesc^^.branches[high(variantdesc^^.branches)] do

+ 2 - 2
compiler/pexports.pas

@@ -136,7 +136,7 @@ implementation
                      end;
                     if try_to_consume(_INDEX) then
                      begin
-                       pt:=comp_expr(true,false);
+                       pt:=comp_expr([ef_accept_equal]);
                        if pt.nodetype=ordconstn then
                         if (Tordconstnode(pt).value<int64(low(index))) or
                            (Tordconstnode(pt).value>int64(high(index))) then
@@ -160,7 +160,7 @@ implementation
                      end;
                     if try_to_consume(_NAME) then
                      begin
-                       pt:=comp_expr(true,false);
+                       pt:=comp_expr([ef_accept_equal]);
                        if pt.nodetype=stringconstn then
                          hpname:=strpas(tstringconstnode(pt).value_str)
                        else if is_constcharnode(pt) then

+ 112 - 104
compiler/pexpr.pas

@@ -31,14 +31,22 @@ interface
       tokens,globtype,globals,constexp,
       pgentype;
 
+    type
+      texprflag = (
+        ef_accept_equal,
+        ef_type_only,
+        ef_had_specialize
+      );
+      texprflags = set of texprflag;
+
     { reads a whole expression }
     function expr(dotypecheck:boolean) : tnode;
 
     { reads an expression without assignements and .. }
-    function comp_expr(accept_equal,typeonly:boolean):tnode;
+    function comp_expr(flags:texprflags):tnode;
 
     { reads a single factor }
-    function factor(getaddr,typeonly,hadspecialize:boolean) : tnode;
+    function factor(getaddr:boolean;flags:texprflags) : tnode;
 
     procedure string_dec(var def: tdef; allowtypedef: boolean);
 
@@ -74,7 +82,7 @@ implementation
        pbase,pinline,ptype,pgenutil,procinfo,cpuinfo
        ;
 
-    function sub_expr(pred_level:Toperator_precedence;accept_equal,typeonly:boolean;factornode:tnode):tnode;forward;
+    function sub_expr(pred_level:Toperator_precedence;flags:texprflags;factornode:tnode):tnode;forward;
 
     const
        { true, if the inherited call is anonymous }
@@ -96,7 +104,7 @@ implementation
              if not(allowtypedef) then
                Message(parser_e_no_local_para_def);
              consume(_LECKKLAMMER);
-             p:=comp_expr(true,false);
+             p:=comp_expr([ef_accept_equal]);
              if not is_constintnode(p) then
                begin
                  Message(parser_e_illegal_expression);
@@ -172,12 +180,12 @@ implementation
                else
                  begin
                    named_args_allowed:=true;
-                   p1:=comp_expr(true,false);
+                   p1:=comp_expr([ef_accept_equal]);
                    named_args_allowed:=false;
                    if found_arg_name then
                      begin
                        argname:=p1;
-                       p1:=comp_expr(true,false);
+                       p1:=comp_expr([ef_accept_equal]);
                        p2:=ccallparanode.create(p1,p2);
                        tcallparanode(p2).parametername:=argname;
                      end
@@ -188,19 +196,19 @@ implementation
              end
            else
              begin
-               p1:=comp_expr(true,false);
+               p1:=comp_expr([ef_accept_equal]);
                p2:=ccallparanode.create(p1,p2);
              end;
            { it's for the str(l:5,s); }
            if __colon and (token=_COLON) then
              begin
                consume(_COLON);
-               p1:=comp_expr(true,false);
+               p1:=comp_expr([ef_accept_equal]);
                p2:=ccallparanode.create(p1,p2);
                include(tcallparanode(p2).callparaflags,cpf_is_colon_para);
                if try_to_consume(_COLON) then
                  begin
-                   p1:=comp_expr(true,false);
+                   p1:=comp_expr([ef_accept_equal]);
                    p2:=ccallparanode.create(p1,p2);
                    include(tcallparanode(p2).callparaflags,cpf_is_colon_para);
                  end
@@ -284,7 +292,7 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               consume(_RKLAMMER);
               p1:=geninlinenode(in_ord_x,false,p1);
               statement_syssym := p1;
@@ -299,7 +307,7 @@ implementation
                     begin
                       if not(try_to_consume(_RKLAMMER)) then
                         begin
-                          p1:=comp_expr(true,false);
+                          p1:=comp_expr([ef_accept_equal]);
                           consume(_RKLAMMER);
                           if not assigned(current_procinfo) or
                              (current_procinfo.procdef.proctypeoption in [potype_constructor,potype_destructor]) or
@@ -397,7 +405,7 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               consume(_RKLAMMER);
               if p1.nodetype=typen then
                 ttypenode(p1).allowed:=true;
@@ -424,7 +432,7 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               consume(_RKLAMMER);
               if ((p1.nodetype<>typen) and
 
@@ -475,7 +483,7 @@ implementation
                 begin
                   consume(_LKLAMMER);
                   in_args:=true;
-                  p1:=comp_expr(true,false);
+                  p1:=comp_expr([ef_accept_equal]);
                   { When reading a class type it is parsed as loadvmtaddrn,
                     typeinfo only needs the type so we remove the loadvmtaddrn }
                   if p1.nodetype=loadvmtaddrn then
@@ -515,7 +523,7 @@ implementation
               err:=false;
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               p2:=ccallparanode.create(p1,nil);
               p2:=geninlinenode(l,false,p2);
               consume(_RKLAMMER);
@@ -527,7 +535,7 @@ implementation
               err:=false;
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               { When reading a class type it is parsed as loadvmtaddrn,
                 typeinfo only needs the type so we remove the loadvmtaddrn }
               if p1.nodetype=loadvmtaddrn then
@@ -584,10 +592,10 @@ implementation
             begin
               consume(_LKLAMMER);
               got_addrn:=true;
-              p1:=factor(true,false,false);
+              p1:=factor(true,[]);
               { inside parentheses a full expression is allowed, see also tests\webtbs\tb27517.pp }
               if token<>_RKLAMMER then
-                p1:=sub_expr(opcompare,true,false,p1);
+                p1:=sub_expr(opcompare,[ef_accept_equal],p1);
               p1:=caddrnode.create(p1);
               got_addrn:=false;
               consume(_RKLAMMER);
@@ -600,10 +608,10 @@ implementation
                 message(parser_e_feature_unsupported_for_vm);
               consume(_LKLAMMER);
               got_addrn:=true;
-              p1:=factor(true,false,false);
+              p1:=factor(true,[]);
               { inside parentheses a full expression is allowed, see also tests\webtbs\tb27517.pp }
               if token<>_RKLAMMER then
-                p1:=sub_expr(opcompare,true,false,p1);
+                p1:=sub_expr(opcompare,[ef_accept_equal],p1);
               p1:=caddrnode.create(p1);
               got_addrn:=false;
               { Ofs() returns a cardinal/qword, not a pointer }
@@ -616,10 +624,10 @@ implementation
             begin
               consume(_LKLAMMER);
               got_addrn:=true;
-              p1:=factor(true,false,false);
+              p1:=factor(true,[]);
               { inside parentheses a full expression is allowed, see also tests\webtbs\tb27517.pp }
               if token<>_RKLAMMER then
-                p1:=sub_expr(opcompare,true,false,p1);
+                p1:=sub_expr(opcompare,[ef_accept_equal],p1);
               p1:=geninlinenode(in_seg_x,false,p1);
               got_addrn:=false;
               consume(_RKLAMMER);
@@ -631,7 +639,7 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               p2:=geninlinenode(l,false,p1);
               consume(_RKLAMMER);
               statement_syssym:=p2;
@@ -642,7 +650,7 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               p2:=geninlinenode(l,false,p1);
               consume(_RKLAMMER);
               statement_syssym:=p2;
@@ -653,9 +661,9 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               if try_to_consume(_COMMA) then
-                p2:=ccallparanode.create(comp_expr(true,false),nil)
+                p2:=ccallparanode.create(comp_expr([ef_accept_equal]),nil)
               else
                 p2:=nil;
               p2:=ccallparanode.create(p1,p2);
@@ -670,9 +678,9 @@ implementation
                   message(parser_e_illegal_slice);
                   consume(_LKLAMMER);
                   in_args:=true;
-                  comp_expr(true,false).free;
+                  comp_expr([ef_accept_equal]).free;
                   if try_to_consume(_COMMA) then
-                    comp_expr(true,false).free;
+                    comp_expr([ef_accept_equal]).free;
                   statement_syssym:=cerrornode.create;
                   consume(_RKLAMMER);
                 end
@@ -680,10 +688,10 @@ implementation
                 begin
                   consume(_LKLAMMER);
                   in_args:=true;
-                  p1:=comp_expr(true,false);
+                  p1:=comp_expr([ef_accept_equal]);
                   Consume(_COMMA);
                   if not(codegenerror) then
-                    p2:=ccallparanode.create(comp_expr(true,false),nil)
+                    p2:=ccallparanode.create(comp_expr([ef_accept_equal]),nil)
                   else
                     p2:=cerrornode.create;
                   p2:=ccallparanode.create(p1,p2);
@@ -715,7 +723,7 @@ implementation
                 type checking }
               p2:=nil;
               repeat
-                p1:=comp_expr(true,false);
+                p1:=comp_expr([ef_accept_equal]);
                 if p2<>nil then
                   p2:=caddnode.create(addn,p2,p1)
                 else
@@ -761,7 +769,7 @@ implementation
                   consume(_LKLAMMER);
                   in_args:=true;
                   { don't turn procsyms into calls (getaddr = true) }
-                  p1:=factor(true,false,false);
+                  p1:=factor(true,[]);
                   p2:=geninlinenode(l,false,p1);
                   consume(_RKLAMMER);
                   statement_syssym:=p2;
@@ -777,7 +785,7 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               p2:=geninlinenode(l,false,p1);
               consume(_RKLAMMER);
               statement_syssym:=p2;
@@ -811,11 +819,11 @@ implementation
             Begin
               consume(_LKLAMMER);
               in_args := true;
-              p1:= ccallparanode.create(comp_expr(true,false), nil);
+              p1:= ccallparanode.create(comp_expr([ef_accept_equal]), nil);
               consume(_COMMA);
-              p2 := ccallparanode.create(comp_expr(true,false),p1);
+              p2 := ccallparanode.create(comp_expr([ef_accept_equal]),p1);
               if try_to_consume(_COMMA) then
-                p2 := ccallparanode.create(comp_expr(true,false),p2);
+                p2 := ccallparanode.create(comp_expr([ef_accept_equal]),p2);
               consume(_RKLAMMER);
               p2 := geninlinenode(l,false,p2);
               statement_syssym := p2;
@@ -826,9 +834,9 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               consume(_COMMA);
-              p2:=comp_expr(true,false);
+              p2:=comp_expr([ef_accept_equal]);
               statement_syssym:=geninlinenode(l,false,ccallparanode.create(p1,ccallparanode.create(p2,nil)));
               consume(_RKLAMMER);
             end;
@@ -838,11 +846,11 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               consume(_COMMA);
-              p2:=comp_expr(true,false);
+              p2:=comp_expr([ef_accept_equal]);
               consume(_COMMA);
-              paras:=comp_expr(true,false);
+              paras:=comp_expr([ef_accept_equal]);
               statement_syssym:=geninlinenode(l,false,ccallparanode.create(p1,ccallparanode.create(p2,ccallparanode.create(paras,nil))));
               consume(_RKLAMMER);
             end;
@@ -851,9 +859,9 @@ implementation
             begin
               consume(_LKLAMMER);
               in_args:=true;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               if try_to_consume(_COMMA) then
-                 p2:=comp_expr(true,false)
+                 p2:=comp_expr([ef_accept_equal])
               else
                begin
                  { then insert an empty string }
@@ -875,7 +883,7 @@ implementation
                    however, as a stack frame may not exist, it does more harm than
                    good, so ignore it.}
                   in_args:=true;
-                  p1:=comp_expr(true,false);
+                  p1:=comp_expr([ef_accept_equal]);
                   p1.destroy;
                   consume(_RKLAMMER);
                 end;
@@ -1175,7 +1183,7 @@ implementation
                          { read the expression }
                          if propsym.propdef.typ=procvardef then
                            getprocvardef:=tprocvardef(propsym.propdef);
-                         p2:=comp_expr(true,false);
+                         p2:=comp_expr([ef_accept_equal]);
                          if assigned(getprocvardef) then
                            handle_procvar(getprocvardef,p2);
                          tcallnode(p1).left:=ccallparanode.create(p2,tcallnode(p1).left);
@@ -1191,7 +1199,7 @@ implementation
                          include(p1.flags,nf_isproperty);
                          consume(_ASSIGNMENT);
                          { read the expression }
-                         p2:=comp_expr(true,false);
+                         p2:=comp_expr([ef_accept_equal]);
                          p1:=cassignmentnode.create(p1,p2);
                       end
                     else
@@ -1348,7 +1356,7 @@ implementation
                      p1.free;
                      if try_to_consume(_LKLAMMER) then
                       begin
-                        p1:=comp_expr(true,false);
+                        p1:=comp_expr([ef_accept_equal]);
                         consume(_RKLAMMER);
                         p1:=ctypeconvnode.create_explicit(p1,ttypesym(sym).typedef);
                       end
@@ -1466,7 +1474,7 @@ implementation
          if (not typeonly or is_ordinal(hdef)) and
             try_to_consume(_LKLAMMER) then
           begin
-            result:=comp_expr(true,false);
+            result:=comp_expr([ef_accept_equal]);
             consume(_RKLAMMER);
             { type casts to class helpers aren't allowed }
             if is_objectpascal_helper(hdef) then
@@ -1684,14 +1692,14 @@ implementation
              else if try_to_consume(_LECKKLAMMER) then
                begin
                  repeat
-                   comp_expr(true,false);
+                   comp_expr([ef_accept_equal]);
                  until not try_to_consume(_COMMA);
                  consume(_RECKKLAMMER);
                end
              else if try_to_consume(_LKLAMMER) then
                begin
                  repeat
-                   comp_expr(true,false);
+                   comp_expr([ef_accept_equal]);
                  until not try_to_consume(_COMMA);
                  consume(_RKLAMMER);
                end
@@ -1722,7 +1730,7 @@ implementation
 
          countindices:=0;
          repeat
-           p4:=comp_expr(true,false);
+           p4:=comp_expr([ef_accept_equal]);
 
            addstatement(newstatement,cassignmentnode.create(
              ctemprefnode.create_offset(temp,countindices*s32inttype.size),p4));
@@ -1738,7 +1746,7 @@ implementation
          if token=_ASSIGNMENT then
            begin
              consume(_ASSIGNMENT);
-             p4:=comp_expr(true,false);
+             p4:=comp_expr([ef_accept_equal]);
 
              { create call to fpc_vararray_put }
              paras:=ccallparanode.create(cordconstnode.create
@@ -1805,7 +1813,7 @@ implementation
                     cvecnode.create(
                       ctemprefnode.create(arrnode),
                       cordconstnode.create(paracount,arrdef.rangedef,false)),
-                    comp_expr(true,false)));
+                    comp_expr([ef_accept_equal])));
                 inc(paracount);
               until not try_to_consume(_COMMA);
               consume(_RKLAMMER);
@@ -2017,10 +2025,10 @@ implementation
                             if (tpointerdef(p1.resultdef).pointeddef.typ=arraydef) and
                                (m_autoderef in current_settings.modeswitches) then
                               p1:=cderefnode.create(p1);
-                            p2:=comp_expr(true,false);
+                            p2:=comp_expr([ef_accept_equal]);
                             { Support Pbytevar[0..9] which returns array [0..9].}
                             if try_to_consume(_POINTPOINT) then
-                              p2:=crangenode.create(p2,comp_expr(true,false));
+                              p2:=crangenode.create(p2,comp_expr([ef_accept_equal]));
                             p1:=cvecnode.create(p1,p2);
                          end;
                        variantdef:
@@ -2031,15 +2039,15 @@ implementation
                          end;
                        stringdef :
                          begin
-                           p2:=comp_expr(true,false);
+                           p2:=comp_expr([ef_accept_equal]);
                            { Support string[0..9] which returns array [0..9] of char.}
                            if try_to_consume(_POINTPOINT) then
-                             p2:=crangenode.create(p2,comp_expr(true,false));
+                             p2:=crangenode.create(p2,comp_expr([ef_accept_equal]));
                            p1:=cvecnode.create(p1,p2);
                          end;
                        arraydef:
                          begin
-                           p2:=comp_expr(true,false);
+                           p2:=comp_expr([ef_accept_equal]);
                            { support SEG:OFS for go32v2/msdos Mem[] }
                            if (target_info.system in [system_i386_go32v2,system_i386_watcom,system_i8086_msdos,system_i8086_win16]) and
                               (p1.nodetype=loadn) and
@@ -2055,7 +2063,7 @@ implementation
                                inserttypeconv(p2,u16inttype);
                                inserttypeconv_internal(p2,u32inttype);
                                p3:=cshlshrnode.create(shln,p2,cordconstnode.create($10,s16inttype,false));
-                               p2:=comp_expr(true,false);
+                               p2:=comp_expr([ef_accept_equal]);
                                inserttypeconv(p2,u16inttype);
                                inserttypeconv_internal(p2,u32inttype);
                                p2:=caddnode.create(addn,p2,p3);
@@ -2071,11 +2079,11 @@ implementation
                                if try_to_consume(_COLON) then
                                 begin
                                   p3:=caddnode.create(muln,cordconstnode.create($10,s32inttype,false),p2);
-                                  p2:=comp_expr(true,false);
+                                  p2:=comp_expr([ef_accept_equal]);
                                   p2:=caddnode.create(addn,p2,p3);
                                   if try_to_consume(_POINTPOINT) then
                                     { Support mem[$a000:$0000..$07ff] which returns array [0..$7ff] of memtype.}
-                                    p2:=crangenode.create(p2,caddnode.create(addn,comp_expr(true,false),p3.getcopy));
+                                    p2:=crangenode.create(p2,caddnode.create(addn,comp_expr([ef_accept_equal]),p3.getcopy));
                                   p1:=cvecnode.create(p1,p2);
                                   include(tvecnode(p1).flags,nf_memseg);
                                   include(tvecnode(p1).flags,nf_memindex);
@@ -2084,7 +2092,7 @@ implementation
                                 begin
                                   if try_to_consume(_POINTPOINT) then
                                     { Support mem[$80000000..$80000002] which returns array [0..2] of memtype.}
-                                    p2:=crangenode.create(p2,comp_expr(true,false));
+                                    p2:=crangenode.create(p2,comp_expr([ef_accept_equal]));
                                   p1:=cvecnode.create(p1,p2);
                                   include(tvecnode(p1).flags,nf_memindex);
                                 end;
@@ -2096,7 +2104,7 @@ implementation
                              begin
                                if try_to_consume(_POINTPOINT) then
                                  { Support arrayvar[0..9] which returns array [0..9] of arraytype.}
-                                 p2:=crangenode.create(p2,comp_expr(true,false));
+                                 p2:=crangenode.create(p2,comp_expr([ef_accept_equal]));
                                p1:=cvecnode.create(p1,p2);
                              end;
                          end;
@@ -2106,7 +2114,7 @@ implementation
                              Message(parser_e_invalid_qualifier);
                            p1.destroy;
                            p1:=cerrornode.create;
-                           comp_expr(true,false);
+                           comp_expr([ef_accept_equal]);
                            again:=false;
                          end;
                      end;
@@ -2400,7 +2408,7 @@ implementation
                                 begin
                                   consume(_ASSIGNMENT);
                                   { read the expression }
-                                  p3:=comp_expr(true,false);
+                                  p3:=comp_expr([ef_accept_equal]);
                                   { concat value parameter too }
                                   p2:=ccallparanode.create(p3,p2);
                                   p1:=translate_disp_call(p1,p2,dct_propput,dispatchstring,0,voidtype);
@@ -2590,7 +2598,7 @@ implementation
                     begin
                       if try_to_consume(_LKLAMMER) then
                         begin
-                          p1:=comp_expr(true,false);
+                          p1:=comp_expr([ef_accept_equal]);
                           consume(_RKLAMMER);
                           p1:=ctypeconvnode.create_explicit(p1,p1.resultdef);
                         end
@@ -2666,7 +2674,7 @@ implementation
 
   {$maxfpuregisters 0}
 
-    function factor(getaddr,typeonly,hadspecialize:boolean) : tnode;
+    function factor(getaddr:boolean;flags:texprflags) : tnode;
 
          {---------------------------------------------
                          Factor_read_id
@@ -2711,7 +2719,7 @@ implementation
            p1:=nil;
 
            allowspecialize:=not (m_delphi in current_settings.modeswitches) and
-                            not hadspecialize and
+                            not (ef_had_specialize in flags) and
                             (block_type in [bt_type,bt_var_type,bt_const_type]);
            if allowspecialize and (token=_ID) and (idtoken=_SPECIALIZE) then
              begin
@@ -2719,7 +2727,7 @@ implementation
                isspecialize:=true;
              end
            else
-             isspecialize:=hadspecialize;
+             isspecialize:=ef_had_specialize in flags;
 
            { first check for identifier }
            if token<>_ID then
@@ -2731,7 +2739,7 @@ implementation
              end
            else
              begin
-               if typeonly then
+               if ef_type_only in flags then
                  searchsym_type(pattern,srsym,srsymtable)
                else
                  searchsym(pattern,srsym,srsymtable);
@@ -2952,7 +2960,7 @@ implementation
                        if ((hdef=cvarianttype) or (hdef=colevarianttype)) and
                           not(cs_compilesystem in current_settings.moduleswitches) then
                          current_module.flags:=current_module.flags or uf_uses_variants;
-                       p1:=handle_factor_typenode(hdef,getaddr,again,srsym,typeonly);
+                       p1:=handle_factor_typenode(hdef,getaddr,again,srsym,ef_type_only in flags);
                      end;
                   end;
 
@@ -3116,10 +3124,10 @@ implementation
               { nested array constructors are not allowed, see also tests/webtbs/tw17213.pp }
               old_allow_array_constructor:=allow_array_constructor;
               allow_array_constructor:=false;
-              p1:=comp_expr(true,false);
+              p1:=comp_expr([ef_accept_equal]);
               if try_to_consume(_POINTPOINT) then
                 begin
-                  p2:=comp_expr(true,false);
+                  p2:=comp_expr([ef_accept_equal]);
                   p1:=carrayconstructorrangenode.create(p1,p2);
                 end;
                { insert at the end of the tree, to get the correct order }
@@ -3228,7 +3236,7 @@ implementation
                  dopostfix:=not could_be_generic(idstr);
                end;
            { maybe an additional parameter instead of misusing hadspezialize? }
-           if dopostfix and not hadspecialize then
+           if dopostfix and not (ef_had_specialize in flags) then
              updatefpos:=postfixoperators(p1,again,getaddr);
          end
         else
@@ -3241,7 +3249,7 @@ implementation
                   p1:=nil;
                   if not(token in [_SEMICOLON,_ELSE,_END]) then
                     begin
-                      p1:=comp_expr(true,false);
+                      p1:=comp_expr([ef_accept_equal]);
                       if not assigned(current_procinfo) or
                          (current_procinfo.procdef.proctypeoption in [potype_constructor,potype_destructor]) or
                          is_void(current_procinfo.procdef.returndef) then
@@ -3477,7 +3485,7 @@ implementation
                  { STRING can be also a type cast }
                  if try_to_consume(_LKLAMMER) then
                   begin
-                    p1:=comp_expr(true,false);
+                    p1:=comp_expr([ef_accept_equal]);
                     consume(_RKLAMMER);
                     p1:=ctypeconvnode.create_explicit(p1,hdef);
                     { handle postfix operators here e.g. string(a)[10] }
@@ -3495,7 +3503,7 @@ implementation
                  { FILE can be also a type cast }
                  if try_to_consume(_LKLAMMER) then
                   begin
-                    p1:=comp_expr(true,false);
+                    p1:=comp_expr([ef_accept_equal]);
                     consume(_RKLAMMER);
                     p1:=ctypeconvnode.create_explicit(p1,hdef);
                     { handle postfix operators here e.g. string(a)[10] }
@@ -3559,14 +3567,14 @@ implementation
                  { support both @<x> and @(<x>) }
                  if try_to_consume(_LKLAMMER) then
                   begin
-                    p1:=factor(true,false,false);
+                    p1:=factor(true,[]);
                     { inside parentheses a full expression is allowed, see also tests\webtbs\tb27517.pp }
                     if token<>_RKLAMMER then
-                      p1:=sub_expr(opcompare,true,false,p1);
+                      p1:=sub_expr(opcompare,[ef_accept_equal],p1);
                     consume(_RKLAMMER);
                   end
                  else
-                  p1:=factor(true,false,false);
+                  p1:=factor(true,[]);
                  if token in postfixoperator_tokens then
                   begin
                     again:=true;
@@ -3588,7 +3596,7 @@ implementation
              _LKLAMMER :
                begin
                  consume(_LKLAMMER);
-                 p1:=comp_expr(true,false);
+                 p1:=comp_expr([ef_accept_equal]);
                  consume(_RKLAMMER);
                  { it's not a good solution
                    but (a+b)^ makes some problems  }
@@ -3609,7 +3617,7 @@ implementation
              _PLUS :
                begin
                  consume(_PLUS);
-                 p1:=factor(false,false,false);
+                 p1:=factor(false,[]);
                  p1:=cunaryplusnode.create(p1);
                end;
 
@@ -3621,7 +3629,7 @@ implementation
                       { ugly hack, but necessary to be able to parse }
                       { -9223372036854775808 as int64 (JM)           }
                       pattern := '-'+pattern;
-                      p1:=sub_expr(oppower,false,false,nil);
+                      p1:=sub_expr(oppower,[],nil);
                       {  -1 ** 4 should be - (1 ** 4) and not
                          (-1) ** 4
                          This was the reason of tw0869.pp test failure PM }
@@ -3645,9 +3653,9 @@ implementation
                  else
                    begin
                      if m_isolike_unary_minus in current_settings.modeswitches then
-                       p1:=sub_expr(opmultiply,false,false,nil)
+                       p1:=sub_expr(opmultiply,[],nil)
                      else
-                       p1:=sub_expr(oppower,false,false,nil);
+                       p1:=sub_expr(oppower,[],nil);
 
                      p1:=cunaryminusnode.create(p1);
                    end;
@@ -3656,7 +3664,7 @@ implementation
              _OP_NOT :
                begin
                  consume(_OP_NOT);
-                 p1:=factor(false,false,false);
+                 p1:=factor(false,[]);
                  p1:=cnotnode.create(p1);
                end;
 
@@ -3682,7 +3690,7 @@ implementation
                }
                consume(_OBJCPROTOCOL);
                consume(_LKLAMMER);
-               p1:=factor(false,false,false);
+               p1:=factor(false,[]);
                consume(_RKLAMMER);
                p1:=cinlinenode.create(in_objc_protocol_x,false,p1);
              end;
@@ -3742,7 +3750,7 @@ implementation
 {****************************************************************************
                              Sub_Expr
 ****************************************************************************}
-    function sub_expr(pred_level:Toperator_precedence;accept_equal,typeonly:boolean;factornode:tnode):tnode;
+    function sub_expr(pred_level:Toperator_precedence;flags:texprflags;factornode:tnode):tnode;
     {Reads a subexpression while the operators are of the current precedence
      level, or any higher level. Replaces the old term, simpl_expr and
      simpl2_expr.}
@@ -3945,24 +3953,24 @@ implementation
         if pred_level=highest_precedence then
           begin
             if factornode=nil then
-              p1:=factor(false,typeonly,false)
+              p1:=factor(false,flags)
             else
               p1:=factornode;
           end
         else
-          p1:=sub_expr(succ(pred_level),true,typeonly,factornode);
+          p1:=sub_expr(succ(pred_level),flags+[ef_accept_equal],factornode);
         repeat
           if (token in [NOTOKEN..last_operator]) and
              (token in operator_levels[pred_level]) and
-             ((token<>_EQ) or accept_equal) then
+             ((token<>_EQ) or (ef_accept_equal in flags)) then
            begin
              oldt:=token;
              filepos:=current_tokenpos;
              consume(token);
              if pred_level=highest_precedence then
-               p2:=factor(false,false,false)
+               p2:=factor(false,[])
              else
-               p2:=sub_expr(succ(pred_level),true,typeonly,nil);
+               p2:=sub_expr(succ(pred_level),flags+[ef_accept_equal],nil);
              case oldt of
                _PLUS :
                  p1:=caddnode.create(addn,p1,p2);
@@ -4154,14 +4162,14 @@ implementation
       end;
 
 
-    function comp_expr(accept_equal,typeonly:boolean):tnode;
+    function comp_expr(flags:texprflags):tnode;
       var
          oldafterassignment : boolean;
          p1 : tnode;
       begin
          oldafterassignment:=afterassignment;
          afterassignment:=true;
-         p1:=sub_expr(opcompare,accept_equal,typeonly,nil);
+         p1:=sub_expr(opcompare,flags,nil);
          { get the resultdef for this expression }
          if not assigned(p1.resultdef) then
           do_typecheckpass(p1);
@@ -4180,7 +4188,7 @@ implementation
 
       begin
          oldafterassignment:=afterassignment;
-         p1:=sub_expr(opcompare,true,false,nil);
+         p1:=sub_expr(opcompare,[ef_accept_equal],nil);
          { get the resultdef for this expression }
          if not assigned(p1.resultdef) and
             dotypecheck then
@@ -4193,7 +4201,7 @@ implementation
            _POINTPOINT :
              begin
                 consume(_POINTPOINT);
-                p2:=sub_expr(opcompare,true,false,nil);
+                p2:=sub_expr(opcompare,[ef_accept_equal],nil);
                 p1:=crangenode.create(p1,p2);
              end;
            _ASSIGNMENT :
@@ -4201,7 +4209,7 @@ implementation
                 consume(_ASSIGNMENT);
                 if assigned(p1.resultdef) and (p1.resultdef.typ=procvardef) then
                   getprocvardef:=tprocvardef(p1.resultdef);
-                p2:=sub_expr(opcompare,true,false,nil);
+                p2:=sub_expr(opcompare,[ef_accept_equal],nil);
                 if assigned(getprocvardef) then
                   handle_procvar(getprocvardef,p2);
                 getprocvardef:=nil;
@@ -4210,25 +4218,25 @@ implementation
            _PLUSASN :
              begin
                consume(_PLUSASN);
-               p2:=sub_expr(opcompare,true,false,nil);
+               p2:=sub_expr(opcompare,[ef_accept_equal],nil);
                p1:=gen_c_style_operator(addn,p1,p2);
             end;
           _MINUSASN :
             begin
                consume(_MINUSASN);
-               p2:=sub_expr(opcompare,true,false,nil);
+               p2:=sub_expr(opcompare,[ef_accept_equal],nil);
                p1:=gen_c_style_operator(subn,p1,p2);
             end;
           _STARASN :
             begin
                consume(_STARASN  );
-               p2:=sub_expr(opcompare,true,false,nil);
+               p2:=sub_expr(opcompare,[ef_accept_equal],nil);
                p1:=gen_c_style_operator(muln,p1,p2);
             end;
           _SLASHASN :
             begin
                consume(_SLASHASN  );
-               p2:=sub_expr(opcompare,true,false,nil);
+               p2:=sub_expr(opcompare,[ef_accept_equal],nil);
                p1:=gen_c_style_operator(slashn,p1,p2);
             end;
           else
@@ -4251,7 +4259,7 @@ implementation
       p:tnode;
     begin
       result:=0;
-      p:=comp_expr(true,false);
+      p:=comp_expr([ef_accept_equal]);
       if not codegenerror then
        begin
          if (p.nodetype<>ordconstn) or
@@ -4271,7 +4279,7 @@ implementation
       p:tnode;
     begin
       get_stringconst:='';
-      p:=comp_expr(true,false);
+      p:=comp_expr([ef_accept_equal]);
       if p.nodetype<>stringconstn then
         begin
           if (p.nodetype=ordconstn) and is_char(p.resultdef) then

+ 2 - 2
compiler/pgenutil.pas

@@ -327,7 +327,7 @@ uses
               consume(_COMMA);
             block_type:=bt_type;
             tmpparampos:=current_filepos;
-            typeparam:=factor(false,true,false);
+            typeparam:=factor(false,[ef_type_only]);
             if typeparam.nodetype=typen then
               begin
                 if tstoreddef(typeparam.resultdef).is_generic and
@@ -453,7 +453,7 @@ uses
               repeat
                 if not first then
                   begin
-                    pt2:=factor(false,true,false);
+                    pt2:=factor(false,[ef_type_only]);
                     pt2.free;
                   end;
                 first:=false;

+ 7 - 7
compiler/pinline.pas

@@ -83,7 +83,7 @@ implementation
         if target_info.system in systems_managed_vm then
           message(parser_e_feature_unsupported_for_vm);
         consume(_LKLAMMER);
-        p:=comp_expr(true,false);
+        p:=comp_expr([ef_accept_equal]);
         { calc return type }
         if is_new then
           begin
@@ -167,7 +167,7 @@ implementation
             if is_typeparam(p.resultdef) then
               begin
                  p.free;
-                 p:=factor(false,false,false);
+                 p:=factor(false,[]);
                  p.free;
                  consume(_RKLAMMER);
                  new_dispose_statement:=cnothingnode.create;
@@ -178,7 +178,7 @@ implementation
               begin
                  Message1(type_e_pointer_type_expected,p.resultdef.typename);
                  p.free;
-                 p:=factor(false,false,false);
+                 p:=factor(false,[]);
                  p.free;
                  consume(_RKLAMMER);
                  new_dispose_statement:=cerrornode.create;
@@ -189,7 +189,7 @@ implementation
               begin
                  Message(parser_e_pointer_to_class_expected);
                  p.free;
-                 new_dispose_statement:=factor(false,false,false);
+                 new_dispose_statement:=factor(false,[]);
                  consume_all_until(_RKLAMMER);
                  consume(_RKLAMMER);
                  exit;
@@ -199,7 +199,7 @@ implementation
             if is_class(classh) then
               begin
                  Message(parser_e_no_new_or_dispose_for_classes);
-                 new_dispose_statement:=factor(false,false,false);
+                 new_dispose_statement:=factor(false,[]);
                  consume_all_until(_RKLAMMER);
                  consume(_RKLAMMER);
                  exit;
@@ -354,7 +354,7 @@ implementation
                          while (token=_COMMA) and assigned(variantdesc) do
                            begin
                              consume(_COMMA);
-                             p2:=factor(false,false,false);
+                             p2:=factor(false,[]);
                              do_typecheckpass(p2);
                              if p2.nodetype=ordconstn then
                                begin
@@ -421,7 +421,7 @@ implementation
         if target_info.system in systems_managed_vm then
           message(parser_e_feature_unsupported_for_vm);
         consume(_LKLAMMER);
-        p1:=factor(false,false,false);
+        p1:=factor(false,[]);
         if p1.nodetype<>typen then
          begin
            Message(type_e_type_id_expected);

+ 12 - 12
compiler/pstatmnt.pas

@@ -71,7 +71,7 @@ implementation
          ex,if_a,else_a : tnode;
       begin
          consume(_IF);
-         ex:=comp_expr(true,false);
+         ex:=comp_expr([ef_accept_equal]);
          consume(_THEN);
          if not(token in endtokens) then
            if_a:=statement
@@ -126,7 +126,7 @@ implementation
          casenode : tcasenode;
       begin
          consume(_CASE);
-         caseexpr:=comp_expr(true,false);
+         caseexpr:=comp_expr([ef_accept_equal]);
          { determines result type }
          do_typecheckpass(caseexpr);
          { variants must be accepted, but first they must be converted to integer }
@@ -320,7 +320,7 @@ implementation
          consume(_UNTIL);
 
          first:=cblocknode.create(first);
-         p_e:=comp_expr(true,false);
+         p_e:=comp_expr([ef_accept_equal]);
          result:=cwhilerepeatnode.create(p_e,first,false,true);
       end;
 
@@ -332,7 +332,7 @@ implementation
 
       begin
          consume(_WHILE);
-         p_e:=comp_expr(true,false);
+         p_e:=comp_expr([ef_accept_equal]);
          consume(_DO);
          p_a:=statement;
          result:=cwhilerepeatnode.create(p_e,p_a,true,false);
@@ -462,7 +462,7 @@ implementation
              else
                MessagePos(hloopvar.fileinfo,type_e_illegal_count_var);
 
-             hfrom:=comp_expr(true,false);
+             hfrom:=comp_expr([ef_accept_equal]);
 
              if try_to_consume(_DOWNTO) then
                backward:=true
@@ -472,7 +472,7 @@ implementation
                  backward:=false;
                end;
 
-             hto:=comp_expr(true,false);
+             hto:=comp_expr([ef_accept_equal]);
              consume(_DO);
 
              { Check if the constants fit in the range }
@@ -519,7 +519,7 @@ implementation
               else
                 loopvarsym:=nil;
 
-              expr:=comp_expr(true,false);
+              expr:=comp_expr([ef_accept_equal]);
 
               consume(_DO);
 
@@ -541,7 +541,7 @@ implementation
          { parse loop header }
          consume(_FOR);
 
-         hloopvar:=factor(false,false,false);
+         hloopvar:=factor(false,[]);
          valid_for_loopvar(hloopvar,true);
 
          if try_to_consume(_ASSIGNMENT) then
@@ -604,7 +604,7 @@ implementation
 
       begin
          calltempnode:=nil;
-         p:=comp_expr(true,false);
+         p:=comp_expr([ef_accept_equal]);
          do_typecheckpass(p);
 
          if (p.nodetype=vecn) and
@@ -830,12 +830,12 @@ implementation
          if not(token in endtokens) then
            begin
               { object }
-              pobj:=comp_expr(true,false);
+              pobj:=comp_expr([ef_accept_equal]);
               if try_to_consume(_AT) then
                 begin
-                   paddr:=comp_expr(true,false);
+                   paddr:=comp_expr([ef_accept_equal]);
                    if try_to_consume(_COMMA) then
-                     pframe:=comp_expr(true,false);
+                     pframe:=comp_expr([ef_accept_equal]);
                 end;
            end
          else

+ 3 - 3
compiler/ptype.pas

@@ -1030,11 +1030,11 @@ implementation
              if try_parse_structdef_nested_type(def,current_structdef,false) then
                exit;
            { we can't accept a equal in type }
-           pt1:=comp_expr(false,true);
+           pt1:=comp_expr([ef_type_only]);
            if try_to_consume(_POINTPOINT) then
              begin
                { get high value of range }
-               pt2:=comp_expr(false,false);
+               pt2:=comp_expr([]);
                { make both the same type or give an error. This is not
                  done when both are integer values, because typecasting
                  between -3200..3200 will result in a signed-unsigned
@@ -1610,7 +1610,7 @@ implementation
                     begin
                        oldlocalswitches:=current_settings.localswitches;
                        include(current_settings.localswitches,cs_allow_enum_calc);
-                       p:=comp_expr(true,false);
+                       p:=comp_expr([ef_accept_equal]);
                        current_settings.localswitches:=oldlocalswitches;
                        if (p.nodetype=ordconstn) then
                         begin