This commit is contained in:
Бондарев Иван 2019-10-20 14:12:23 +02:00
parent 3e818b7aec
commit b895f2823c
3 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,12 @@
namespace nsyield1;
type
T1 = class
public static function Seq(): sequence of integer;
begin
yield 1;
end;
end;
end.

View file

@ -0,0 +1,7 @@
//nopabcrtl
{$includenamespace 'namespaces/nsyield1.pas'}
uses nsyield1;
begin
assert(T1.Seq().ToArray()[0] = 1);
end.

View file

@ -10991,6 +10991,10 @@ namespace PascalABCCompiler.TreeConverter
}
}
else if (decl is procedure_definition && get_location(decl) == null)
{
//yield
}
else
AddError(get_location(decl), "NAMESPACE_SHOULD_CONTAINS_ONLY_TYPES");
}
@ -11043,6 +11047,20 @@ namespace PascalABCCompiler.TreeConverter
}
}
}
}
context.leave_scope();
}
foreach (syntax_namespace_node _syntax_namespace_node in namespaces)
{
common_namespace_node cmn = dict[_syntax_namespace_node];
context.enter_scope(cmn.scope);
foreach (declaration decl in _syntax_namespace_node.defs)
{
if (decl is procedure_definition)
{
hard_node_test_and_visit(decl);
}
}
context.leave_scope();
}