瀏覽代碼

* fixed stabs generation for static class variables

git-svn-id: trunk@3614 -
florian 19 年之前
父節點
當前提交
3261281184
共有 3 個文件被更改,包括 32 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 17 0
      compiler/symsym.pas
  3. 14 0
      tests/webtbs/tw6435.pp

+ 1 - 0
.gitattributes

@@ -6821,6 +6821,7 @@ tests/webtbs/tw5015.pp svneol=native#text/plain
 tests/webtbs/tw5023.pp svneol=native#text/plain
 tests/webtbs/tw5023.pp svneol=native#text/plain
 tests/webtbs/tw5036.pp svneol=native#text/plain
 tests/webtbs/tw5036.pp svneol=native#text/plain
 tests/webtbs/tw5082.pp -text svneol=unset#text/plain
 tests/webtbs/tw5082.pp -text svneol=unset#text/plain
+tests/webtbs/tw6435.pp svneol=native#text/plain
 tests/webtbs/tw6491.pp svneol=native#text/plain
 tests/webtbs/tw6491.pp svneol=native#text/plain
 tests/webtbs/tw6624.pp svneol=native#text/plain
 tests/webtbs/tw6624.pp svneol=native#text/plain
 tests/webtbs/tw6684.pp svneol=native#text/plain
 tests/webtbs/tw6684.pp svneol=native#text/plain

+ 17 - 0
compiler/symsym.pas

@@ -163,6 +163,7 @@ interface
           constructor create(const n : string;vsp:tvarspez;const tt : ttype;vopts:tvaroptions);
           constructor create(const n : string;vsp:tvarspez;const tt : ttype;vopts:tvaroptions);
           constructor ppuload(ppufile:tcompilerppufile);
           constructor ppuload(ppufile:tcompilerppufile);
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
+          function mangledname:string;override;
       end;
       end;
 
 
       tabstractnormalvarsym = class(tabstractvarsym)
       tabstractnormalvarsym = class(tabstractvarsym)
@@ -1416,6 +1417,22 @@ implementation
       end;
       end;
 
 
 
 
+    function tfieldvarsym.mangledname:string;
+      var
+        srsym : tsym;
+        srsymtable : tsymtable;
+      begin
+        if sp_static in symoptions then
+          begin
+            searchsym(lower(owner.name^)+'_'+name,srsym,srsymtable);
+            if assigned(srsym) then
+             result:=srsym.mangledname;
+          end
+        else
+          result:=inherited mangledname;
+      end;
+
+
 {****************************************************************************
 {****************************************************************************
                         TABSTRACTNORMALVARSYM
                         TABSTRACTNORMALVARSYM
 ****************************************************************************}
 ****************************************************************************}

+ 14 - 0
tests/webtbs/tw6435.pp

@@ -0,0 +1,14 @@
+{ %OPT=-gl }
+program Project1;
+
+{$mode objfpc}{$H+}{$static on}
+
+type
+  MyClass = class(TObject)
+  private
+    FClassVar: integer; static;
+  end;
+
+begin
+end.
+