@@ -58,26 +58,6 @@ using namespace swift;
58
58
59
59
#define DEBUG_TYPE " TypeCheckStmt"
60
60
61
- #ifndef NDEBUG
62
- // / Determine whether the given context is for the backing property of a
63
- // / property wrapper.
64
- static bool isPropertyWrapperBackingInitContext (DeclContext *dc) {
65
- auto initContext = dyn_cast<Initializer>(dc);
66
- if (!initContext) return false ;
67
-
68
- auto patternInitContext = dyn_cast<PatternBindingInitializer>(initContext);
69
- if (!patternInitContext) return false ;
70
-
71
- auto binding = patternInitContext->getBinding ();
72
- if (!binding) return false ;
73
-
74
- auto singleVar = binding->getSingleVar ();
75
- if (!singleVar) return false ;
76
-
77
- return singleVar->getOriginalWrappedProperty () != nullptr ;
78
- }
79
- #endif
80
-
81
61
namespace {
82
62
class ContextualizeClosures : public ASTWalker {
83
63
DeclContext *ParentDC;
@@ -129,20 +109,7 @@ namespace {
129
109
130
110
// Explicit closures start their own sequence.
131
111
if (auto CE = dyn_cast<ClosureExpr>(E)) {
132
- // In the repl, the parent top-level context may have been re-written.
133
- if (CE->getParent () != ParentDC) {
134
- if ((CE->getParent ()->getContextKind () !=
135
- ParentDC->getContextKind ()) ||
136
- ParentDC->getContextKind () != DeclContextKind::TopLevelCodeDecl) {
137
- // If a closure is nested within an auto closure, we'll need to update
138
- // its parent to the auto closure parent.
139
- assert ((ParentDC->getContextKind () ==
140
- DeclContextKind::AbstractClosureExpr ||
141
- isPropertyWrapperBackingInitContext (ParentDC)) &&
142
- " Incorrect parent decl context for closure" );
143
- CE->setParent (ParentDC);
144
- }
145
- }
112
+ CE->setParent (ParentDC);
146
113
147
114
// If the closure was type checked within its enclosing context,
148
115
// we need to walk into it with a new sequence.
0 commit comments