Update for latest Nim
This commit is contained in:
parent
4e24244c48
commit
e2049ff1a7
5 changed files with 14 additions and 13 deletions
|
|
@ -55,7 +55,7 @@ about compiling Godot can be found in `Godot documentation
|
|||
Installing Nim
|
||||
-------------
|
||||
|
||||
The library requires Nim version 0.17.2 or newer, which you can get here:
|
||||
The library requires Nim version 0.18.0 or newer, which you can get here:
|
||||
https://nim-lang.org/install.html
|
||||
|
||||
Make sure you also have ``nimble`` (Nim's package manager) installed.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version = "0.6.7"
|
||||
version = "0.6.8"
|
||||
author = "Xored Software, Inc."
|
||||
description = "Godot Engine bindings"
|
||||
license = "MIT"
|
||||
|
|
|
|||
|
|
@ -136,20 +136,20 @@ proc binarySearchCustom*(self: var GodotArray, val: ptr GodotVariant,
|
|||
getGDNativeAPI().arrayBSearchCustom(self, val, obj, funcName, before)
|
||||
|
||||
iterator items*(self: GodotArray): GodotVariant =
|
||||
for i in 0..<self.len:
|
||||
for i in 0.cint..<self.len:
|
||||
yield self[i]
|
||||
|
||||
iterator mitems*(self: var GodotArray): var GodotVariant =
|
||||
for i in 0..<self.len:
|
||||
for i in 0.cint..<self.len:
|
||||
yield self.mget(i)[]
|
||||
|
||||
iterator pairs*(self: GodotArray): tuple[key: cint, val: GodotVariant] =
|
||||
for i in 0..<self.len:
|
||||
for i in 0.cint..<self.len:
|
||||
yield (i, self[i])
|
||||
|
||||
iterator mpairs*(self: var GodotArray): tuple[key: cint,
|
||||
val: var GodotVariant] =
|
||||
for i in 0..<self.len:
|
||||
for i in 0.cint..<self.len:
|
||||
yield (i, self.mget(i)[])
|
||||
|
||||
proc `$`*(self: GodotArray): string =
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ template genPoolArrayAPI(ArrayT, initIdent, DataT,
|
|||
getGDNativeAPI().sizeProc(self)
|
||||
|
||||
iterator items*(arr: ArrayT): DataT =
|
||||
for i in 0..<arr.len:
|
||||
for i in 0.cint..<arr.len:
|
||||
yield arr[i]
|
||||
|
||||
iterator pairs*(arr: ArrayT): tuple[key: cint, val: DataT] =
|
||||
for i in 0..<arr.len:
|
||||
for i in 0.cint..<arr.len:
|
||||
yield (i, arr[i])
|
||||
|
||||
genPoolArrayAPI(GodotPoolByteArray, initGodotPoolByteArray, byte,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ proc extractNames(definition: NimNode):
|
|||
if definition.kind == nnkIdent:
|
||||
result.name = $(definition.ident)
|
||||
else:
|
||||
if not (definition.kind == nnkInfix and definition[0].ident == !"of"):
|
||||
if not (definition.kind == nnkInfix and
|
||||
definition[0].ident == toNimIdent("of")):
|
||||
parseError(definition, "invalid type definition")
|
||||
result.name = $(definition[1].ident)
|
||||
case definition[2].kind:
|
||||
|
|
@ -90,7 +91,7 @@ proc removePragmaNode(statement: NimNode,
|
|||
result = nil
|
||||
var pragmas = if RoutineNodes.contains(statement.kind): statement.pragma()
|
||||
else: statement[1]
|
||||
let pnameIdent = !pname
|
||||
let pnameIdent = toNimIdent(pname)
|
||||
for ident, val, i in pragmas(pragmas):
|
||||
if ident == pnameIdent:
|
||||
pragmas.del(i)
|
||||
|
|
@ -103,7 +104,7 @@ proc removePragma(statement: NimNode, pname: string): bool =
|
|||
return false
|
||||
var pragmas = if RoutineNodes.contains(statement.kind): statement.pragma()
|
||||
else: statement[1]
|
||||
let pnameIdent = !pname
|
||||
let pnameIdent = toNimIdent(pname)
|
||||
for ident, val, i in pragmas(pragmas):
|
||||
if ident == pnameIdent:
|
||||
pragmas.del(i)
|
||||
|
|
@ -186,7 +187,7 @@ proc parseType(definition, callSite: NimNode): ObjectDecl =
|
|||
let option = callSite[i]
|
||||
if option.kind != nnkIdent:
|
||||
parseError(option, "type specifier expected")
|
||||
if option.ident == !"tool":
|
||||
if option.ident == toNimIdent("tool"):
|
||||
isTool = true
|
||||
else:
|
||||
parseError(option, "valid type specifier expected")
|
||||
|
|
@ -587,7 +588,7 @@ proc genType(obj: ObjectDecl): NimNode {.compileTime.} =
|
|||
let hasReturnValueBool = not (meth.returnType.isNil or
|
||||
meth.returnType.kind == nnkEmpty or
|
||||
(meth.returnType.kind == nnkIdent and
|
||||
meth.returnType.ident == !"void"))
|
||||
meth.returnType.ident == toNimIdent("void")))
|
||||
let hasReturnValue = if hasReturnValueBool: ident("true")
|
||||
else: ident("false")
|
||||
result.add(getAst(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue