> Counter of SomeBaseClass would require an untyped argument, and I don't think > it would be possible to access the type impl in this case.
Would this help? It generates a call to a macro which takes the base class type as a typed arg: import macros type B = object field: int macro typeInfo(b: typed): untyped = echo b.getImpl.treeRepr macro class(args: varargs[untyped]): untyped = template tpl(b) = typeInfo(b) result = getAst(tpl(args[0][2])) class A of B: discard Run