This commit is contained in:
Бондарев Иван 2020-02-09 12:58:12 +01:00
parent 536e62e369
commit 8903c838c7
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,15 @@
procedure test;
begin
var o: (a, b) := a;
assert(o = a);
var p: ()->() := ()->exit();
end;
begin
var o: (a, b) := a;
assert(o = a);
var p: ()->() := ()->begin o := b end;
p;
assert(o = b);
test;
end.

View file

@ -3422,9 +3422,20 @@ namespace PascalABCCompiler.TreeConverter
var si = context.CurrentScope.Find(id.name);
if ((si==null) || !(si.FirstOrDefault().sym_info is type_node))
{
if (si != null && si.FirstOrDefault().sym_info is constant_definition_node)
{
constant_definition_node ncd = si.FirstOrDefault().sym_info as constant_definition_node;
if (_enum_type_definition.source_context != null && ncd.type.location != null && ncd.type.location.begin_line_num == _enum_type_definition.source_context.begin_position.line_num
&& ncd.type.location.begin_column_num == _enum_type_definition.source_context.begin_position.column_num && ncd.type.location.doc.file_name == _enum_type_definition.source_context.FileName)
{
return_value(ncd.type);
return;
}
}
is_enum = true;
break;
}
}
if (!is_enum) // Значит, это определение типа