Răsfoiți Sursa

* do not interpret procsyms followed by ./^/( as potential procvar
expressions in case of TP/Mac-style procvar modes (mantis #21073)

git-svn-id: trunk@20062 -

Jonas Maebe 13 ani în urmă
părinte
comite
56161e608d
3 a modificat fișierele cu 30 adăugiri și 2 ștergeri
  1. 1 0
      .gitattributes
  2. 3 2
      compiler/pexpr.pas
  3. 26 0
      tests/webtbs/tw21073.pp

+ 1 - 0
.gitattributes

@@ -12118,6 +12118,7 @@ tests/webtbs/tw20995a.pp svneol=native#text/pascal
 tests/webtbs/tw20995b.pp svneol=native#text/pascal
 tests/webtbs/tw20998.pp svneol=native#text/pascal
 tests/webtbs/tw21029.pp svneol=native#text/plain
+tests/webtbs/tw21073.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain
 tests/webtbs/tw2110.pp svneol=native#text/plain
 tests/webtbs/tw2128.pp svneol=native#text/plain

+ 3 - 2
compiler/pexpr.pas

@@ -899,8 +899,9 @@ implementation
                getaddr:=true;
              end
             else
-             if (m_tp_procvar in current_settings.modeswitches) or
-                (m_mac_procvar in current_settings.modeswitches) then
+             if ((m_tp_procvar in current_settings.modeswitches) or
+                 (m_mac_procvar in current_settings.modeswitches)) and
+                not(token in [_CARET,_POINT,_LKLAMMER]) then
               begin
                 aprocdef:=Tprocsym(sym).Find_procdef_byprocvardef(getprocvardef);
                 if assigned(aprocdef) then

+ 26 - 0
tests/webtbs/tw21073.pp

@@ -0,0 +1,26 @@
+{ %norun }
+
+{$mode delphi}
+
+program gpabugtest;
+
+TYPE TGetCurrentProcess = function : THandle; stdcall;
+     TGetProcAddress = function(const hModule : THandle; const lpProcName : PAnsiChar) : Pointer; stdcall;
+
+function GetProcAddress(const hModule : THandle;const lpProcName : PAnsiChar) : Pointer; stdcall;
+begin
+  result:=nil;
+end;
+
+function GetModuleHandle(const lpModuleName : PWideChar) : THandle; stdcall;
+begin
+  result:=thandle(-1);
+end;
+
+var proc_GetCurrentProcess : TGetCurrentProcess;
+    proc_GetProcAddress : TGetProcAddress;
+
+begin
+ {no error} proc_GetCurrentProcess:=GetProcAddress(GetModuleHandle('Kernel32'),'GetCurrentProcess');
+ {error ??} proc_GetProcAddress:=   GetProcAddress(GetModuleHandle('Kernel32'),'GetProcAddress');
+end.