This commit is contained in:
Бондарев Иван 2018-04-19 20:11:51 +02:00
parent 4ac49e57e0
commit 3e1d264cbd
4 changed files with 22 additions and 2 deletions

View file

@ -41,6 +41,8 @@ namespace SyntaxVisitors
return;
}
if (cd.body == null)
return;
var fields = cd.body.class_def_blocks.SelectMany(cm => cm.members.Where(decl => decl is var_def_statement)
.Select(decl1 => (decl1 as var_def_statement).vars.idents)
.SelectMany(ids => ids.Select(id => id)));

View file

@ -39,7 +39,8 @@ namespace SyntaxVisitors
// Yoda
return;
}
if (cd.body == null)
return;
var methods = cd.body.class_def_blocks.SelectMany(cm => cm.members.Select(decl1 =>
{
if (decl1 is procedure_header)

View file

@ -39,7 +39,8 @@ namespace SyntaxVisitors
// Yoda
return;
}
if (cd.body == null)
return;
var properties = cd.body.class_def_blocks.SelectMany(cm => cm.members.Select(decl => decl as simple_property)
.Where(name => (object)name != null)
.Select(sp => sp.property_name));

16
TestSuite/yield4.pas Normal file
View file

@ -0,0 +1,16 @@
type
t1 = class;
t1 = class
function f1: sequence of byte;
begin
yield 0;//обязательно yield
yield 1;
end;
end;
begin
var o1:t1 := new t1;
var arr := o1.f1.ToArray;
assert(arr[1] = 1);
end.