From a1d918769ae4b499e627c1f9cfb8364d15cf0a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Sun, 26 Jan 2020 14:15:16 +0100 Subject: [PATCH] fix pascalabcnet/pascalabcnetide#175 --- NETGenerator/NETGenerator.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index dafca2091..54d362ff4 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -144,6 +144,7 @@ namespace PascalABCCompiler.NETGenerator protected bool is_constructor = false;//флаг, переводим ли мы конструктор protected bool init_call_awaited = false; protected bool save_debug_info = false; + protected ILocation next_location; protected bool add_special_debug_variables = false; protected bool make_next_spoint = true; protected SemanticTree.ILocation EntryPointLocation; @@ -5613,9 +5614,13 @@ namespace PascalABCCompiler.NETGenerator il.Emit(OpCodes.Nop); return; } - + next_location = null; for (int i = 0; i < statements.Length - 1; i++) { + if (i < statements.Length - 2) + next_location = statements[i + 1].Location; + else + next_location = value.RightLogicalBracketLocation; ConvertStatement(statements[i]); } @@ -5624,7 +5629,7 @@ namespace PascalABCCompiler.NETGenerator //если return не имеет location то метим точку на месте закрывающей логической скобки if (statements[statements.Length - 1].Location == null) MarkSequencePoint(value.RightLogicalBracketLocation); - + next_location = value.RightLogicalBracketLocation; ConvertStatement(statements[statements.Length - 1]); //TODO: переделать. сдель функцию которая ложет ret и MarkSequencePoint @@ -5905,6 +5910,8 @@ namespace PascalABCCompiler.NETGenerator ConvertStatement(value.then_body); il.Emit(OpCodes.Br, EndLabel); + if (value.else_body == null && next_location != null) + il.MarkSequencePoint(doc, next_location.begin_line_num, 1, next_location.begin_line_num, next_location.begin_column_num); il.MarkLabel(FalseLabel); if (value.else_body != null) ConvertStatement(value.else_body);