|
31 | 31 | #include "swift/AST/GenericParamKey.h" |
32 | 32 | #include "swift/AST/IfConfigClause.h" |
33 | 33 | #include "swift/AST/Import.h" |
| 34 | +#include "swift/AST/Initializer.h" |
34 | 35 | #include "swift/AST/LayoutConstraint.h" |
35 | 36 | #include "swift/AST/LifetimeAnnotation.h" |
36 | 37 | #include "swift/AST/ReferenceCounting.h" |
@@ -1962,7 +1963,7 @@ class PatternBindingEntry { |
1962 | 1963 | IsFromDebugger = 1 << 2, |
1963 | 1964 | }; |
1964 | 1965 | /// The initializer context used for this pattern binding entry. |
1965 | | - llvm::PointerIntPair<DeclContext *, 3, OptionSet<PatternFlags>> |
| 1966 | + llvm::PointerIntPair<PatternBindingInitializer *, 3, OptionSet<PatternFlags>> |
1966 | 1967 | InitContextAndFlags; |
1967 | 1968 |
|
1968 | 1969 | /// Values captured by this initializer. |
@@ -2003,7 +2004,7 @@ class PatternBindingEntry { |
2003 | 2004 | public: |
2004 | 2005 | /// \p E is the initializer as parsed. |
2005 | 2006 | PatternBindingEntry(Pattern *P, SourceLoc EqualLoc, Expr *E, |
2006 | | - DeclContext *InitContext) |
| 2007 | + PatternBindingInitializer *InitContext) |
2007 | 2008 | : PatternAndFlags(P, {}), |
2008 | 2009 | InitExpr({E, {E, InitializerStatus::NotChecked}, EqualLoc}), |
2009 | 2010 | InitContextAndFlags({InitContext, llvm::None}) {} |
@@ -2107,12 +2108,14 @@ class PatternBindingEntry { |
2107 | 2108 | VarDecl *getAnchoringVarDecl() const; |
2108 | 2109 |
|
2109 | 2110 | // Retrieve the declaration context for the initializer. |
2110 | | - DeclContext *getInitContext() const { |
| 2111 | + PatternBindingInitializer *getInitContext() const { |
2111 | 2112 | return InitContextAndFlags.getPointer(); |
2112 | 2113 | } |
2113 | 2114 |
|
2114 | 2115 | /// Override the initializer context. |
2115 | | - void setInitContext(DeclContext *dc) { InitContextAndFlags.setPointer(dc); } |
| 2116 | + void setInitContext(PatternBindingInitializer *init) { |
| 2117 | + InitContextAndFlags.setPointer(init); |
| 2118 | + } |
2116 | 2119 |
|
2117 | 2120 | SourceLoc getStartLoc() const; |
2118 | 2121 |
|
@@ -2310,15 +2313,16 @@ class PatternBindingDecl final : public Decl, |
2310 | 2313 | Pattern *getPattern(unsigned i) const { |
2311 | 2314 | return getPatternList()[i].getPattern(); |
2312 | 2315 | } |
2313 | | - |
2314 | | - void setPattern(unsigned i, Pattern *Pat, DeclContext *InitContext, |
| 2316 | + |
| 2317 | + void setPattern(unsigned i, Pattern *Pat, |
| 2318 | + PatternBindingInitializer *InitContext, |
2315 | 2319 | bool isFullyValidated = false); |
2316 | 2320 |
|
2317 | 2321 | bool isFullyValidated(unsigned i) const { |
2318 | 2322 | return getPatternList()[i].isFullyValidated(); |
2319 | 2323 | } |
2320 | 2324 |
|
2321 | | - DeclContext *getInitContext(unsigned i) const { |
| 2325 | + PatternBindingInitializer *getInitContext(unsigned i) const { |
2322 | 2326 | return getPatternList()[i].getInitContext(); |
2323 | 2327 | } |
2324 | 2328 |
|
|
0 commit comments