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

Compiler does not check field dependencies in expressions #926

Closed
Mingun opened this issue Nov 21, 2021 · 1 comment
Closed

Compiler does not check field dependencies in expressions #926

Mingun opened this issue Nov 21, 2021 · 1 comment

Comments

@Mingun
Copy link

Mingun commented Nov 21, 2021

You can write an expression that will refer to fields parsed after the field which you try to parse:

meta:
  id: dependencies_bug
seq:
  - id: value
    size: after
  - id: after
    type: u1

compiled successfully in both development and released WebIDE.

This check could be more tricky because compiler should also detect indirect dependencies and prohibit them:

meta:
  id: indirect_dependencies_bug
params:
  - id: direct_size
    type: bool
seq:
  - id: value
    size: instance
  - id: after
    type: u1
instances:
  instance:
    value: 'direct_size ? 2 : after'

At the same time, I would like this to be allowed:

meta:
  id: indirect_dependencies_allowed
params:
  - id: direct_size
    type: bool
seq:
  - id: value
    size: 'direct_size ? instance : 3'
  - id: after
    type: u1
instances:
  instance:
    value: 'direct_size ? 2 : after'
@generalmimon
Copy link
Member

Duplicate of #469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants