This commit is contained in:
Бондарев Иван 2017-08-26 15:01:25 +02:00
parent aaebcf48c9
commit 5f28848d1f
2 changed files with 16 additions and 1 deletions

View file

@ -2351,7 +2351,7 @@ namespace PascalABCCompiler.NETGenerator
funcs.Add(func); //здесь наверное дублирование
MethodBuilder tmp = cur_meth;
cur_meth = methb;
ConvertCommonFunctionConstantDefinitions(func.constants);
//если функция не содержит вложенных процедур, то
//переводим переменные как локальные
if (func.functions_nodes.Length > 0)
@ -2413,6 +2413,7 @@ namespace PascalABCCompiler.NETGenerator
il = cur_meth.GetILGenerator();
smi.Push(mi);
funcs.Add(func);
ConvertCommonFunctionConstantDefinitions(func.constants);
if (func.functions_nodes.Length == 0)
ConvertLocalVariables(func.var_definition_nodes);

14
TestSuite/const3.pas Normal file
View file

@ -0,0 +1,14 @@
const
h = Round(1.3);
h2 = h;
procedure Test;
const dh = h;
begin
assert(dh = 1);
end;
begin
Test;
assert(h2 = h);
end.