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")