diff --git a/frontend.go b/frontend.go index ddd89cd..40ca182 100644 --- a/frontend.go +++ b/frontend.go @@ -13,6 +13,10 @@ type object struct { Children []object } +type FrontendRef struct { + Current *Frontend +} + type Frontend struct { CurrentChildrenFunc func() stack []object diff --git a/schema/gen.go b/schema/gen.go index 8d170c4..fb1ee15 100644 --- a/schema/gen.go +++ b/schema/gen.go @@ -25,20 +25,20 @@ func (self *generator) writeSchema(schema *Schema) { }) self.writeStruct(self.frontendName, func() { - self.text.WriteString("frontend *objection.Frontend") + self.text.WriteString("frontendRef *objection.FrontendRef") }) self.writeFunc( fmt.Sprintf("New%s", self.frontendName), "", func() { - self.text.WriteString("frontend *objection.Frontend") + self.text.WriteString("frontendRef *objection.FrontendRef") }, self.frontendName, func() { self.writeReturnStatement(func() { self.writeStructConstruction(self.frontendName, func() { - self.text.WriteString("frontend,") + self.text.WriteString("frontendRef,") }) }) }, @@ -68,14 +68,14 @@ func (self *generator) writeObjectMethod(object *ObjectDef) { }, "", func() { - self.text.WriteString("self.frontend.StartNewObject(") + self.text.WriteString("self.frontendRef.Current.StartNewObject(") self.writeStringLiteral(object.Name) self.text.WriteString(")\n") - self.text.WriteString("self.frontend.SetAttributes(attributes)\n") - self.text.WriteString("self.frontend.CurrentChildrenFunc = children\n") + self.text.WriteString("self.frontendRef.Current.SetAttributes(attributes)\n") + self.text.WriteString("self.frontendRef.Current.CurrentChildrenFunc = children\n") self.text.WriteString("children()\n") - self.text.WriteString("self.frontend.FinishObject()") + self.text.WriteString("self.frontendRef.Current.FinishObject()") }, )