Better version of SAME-P for FUNCTION-AST.