Fix nested conditional preprocessors #66
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#@since
などのpreprocessorがネストした時に条件文の評価結果がおかしくなってしまっていたので修正します。Problem
State#processing?
で1つ前までの条件しか見ていなかったために、条件が3つ以上重なると最初の条件が見られなくなってしまっていました。これにより、例えばバージョンが2.4.0のときに次のようなコードの
#@until 2.4.0
が無視されて、Not display here!
が評価されてしまいます。実際にこれと同じような現象がるりまの
LIBRARIES
ファイルのtkライブラリについて起きていました。https://github.com/rurema/doctree/blob/95032ee45837734b0f3a1f8e59f45dec6c17e11e/refm/api/src/LIBRARIES#L656
656行目で
#@until 2.4.0
、679行目で#@since 1.8.2
、762行目で#@since 1.8.4
が始まっていて、ネストしているため、最初の#@until 2.4.0
が無視されていました。これは
#@since 1.8.x
を消すなかで差分の確認をしていたら、何故かいじっていないはずのtkライブラリの差分が出ていて気が付きました。Solution
#32 の以前はstateは
前のstate && 次のstate
を取っていたようなので、それと同じような挙動をするように修正しました。https://github.com/rurema/bitclust/pull/32/files#diff-4d60bb90db26cd19051f3a8699ec0437L154 この辺のコードを参考にしています。