From 895c0e34a1bac7921d14d970f3b727c1c1038b7c Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Thu, 27 Jul 2017 08:27:09 -0600 Subject: [PATCH] Fix oop macro to work with latest Nim --- content/content/oop_macro.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/content/oop_macro.md b/content/content/oop_macro.md index 0b13042..0b2054f 100644 --- a/content/content/oop_macro.md +++ b/content/content/oop_macro.md @@ -105,12 +105,12 @@ macro class*(head, body: untyped): untyped = # Empty # create a type section in the result - result = - if exported: - # mark `typeName` with an asterisk + if exported: + result = quote do: type `typeName`* = ref object of `baseName` - else: + else: + result = quote do: type `typeName` = ref object of `baseName` @@ -167,8 +167,8 @@ macro class*(head, body: untyped): untyped = # specify the return type of the ctor proc node.params[0] = typeName else: - # inject `self: T` into the arguments - node.params.insert(1, newIdentDefs(ident("self"), typeName)) + # inject `this: T` into the arguments + node.params.insert(1, newIdentDefs(ident("this"), typeName)) result.add(node) of nnkVarSection: