diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-01-17 13:16:29 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-02-19 11:54:01 +0000 |
| commit | 8cb16e665dbb5f87aa58856049c1ad6067dc6293 (patch) | |
| tree | cb8eacf9619ce1ea3df3aa5891cf6ab44ebf83b8 /pkg | |
| parent | 0936819b9f980bde731cb6191677f9aa2cbfd9aa (diff) | |
prog: handle multiple matching union fields
If conditions of several union fields are satisfied, select one
randomly. This would be a more logical semantics.
When conditional struct fields are translated to unions, negate the
condition for the union alternative.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/compiler/gen.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/compiler/gen.go b/pkg/compiler/gen.go index d274877a2..f91e2502c 100644 --- a/pkg/compiler/gen.go +++ b/pkg/compiler/gen.go @@ -556,6 +556,11 @@ func (comp *compiler) wrapConditionalField(name string, field prog.Field) prog.F { Name: "void", Type: voidType, + Condition: &prog.BinaryExpression{ + Operator: prog.OperatorCompareEq, + Left: newCondition, + Right: &prog.Value{Value: 0x0, Path: nil}, + }, }, }, }, |
