mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Typed throws] Record thrown error types and conversions in the AST
For any operation that can throw an error, such as calls, property accesses, and non-exhaustive do..catch statements, record the thrown error type along with the conversion from that thrown error to the error type expected in context, as appropriate. This will prevent later stages from having to re-compute the conversion sequences.
This commit is contained in:
@@ -253,7 +253,7 @@ private:
|
||||
|
||||
auto *POArgList = ArgumentList::forImplicitUnlabeled(Ctx, {DstRef});
|
||||
auto *POCall = CallExpr::createImplicit(Ctx, PODeclRef, POArgList);
|
||||
POCall->setThrows(false);
|
||||
POCall->setThrows(nullptr);
|
||||
|
||||
// Create the call to checkExpect.
|
||||
UnresolvedDeclRefExpr *CheckExpectDRE = new (Ctx)
|
||||
@@ -263,7 +263,7 @@ private:
|
||||
ArgumentList::forImplicitUnlabeled(Ctx, {Varname, POCall});
|
||||
auto *CheckExpectExpr =
|
||||
CallExpr::createImplicit(Ctx, CheckExpectDRE, CheckArgList);
|
||||
CheckExpectExpr->setThrows(false);
|
||||
CheckExpectExpr->setThrows(nullptr);
|
||||
|
||||
// Create the closure.
|
||||
auto *Params = ParameterList::createEmpty(Ctx);
|
||||
@@ -283,7 +283,7 @@ private:
|
||||
|
||||
// Call the closure.
|
||||
auto *ClosureCall = CallExpr::createImplicitEmpty(Ctx, Closure);
|
||||
ClosureCall->setThrows(false);
|
||||
ClosureCall->setThrows(nullptr);
|
||||
|
||||
// TODO: typeCheckExpression() seems to assign types to everything here,
|
||||
// but may not be sufficient in some cases.
|
||||
|
||||
Reference in New Issue
Block a user