Child table doctype and docname

cdt (Child DocType) and cdn (Child Docname) are child parameters

I know if i do locals[cdt][cdn]. I will get the child table details but i was wondering where exactly this value is being fetched as i search the whole codes and i was not able to find the logics how these values are being stored in cdt and cdn.