bug fix #592
This commit is contained in:
parent
4a9f3171bd
commit
6e177e0c90
19
TestSuite/lambdas5.pas
Normal file
19
TestSuite/lambdas5.pas
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
type
|
||||||
|
t1=class
|
||||||
|
|
||||||
|
function f1(aX,aY:Single):=byte(2);
|
||||||
|
|
||||||
|
constructor;
|
||||||
|
begin
|
||||||
|
|
||||||
|
var MAng := 0;
|
||||||
|
var NP2 := new byte[1];
|
||||||
|
NP2.Fill(i->self.f1(i,MAng));
|
||||||
|
assert(NP2[0] = 2);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
new t1;
|
||||||
|
end.
|
||||||
|
|
@ -287,7 +287,8 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (lst.statements[0] is basic_function_call)
|
if (lst.statements[0] is basic_function_call)
|
||||||
{
|
{
|
||||||
base_function_call bfc = lst.statements[0] as basic_function_call;
|
base_function_call bfc = lst.statements[0] as basic_function_call;
|
||||||
|
if (bfc.type != null && bfc.type.name.Contains("<>local_variables_class"))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16662,17 +16662,27 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
statements_list stl = new statements_list(get_location(_statement_list), get_location_with_check(_statement_list.left_logical_bracket), get_location_with_check(_statement_list.right_logical_bracket));
|
statements_list stl = new statements_list(get_location(_statement_list), get_location_with_check(_statement_list.left_logical_bracket), get_location_with_check(_statement_list.right_logical_bracket));
|
||||||
convertion_data_and_alghoritms.statement_list_stack_push(stl);
|
convertion_data_and_alghoritms.statement_list_stack_push(stl);
|
||||||
|
|
||||||
for (var i=0; i< _statement_list.subnodes.Count; i++) // SSM 13.10.16 - поменял т.к. собираюсь менять узлы в процессе обхода
|
for (var i = 0; i < _statement_list.subnodes.Count; i++) // SSM 13.10.16 - поменял т.к. собираюсь менять узлы в процессе обхода
|
||||||
{
|
{
|
||||||
statement syntax_statement = _statement_list.subnodes[i];
|
statement syntax_statement = _statement_list.subnodes[i];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
statement_node semantic_statement = convert_strong(syntax_statement);
|
statement_node semantic_statement = convert_strong(syntax_statement);
|
||||||
|
bool lambda_init_code = false;
|
||||||
|
if (semantic_statement is basic_function_call)
|
||||||
|
{
|
||||||
|
base_function_call bfc = semantic_statement as basic_function_call;
|
||||||
|
if (bfc.type != null && bfc.type.name.Contains("<>local_variables_class"))
|
||||||
|
lambda_init_code = true;
|
||||||
|
}
|
||||||
if (semantic_statement != null)
|
if (semantic_statement != null)
|
||||||
{
|
{
|
||||||
|
if (context.allow_inherited_ctor_call && !lambda_init_code)
|
||||||
|
stl.statements.AddElementFirst(semantic_statement);
|
||||||
|
else
|
||||||
stl.statements.AddElement(semantic_statement);
|
stl.statements.AddElement(semantic_statement);
|
||||||
}
|
}
|
||||||
|
if (!lambda_init_code)
|
||||||
context.allow_inherited_ctor_call = false;
|
context.allow_inherited_ctor_call = false;
|
||||||
}
|
}
|
||||||
catch (Errors.Error ex)
|
catch (Errors.Error ex)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue