treassign.nim 517 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. output: "SUCCESS"
  3. """
  4. type
  5. BasicNumber = object of RootObj
  6. value: float32
  7. RefChild* = ref object
  8. curr*: TokenObject
  9. Token* {.pure.} = enum
  10. foo,
  11. bar,
  12. TokenObject = object
  13. case kind*: Token
  14. of Token.foo:
  15. foo*: string
  16. of Token.bar:
  17. bar*: BasicNumber
  18. var t = RefChild()
  19. t.curr = TokenObject(kind: Token.bar, bar: BasicNumber(value: 12.34))
  20. t.curr = TokenObject(kind: Token.foo, foo: "foo")
  21. echo "SUCCESS"