bug fix #496
This commit is contained in:
parent
59973c9535
commit
b2ac415b2c
24
TestSuite/lambdas_closures_12.pas
Normal file
24
TestSuite/lambdas_closures_12.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
var i: integer;
|
||||
type
|
||||
t2 = class
|
||||
procedure Redraw;
|
||||
begin
|
||||
i := 1;
|
||||
end;
|
||||
|
||||
constructor(Redraw: boolean);
|
||||
begin
|
||||
var p:procedure := ()->
|
||||
begin
|
||||
if Redraw then
|
||||
self.Redraw;
|
||||
end;
|
||||
p;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
new t2(true);
|
||||
assert(i = 1);
|
||||
end.
|
||||
|
|
@ -2130,6 +2130,15 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
|
||||
SymbolInfoList si = curscope.Find(name, curscope);
|
||||
SymbolInfoList si2 = null;
|
||||
if (si != null && si.First().scope is SymbolTable.ClassScope && curscope.TopScope is SymbolTable.BlockScope && curscope.TopScope.TopScope is SymbolTable.ClassMethodScope && curscope.TopScope.TopScope.TopScope is SymbolTable.BlockScope)
|
||||
{
|
||||
si2 = curscope.TopScope.TopScope.TopScope.Find(name, curscope.TopScope.TopScope.TopScope);
|
||||
if (si2 != null && si2.First().scope is SymbolTable.ClassMethodScope)
|
||||
{
|
||||
si = si2;
|
||||
}
|
||||
}
|
||||
|
||||
if (si == null && _compiled_tn != null && curscope.TopScope != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue