Whole file

terryyin/lizard

The author described this change as Fix error function statistic in some scenario. It counts as a record because the checks below fail on the code as it stood at 09a677e73 and pass on 3d993e1fc, with nothing else changed between the two runs.

Fix saved2022-04-14
Sharing licenceMIT · LICENSE.txt
Change size+7 2

What the code was meant to do, written into the code itself as a save note

Fix error function statistic in some scenario

The change

2121 def _function_name(self, token):
2222 if token != '`':
2323 if token == '(':
24- return self.next(self._member_function, token)
24+ if len(self.context.stacked_functions) > 0\
25+ and self.context.stacked_functions[-1].name != '*global*':
26+ return self.next(self._function_dec, token)
27+ else:
28+ return self.next(self._member_function, token)
2529 if token == '{':
2630 return self.next(self._expect_function_impl, token)
2731 self.context.add_to_function_name(token)
4953 self.context.parameter(token)
5054
5155 def _expect_function_impl(self, token):
52- self.next_if(self._function_impl, token, '{')
56+ if token == '{' and self.last_token != 'interface':
57+ self.next(self._function_impl, token)
5358
5459 def _function_impl(self, _):
5560 def callback():

The check that tells the two apart

failpass·test/test_languages/testGo.py::Test_parser_for_Go::test_nest_function
failpass·test/test_languages/testGo.py::Test_parser_for_Go::test_one_function_with_return_empty_interface

Check file test/test_languages/testGo.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it09a677e732067daaa0cd3a89ffc26885cd86974e
Broken version dated2022-04-04
Modulelizard_languages.golike
Units changedGoLikeStates
Fingerprintd0917c3568a099cf
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in terryyin/lizard