@@ -227,6 +227,25 @@ extension TypeProperties {
227227 GenericSignature ( bridged: rawType. bridged. getInvocationGenericSignatureOfFunctionType ( ) )
228228 }
229229
230+ public var functionTypeRepresentation : FunctionTypeRepresentation {
231+ switch rawType. bridged. getFunctionTypeRepresentation ( ) {
232+ case . Thick: return . thick
233+ case . Block: return . block
234+ case . Thin: return . thin
235+ case . CFunctionPointer: return . cFunctionPointer
236+ case . Method: return . method
237+ case . ObjCMethod: return . objCMethod
238+ case . WitnessMethod: return . witnessMethod
239+ case . Closure: return . closure
240+ case . CXXMethod: return . cxxMethod
241+ case . KeyPathAccessorGetter: return . keyPathAccessorGetter
242+ case . KeyPathAccessorSetter: return . keyPathAccessorSetter
243+ case . KeyPathAccessorEquals: return . keyPathAccessorEquals
244+ case . KeyPathAccessorHash: return . keyPathAccessorHash
245+ default : fatalError ( )
246+ }
247+ }
248+
230249 //===--------------------------------------------------------------------===//
231250 // Type properties
232251 //===--------------------------------------------------------------------===//
@@ -307,6 +326,59 @@ extension TypeProperties {
307326 }
308327}
309328
329+ public enum FunctionTypeRepresentation {
330+ /// A freestanding thick function.
331+ case thick
332+
333+ /// A thick function that is represented as an Objective-C block.
334+ case block
335+
336+ /// A freestanding thin function that needs no context.
337+ case thin
338+
339+ /// A C function pointer, which is thin and also uses the C calling convention.
340+ case cFunctionPointer
341+
342+ /// A Swift instance method.
343+ case method
344+
345+ /// An Objective-C method.
346+ case objCMethod
347+
348+ /// A Swift protocol witness.
349+ case witnessMethod
350+
351+ /// A closure invocation function that has not been bound to a context.
352+ case closure
353+
354+ /// A C++ method that takes a "this" argument (not a static C++ method or constructor).
355+ /// Except for handling the "this" argument, has the same behavior as "CFunctionPointer".
356+ case cxxMethod
357+
358+ /// A KeyPath accessor function, which is thin and also uses the variadic length generic
359+ /// components serialization in trailing buffer. Each representation has a different convention
360+ /// for which parameters have serialized generic type info.
361+ case keyPathAccessorGetter, keyPathAccessorSetter, keyPathAccessorEquals, keyPathAccessorHash
362+
363+ public var bridged : BridgedASTType . FunctionTypeRepresentation {
364+ switch self {
365+ case . thick: return . Thick
366+ case . block: return . Block
367+ case . thin: return . Thin
368+ case . cFunctionPointer: return . CFunctionPointer
369+ case . method: return . Method
370+ case . objCMethod: return . ObjCMethod
371+ case . witnessMethod: return . WitnessMethod
372+ case . closure: return . Closure
373+ case . cxxMethod: return . CXXMethod
374+ case . keyPathAccessorGetter: return . KeyPathAccessorGetter
375+ case . keyPathAccessorSetter: return . KeyPathAccessorSetter
376+ case . keyPathAccessorEquals: return . KeyPathAccessorEquals
377+ case . keyPathAccessorHash: return . KeyPathAccessorHash
378+ }
379+ }
380+ }
381+
310382public struct TypeArray : RandomAccessCollection , CustomReflectable {
311383 public let bridged : BridgedASTTypeArray
312384
0 commit comments