test with nest union

This commit is contained in:
Rongsong Shen 2025-05-08 09:42:09 +08:00
parent dd65178724
commit 6c0fbc4bbd
3 changed files with 51 additions and 25 deletions

View file

@ -20,6 +20,13 @@ struct Nulldata $C.mapname("nulldata_t") {
null @0: UInt32 $C.mapname("null_");
}
struct Buy $C.mapname("buy_t") {
from @0: Text;
u :union $C.mapname("u") $C.mapuniontag("with_recipe") {
norecipe @1: Void;
recipeAddr @2: Text $C.mapname("recipe_addr");
}
}
struct Book $C.mapname("book_t") {
title @0: Text;
authors @1: List(Text) $C.mapname("authors") $C.maplistcount("n_authors");
@ -29,7 +36,7 @@ struct Book $C.mapname("book_t") {
magic1 @2: List(UInt32) $C.mapname("magic_1") $C.maplistcount("n_magic1");
description @8: Text;
acquire :union $C.mapuniontag("acquire_method") {
buy @3: Text;
buy @3: Buy;
donation @4: Text;
}
}