Codegen: use type forward declarations more aggresively. Fixes #7339 (#7340)

Do not emit object definition it if used only by ref or ptr
This commit is contained in:
cooldome 2018-03-16 15:21:03 +00:00 • committed by Andreas Rumpf
commit 70b28a39fe
4 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,12 @@
type
MyRefObject* = ref object
s: string
proc newMyRefObject*(s: string): MyRefObject =
new(result)
result.s = s
proc `$`*(o: MyRefObject): string =
o.s