Refactor to not call path.ast twice