diff --git a/node.go b/node.go index 3128709..0d44f33 100644 --- a/node.go +++ b/node.go @@ -418,15 +418,13 @@ func (this *conversionState) convert(n_ node.Node) (string, error) { // within the constructor, but, our generated code will never do that // TODO replace our NewX constructors with split NewX + newXInPlace(??) - // Use a child scope for the temporary name - ret := "{\n" - ret += "super, err := " + constructorName(this.currentClassParentName) + funcArgs + "\n" + // No need to use a child scope for the temporary name - + // super() is a reserved name in PHP anyway + ret := "super, err := " + constructorName(this.currentClassParentName) + funcArgs + "\n" ret += "if err != nil {\n" ret += "return err\n" ret += "}\n" - ret += "this." + this.currentClassParentName + " = *super\n" - ret += "}\n" - ret += "\n" + ret += "this." + this.currentClassParentName + " = *super // copy by value\n" return ret, nil } }