From 920d6cf0706fbb5dc7f03fb48b0f9b9883b479cd Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 22 Mar 2026 12:54:32 +0000 Subject: Wrap unions in tables --- flatbuffers/patio.fbs | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'flatbuffers') diff --git a/flatbuffers/patio.fbs b/flatbuffers/patio.fbs index e002b5be..266b12ef 100644 --- a/flatbuffers/patio.fbs +++ b/flatbuffers/patio.fbs @@ -4,7 +4,7 @@ namespace Patio; // == Data layouts == -union PatioDataLayout { +union PatioDataLayoutValue { PatioDataLayoutArray, PatioDataLayoutBool, PatioDataLayoutByte, @@ -15,6 +15,10 @@ union PatioDataLayout { PatioDataLayoutStruct, } +table PatioDataLayout { + value:PatioDataLayoutValue (required); +} + table PatioDataLayoutArray { element:PatioDataLayout; size:uint; @@ -62,12 +66,16 @@ table PatioDataPtrValueNull { // == Int values == -union PatioIntValue { +union PatioIntValueValue { PatioIntValueByteOffsetOf, PatioIntValueByteSizeOf, PatioIntValueLiteral, } +table PatioIntValue { + value:PatioIntValueValue (required); +} + table PatioIntValueByteOffsetOf { layout:PatioDataLayout; offset:[uint]; @@ -83,7 +91,7 @@ table PatioIntValueLiteral { // == Data values == -union PatioDataValue { +union PatioDataValueValue { PatioDataValueArray, PatioDataValueBool, PatioDataValueByte, @@ -93,6 +101,10 @@ union PatioDataValue { PatioDataValueStruct, } +table PatioDataValue { + value:PatioDataValueValue (required); +} + table PatioDataValueArray { element_layout:PatioDataLayout; elements:[PatioDataValue]; @@ -124,7 +136,7 @@ table PatioDataValueStruct { // == Types == -union PatioType { +union PatioTypeValue { PatioBoolType, PatioByteType, PatioDataPtrType, @@ -134,6 +146,10 @@ union PatioType { PatioVoidType, } +table PatioType { + value:PatioType (required); +} + table PatioBoolType { } @@ -157,7 +173,7 @@ table PatioVoidType { // == Operands == -union PatioOperand { +union PatioOperandValue { PatioBoolConst, PatioByteConst, PatioDataPtrConst, @@ -167,6 +183,10 @@ union PatioOperand { PatioLocalRef, } +table PatioOperand { + value:PatioOperandValue (required); +} + table PatioBoolConst { value:bool; } @@ -197,7 +217,7 @@ table PatioLocalRef { // == Instructions == -union PatioInstruction { +union PatioInstructionValue { PatioBlock, PatioBoolToInt, PatioCall, @@ -227,6 +247,10 @@ union PatioInstruction { PatioVarStore, } +table PatioInstruction { + value:PatioInstructionValue (required); +} + table PatioBlock { source:Sources.Source; body:[PatioInstruction]; @@ -429,7 +453,7 @@ table PatioLocal { // == Compilation unit elements == -union PatioCompilationUnitElement { +union PatioCompilationUnitElementValue { PatioDataElementImmutableDefinition, PatioDataElementMutableDeclaration, PatioDataElementMutableDefinition, @@ -438,6 +462,10 @@ union PatioCompilationUnitElement { PatioFunctionDefinition, } +table PatioCompilationUnitElement { + value:PatioCompilationUnitElementValue (required); +} + table PatioDataElementImmutableDefinition { source:Sources.Source; name:string; -- cgit v1.2.3