Foundation models aren't primarily trained on ASTs, so you're typically going to have worse results than just using text unless you do extensive fine-tuning yourself.
ASTs also generally don't actually have magical information in them. They won't solve the lifetime issues for you.