Skip to content

Commit 21cc043

Browse files
author
Omar Habra
committed
fixing setters
1 parent d7d3fe3 commit 21cc043

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

5052+
static VarDecl *createImported(ASTContext &Context, DeclName Name,
5053+
SourceLoc SubscriptLoc,
5054+
SourceLoc ArrowLoc, Type ElementTy,
5055+
DeclContext *Parent,
5056+
ClangNode ClangN);
5057+
50525058
SourceRange getSourceRange() const;
50535059

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

lib/AST/Decl.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7272,6 +7272,22 @@ SubscriptDecl *SubscriptDecl::create(ASTContext &Context, DeclName Name,
72727272
return SD;
72737273
}
72747274

7275+
VarDecl *VarDecl::createImported(ASTContext &Context, DeclName Name,
7276+
SourceLoc SubscriptLoc,
7277+
SourceLoc ArrowLoc, Type ElementTy,
7278+
DeclContext *Parent,
7279+
ClangNode ClangN) {
7280+
assert(ClangN && ElementTy);
7281+
auto *DeclPtr = allocateMemoryForDecl<VarDecl>(
7282+
Context, sizeof(VarDecl), /*includeSpaceForClangNode=*/true);
7283+
7284+
auto *const SD = ::new (DeclPtr)
7285+
VarDecl(false, Introducer::Var, SourceLoc(), Name.getBaseIdentifier(), Parent);
7286+
SD->setInterfaceType(ElementTy);
7287+
SD->setClangNode(ClangN);
7288+
return SD;
7289+
}
7290+
72757291
SubscriptDecl *SubscriptDecl::createImported(ASTContext &Context, DeclName Name,
72767292
SourceLoc SubscriptLoc,
72777293
ParameterList *Indices,

0 commit comments

Comments
 (0)