Fix for Mantis #25210 .

compiler/pdecobj.pas, object_dec:
  * since revision 25518 the global symtable of the current module is no longer popped and pushed again so that the defaware symtablestack can add the helper; thus we need to do this not only for static symtables, but for global ones as well
  * adjusted comment to reflect current situation

git-svn-id: trunk@25834 -
This commit is contained in:
svenbarth 2013-10-20 11:33:01 +00:00
parent 1f30cd9505
commit d91d4afb0f
3 changed files with 33 additions and 4 deletions

1
.gitattributes vendored
View File

@ -13624,6 +13624,7 @@ tests/webtbs/tw25081.pp svneol=native#text/pascal
tests/webtbs/tw25101.pp svneol=native#text/pascal
tests/webtbs/tw2514.pp svneol=native#text/plain
tests/webtbs/tw25198.pp svneol=native#text/plain
tests/webtbs/tw25210.pp svneol=native#text/pascal
tests/webtbs/tw2525.pp svneol=native#text/plain
tests/webtbs/tw2536.pp svneol=native#text/plain
tests/webtbs/tw2540.pp svneol=native#text/plain

View File

@ -1565,9 +1565,9 @@ implementation
else if is_objcclass(current_structdef) then
setobjcclassmethodoptions;
{ if this helper is defined in the implementation section of the unit
or inside the main project file, the extendeddefs list of the current
module must be updated (it will be removed when poping the symtable) }
{ we need to add this helper to the extendeddefs of the current module,
as the global and static symtable are not pushed onto the symtable
stack again (it will be removed when poping the symtable) }
if is_objectpascal_helper(current_structdef) and
(current_objectdef.extendeddef.typ<>errordef) then
begin
@ -1575,7 +1575,7 @@ implementation
st:=current_structdef.owner;
while st.symtabletype in [objectsymtable,recordsymtable] do
st:=st.defowner.owner;
if st.symtabletype=staticsymtable then
if st.symtabletype in [staticsymtable,globalsymtable] then
begin
if current_objectdef.extendeddef.typ in [recorddef,objectdef] then
s:=make_mangledname('',tabstractrecorddef(current_objectdef.extendeddef).symtable,'')

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

@ -0,0 +1,28 @@
unit tw25210;
{$mode objfpc}
interface
uses
Classes;
type
TStringsHelper = class helper for TStrings
procedure Test;
end;
implementation
procedure TStringsHelper.Test;
begin
Writeln('Foobar');
end;
var
s: TStrings;
initialization
s := TStringList.Create;
s.Test;
s.Free;
end.