Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nested conditional preprocessors #66

Merged
merged 1 commit into from Aug 15, 2019
Merged

Conversation

pocke
Copy link
Member

@pocke pocke commented Aug 14, 2019

#@sinceなどのpreprocessorがネストした時に条件文の評価結果がおかしくなってしまっていたので修正します。

Problem

State#processing?で1つ前までの条件しか見ていなかったために、条件が3つ以上重なると最初の条件が見られなくなってしまっていました。
これにより、例えばバージョンが2.4.0のときに次のようなコードの#@until 2.4.0が無視されて、Not display here!が評価されてしまいます。

#@until 2.4.0
#@since 1.8.7
#@since 1.9.3
Not display here!
#@end
#@end
#@end

実際にこれと同じような現象がるりまの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 この辺のコードを参考にしています。

@okkez
Copy link
Member

okkez commented Aug 15, 2019

Thanks!

@pocke pocke deleted the nest-cond-preprop branch August 15, 2019 05:13
@sho-h sho-h added 1.2.2 1.2.2でリリース予定 bug labels Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.2.2 1.2.2でリリース予定 bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants