Procházet zdrojové kódy

* fix for Mantis #36114: when converting a static class field to a global variable the varspez of the field needs to be respected
+ added test

git-svn-id: trunk@43116 -

svenbarth před 5 roky
rodič
revize
beb606be13
3 změnil soubory, kde provedl 24 přidání a 1 odebrání
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/symsym.pas
  3. 22 0
      tests/webtbf/tw36114.pp

+ 1 - 0
.gitattributes

@@ -16063,6 +16063,7 @@ tests/webtbf/tw35753.pp svneol=native#text/plain
 tests/webtbf/tw3583.pp svneol=native#text/plain
 tests/webtbf/tw35866.pp svneol=native#text/pascal
 tests/webtbf/tw35981.pp svneol=native#text/pascal
+tests/webtbf/tw36114.pp svneol=native#text/pascal
 tests/webtbf/tw3626.pp svneol=native#text/plain
 tests/webtbf/tw3631.pp svneol=native#text/plain
 tests/webtbf/tw3643.pp svneol=native#text/plain

+ 1 - 1
compiler/symsym.pas

@@ -1960,7 +1960,7 @@ implementation
 
     constructor tstaticvarsym.create_from_fieldvar(const n: string;fieldvar:tfieldvarsym);
       begin
-        create(internal_static_field_name(n),vs_value,fieldvar.vardef,[]);
+        create(internal_static_field_name(n),fieldvar.varspez,fieldvar.vardef,[]);
         fieldvarsym:=fieldvar;
       end;
 

+ 22 - 0
tests/webtbf/tw36114.pp

@@ -0,0 +1,22 @@
+{ %FAIL }
+
+program tw36114;
+
+{$mode objfpc}{$H+}{$J-}
+type
+  TTestme=class
+  strict private
+  const
+  {$push}{$writeableconst off} // superfluous but also doesn't work
+    c_one:integer = 1;
+    c_two:integer = 10;
+  {$pop}
+  public
+  class property one:integer read c_one;
+  class property two:integer read c_two;
+  end;
+
+begin
+  TTestme.c_one := 1000;
+  writeln(TTestme.One);
+end.