Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
macro `.`*(pkg: PkgInstall, field: untyped): untyped =
## ^ This makes PkgInstall types act like concatinations
## of the Pkg, PkgVer and PkgLayout types
var subfields = pkg.getType.last
expectKind(subfields, nnkRecList)
for elm in subfields:
var fields = elm.getType.last
expectKind(fields, nnkRecList)
var real_field = findChild(fields, eqIdent(it, $field))
if real_field != nil:
result = newDotExpr(pkg, elm).newDotExpr real_field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment