Add more init procs for tables and macros.genExpr

This commit is contained in:
Zahary Karadjov 2019-08-02 15:26:08 +03:00
parent d196350d22
commit a3df04d701
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
2 changed files with 11 additions and 0 deletions

View File

@ -289,3 +289,7 @@ template genCode*(body: untyped) =
payload()
template genExpr*(body: untyped) =
macro payload: untyped = body
payload()

View File

@ -1,5 +1,12 @@
import std/tables, ../objects
template init*[A, B](T: type Table[A, B]): auto = initTable[A, B]()
template init*[A, B](T: type TableRef[A, B]): auto = newTable[A, B]()
template init*[A, B](T: type OrderedTable[A, B]): auto = initOrderedTable[A, B]()
template init*[A, B](T: type OrderedTableRef[A, B]): auto = newOrderedTable[A, B]()
template init*[A](T: type CountTable[A]): auto = initCountTable[A]()
template init*[A](T: type CountTableRef[A]): auto = newCountTable[A]()
export tables, objects