Closed fdodino closed 1 month ago
Update, se migraron algunas, quedó pendiente ésto:
// TODO: terminar de migrar a wollok-ts estas 4 definiciones
export const getNodeDefinition = (environment: Environment) => (node: Node): Node[] => {
try {
return match(node)(
when(Reference)(node => definedOrEmpty(node.target)),
when(Send)(sendDefinitions(environment)),
when(Super)(node => definedOrEmpty(superMethodDefinition(node))),
when(Self)(node => definedOrEmpty(getParentModule(node)))
)
} catch {
return [node]
}
}
const superMethodDefinition = (superNode: Super): Method | undefined => {
const currentMethod = superNode.ancestors.find(is(Method))!
const module = getParentModule(superNode)
return module ? module.lookupMethod(currentMethod.name, superNode.args.length, { lookupStartFQN: module.fullyQualifiedName }) : undefined
}
const getParentModule = (node: Node) => node.ancestors.find(is(Module))
const definedOrEmpty = <T>(value: T | undefined): T[] => value ? [value] : []
Hoy tenemos toda esta funcionalidad que parece que podría migrarse toda a wollok-ts: