| 1985 | } |
| 1986 | |
| 1987 | func NewObjectResultForCall[T Typed]( |
| 1988 | self T, |
| 1989 | srv *Server, |
| 1990 | call *ResultCall, |
| 1991 | ) (res ObjectResult[T], _ error) { |
| 1992 | objType, ok := srv.ObjectType(self.Type().Name()) |
| 1993 | if !ok { |
| 1994 | return res, fmt.Errorf("unknown type %q", self.Type().Name()) |
| 1995 | } |
| 1996 | class, ok := objType.(Class[T]) |
| 1997 | if !ok { |
| 1998 | return res, fmt.Errorf("not a Class: %T", objType) |
| 1999 | } |
| 2000 | |
| 2001 | inst, err := NewResultForCall(self, call) |
| 2002 | if err != nil { |
| 2003 | return res, err |
| 2004 | } |
| 2005 | inst.shared.setObjClass(class) |
| 2006 | |
| 2007 | return ObjectResult[T]{ |
| 2008 | Result: inst, |
| 2009 | class: class, |
| 2010 | }, nil |
| 2011 | } |
| 2012 | |
| 2013 | func idToPath(id *call.ID) ast.Path { |
| 2014 | path := ast.Path{} |