This commit is contained in:
parent
28b1a4917b
commit
acaff327bc
10
TestSuite/delegates21.pas
Normal file
10
TestSuite/delegates21.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
procedure pr1(act: (array of integer)-> ());
|
||||||
|
begin
|
||||||
|
act(Arr(1,2,3));
|
||||||
|
end;
|
||||||
|
var l: integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
pr1(x-> begin l := x.Length end);
|
||||||
|
assert(l = 3);
|
||||||
|
end.
|
||||||
|
|
@ -21055,14 +21055,14 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (_modern_proc_type.el != null)
|
if (_modern_proc_type.el != null)
|
||||||
{
|
{
|
||||||
var en = _modern_proc_type.el;
|
var en = _modern_proc_type.el;
|
||||||
if (en.enumerators.Count == 1)
|
//if (en.enumerators.Count == 1)
|
||||||
AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
|
// AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
|
||||||
for (int i = 0; i < en.enumerators.Count; i++)
|
for (int i = 0; i < en.enumerators.Count; i++)
|
||||||
{
|
{
|
||||||
if (en.enumerators[i].value != null)
|
if (en.enumerators[i].value != null)
|
||||||
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
||||||
|
|
||||||
if (!(en.enumerators[i].name is named_type_reference))
|
if (!(en.enumerators[i].name is named_type_reference) && !(en.enumerators[i].name is array_type))
|
||||||
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
||||||
|
|
||||||
t.Add(en.enumerators[i].name); // ???????????????
|
t.Add(en.enumerators[i].name); // ???????????????
|
||||||
|
|
@ -21084,15 +21084,15 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (_modern_proc_type.el != null)
|
if (_modern_proc_type.el != null)
|
||||||
{
|
{
|
||||||
var en = _modern_proc_type.el;
|
var en = _modern_proc_type.el;
|
||||||
if (en.enumerators.Count == 1)
|
//if (en.enumerators.Count == 1)
|
||||||
AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
|
// AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
|
||||||
for (int i = 0; i < en.enumerators.Count; i++)
|
for (int i = 0; i < en.enumerators.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (en.enumerators[i].value != null)
|
if (en.enumerators[i].value != null)
|
||||||
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
||||||
|
|
||||||
if (!(en.enumerators[i].name is named_type_reference))
|
if (!(en.enumerators[i].name is named_type_reference) && !(en.enumerators[i].name is array_type))
|
||||||
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
|
||||||
|
|
||||||
t.Add(en.enumerators[i].name);
|
t.Add(en.enumerators[i].name);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue