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,23 +343,20 @@ proc newRStrLit(s: string): NimNode {.compileTime.} =
result = newNimNode(nnkRStrLit)
result.strVal = s
macro toGodotName(T: typedesc): string =
var godotName =
if T is GodotString or T is string:
"String"
elif T is SomeFloat:
"float"
elif T is SomeUnsignedInt or T is SomeSignedInt:
"int"
else:
let nameStr = (($T.getType()[1][1].symbol).split(':')[0])
case nameStr:
of "File", "Directory", "Thread", "Mutex", "Semaphore":
"_" & nameStr
else:
nameStr
result = newLit(godotName)
proc toGodotName(T: typedesc): string =
if T is GodotString or T is string:
"String"
elif T is SomeFloat:
"float"
elif T is SomeUnsignedInt or T is SomeSignedInt:
"int"
else:
let nameStr = (($T.getType()[1][1].symbol).split(':')[0])
case nameStr:
of "File", "Directory", "Thread", "Mutex", "Semaphore":
"_" & nameStr
else:
nameStr
macro asCString(s: static[string]): cstring =
result = newNimNode(nnkCallStrLit).add(