Skip to content

Commit 37ef2d7

Browse files
committed
[astgen] Correctly thread 'name' through VarDecl visitor.
1 parent 799463b commit 37ef2d7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/AST/CASTBridging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ void *SwiftBooleanLiteralExpr_create(void *ctx, bool value, void *TokenLoc) {
141141
void *SwiftVarDecl_create(void *ctx, BridgedIdentifier _Nullable nameId,
142142
void *loc, bool isStatic, bool isLet, void *dc) {
143143
ASTContext &Context = *static_cast<ASTContext *>(ctx);
144+
auto name = (UnresolvedDeclRefExpr *)nameId;
144145
return new (Context) VarDecl(
145146
isStatic, isLet ? VarDecl::Introducer::Let : VarDecl::Introducer::Var,
146-
getSourceLocFromPointer(loc), Identifier::getFromOpaquePointer(nameId),
147+
getSourceLocFromPointer(loc), name->getName().getBaseIdentifier(),
147148
reinterpret_cast<DeclContext *>(dc));
148149
}
149150

lib/ASTGen/Sources/ASTGen/Decls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extension ASTGenVisitor {
7575
let isLet = node.letOrVarKeyword.tokenKind == .letKeyword
7676

7777
// TODO: don't drop "initializer" on the floor.
78-
return .decl(SwiftVarDecl_create(ctx, nil, loc, isStateic, isLet, declContext))
78+
return .decl(SwiftVarDecl_create(ctx, pattern, loc, isStateic, isLet, declContext))
7979
}
8080

8181
public func visit(_ node: FunctionParameterSyntax) -> ASTNode {

0 commit comments

Comments
 (0)