Always generate init with super call

This commit is contained in:
Ruslan Mustakov 2017-09-04 19:29:59 +07:00
commit b5fd4295e6
2 changed files with 21 additions and 20 deletions

View file

@ -1,4 +1,4 @@
version = "0.5.6" version = "0.5.7"
author = "Xored Software, Inc." author = "Xored Software, Inc."
description = "Godot Engine bindings" description = "Godot Engine bindings"
license = "MIT" license = "MIT"

View file

@ -451,8 +451,9 @@ proc genType(obj: ObjectDecl): NimNode {.compileTime.} =
else: postfix(decl.name, "*") else: postfix(decl.name, "*")
recList.add(newIdentDefs(name, decl.typ)) recList.add(newIdentDefs(name, decl.typ))
# Add default values to init method # Add default values and/or super call to init method
if initBody.len > 0: initBody.insert(0, newNimNode(nnkCommand).add(ident("procCall"),
newCall("init", newCall(obj.parentName, ident("self")))))
var initMethod: NimNode var initMethod: NimNode
for meth in obj.methods: for meth in obj.methods:
if meth.name == "init" and meth.nimNode[3].len == 1: if meth.name == "init" and meth.nimNode[3].len == 1: