terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

Fix handling of braceless consecutive NS structures #174

Closed rakhimov closed 7 years ago

rakhimov commented 7 years ago

The nesting structure extension is running before the assignment of the nesting level for tokens. The solution is to increment the nesting level right at the end of control-flow structure declaration but before its body.

In addition, the token is yielded before being processed by the NS extension to simulate running the extension after the code reader, but this is somewhat hacky.

This bug (surprisingly) has been a feature! The fix broke the gotcha braceless nested if-then-else structures. As a result, separate handling of these "paired" structures is implemented.

Fixes #157.


This change is Reviewable