fix #1692
This commit is contained in:
parent
1968242990
commit
068b5270d4
|
|
@ -1,6 +1,7 @@
|
||||||
using PascalABCCompiler.SyntaxTree;
|
using PascalABCCompiler.SyntaxTree;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
|
@ -13,7 +14,18 @@ namespace SyntaxVisitors.SugarVisitors
|
||||||
get { return new PropertyDesugarVisitor(); }
|
get { return new PropertyDesugarVisitor(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void visit(simple_property _simple_property)
|
public override void visit(class_members _class_members)
|
||||||
|
{
|
||||||
|
foreach (var member in _class_members.members)
|
||||||
|
{
|
||||||
|
if (member is simple_property)
|
||||||
|
{
|
||||||
|
Desugar(member as simple_property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Desugar(simple_property _simple_property)
|
||||||
{
|
{
|
||||||
var property_parent_node = _simple_property.Parent;
|
var property_parent_node = _simple_property.Parent;
|
||||||
while (property_parent_node != null && property_parent_node.GetType() != typeof(class_members))
|
while (property_parent_node != null && property_parent_node.GetType() != typeof(class_members))
|
||||||
|
|
|
||||||
12
TestSuite/autoproperty7.pas
Normal file
12
TestSuite/autoproperty7.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
type
|
||||||
|
TSome = auto class
|
||||||
|
public
|
||||||
|
auto property A: byte;
|
||||||
|
auto property B: object;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var node := new TSome(1, nil);
|
||||||
|
assert(node.A = 1);
|
||||||
|
assert(node.B = nil);
|
||||||
|
end.
|
||||||
Loading…
Reference in a new issue