File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -768,6 +768,9 @@ struct BridgedDeclAttributes {
768768 BRIDGED_INLINE swift::DeclAttributes unbridged () const ;
769769};
770770
771+ SWIFT_NAME (" BridgedDeclAttribute.isDeclModifier(_:)" )
772+ bool BridgedDeclAttribute_isDeclModifier(BridgedDeclAttrKind cKind);
773+
771774SWIFT_NAME (" BridgedDeclAttributes.add(self:_:)" )
772775void BridgedDeclAttributes_add(BridgedDeclAttributes *_Nonnull attrs,
773776 BridgedDeclAttribute add);
Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ BridgedDeclAttribute BridgedDeclAttribute_createSimple(
6666 cAtLoc.unbridged (), cAttrLoc.unbridged ());
6767}
6868
69+ bool BridgedDeclAttribute_isDeclModifier (BridgedDeclAttrKind cKind) {
70+ auto optKind = unbridged (cKind);
71+ if (!optKind)
72+ return false ;
73+ return DeclAttribute::isDeclModifier (*optKind);
74+ }
75+
6976void BridgedDeclAttributes_add (BridgedDeclAttributes *cAttrs,
7077 BridgedDeclAttribute cAdd) {
7178 auto attrs = cAttrs->unbridged ();
Original file line number Diff line number Diff line change @@ -1971,9 +1971,12 @@ extension ASTGenVisitor {
19711971 // Other modifiers are all "simple" attributes.
19721972 let kind = BridgedDeclAttrKind ( from: node. name. rawText. bridged)
19731973 guard kind != . none else {
1974- // TODO: Diagnose?
1975- assertionFailure ( " unknown decl modifier " )
1976- return nil
1974+ // TODO: Diagnose.
1975+ fatalError ( " (compiler bug) unknown decl modifier " )
1976+ }
1977+ if !BridgedDeclAttribute. isDeclModifier ( kind) {
1978+ // TODO: Diagnose.
1979+ fatalError ( " (compiler bug) decl attribute was parsed as a modifier " )
19771980 }
19781981 return self . generateSimpleDeclAttr ( declModifier: node, kind: kind)
19791982 }
You can’t perform that action at this time.
0 commit comments