fix #1734
This commit is contained in:
parent
bfc6ac8a84
commit
981f01bdc3
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);*/
|
||||
|
||||
// Теперь на месте функции генерируем класс
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue