Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 1a7675d6 authored by Martin Geisler's avatar Martin Geisler
Browse files

pdl: Add support for constraints in grand children

Before, we assumed that we could fully parse a packet based on the
not-yet-parsed bytes from the parent packet. However, this assumption
is wrong when child packets are constrained by fields in the (grand)
parent packets:

    packet Parent {
      a: 8,
      b: 8,
      c: 8,
    }
    packet Child: Parent(a = 10) {
      x: 8,
    }
    packet GrandChild: Child(b = 20) {
      y: 8,
    }
    packet GrandGrandChild: GrandChild(c = 30) {
      z: 8,
    }

Here, we need to pass down the values of b and c when constructing a
Child packet since b will be used to specialize into a GrandChild
packet. Similarly, we need to pass c into GrandChild so that we can
determine if we’re dealing with a GrandGranChild packet.

Test: atest pdl_tests pdl_rust_generator_tests_{le,be}
Change-Id: Iffffdca4b3601f46d3d13bae61490d1e0b60d8ae
parent 036ad48e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment