@@ -380,15 +380,15 @@ class alignas(1 << DeclAlignInBits) Decl {
380
380
DefaultArgumentResilienceExpansion : 1
381
381
);
382
382
383
- SWIFT_INLINE_BITFIELD (AbstractFunctionDecl, ValueDecl, 3 +8 +5 +1 +1 +1 +1 +1 +1 ,
383
+ SWIFT_INLINE_BITFIELD (AbstractFunctionDecl, ValueDecl, 3 +8 +1 +1 +1 +1 +1 +1 +1 ,
384
384
// / \see AbstractFunctionDecl::BodyKind
385
385
BodyKind : 3 ,
386
386
387
387
// / Import as member status.
388
388
IAMStatus : 8 ,
389
389
390
- // / Number of curried parameter lists .
391
- NumParameterLists : 5 ,
390
+ // / Whether the function has an implicit 'self' parameter .
391
+ HasImplicitSelfDecl : 1 ,
392
392
393
393
// / Whether we are overridden later.
394
394
Overridden : 1 ,
@@ -5001,24 +5001,21 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5001
5001
5002
5002
AbstractFunctionDecl (DeclKind Kind, DeclContext *Parent, DeclName Name,
5003
5003
SourceLoc NameLoc, bool Throws, SourceLoc ThrowsLoc,
5004
- unsigned NumParameterLists ,
5004
+ bool HasImplicitSelfDecl ,
5005
5005
GenericParamList *GenericParams)
5006
5006
: GenericContext(DeclContextKind::AbstractFunctionDecl, Parent),
5007
5007
ValueDecl (Kind, Parent, Name, NameLoc),
5008
5008
Body(nullptr ), ThrowsLoc(ThrowsLoc) {
5009
5009
setBodyKind (BodyKind::None);
5010
5010
setGenericParams (GenericParams);
5011
- Bits.AbstractFunctionDecl .NumParameterLists = NumParameterLists ;
5011
+ Bits.AbstractFunctionDecl .HasImplicitSelfDecl = HasImplicitSelfDecl ;
5012
5012
Bits.AbstractFunctionDecl .Overridden = false ;
5013
5013
Bits.AbstractFunctionDecl .Throws = Throws;
5014
5014
Bits.AbstractFunctionDecl .NeedsNewVTableEntry = false ;
5015
5015
Bits.AbstractFunctionDecl .HasComputedNeedsNewVTableEntry = false ;
5016
5016
Bits.AbstractFunctionDecl .DefaultArgumentResilienceExpansion =
5017
5017
unsigned (ResilienceExpansion::Maximal);
5018
5018
Bits.AbstractFunctionDecl .Synthesized = false ;
5019
-
5020
- // Verify no bitfield truncation.
5021
- assert (Bits.AbstractFunctionDecl .NumParameterLists == NumParameterLists);
5022
5019
}
5023
5020
5024
5021
void setBodyKind (BodyKind K) {
@@ -5064,7 +5061,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5064
5061
Bits.AbstractFunctionDecl .IAMStatus = newValue.getRawValue ();
5065
5062
}
5066
5063
5067
- public:
5068
5064
// / Retrieve the location of the 'throws' keyword, if present.
5069
5065
SourceLoc getThrowsLoc () const { return ThrowsLoc; }
5070
5066
@@ -5200,7 +5196,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5200
5196
// / function. This value is one for free-standing functions, and two for
5201
5197
// / methods.
5202
5198
unsigned getNumParameterLists () const {
5203
- return Bits.AbstractFunctionDecl .NumParameterLists ;
5199
+ return Bits.AbstractFunctionDecl .HasImplicitSelfDecl ? 2 : 1 ;
5204
5200
}
5205
5201
5206
5202
// / \brief Returns the parameter pattern(s) for the function definition that
@@ -5227,6 +5223,9 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5227
5223
return getParameterLists ().back ();
5228
5224
}
5229
5225
5226
+ void setParameters (ParamDecl *SelfDecl,
5227
+ ParameterList *Params);
5228
+
5230
5229
// / \brief This method returns the implicit 'self' decl.
5231
5230
// /
5232
5231
// / Note that some functions don't have an implicit 'self' decl, for example,
@@ -5341,19 +5340,18 @@ class FuncDecl : public AbstractFunctionDecl {
5341
5340
SourceLoc FuncLoc,
5342
5341
DeclName Name, SourceLoc NameLoc,
5343
5342
bool Throws, SourceLoc ThrowsLoc,
5344
- unsigned NumParameterLists ,
5343
+ bool HasImplicitSelfDecl ,
5345
5344
GenericParamList *GenericParams, DeclContext *Parent)
5346
5345
: AbstractFunctionDecl(Kind, Parent,
5347
5346
Name, NameLoc,
5348
5347
Throws, ThrowsLoc,
5349
- NumParameterLists , GenericParams),
5348
+ HasImplicitSelfDecl , GenericParams),
5350
5349
StaticLoc (StaticLoc), FuncLoc(FuncLoc) {
5351
5350
assert (!Name.getBaseName ().isSpecial ());
5352
5351
5353
5352
Bits.FuncDecl .IsStatic =
5354
5353
StaticLoc.isValid () || StaticSpelling != StaticSpellingKind::None;
5355
5354
Bits.FuncDecl .StaticSpelling = static_cast <unsigned >(StaticSpelling);
5356
- assert (NumParameterLists > 0 && " Must have at least an empty tuple arg" );
5357
5355
5358
5356
Bits.FuncDecl .HasDynamicSelf = false ;
5359
5357
Bits.FuncDecl .ForcedStaticDispatch = false ;
@@ -5367,7 +5365,7 @@ class FuncDecl : public AbstractFunctionDecl {
5367
5365
DeclName Name, SourceLoc NameLoc,
5368
5366
bool Throws, SourceLoc ThrowsLoc,
5369
5367
GenericParamList *GenericParams,
5370
- unsigned NumParameterLists ,
5368
+ bool HasImplicitSelfDecl ,
5371
5369
DeclContext *Parent,
5372
5370
ClangNode ClangN);
5373
5371
@@ -5379,7 +5377,7 @@ class FuncDecl : public AbstractFunctionDecl {
5379
5377
DeclName Name, SourceLoc NameLoc,
5380
5378
bool Throws, SourceLoc ThrowsLoc,
5381
5379
GenericParamList *GenericParams,
5382
- unsigned NumParameterLists ,
5380
+ bool HasImplicitSelfDecl ,
5383
5381
DeclContext *Parent);
5384
5382
5385
5383
static FuncDecl *create (ASTContext &Context, SourceLoc StaticLoc,
@@ -5388,7 +5386,8 @@ class FuncDecl : public AbstractFunctionDecl {
5388
5386
DeclName Name, SourceLoc NameLoc,
5389
5387
bool Throws, SourceLoc ThrowsLoc,
5390
5388
GenericParamList *GenericParams,
5391
- ArrayRef<ParameterList *> ParameterLists,
5389
+ ParamDecl *SelfDecl,
5390
+ ParameterList *ParameterList,
5392
5391
TypeLoc FnRetType, DeclContext *Parent,
5393
5392
ClangNode ClangN = ClangNode());
5394
5393
@@ -5455,9 +5454,6 @@ class FuncDecl : public AbstractFunctionDecl {
5455
5454
// / attribute. For example a "mutating set" accessor.
5456
5455
bool isExplicitNonMutating () const ;
5457
5456
5458
- void setDeserializedSignature (ArrayRef<ParameterList *> ParameterLists,
5459
- TypeLoc FnRetType);
5460
-
5461
5457
SourceLoc getStaticLoc () const { return StaticLoc; }
5462
5458
SourceLoc getFuncLoc () const { return FuncLoc; }
5463
5459
@@ -5594,7 +5590,7 @@ class AccessorDecl final : public FuncDecl {
5594
5590
SourceLoc staticLoc,
5595
5591
StaticSpellingKind staticSpelling,
5596
5592
bool throws, SourceLoc throwsLoc,
5597
- unsigned numParameterLists ,
5593
+ bool hasImplicitSelfDecl ,
5598
5594
GenericParamList *genericParams,
5599
5595
DeclContext *parent,
5600
5596
ClangNode clangNode);
@@ -5610,7 +5606,7 @@ class AccessorDecl final : public FuncDecl {
5610
5606
StaticSpellingKind staticSpelling,
5611
5607
bool throws, SourceLoc throwsLoc,
5612
5608
GenericParamList *genericParams,
5613
- unsigned numParameterLists ,
5609
+ bool hasImplicitSelfDecl ,
5614
5610
DeclContext *parent);
5615
5611
5616
5612
static AccessorDecl *create (ASTContext &ctx, SourceLoc declLoc,
@@ -5622,7 +5618,8 @@ class AccessorDecl final : public FuncDecl {
5622
5618
StaticSpellingKind staticSpelling,
5623
5619
bool throws, SourceLoc throwsLoc,
5624
5620
GenericParamList *genericParams,
5625
- ArrayRef<ParameterList *> parameterLists,
5621
+ ParamDecl *selfDecl,
5622
+ ParameterList *parameterList,
5626
5623
TypeLoc fnRetType, DeclContext *parent,
5627
5624
ClangNode clangNode = ClangNode());
5628
5625
@@ -5923,8 +5920,6 @@ class ConstructorDecl : public AbstractFunctionDecl {
5923
5920
GenericParamList *GenericParams,
5924
5921
DeclContext *Parent);
5925
5922
5926
- void setParameterLists (ParamDecl *selfParam, ParameterList *bodyParams);
5927
-
5928
5923
SourceLoc getConstructorLoc () const { return getNameLoc (); }
5929
5924
SourceLoc getStartLoc () const { return getConstructorLoc (); }
5930
5925
SourceRange getSourceRange () const ;
@@ -6114,8 +6109,6 @@ class DestructorDecl : public AbstractFunctionDecl {
6114
6109
DestructorDecl (SourceLoc DestructorLoc, ParamDecl *selfDecl,
6115
6110
DeclContext *Parent);
6116
6111
6117
- void setSelfDecl (ParamDecl *selfDecl);
6118
-
6119
6112
MutableArrayRef<ParameterList *> getParameterLists () {
6120
6113
return { ParameterLists, 2 };
6121
6114
}
0 commit comments