Case macro for the different kinds of vl-expr structures.
This is an fty sum-type case macro, typically introduced by defflexsum or deftagsum. It allows you to safely check the type of a vl-expr structure, or to split into cases based on its type.
In its short form,
(vl-expr-case x :vl-literal)
is essentially just a safer alternative to writing:
(equal (vl-expr-kind x) :vl-literal)
Why is using vl-expr-case safer? When we directly inspect the
kind with
In its longer form,
(vl-expr-case x :vl-literal ... :vl-index ... :vl-unary ... :vl-binary ... :vl-qmark ... :vl-concat ... :vl-multiconcat ... :vl-bitselect-expr ... :vl-partselect-expr ... :vl-mintypmax ... :vl-call ... :vl-stream ... :vl-cast ... :vl-inside ... :vl-tagged ... :vl-pattern ... :vl-special ... :vl-eventexpr ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of