mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 06:30:54 +00:00
Fix C# vector of enum code generation
Fixes a bug where the logic to determine when to use a C# enum flags both enums and vectors of enums. This causes the C# generator to generate code that doesn't compile for tables that contain vectors of enums. The fix also consolidates type generation functions a bit and adds some additional casting functions for clarity.
This commit is contained in:
@@ -17,12 +17,12 @@ public sealed class Stat : Table {
|
||||
public bool MutateCount(ushort count) { int o = __offset(8); if (o != 0) { bb.PutUshort(o + bb_pos, count); return true; } else { return false; } }
|
||||
|
||||
public static Offset<Stat> CreateStat(FlatBufferBuilder builder,
|
||||
StringOffset id = default(StringOffset),
|
||||
StringOffset idOffset = default(StringOffset),
|
||||
long val = 0,
|
||||
ushort count = 0) {
|
||||
builder.StartObject(3);
|
||||
Stat.AddVal(builder, val);
|
||||
Stat.AddId(builder, id);
|
||||
Stat.AddId(builder, idOffset);
|
||||
Stat.AddCount(builder, count);
|
||||
return Stat.EndStat(builder);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user