Extract LetStatement and LetExpression handling to external function