Use a meaningful representation of parameter specifiers

In anticipation of future attributes, and perhaps the ability to
declare lvalues with specifiers other than 'let' and 'var', expand
the "isLet" bit into a more general "specifier" field.
This commit is contained in:
Robert Widmann
2017-06-28 13:38:36 -07:00
parent 04bc382e1c
commit ac5594dabe
29 changed files with 229 additions and 132 deletions

View File

@@ -2692,7 +2692,8 @@ ModuleFile::getDeclChecked(DeclID DID, Optional<DeclContext *> ForcedContext) {
case decls_block::VAR_DECL: {
IdentifierID nameID;
DeclContextID contextID;
bool isImplicit, isObjC, isStatic, isLet, hasNonPatternBindingInit;
bool isImplicit, isObjC, isStatic, hasNonPatternBindingInit;
unsigned specifier;
uint8_t storageKind, rawAccessLevel, rawSetterAccessLevel;
TypeID interfaceTypeID;
DeclID getterID, setterID, materializeForSetID, willSetID, didSetID;
@@ -2700,7 +2701,7 @@ ModuleFile::getDeclChecked(DeclID DID, Optional<DeclContext *> ForcedContext) {
ArrayRef<uint64_t> dependencyIDs;
decls_block::VarLayout::readRecord(scratch, nameID, contextID,
isImplicit, isObjC, isStatic, isLet,
isImplicit, isObjC, isStatic, specifier,
hasNonPatternBindingInit, storageKind,
interfaceTypeID,
getterID, setterID, materializeForSetID,
@@ -2729,7 +2730,8 @@ ModuleFile::getDeclChecked(DeclID DID, Optional<DeclContext *> ForcedContext) {
if (declOrOffset.isComplete())
return declOrOffset;
auto var = createDecl<VarDecl>(/*IsStatic*/isStatic, /*IsLet*/isLet,
auto var = createDecl<VarDecl>(/*IsStatic*/isStatic,
(VarDecl::Specifier)specifier,
/*IsCaptureList*/false, SourceLoc(), name,
Type(), DC);
var->setHasNonPatternBindingInit(hasNonPatternBindingInit);
@@ -2774,17 +2776,18 @@ ModuleFile::getDeclChecked(DeclID DID, Optional<DeclContext *> ForcedContext) {
case decls_block::PARAM_DECL: {
IdentifierID argNameID, paramNameID;
DeclContextID contextID;
bool isLet;
unsigned specifier;
TypeID interfaceTypeID;
decls_block::ParamLayout::readRecord(scratch, argNameID, paramNameID,
contextID, isLet, interfaceTypeID);
contextID, specifier, interfaceTypeID);
auto DC = ForcedContext ? *ForcedContext : getDeclContext(contextID);
if (declOrOffset.isComplete())
return declOrOffset;
auto param = createDecl<ParamDecl>(isLet, SourceLoc(), SourceLoc(),
auto param = createDecl<ParamDecl>((VarDecl::Specifier)specifier,
SourceLoc(), SourceLoc(),
getIdentifier(argNameID), SourceLoc(),
getIdentifier(paramNameID), Type(), DC);