bug fix #529
This commit is contained in:
parent
680a9b99b4
commit
170e47253d
25
TestSuite/lambdas_closures_13.pas
Normal file
25
TestSuite/lambdas_closures_13.pas
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
type
|
||||||
|
t1 = class
|
||||||
|
|
||||||
|
public class i: integer;
|
||||||
|
|
||||||
|
procedure p1;
|
||||||
|
begin
|
||||||
|
var i2: integer;
|
||||||
|
|
||||||
|
var p: procedure := ()->begin
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
i2 += 1;
|
||||||
|
|
||||||
|
end;
|
||||||
|
p;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var o := new t1;
|
||||||
|
o.p1;
|
||||||
|
assert(t1.i = 1);
|
||||||
|
end.
|
||||||
|
|
@ -392,7 +392,11 @@ namespace TreeConverter.LambdaExpressions.Closure
|
||||||
{
|
{
|
||||||
if (upperScopeWhereVarsAreCaptured != scope)
|
if (upperScopeWhereVarsAreCaptured != scope)
|
||||||
{
|
{
|
||||||
var dotnode1 = new dot_node(
|
dot_node dotnode1 = null;
|
||||||
|
if (ClassField != null && ClassField.IsStatic)
|
||||||
|
dotnode1 = new dot_node(ClassName, new ident(varName));
|
||||||
|
else
|
||||||
|
dotnode1 = new dot_node(
|
||||||
new ident(compiler_string_consts.self_word),
|
new ident(compiler_string_consts.self_word),
|
||||||
new ident(
|
new ident(
|
||||||
_capturedVarsClassDefs[upperScopeWhereVarsAreCaptured.ScopeIndex]
|
_capturedVarsClassDefs[upperScopeWhereVarsAreCaptured.ScopeIndex]
|
||||||
|
|
@ -429,6 +433,7 @@ namespace TreeConverter.LambdaExpressions.Closure
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!(ClassField != null && ClassField.IsStatic))
|
||||||
dotnode1 = new dot_node(dotnode1, new ident(varName));
|
dotnode1 = new dot_node(dotnode1, new ident(varName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue