This commit is contained in:
parent
35381d6778
commit
0d85e872d3
28
TestSuite/yield7.pas
Normal file
28
TestSuite/yield7.pas
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
type
|
||||
// Обязательно шаблон
|
||||
//Ошибка: Данная конструкция не поддерживается текущей версией компилятора
|
||||
t1<T> = sealed class
|
||||
|
||||
// Обязательно static
|
||||
static procedure p1 := exit;
|
||||
|
||||
function f1: sequence of byte;
|
||||
begin
|
||||
// Если расскомментировать - не воспроизводится
|
||||
// t1&<T>.
|
||||
p1;
|
||||
// Обязательно yield
|
||||
yield 1;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var t := new t1<integer>;
|
||||
var j := 0;
|
||||
foreach var i in t.f1 do
|
||||
begin
|
||||
j := i;
|
||||
end;
|
||||
assert(j = 1);
|
||||
end.
|
||||
|
|
@ -20424,7 +20424,16 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
public override void visit(SyntaxTree.template_type_name node)
|
||||
{
|
||||
throw new NotSupportedError(get_location(node));
|
||||
//throw new NotSupportedError(get_location(node));
|
||||
ident_with_templateparams id = new ident_with_templateparams();
|
||||
if (node.name.IndexOf('`') != -1 )
|
||||
id.name = new ident(node.name.Substring(0, node.name.IndexOf('`')), node.source_context);
|
||||
else
|
||||
id.name = new ident(node.name, node.source_context);
|
||||
id.template_params = new template_param_list();
|
||||
for (int i = 0; i < node.template_args.Count; i++)
|
||||
id.template_params.Add(new named_type_reference(node.template_args[0] as SyntaxTree.ident, node.template_args[i].source_context));
|
||||
id.visit(this);
|
||||
}
|
||||
|
||||
public override void visit(SyntaxTree.default_operator _default_operator)
|
||||
|
|
|
|||
Loading…
Reference in a new issue