ModuleConstructor returns the constructor function for the module's named main object. This is the module-specific constructor (e.g. Query.myMod()), as opposed to MainObject.AsObject.Constructor which is Query's synthetic "with" or no-op constructor. Returns nil if no named constructor is available.
()
| 569 | // is Query's synthetic "with" or no-op constructor. |
| 570 | // Returns nil if no named constructor is available. |
| 571 | func (m *moduleDef) ModuleConstructor() *modFunction { |
| 572 | if obj := m.GetObject(m.Name); obj != nil && obj.Constructor != nil && obj.Constructor.Name != "" { |
| 573 | return obj.Constructor |
| 574 | } |
| 575 | // Only fall back to MainObject's constructor if it's a real one |
| 576 | // or the Query-side shell constructor path. The object typedef constructor |
| 577 | // can be metadata-only with an empty name. |
| 578 | if c := m.MainObject.AsObject.Constructor; c != nil { |
| 579 | return c |
| 580 | } |
| 581 | return nil |
| 582 | } |
| 583 | |
| 584 | func (m *moduleDef) HasMainFunction(name string) bool { |
| 585 | return m.GetMainFunction(name) != nil |
no test coverage detected