From cb2cca006ac7b4a3b4ef62fb353df262d7af68d2 Mon Sep 17 00:00:00 2001 From: Jeremiah Leary Date: Thu, 1 Dec 2022 06:03:11 -0600 Subject: [PATCH] #892 (#893): VSG would crash if code after last ) in array assignment * Issue #892: VSG would crash if code after last ) in array assignment was on a different line. * Refactoring to improve readability. --- vsg/rules/multiline_array_alignment.py | 3 ++- vsg/tests/sequential/rule_402_test_input.fixed.vhd | 7 +++++++ vsg/tests/sequential/rule_402_test_input.vhd | 7 +++++++ vsg/tests/sequential/test_rule_402.py | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/vsg/rules/multiline_array_alignment.py b/vsg/rules/multiline_array_alignment.py index 7094279d..8113ed8a 100644 --- a/vsg/rules/multiline_array_alignment.py +++ b/vsg/rules/multiline_array_alignment.py @@ -159,7 +159,8 @@ def check_last_line(oLine, oLines, iIndentStep): def check_middle_line(oLine, oLines, iIndentStep): set_expected_indent_of_line(oLine, oLines, iIndentStep) oLines.update_parens(oLine, iIndentStep) - oLines.iNextIndent = oLines.lParens[-1].iExpectedColumn + if not oLines.no_parens(): + oLines.iNextIndent = oLines.lParens[-1].iExpectedColumn def set_expected_indent_of_line(oLine, oLines, iIndentStep): diff --git a/vsg/tests/sequential/rule_402_test_input.fixed.vhd b/vsg/tests/sequential/rule_402_test_input.fixed.vhd index a88344d8..ef003ab8 100644 --- a/vsg/tests/sequential/rule_402_test_input.fixed.vhd +++ b/vsg/tests/sequential/rule_402_test_input.fixed.vhd @@ -19,6 +19,13 @@ begin cnt_out => "00") ); + rd_data <= + ( + others => '0' + ) + after 4 ns + ; + end process; end architecture rtl; diff --git a/vsg/tests/sequential/rule_402_test_input.vhd b/vsg/tests/sequential/rule_402_test_input.vhd index f7e671f4..0ef71680 100644 --- a/vsg/tests/sequential/rule_402_test_input.vhd +++ b/vsg/tests/sequential/rule_402_test_input.vhd @@ -19,6 +19,13 @@ rst_in => "00", cnt_out => "00") ); + rd_data <= + ( + others => '0' + ) + after 4 ns + ; + end process; end architecture rtl; diff --git a/vsg/tests/sequential/test_rule_402.py b/vsg/tests/sequential/test_rule_402.py index 8f8a6504..d4a02125 100644 --- a/vsg/tests/sequential/test_rule_402.py +++ b/vsg/tests/sequential/test_rule_402.py @@ -28,7 +28,7 @@ class test_sequential_rule(unittest.TestCase): self.assertEqual(oRule.identifier, '402') self.assertEqual(oRule.groups, ['alignment']) - lExpected = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] + lExpected = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))