Added immediate pragma to 'new' macro.

This commit is contained in:
Joey Payne 2015-07-05 21:25:41 -06:00
commit 2e48f48cd8

View file

@ -3,7 +3,7 @@ import strutils
{.hint[XDeclaredButNotUsed]: off.} {.hint[XDeclaredButNotUsed]: off.}
macro new*(obj: untyped): untyped= macro new*(obj: untyped): untyped {.immediate.}=
## Creates a new instance of the class ## Creates a new instance of the class
## and calls the init() method on it ## and calls the init() method on it
if obj.kind == nnkObjConstr: if obj.kind == nnkObjConstr:
@ -24,9 +24,6 @@ macro new*(obj: untyped): untyped=
macro class*(head: untyped, body: untyped): untyped= macro class*(head: untyped, body: untyped): untyped=
# The macro is immediate so that it doesn't
# resolve identifiers passed to it
# object reference name inside methods. # object reference name inside methods.
# ie: self, self # ie: self, self
let obj_reference = "self" let obj_reference = "self"