mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-15 08:48:52 +00:00
Fixed namespace code generation for C++
The code generator was assuming all declarations for the current file sit in the same namepace. Now uses the "on demand" namespace switching we had for the forward declarations. Also fixed a bug related to namespace lookup. Change-Id: Ib54a3efbc752cbb9590302fa0707c0c73448db3d Tested: on Linux.
This commit is contained in:
27
tests/namespace_test/NamespaceA/SecondTableInA.py
Normal file
27
tests/namespace_test/NamespaceA/SecondTableInA.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# automatically generated, do not modify
|
||||
|
||||
# namespace: NamespaceA
|
||||
|
||||
import flatbuffers
|
||||
|
||||
class SecondTableInA(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
# SecondTableInA
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# SecondTableInA
|
||||
def ReferToC(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
x = self._tab.Indirect(o + self._tab.Pos)
|
||||
from .TableInC import TableInC
|
||||
obj = TableInC()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def SecondTableInAStart(builder): builder.StartObject(1)
|
||||
def SecondTableInAAddReferToC(builder, referToC): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToC), 0)
|
||||
def SecondTableInAEnd(builder): return builder.EndObject()
|
||||
Reference in New Issue
Block a user