Browse Source

* apply patch by Blaise.ru:
- all call sites of parse_var_proc_directives() have the tprocvardef easily available, so use parse_proctype_directives() directly
- remove the now no longer required parse_var_proc_directives()

Sven/Sarah Barth 3 years ago
parent
commit
9c9c6cc81b
3 changed files with 4 additions and 26 deletions
  1. 3 3
      compiler/pdecl.pas
  2. 0 22
      compiler/pdecsub.pas
  3. 1 1
      compiler/pgenutil.pas

+ 3 - 3
compiler/pdecl.pas

@@ -324,7 +324,7 @@ implementation
                       if try_to_consume(_SEMICOLON) then
                        begin
                          if check_proc_directive(true) then
-                          parse_var_proc_directives(sym)
+                          parse_proctype_directives(tprocvardef(hdef))
                          else
                           begin
                             Message(parser_e_proc_directive_expected);
@@ -335,7 +335,7 @@ implementation
                       { support p : procedure stdcall=nil; }
                        begin
                          if check_proc_directive(true) then
-                          parse_var_proc_directives(sym);
+                          parse_proctype_directives(tprocvardef(hdef));
                        end;
                       { add default calling convention }
                       handle_calling_convention(tabstractprocdef(hdef),hcc_default_actions_intf);
@@ -1051,7 +1051,7 @@ implementation
                            try_consume_hintdirective(newtype.symoptions,newtype.deprecatedmsg);
                            consume(_SEMICOLON);
                          end;
-                       parse_var_proc_directives(tsym(newtype));
+                       parse_proctype_directives(tprocvardef(hdef));
                        if po_is_function_ref in tprocvardef(hdef).procoptions then
                          begin
                            { these always support everything, no "of object" or

+ 0 - 22
compiler/pdecsub.pas

@@ -68,7 +68,6 @@ interface
 
     procedure parse_parameter_dec(pd:tabstractprocdef);
     procedure parse_proc_directives(pd:tabstractprocdef;var pdflags:tpdflags);
-    procedure parse_var_proc_directives(sym:tsym);
     procedure parse_proctype_directives(pd:tprocvardef);
     procedure parse_object_proc_directives(pd:tabstractprocdef);
     procedure parse_record_proc_directives(pd:tabstractprocdef);
@@ -3432,27 +3431,6 @@ const
       end;
 
 
-    procedure parse_var_proc_directives(sym:tsym);
-      var
-        pd      : tprocvardef;
-      begin
-        case sym.typ of
-          fieldvarsym,
-          staticvarsym,
-          localvarsym,
-          paravarsym :
-            pd:=tprocvardef(tabstractvarsym(sym).vardef);
-          typesym :
-            pd:=tprocvardef(ttypesym(sym).typedef);
-          else
-            internalerror(2003042617);
-        end;
-        if pd.typ<>procvardef then
-          internalerror(2003042618);
-        parse_proctype_directives(pd);
-      end;
-
-
     procedure parse_proctype_directives(pd:tprocvardef);
       var
         pdflags : tpdflags;

+ 1 - 1
compiler/pgenutil.pas

@@ -1998,7 +1998,7 @@ uses
                             hintsprocessed:=true;
                         end;
                       if replaydepth>current_scanner.replay_stack_depth then
-                        parse_var_proc_directives(ttypesym(srsym));
+                        parse_proctype_directives(tprocvardef(result));
                       handle_calling_convention(tprocvardef(result),hcc_default_actions_intf);
                       if not hintsprocessed and (replaydepth>current_scanner.replay_stack_depth) then
                         begin