syntax = "proto3"; package wasm.ast; message Type { oneof type { TypePrimitive primitive = 1; TypeList list = 2; TypeTuple tuple = 3; TypeRecord record = 5; TypeFlags flags = 6; TypeEnum enum = 7; TypeOption option = 8; TypeResult result = 9; TypeVariant variant = 10; TypeHandle handle = 11; } } message TypePrimitive { PrimitiveType primitive = 1; } message TypeList { Type elem = 1; } message TypeTuple { repeated Type elems = 1; } message TypeRecord { repeated NameTypePair fields = 1; } message TypeFlags { repeated string names = 1; } message TypeEnum { repeated string names = 1; } message TypeOption { Type elem = 1; } message TypeResult { optional Type ok = 1; optional Type err = 2; } message TypeVariant { repeated NameOptionTypePair cases = 1; } message TypeHandle { uint64 resource_id = 1; ResourceMode mode = 2; } message NameTypePair { string name = 1; Type typ = 2; } message NameOptionTypePair { string name = 1; optional Type typ = 2; } enum PrimitiveType { BOOL = 0; S8 = 1; U8 = 2; S16 = 3; U16 = 4; S32 = 5; U32 = 6; S64 = 7; U64 = 8; F32 = 9; F64 = 10; CHR = 11; STR = 12; } enum ResourceMode { BORROWED = 0; OWNED = 1; }