Aggregate extern_fn generation logic to ExternFnGenerator class.