Fix for Mantis #26922.

pgenutil.pas, specialization_init:
  * don't push the localsymtable if the unit does not have one available

+ added test (needs manual execution though... :/ )

git-svn-id: trunk@29172 -
This commit is contained in:
svenbarth 2014-11-28 16:35:28 +00:00
parent 865d074c3d
commit fa1bc0757d
5 changed files with 65 additions and 1 deletions

3
.gitattributes vendored
View File

@ -14116,6 +14116,7 @@ tests/webtbs/tw26773.pp svneol=native#text/plain
tests/webtbs/tw2678.pp svneol=native#text/plain
tests/webtbs/tw2690.pp svneol=native#text/plain
tests/webtbs/tw2691.pp svneol=native#text/plain
tests/webtbs/tw26922.pp svneol=native#text/pascal
tests/webtbs/tw2696.pp svneol=native#text/plain
tests/webtbs/tw26976.pp svneol=native#text/plain
tests/webtbs/tw26993.pp svneol=native#text/plain
@ -14875,6 +14876,8 @@ tests/webtbs/uw25598.pp svneol=native#text/plain
tests/webtbs/uw25610a.pp -text svneol=native#text/plain
tests/webtbs/uw25610b.pp -text svneol=native#text/plain
tests/webtbs/uw25814.pp svneol=native#text/plain
tests/webtbs/uw26922a.pp svneol=native#text/pascal
tests/webtbs/uw26922b.pp svneol=native#text/pascal
tests/webtbs/uw2706a.pp svneol=native#text/plain
tests/webtbs/uw2706b.pp svneol=native#text/plain
tests/webtbs/uw2731.pp svneol=native#text/plain

View File

@ -1321,7 +1321,8 @@ uses
if assigned(hmodule.globalsymtable) then
symtablestack.push(hmodule.globalsymtable);
{ push the localsymtable if needed }
if (hmodule<>current_module) or not current_module.in_interface then
if ((hmodule<>current_module) or not current_module.in_interface)
and assigned(hmodule.localsymtable) then
symtablestack.push(hmodule.localsymtable);
end;

12
tests/webtbs/tw26922.pp Normal file
View File

@ -0,0 +1,12 @@
{ %INTERACTIVE }
{ This test requires a change in uw26922a for recompilation which can not be done automatically by
simply adding a define, because the compiler won't detect that it needs to recompile that unit }
program tw26922;
uses
uw26922a, uw26922b;
begin
end.

28
tests/webtbs/uw26922a.pp Normal file
View File

@ -0,0 +1,28 @@
unit uw26922a;
{$mode objfpc}{$H+}
interface
uses
unit2_test;
Type
TTestAbstract = class
end;
TTest = class;
TTestObject = class(specialize TTestObjectAbstract<TTest>);
// Note: uncomment TTestAbstract when for recompilation
TTest = class//(TTestAbstract)
public
end;
implementation
end.

20
tests/webtbs/uw26922b.pp Normal file
View File

@ -0,0 +1,20 @@
unit uw26922b;
{$mode objfpc}{$H+}
interface
Type
generic TTestObjectAbstract<T> = class
private
var
FTest : T;
end;
implementation
uses
uw26922a;
end.