kaitai_struct_compiler icon indicating copy to clipboard operation
kaitai_struct_compiler copied to clipboard

Improvements and bug fixes for sizeof calculator

Open Mingun opened this issue 2 years ago • 2 comments

This PR improves situation with _sizeof / sizeof<>:

  • switch-on types with the same size in all arms now correctly have the constant size
  • if keys now correctly influence to class / attribute sizeof (probably this will fix https://github.com/kaitai-io/kaitai_struct/issues/927)
  • as a side effect, improvements in the constant evaluator of boolean values
  • add tests for boolean constant evaluator
  • add tests for sizeof calculator
  • forbid explicit negative repetition number in the repeat-expr key
  • forbid explicit repeat-until: <falsy value> because that will lead to an infinity cycle

This PR is based on the #225 because the last commit (f6238c0d943325c3a5e81c9523ba1a214318981a) from that PR is needed for correct switch-on size calculations

Also this PR fixes the expr_sizeof_value_dynamic3.ksy test -- corresponding PR to the tests repository: https://github.com/kaitai-io/kaitai_struct_tests/pull/95. Also, this test was mentioned in the https://github.com/kaitai-io/kaitai_struct/issues/721

Mingun avatar Dec 05 '21 20:12 Mingun

@generalmimon , I see that you've started to merge some PRs and close issues. Could you look at my PRs? This one is a good candidate to start. List of all my PRs: https://github.com/pulls?page=1&q=is%3Aopen+is%3Apr+author%3AMingun+archived%3Afalse+org%3Akaitai-io

Mingun avatar Jun 24 '22 16:06 Mingun

@GreyCat, @generalmimon, I see that you have some activity in the project recently. Could you find a time to review my PRs, for example, this?

Mingun avatar Mar 07 '24 15:03 Mingun