Merge pull request #1075 from flaviut/inlinedocs
Add some documentations and code examples in system
This commit is contained in:
commit
a690e7b267
71 changed files with 2521 additions and 15 deletions
71
tests/misc/theaproots.nim
Normal file
71
tests/misc/theaproots.nim
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
type
|
||||
Bar = object
|
||||
x: int
|
||||
|
||||
Foo = object
|
||||
rheap: ref Bar
|
||||
rmaybe: ref Bar
|
||||
rstack: ref Bar
|
||||
list: seq[ref Bar]
|
||||
listarr: array[0..5, ref Bar]
|
||||
nestedtup: Tup
|
||||
inner: TInner
|
||||
inref: ref TInner
|
||||
|
||||
TInner = object
|
||||
inref: ref Bar
|
||||
|
||||
Tup = tuple
|
||||
tupbar: ref Bar
|
||||
inner: TInner
|
||||
|
||||
proc acc(x: var Foo): var ref Bar =
|
||||
result = x.rheap
|
||||
|
||||
proc test(maybeFoo: var Foo,
|
||||
maybeSeq: var seq[ref Bar],
|
||||
bars: var openarray[ref Bar],
|
||||
maybeTup: var Tup) =
|
||||
var bb: ref Bar
|
||||
maybeFoo.rmaybe = bb
|
||||
maybeFoo.list[3] = bb
|
||||
maybeFoo.listarr[3] = bb
|
||||
acc(maybeFoo) = bb
|
||||
|
||||
var localFoo: Foo
|
||||
localFoo.rstack = bb
|
||||
localFoo.list[3] = bb
|
||||
localFoo.listarr[3] = bb
|
||||
acc(localFoo) = bb
|
||||
|
||||
var heapFoo: ref Foo
|
||||
heapFoo.rheap = bb
|
||||
heapFoo.list[3] = bb
|
||||
heapFoo.listarr[3] = bb
|
||||
acc(heapFoo[]) = bb
|
||||
|
||||
heapFoo.nestedtup.tupbar = bb
|
||||
heapFoo.nestedtup.inner.inref = bb
|
||||
heapFoo.inner.inref = bb
|
||||
heapFoo.inref.inref = bb
|
||||
|
||||
var locseq: seq[ref Bar]
|
||||
locseq[3] = bb
|
||||
|
||||
var locarr: array[0..4, ref Bar]
|
||||
locarr[3] = bb
|
||||
|
||||
maybeSeq[3] = bb
|
||||
|
||||
bars[3] = bb
|
||||
|
||||
maybeTup[0] = bb
|
||||
|
||||
var
|
||||
ff: ref Foo
|
||||
tt: Tup
|
||||
gseq: seq[ref Bar]
|
||||
|
||||
new(ff)
|
||||
|
||||
test(ff[], gseq, gseq, tt)
|
||||
Loading…
Add table
Add a link
Reference in a new issue