mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The "typechecked function body" request was defined to type-check a function body that is known to be present, and not skipped, and would assert these conditions, requiring its users to check whether a body was expected. Often, this means that callers would use `getBody()` instead, which retrieves the underlying value in whatever form it happens to be, and assume it has been mutated appropriately. Make the "typechecked function body" request, triggered by `getTypecheckedBody()`, more resilient and central. A `NULL` result is now acceptable, signifying that there is no body. Clients will need to tolerate NULL results. * When there is no body but should be one, produce an appropriate error. * When there shouldn't be a body but is, produce an appropriate error * Handle skipping of function bodies here, rather than elsewhere. Over time, we should move clients off of `getBody` and `hasBody` entirely, and toward `getTypecheckedBody` or some yet-to-be-introduced forms like `getBodyAsWritten` for the pre-typechecked body.