Skip to content

Commit 7eedc18

Browse files
committed
Swift AST: add ConstructorDecl.isInheritable
and make `AbstractFunctionDecl.isOverridden` final
1 parent 153dd02 commit 7eedc18

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

SwiftCompilerSources/Sources/AST/Declarations.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,12 @@ final public class ParamDecl: VarDecl {
182182
final public class SubscriptDecl: AbstractStorageDecl, GenericContext {}
183183

184184
public class AbstractFunctionDecl: ValueDecl, GenericContext {
185-
public var isOverridden: Bool { bridged.AbstractFunction_isOverridden() }
185+
final public var isOverridden: Bool { bridged.AbstractFunction_isOverridden() }
186186
}
187187

188-
final public class ConstructorDecl: AbstractFunctionDecl {}
188+
final public class ConstructorDecl: AbstractFunctionDecl {
189+
public var isInheritable: Bool { bridged.Constructor_isInheritable() }
190+
}
189191

190192
final public class DestructorDecl: AbstractFunctionDecl {
191193
final public var isIsolated: Bool { bridged.Destructor_isIsolated() }

include/swift/AST/ASTBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ struct BridgedDeclObj {
351351
BRIDGED_INLINE bool ProtocolDecl_requiresClass() const;
352352
BRIDGED_INLINE bool ProtocolDecl_isMarkerProtocol() const;
353353
BRIDGED_INLINE bool AbstractFunction_isOverridden() const;
354+
BRIDGED_INLINE bool Constructor_isInheritable() const;
354355
BRIDGED_INLINE bool Destructor_isIsolated() const;
355356
BRIDGED_INLINE bool EnumElementDecl_hasAssociatedValues() const;
356357
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedParameterList

include/swift/AST/ASTBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ bool BridgedDeclObj::AbstractFunction_isOverridden() const {
272272
return getAs<swift::AbstractFunctionDecl>()->isOverridden();
273273
}
274274

275+
bool BridgedDeclObj::Constructor_isInheritable() const {
276+
return getAs<swift::ConstructorDecl>()->isInheritable();
277+
}
278+
275279
bool BridgedDeclObj::Destructor_isIsolated() const {
276280
auto dd = getAs<swift::DestructorDecl>();
277281
auto ai = swift::getActorIsolation(dd);

0 commit comments

Comments
 (0)