This commit is contained in:
Mikhalkovich Stanislav 2019-02-14 00:10:32 +03:00
parent bfc6ac8a84
commit 981f01bdc3
2 changed files with 9 additions and 2 deletions

View file

@ -151,6 +151,13 @@ namespace SyntaxVisitors
var fh = (pd.proc_header as function_header);
if (fh == null)
throw new SyntaxVisitorError("ONLY_FUNCTIONS_CAN_CONTAIN_YIELDS", pd.proc_header.source_context);
var ttr = fh.return_type as template_type_reference;
if (ttr.name.names.Count == 1 && ttr.name.names[0].name.ToLower() == "ienumerable")
fh.return_type = new sequence_type(ttr.params_list.params_list[0]);
else if (ttr.name.names.Count == 4 && ttr.name.names[0].name.ToLower() == "system" && ttr.name.names[1].name.ToLower() == "collections" && ttr.name.names[2].name.ToLower() == "generic" && ttr.name.names[3].name.ToLower() == "ienumerable")
fh.return_type = new sequence_type(ttr.params_list.params_list[0]);
var seqt = fh.return_type as sequence_type;
if (seqt == null)
throw new SyntaxVisitorError("YIELD_FUNC_MUST_RETURN_SEQUENCE", fh.source_context);

View file

@ -96,8 +96,8 @@ namespace SyntaxVisitors
if (fh == null)
throw new SyntaxError("Only functions can contain yields", "", pd.proc_header.source_context, pd.proc_header);
var seqt = fh.return_type as sequence_type;
if (seqt == null)
throw new SyntaxError("Functions with yields must return sequences", "", fh.return_type.source_context, fh.return_type);
/*if (seqt == null)
throw new SyntaxError("Functions with yields must return sequences", "", fh.return_type.source_context, fh.return_type);*/
// Теперь на месте функции генерируем класс