From 157a90e4a0bd82a91f8ab34cd1154e0b9869ae48 Mon Sep 17 00:00:00 2001 From: zetashift Date: Wed, 5 Feb 2020 05:35:50 +0100 Subject: [PATCH] add gensym in hygienic template fix thanks to demotohiro (#55) Add gensym in hygienic template fix thanks to demotohiro --- godot/nim/godotmacros.nim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/godot/nim/godotmacros.nim b/godot/nim/godotmacros.nim index c0a23cc..c4715c3 100644 --- a/godot/nim/godotmacros.nim +++ b/godot/nim/godotmacros.nim @@ -396,10 +396,9 @@ template registerGodotField(classNameLit, classNameIdent, propNameLit, getFunc: getFuncIdent ) mixin godotTypeInfo - static: - var typeInfo: GodotTypeInfo - when compiles(godotTypeInfo(propTypeIdent)): - typeInfo = godotTypeInfo(propTypeIdent) + const typeInfo = when compiles(godotTypeInfo(propTypeIdent)): + godotTypeInfo(propTypeIdent) + else: GodotTypeInfo() const hintStr = when hintStrLit != "NIM": hintStrLit else: @@ -455,7 +454,8 @@ 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(newDotExpr(ident("self"), 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)) @@ -605,7 +605,7 @@ N_NOINLINE(void, setStackBottom)(void* thestackbottom); else: toGodotStyle(meth.name) let hasReturnValueBool = not (meth.returnType.isNil or meth.returnType.kind == nnkEmpty or - (meth.returnType.kind == nnkIdent and + (meth.returnType.kind == nnkIdent and meth.returnType.strVal == "void")) let hasReturnValue = if hasReturnValueBool: ident("true") else: ident("false")