Skip to content

Commit 3639d86

Browse files
committed
Address review feedback
1 parent e52b93c commit 3639d86

File tree

4 files changed

+132
-102
lines changed

4 files changed

+132
-102
lines changed

include/swift/AST/ASTBridgingWrappers.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@
5757
#define ABSTRACT_TYPEREPR(Id, Parent) TYPEREPR(Id, Parent)
5858
#include "swift/AST/TypeReprNodes.def"
5959

60-
// Most of the base classes need to be nullable to allow them to be used as
60+
// Some of the base classes need to be nullable to allow them to be used as
6161
// optional parameters.
6262
AST_BRIDGING_WRAPPER_NONNULL(Decl)
63+
AST_BRIDGING_WRAPPER_NONNULL(DeclContext)
6364
AST_BRIDGING_WRAPPER_NULLABLE(Stmt)
6465
AST_BRIDGING_WRAPPER_NULLABLE(Expr)
6566
AST_BRIDGING_WRAPPER_NULLABLE(TypeRepr)

include/swift/AST/CASTBridging.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232

3333
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
3434

35-
typedef struct BridgedDeclContext {
36-
void *_Nonnull raw;
37-
} BridgedDeclContext;
38-
3935
// Define the bridging wrappers for each AST node.
4036
#define AST_BRIDGING_WRAPPER_NONNULL(Name) \
4137
typedef struct { \
@@ -53,7 +49,8 @@ typedef struct BridgedDeclContext {
5349
extern "C" {
5450
#endif
5551

56-
// Declare `.asDecl` on each BridgedXXXDecl type.
52+
// Declare `.asDecl` on each BridgedXXXDecl type, which upcasts a wrapper for
53+
// a Decl subclass to a BridgedDecl.
5754
#define DECL(Id, Parent) \
5855
SWIFT_NAME("getter:Bridged" #Id "Decl.asDecl(self:)") \
5956
BridgedDecl Id##Decl_asDecl(Bridged##Id##Decl decl);
@@ -69,21 +66,24 @@ extern "C" {
6966
#define ABSTRACT_CONTEXT_DECL(Id, Parent) CONTEXT_DECL(Id, Parent)
7067
#include "swift/AST/DeclNodes.def"
7168

72-
// Declare `.asStmt` on each BridgedXXXStmt type.
69+
// Declare `.asStmt` on each BridgedXXXStmt type, which upcasts a wrapper for
70+
// a Stmt subclass to a BridgedStmt.
7371
#define STMT(Id, Parent) \
7472
SWIFT_NAME("getter:Bridged" #Id "Stmt.asStmt(self:)") \
7573
BridgedStmt Id##Stmt_asStmt(Bridged##Id##Stmt stmt);
7674
#define ABSTRACT_STMT(Id, Parent) STMT(Id, Parent)
7775
#include "swift/AST/StmtNodes.def"
7876

79-
// Declare `.asExpr` on each BridgedXXXExpr type.
77+
// Declare `.asExpr` on each BridgedXXXExpr type, which upcasts a wrapper for
78+
// a Expr subclass to a BridgedExpr.
8079
#define EXPR(Id, Parent) \
8180
SWIFT_NAME("getter:Bridged" #Id "Expr.asExpr(self:)") \
8281
BridgedExpr Id##Expr_asExpr(Bridged##Id##Expr expr);
8382
#define ABSTRACT_EXPR(Id, Parent) EXPR(Id, Parent)
8483
#include "swift/AST/ExprNodes.def"
8584

86-
// Declare `.asTypeRepr` on each BridgedXXXTypeRepr type.
85+
// Declare `.asTypeRepr` on each BridgedXXXTypeRepr type, which upcasts a
86+
// wrapper for a TypeRepr subclass to a BridgedTypeRepr.
8787
#define TYPEREPR(Id, Parent) \
8888
SWIFT_NAME("getter:Bridged" #Id "TypeRepr.asTypeRepr(self:)") \
8989
BridgedTypeRepr Id##TypeRepr_asTypeRepr(Bridged##Id##TypeRepr typeRepr);

0 commit comments

Comments
 (0)