Skip to content

Commit d1c5598

Browse files
author
Omar Habra
committed
fixing setters
1 parent d1bb98b commit d1c5598

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
@@ -4972,6 +4972,12 @@ class VarDecl : public AbstractStorageDecl {
49724972
: VarDecl(DeclKind::Var, isStatic, introducer, nameLoc,
49734973
name, dc, StorageIsMutable_t(introducer == Introducer::Var)) {}
49744974

4975+
static VarDecl *createImported(ASTContext &Context, DeclName Name,
4976+
SourceLoc SubscriptLoc,
4977+
SourceLoc ArrowLoc, Type ElementTy,
4978+
DeclContext *Parent,
4979+
ClangNode ClangN);
4980+
49754981
SourceRange getSourceRange() const;
49764982

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

lib/AST/Decl.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7128,6 +7128,22 @@ SubscriptDecl *SubscriptDecl::create(ASTContext &Context, DeclName Name,
71287128
return SD;
71297129
}
71307130

7131+
VarDecl *VarDecl::createImported(ASTContext &Context, DeclName Name,
7132+
SourceLoc SubscriptLoc,
7133+
SourceLoc ArrowLoc, Type ElementTy,
7134+
DeclContext *Parent,
7135+
ClangNode ClangN) {
7136+
assert(ClangN && ElementTy);
7137+
auto *DeclPtr = allocateMemoryForDecl<VarDecl>(
7138+
Context, sizeof(VarDecl), /*includeSpaceForClangNode=*/true);
7139+
7140+
auto *const SD = ::new (DeclPtr)
7141+
VarDecl(false, Introducer::Var, SourceLoc(), Name.getBaseIdentifier(), Parent);
7142+
SD->setInterfaceType(ElementTy);
7143+
SD->setClangNode(ClangN);
7144+
return SD;
7145+
}
7146+
71317147
SubscriptDecl *SubscriptDecl::createImported(ASTContext &Context, DeclName Name,
71327148
SourceLoc SubscriptLoc,
71337149
ParameterList *Indices,

0 commit comments

Comments
 (0)