mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 04:31:47 +00:00
[Nim] Bfbs Nim Generator (#7534)
* Bfbs Nim Generator * Remove commented out tests * add missing line to idl.h * Commit python reflection changes * Commit python reflection changes and move tests * Remove default string addition * Move tests to python file * Fix element size check when element is table * remove whitespace changes * add element_type docs and commit further to namer and remove kkeep * Bfbs Nim Generator * Remove commented out tests * add missing line to idl.h * Commit python reflection changes * Commit python reflection changes and move tests * Remove default string addition * Move tests to python file * Fix element size check when element is table * remove whitespace changes * add element_type docs and commit further to namer and remove kkeep * remove unused variables * added tests to ci * added tests to ci * fixes * Added reflection type Field, Variable to namer * Moved reflection namer impl to bfbsnamer * Remove whitespace at end of line * Added nim to generated code * Revert whitespace removal Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
26
tests/MyGame/Example/Referrable.nim
Normal file
26
tests/MyGame/Example/Referrable.nim
Normal file
@@ -0,0 +1,26 @@
|
||||
#[ MyGame.Example.Referrable
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 22.9.29
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
import flatbuffers
|
||||
|
||||
type Referrable* = object of FlatObj
|
||||
func id*(self: Referrable): uint64 =
|
||||
let o = self.tab.Offset(4)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `id=`*(self: var Referrable, n: uint64): bool =
|
||||
return self.tab.MutateSlot(4, n)
|
||||
proc ReferrableStart*(builder: var Builder) =
|
||||
builder.StartObject(1)
|
||||
proc ReferrableAddid*(builder: var Builder, id: uint64) =
|
||||
builder.PrependSlot(0, id, default(uint64))
|
||||
proc ReferrableEnd*(builder: var Builder): uoffset =
|
||||
return builder.EndObject()
|
||||
Reference in New Issue
Block a user