(object: string, state: State)
| 36 | } |
| 37 | |
| 38 | buildClass(object: string, state: State): any { |
| 39 | const daggerObject = this.daggerModule.objects[object] |
| 40 | if (!daggerObject) { |
| 41 | throw new FunctionNotFound(`Object ${object} not found in the module`) |
| 42 | } |
| 43 | |
| 44 | switch (daggerObject.kind()) { |
| 45 | case "class": { |
| 46 | const obj = this.getExportedObject(object) |
| 47 | |
| 48 | const instanciatedClass = Object.create(obj.prototype) |
| 49 | Object.assign(instanciatedClass, state) |
| 50 | |
| 51 | return instanciatedClass |
| 52 | } |
| 53 | case "object": { |
| 54 | return state |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Transform a Dagger interface identifier into an implementation of this |
no test coverage detected