mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-19 21:55:43 +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:
32
tests/namespace_test/NamespaceA/SecondTableInA.go
Normal file
32
tests/namespace_test/NamespaceA/SecondTableInA.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// automatically generated, do not modify
|
||||
|
||||
package NamespaceA
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
type SecondTableInA struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *SecondTableInA) ReferToC(obj *TableInC) *TableInC {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(TableInC)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SecondTableInAStart(builder *flatbuffers.Builder) { builder.StartObject(1) }
|
||||
func SecondTableInAAddReferToC(builder *flatbuffers.Builder, referToC flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(referToC), 0) }
|
||||
func SecondTableInAEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() }
|
||||
Reference in New Issue
Block a user