-
Notifications
You must be signed in to change notification settings - Fork 154
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 a number of errors in loops #308
Open
Mingun
wants to merge
17
commits into
kaitai-io:master
Choose a base branch
from
Mingun:loops
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… special variables in expressions
… `SwitchIfOps.switchCases` PerlCompiler implements SwitchIfOps so this call already was performed
…et in `CommonReads.attrParse0`
…d here If that not the case, then a bug in compiler is present. Exception is better rather than generating incorrect code
…e it only can be used We do not want that type validation calculate type of actually undefined variable
Previous behavior (everything with 1 in last column was fixed): |Language|Initial|Incremented|`_index` of first iteration |--------|-------|-----------|--------------------------- |C++ |0 |before |1 |C# |0 |before |1 |Go |1 |after |1 |Java |0 |before |1 |JS |0 |before |1 |Lua |0 |after |0 |Nim |0? |after |0 (variable declared without initializer) |Perl |- |- |- (variable was not declared) |PHP |0 |before |1 |Python |0 |after |0 |Ruby |0 |before |1 |Rust |0 |before |1 Fixes kaitai-io/kaitai_struct#958
…ndRepeatExprHeader` and `condRepeatExprFooter`
…_io` is redefined
…dRepeatEosHeader` and `condRepeatEosFooter`
Thank you for fixing this and closing the PR. I apologize for not following up on my PR last year. I'm happy we have this consistent behavior across languages. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR the result of revision of how generation of repeated attributes is implemented due to which a number of bugs was found and fixed:
TypeValidator
incorrectly define_
variable for all kinds of loops, but it is generated only forrepeat-until
loopsrepeat-expr
loops on each iteration, whereas other languages performs such calculations only once. Now they are also calculate count only once_index
variable inrepeat: eos
loopsio: ...
is usedThis PR supersedes #234
Also, some refactoring was done: removed unused parameters and documented methods that generates loops.
Besides,
_currentIteratorType
was renamed to_lastParsedType
(this is the variable that holds type of the_
variable in expression language) because it is used also invalid: expr
key to refer to the element that just was parsed.