mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 20:31:23 +00:00
Fix for build break in c# vector of unions (#5271)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
5cdbd02404
commit
2d67de3151
@@ -1044,7 +1044,7 @@ class GeneralGenerator : public BaseGenerator {
|
||||
: lang_.accessor_prefix + "__indirect(" + index + ")";
|
||||
code += ", " + lang_.accessor_prefix + "bb";
|
||||
} else if (vectortype.base_type == BASE_TYPE_UNION) {
|
||||
code += index + " - bb_pos";
|
||||
code += index + " - " + lang_.accessor_prefix + "bb_pos";
|
||||
} else {
|
||||
code += index;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ set -e
|
||||
|
||||
../flatc --cpp --java --csharp --dart --go --binary --lobster --lua --python --js --ts --php --rust --grpc --gen-mutable --reflect-names --gen-object-api --gen-compare --no-includes --cpp-ptr-type flatbuffers::unique_ptr --no-fb-import -I include_test monster_test.fbs monsterdata_test.json
|
||||
../flatc --cpp --java --csharp --dart --go --binary --lobster --lua --python --js --ts --php --rust --gen-mutable --reflect-names --no-fb-import --cpp-ptr-type flatbuffers::unique_ptr -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
|
||||
../flatc --cpp --java --js --ts --php --gen-mutable --reflect-names --gen-object-api --gen-compare --cpp-ptr-type flatbuffers::unique_ptr -o union_vector ./union_vector/union_vector.fbs
|
||||
../flatc --cpp --java --csharp --js --ts --php --gen-mutable --reflect-names --gen-object-api --gen-compare --cpp-ptr-type flatbuffers::unique_ptr -o union_vector ./union_vector/union_vector.fbs
|
||||
../flatc -b --schema --bfbs-comments --bfbs-builtins -I include_test monster_test.fbs
|
||||
../flatc --jsonschema --schema -I include_test monster_test.fbs
|
||||
../flatc --cpp --java --csharp --python --gen-mutable --reflect-names --gen-object-api --gen-compare --no-includes monster_extra.fbs || goto FAIL
|
||||
|
||||
@@ -15,6 +15,7 @@ public struct Attacker : IFlatbufferObject
|
||||
public Attacker __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int SwordAttackDamage { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||
public bool MutateSwordAttackDamage(int sword_attack_damage) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, sword_attack_damage); return true; } else { return false; } }
|
||||
|
||||
public static Offset<Attacker> CreateAttacker(FlatBufferBuilder builder,
|
||||
int sword_attack_damage = 0) {
|
||||
|
||||
@@ -13,6 +13,7 @@ public struct BookReader : IFlatbufferObject
|
||||
public BookReader __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int BooksRead { get { return __p.bb.GetInt(__p.bb_pos + 0); } }
|
||||
public void MutateBooksRead(int books_read) { __p.bb.PutInt(__p.bb_pos + 0, books_read); }
|
||||
|
||||
public static Offset<BookReader> CreateBookReader(FlatBufferBuilder builder, int BooksRead) {
|
||||
builder.Prep(4, 4);
|
||||
|
||||
@@ -16,6 +16,7 @@ public struct Movie : IFlatbufferObject
|
||||
public Movie __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public Character MainCharacterType { get { int o = __p.__offset(4); return o != 0 ? (Character)__p.bb.Get(o + __p.bb_pos) : Character.NONE; } }
|
||||
public bool MutateMainCharacterType(Character main_character_type) { int o = __p.__offset(4); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)main_character_type); return true; } else { return false; } }
|
||||
public TTable? MainCharacter<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(6); return o != 0 ? (TTable?)__p.__union<TTable>(o) : null; }
|
||||
public Character CharactersType(int j) { int o = __p.__offset(8); return o != 0 ? (Character)__p.bb.Get(__p.__vector(o) + j * 1) : (Character)0; }
|
||||
public int CharactersTypeLength { get { int o = __p.__offset(8); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
@@ -25,7 +26,8 @@ public struct Movie : IFlatbufferObject
|
||||
public ArraySegment<byte>? GetCharactersTypeBytes() { return __p.__vector_as_arraysegment(8); }
|
||||
#endif
|
||||
public Character[] GetCharactersTypeArray() { return __p.__vector_as_array<Character>(8); }
|
||||
public TTable? Characters<TTable>(int j) where TTable : struct, IFlatbufferObject { int o = __p.__offset(10); return o != 0 ? (TTable?)__p.__union<TTable>(__p.__vector(o) + j * 4) : null; }
|
||||
public bool MutateCharactersType(int j, Character characters_type) { int o = __p.__offset(8); if (o != 0) { __p.bb.Put(__p.__vector(o) + j * 1, (byte)characters_type); return true; } else { return false; } }
|
||||
public TTable? Characters<TTable>(int j) where TTable : struct, IFlatbufferObject { int o = __p.__offset(10); return o != 0 ? (TTable?)__p.__union<TTable>(__p.__vector(o) + j * 4 - __p.bb_pos) : null; }
|
||||
public int CharactersLength { get { int o = __p.__offset(10); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
|
||||
public static Offset<Movie> CreateMovie(FlatBufferBuilder builder,
|
||||
|
||||
@@ -13,6 +13,7 @@ public struct Rapunzel : IFlatbufferObject
|
||||
public Rapunzel __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int HairLength { get { return __p.bb.GetInt(__p.bb_pos + 0); } }
|
||||
public void MutateHairLength(int hair_length) { __p.bb.PutInt(__p.bb_pos + 0, hair_length); }
|
||||
|
||||
public static Offset<Rapunzel> CreateRapunzel(FlatBufferBuilder builder, int HairLength) {
|
||||
builder.Prep(4, 4);
|
||||
|
||||
Reference in New Issue
Block a user