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)
@@ -2506,3 +2507,18 @@ private final class ImportSwiftMacrosAPICollector: SyntaxAnyVisitor {
25062507 }
25072508 }
25082509}
2510+
2511+ extension GenericArgumentListSyntax {
2512+ /// Compatibility helper for accessing the first argument as a TypeSyntax
2513+ ///
2514+ /// Note: SwiftSyntax 601 and later support InlineArrayTypeSyntax and
2515+ /// ``GenericArgumentSyntax/argument`` is now a ``TypeSyntax`` or ``ExprSyntax``.
2516+ fileprivate var firstAsTypeSyntax : TypeSyntax ? {
2517+ guard let first = self . first else { return nil }
2518+ #if canImport(SwiftSyntax601)
2519+ return first. argument. as ( TypeSyntax . self)
2520+ #else
2521+ return TypeSyntax ( first. argument)
2522+ #endif
2523+ }
2524+ }
You can’t perform that action at this time.
0 commit comments