workaround for nim/macro/typedesc issue

This commit is contained in:
Fabian Keller 2018-12-30 15:41:44 +01:00
commit a536c102d6

View file

@ -343,8 +343,7 @@ proc newRStrLit(s: string): NimNode {.compileTime.} =
result = newNimNode(nnkRStrLit) result = newNimNode(nnkRStrLit)
result.strVal = s result.strVal = s
macro toGodotName(T: typedesc): string = proc toGodotName(T: typedesc): string =
var godotName =
if T is GodotString or T is string: if T is GodotString or T is string:
"String" "String"
elif T is SomeFloat: elif T is SomeFloat:
@ -359,8 +358,6 @@ macro toGodotName(T: typedesc): string =
else: else:
nameStr nameStr
result = newLit(godotName)
macro asCString(s: static[string]): cstring = macro asCString(s: static[string]): cstring =
result = newNimNode(nnkCallStrLit).add( result = newNimNode(nnkCallStrLit).add(
ident("cstring"), newRStrLit(s)) ident("cstring"), newRStrLit(s))