From 7dd1b1ed5f0c2fedfc23b31ed7593c57515c8c66 Mon Sep 17 00:00:00 2001 From: Dwana Games Date: Thu, 19 Sep 2019 14:14:58 -0500 Subject: [PATCH] Add self to field initialization --- godot/nim/godotmacros.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/godot/nim/godotmacros.nim b/godot/nim/godotmacros.nim index 90e9ea7..c0a23cc 100644 --- a/godot/nim/godotmacros.nim +++ b/godot/nim/godotmacros.nim @@ -455,7 +455,7 @@ proc genType(obj: ObjectDecl): NimNode {.compileTime.} = let initBody = newStmtList() for decl in obj.fields: if not decl.defaultValue.isNil and decl.defaultValue.kind != nnkEmpty: - initBody.add(newNimNode(nnkAsgn).add(decl.name, decl.defaultValue)) + initBody.add(newNimNode(nnkAsgn).add(newDotExpr(ident("self"), decl.name), decl.defaultValue)) let name = if not decl.isExported: decl.name else: postfix(decl.name, "*") recList.add(newIdentDefs(name, decl.typ))