Skip to content

Commit bd631b0

Browse files
author
Omar Habra
committed
fixing setters
1 parent 89b0a4c commit bd631b0

File tree

8 files changed

+375
-12
lines changed

8 files changed

+375
-12
lines changed

include/swift/AST/Decl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5101,6 +5101,12 @@ class VarDecl : public AbstractStorageDecl {
51015101
: VarDecl(DeclKind::Var, isStatic, introducer, nameLoc,
51025102
name, dc, StorageIsMutable_t(introducer == Introducer::Var)) {}
51035103

5104+
static VarDecl *createImported(ASTContext &Context, DeclName Name,
5105+
SourceLoc SubscriptLoc,
5106+
SourceLoc ArrowLoc, Type ElementTy,
5107+
DeclContext *Parent,
5108+
ClangNode ClangN);
5109+
51045110
SourceRange getSourceRange() const;
51055111

51065112
Identifier getName() const { return getBaseIdentifier(); }

lib/AST/Decl.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7163,6 +7163,22 @@ SubscriptDecl *SubscriptDecl::create(ASTContext &Context, DeclName Name,
71637163
return SD;
71647164
}
71657165

7166+
VarDecl *VarDecl::createImported(ASTContext &Context, DeclName Name,
7167+
SourceLoc SubscriptLoc,
7168+
SourceLoc ArrowLoc, Type ElementTy,
7169+
DeclContext *Parent,
7170+
ClangNode ClangN) {
7171+
assert(ClangN && ElementTy);
7172+
auto *DeclPtr = allocateMemoryForDecl<VarDecl>(
7173+
Context, sizeof(VarDecl), /*includeSpaceForClangNode=*/true);
7174+
7175+
auto *const SD = ::new (DeclPtr)
7176+
VarDecl(false, Introducer::Var, SourceLoc(), Name.getBaseIdentifier(), Parent);
7177+
SD->setInterfaceType(ElementTy);
7178+
SD->setClangNode(ClangN);
7179+
return SD;
7180+
}
7181+
71667182
SubscriptDecl *SubscriptDecl::createImported(ASTContext &Context, DeclName Name,
71677183
SourceLoc SubscriptLoc,
71687184
ParameterList *Indices,

0 commit comments

Comments
 (0)