mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:26:24 +02:00
Fix for Mantis #29745.
symdef.pas, getansistringdef: * use a temporary, non-defaware symtablestack to create the ansistringdef + added test git-svn-id: trunk@33214 -
This commit is contained in:
parent
8c68272e89
commit
27ab1c61c5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14975,6 +14975,7 @@ tests/webtbs/tw29620.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw2966.pp svneol=native#text/plain
|
tests/webtbs/tw2966.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw29669.pp svneol=native#text/plain
|
tests/webtbs/tw29669.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw29669a.pp svneol=native#text/plain
|
tests/webtbs/tw29669a.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw29745.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2975.pp svneol=native#text/plain
|
tests/webtbs/tw2975.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2976.pp svneol=native#text/plain
|
tests/webtbs/tw2976.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw29792.pp svneol=native#text/pascal
|
tests/webtbs/tw29792.pp svneol=native#text/pascal
|
||||||
|
@ -1215,6 +1215,7 @@ implementation
|
|||||||
function getansistringdef:tstringdef;
|
function getansistringdef:tstringdef;
|
||||||
var
|
var
|
||||||
symtable:tsymtable;
|
symtable:tsymtable;
|
||||||
|
oldstack : tsymtablestack;
|
||||||
begin
|
begin
|
||||||
{ if a codepage is explicitly defined in this mudule we need to return
|
{ if a codepage is explicitly defined in this mudule we need to return
|
||||||
a replacement for ansistring def }
|
a replacement for ansistring def }
|
||||||
@ -1231,9 +1232,16 @@ implementation
|
|||||||
symtable:=current_module.globalsymtable
|
symtable:=current_module.globalsymtable
|
||||||
else
|
else
|
||||||
symtable:=current_module.localsymtable;
|
symtable:=current_module.localsymtable;
|
||||||
|
{ create a temporary stack as it's not good (TM) to mess around
|
||||||
|
with the order if the unit contains generics or helpers; don't
|
||||||
|
use a def aware symtablestack though }
|
||||||
|
oldstack:=symtablestack;
|
||||||
|
symtablestack:=tsymtablestack.create;
|
||||||
symtablestack.push(symtable);
|
symtablestack.push(symtable);
|
||||||
current_module.ansistrdef:=cstringdef.createansi(current_settings.sourcecodepage,true);
|
current_module.ansistrdef:=cstringdef.createansi(current_settings.sourcecodepage,true);
|
||||||
symtablestack.pop(symtable);
|
symtablestack.pop(symtable);
|
||||||
|
symtablestack.free;
|
||||||
|
symtablestack:=oldstack;
|
||||||
end;
|
end;
|
||||||
result:=tstringdef(current_module.ansistrdef);
|
result:=tstringdef(current_module.ansistrdef);
|
||||||
end
|
end
|
||||||
|
36
tests/webtbs/tw29745.pp
Normal file
36
tests/webtbs/tw29745.pp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{ %NORUN }
|
||||||
|
|
||||||
|
program tw29745;
|
||||||
|
|
||||||
|
{$apptype console}
|
||||||
|
{$ifdef fpc}
|
||||||
|
{$mode objfpc}
|
||||||
|
{$h+}
|
||||||
|
{$codepage utf8}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
uses Classes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo = class helper for TStream
|
||||||
|
public
|
||||||
|
procedure Bar;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFoo.Bar;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
s: string = '';
|
||||||
|
m: TStream;
|
||||||
|
begin
|
||||||
|
m := TMemoryStream.Create;
|
||||||
|
try
|
||||||
|
m.Bar;
|
||||||
|
finally
|
||||||
|
m.Free;
|
||||||
|
end;
|
||||||
|
writeln(defaultsystemcodepage);
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user