This commit is contained in:
parent
772489a15e
commit
27dafcbdfd
24
TestSuite/with3.pas
Normal file
24
TestSuite/with3.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
type
|
||||
node = class
|
||||
i: integer;
|
||||
function f1: node := new node;
|
||||
end;
|
||||
|
||||
begin
|
||||
var n1 := new node;
|
||||
var n2: node;
|
||||
with n1 do
|
||||
begin
|
||||
// Обязательно вложенный with
|
||||
n2 := f1;
|
||||
with n2 do
|
||||
begin
|
||||
i := 2;
|
||||
end;
|
||||
// Обязательно вызвать метод после вложенного with
|
||||
f1;
|
||||
i := 1;
|
||||
end;
|
||||
assert(n1.i = 1);
|
||||
assert(n2.i = 2);
|
||||
end.
|
||||
|
|
@ -9022,6 +9022,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
foreach (expression_node vr in VarRefs)
|
||||
{
|
||||
context.WithVariables.Remove(vr.type.Scope);
|
||||
if (!context.WithVariables.ContainsKey(vr.type.Scope) && OldWithVariables.ContainsKey(vr.type.Scope))
|
||||
{
|
||||
context.WithVariables.Add(vr.type.Scope, OldWithVariables[vr.type.Scope]);
|
||||
OldWithVariables.Remove(vr.type.Scope);
|
||||
}
|
||||
type_node tn = vr.type.base_type;
|
||||
while (tn != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue