compiler: fix internal class symbol search for method arguments

git-svn-id: trunk@14610 -
This commit is contained in:
paul 2010-01-11 09:55:53 +00:00
parent 166f8a63a2
commit fd6e2cc86e
3 changed files with 30 additions and 0 deletions

1
.gitattributes vendored
View File

@ -8894,6 +8894,7 @@ tests/test/tclass11a.pp svneol=native#text/pascal
tests/test/tclass11b.pp svneol=native#text/pascal
tests/test/tclass12a.pp svneol=native#text/pascal
tests/test/tclass12b.pp svneol=native#text/pascal
tests/test/tclass12c.pp svneol=native#text/pascal
tests/test/tclass2.pp svneol=native#text/plain
tests/test/tclass3.pp svneol=native#text/plain
tests/test/tclass4.pp svneol=native#text/plain

View File

@ -702,6 +702,7 @@ implementation
popclass : boolean;
ImplIntf : TImplementedInterface;
old_parse_generic : boolean;
old_current_objectdef: tobjectdef;
begin
{ Save the position where this procedure really starts }
procstartfilepos:=current_tokenpos;
@ -962,6 +963,8 @@ implementation
(symtablestack.top.symtabletype<>ObjectSymtable) then
begin
symtablestack.push(pd._class.symtable);
old_current_objectdef:=current_objectdef;
current_objectdef:=pd._class;
popclass:=true;
end;
{ Add parameter symtable }
@ -971,7 +974,10 @@ implementation
if pd.parast.symtabletype<>staticsymtable then
symtablestack.pop(pd.parast);
if popclass then
begin
current_objectdef:=old_current_objectdef;
symtablestack.pop(pd._class.symtable);
end;
end;
parse_generic:=old_parse_generic;

23
tests/test/tclass12c.pp Normal file
View File

@ -0,0 +1,23 @@
program tclass12c;
{$ifdef fpc}
{$mode delphi}
{$endif}
{$apptype console}
type
TSomeClass = class
strict private
const
PrivateConst = 1;
type
PrivateType = type Integer;
public
procedure DoSomething(Value: PrivateType = PrivateConst);
end;
procedure TSomeClass.DoSomething(Value: PrivateType = PrivateConst);
begin
end;
begin
end.