| 700 | }, |
| 701 | |
| 702 | methodOn(value, name) { |
| 703 | if (value.outside) return null; |
| 704 | const first = (found: Node[]): FlowMethod | null => { |
| 705 | const node = [...found].sort((a, b) => (a.filePath < b.filePath ? -1 : a.filePath > b.filePath ? 1 : a.startLine - b.startLine))[0]; |
| 706 | return node ? methods.get(node.id) ?? null : null; |
| 707 | }; |
| 708 | if (value.isClass) { |
| 709 | const inherited = rubyClassMethodOf(value.type, name, context); |
| 710 | return first(rubyMethodsOf(value.type, name, context).filter((n) => n.isStatic === true)) ?? |
| 711 | (inherited ? methods.get(inherited.id) ?? null : null); |
| 712 | } |
| 713 | for (const owner of rubyAncestry(value.type, context, true)) { |
| 714 | const method = first(rubyMethodsOf(owner, name, context).filter((n) => n.isStatic !== true)); |
| 715 | if (method) return method; |
| 716 | } |
| 717 | return null; |
| 718 | }, |
| 719 | |
| 720 | answersItself(value, name) { |
| 721 | if (value.outside) return true; |