File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Plugins/BridgeJS/Sources/BridgeJSCore Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ public final class SwiftToSkeleton {
104104 identifierType. name. text == " JSTypedClosure " ,
105105 let genericArgs = identifierType. genericArgumentClause? . arguments,
106106 genericArgs. count == 1 ,
107- let signatureType = lookupType ( for: genericArgs. first!. argument, errors: & errors) ,
107+ let argument = genericArgs. firstAsTypeSyntax,
108+ let signatureType = lookupType ( for: argument, errors: & errors) ,
108109 case . closure( let signature) = signatureType
109110 {
110111 return . closure( signature)
@@ -2504,3 +2505,18 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor {
25042505 }
25052506 }
25062507}
2508+
2509+ extension GenericArgumentListSyntax {
2510+ /// Compatibility helper for accessing the first argument as a TypeSyntax
2511+ ///
2512+ /// Note: SwiftSyntax 601 and later support InlineArrayTypeSyntax and
2513+ /// ``GenericArgumentSyntax/argument`` is now a ``TypeSyntax`` or ``ExprSyntax``.
2514+ fileprivate var firstAsTypeSyntax : TypeSyntax ? {
2515+ guard let first = self . first else { return nil }
2516+ #if canImport(SwiftSyntax601)
2517+ return first. argument. as ( TypeSyntax . self)
2518+ #else
2519+ return TypeSyntax ( first. argument)
2520+ #endif
2521+ }
2522+ }
You can’t perform that action at this time.
0 commit comments