bug fix #2024
This commit is contained in:
parent
3e818b7aec
commit
b895f2823c
12
TestSuite/namespaces/nsyield1.pas
Normal file
12
TestSuite/namespaces/nsyield1.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
namespace nsyield1;
|
||||||
|
|
||||||
|
type
|
||||||
|
T1 = class
|
||||||
|
public static function Seq(): sequence of integer;
|
||||||
|
begin
|
||||||
|
yield 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
||||||
7
TestSuite/use_ns_yield1.pas
Normal file
7
TestSuite/use_ns_yield1.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
//nopabcrtl
|
||||||
|
{$includenamespace 'namespaces/nsyield1.pas'}
|
||||||
|
|
||||||
|
uses nsyield1;
|
||||||
|
begin
|
||||||
|
assert(T1.Seq().ToArray()[0] = 1);
|
||||||
|
end.
|
||||||
|
|
@ -10991,6 +10991,10 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (decl is procedure_definition && get_location(decl) == null)
|
||||||
|
{
|
||||||
|
//yield
|
||||||
|
}
|
||||||
else
|
else
|
||||||
AddError(get_location(decl), "NAMESPACE_SHOULD_CONTAINS_ONLY_TYPES");
|
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();
|
context.leave_scope();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue