Skip to content

Commit 78bf32d

Browse files
author
Omar Habra
committed
fixing setters
1 parent c439a46 commit 78bf32d

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

5101+
static VarDecl *createImported(ASTContext &Context, DeclName Name,
5102+
SourceLoc SubscriptLoc,
5103+
SourceLoc ArrowLoc, Type ElementTy,
5104+
DeclContext *Parent,
5105+
ClangNode ClangN);
5106+
51015107
SourceRange getSourceRange() const;
51025108

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

lib/AST/Decl.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7169,6 +7169,22 @@ SubscriptDecl *SubscriptDecl::create(ASTContext &Context, DeclName Name,
71697169
return SD;
71707170
}
71717171

7172+
VarDecl *VarDecl::createImported(ASTContext &Context, DeclName Name,
7173+
SourceLoc SubscriptLoc,
7174+
SourceLoc ArrowLoc, Type ElementTy,
7175+
DeclContext *Parent,
7176+
ClangNode ClangN) {
7177+
assert(ClangN && ElementTy);
7178+
auto *DeclPtr = allocateMemoryForDecl<VarDecl>(
7179+
Context, sizeof(VarDecl), /*includeSpaceForClangNode=*/true);
7180+
7181+
auto *const SD = ::new (DeclPtr)
7182+
VarDecl(false, Introducer::Var, SourceLoc(), Name.getBaseIdentifier(), Parent);
7183+
SD->setInterfaceType(ElementTy);
7184+
SD->setClangNode(ClangN);
7185+
return SD;
7186+
}
7187+
71727188
SubscriptDecl *SubscriptDecl::createImported(ASTContext &Context, DeclName Name,
71737189
SourceLoc SubscriptLoc,
71747190
ParameterList *Indices,

0 commit comments

Comments
 (0)