@@ -201,6 +201,25 @@ extension TypeProperties {
201201 GenericSignature ( bridged: rawType. bridged. getInvocationGenericSignatureOfFunctionType ( ) )
202202 }
203203
204+ public var functionTypeRepresentation : FunctionTypeRepresentation {
205+ switch rawType. bridged. getFunctionTypeRepresentation ( ) {
206+ case . Thick: return . thick
207+ case . Block: return . block
208+ case . Thin: return . thin
209+ case . CFunctionPointer: return . cFunctionPointer
210+ case . Method: return . method
211+ case . ObjCMethod: return . objCMethod
212+ case . WitnessMethod: return . witnessMethod
213+ case . Closure: return . closure
214+ case . CXXMethod: return . cxxMethod
215+ case . KeyPathAccessorGetter: return . keyPathAccessorGetter
216+ case . KeyPathAccessorSetter: return . keyPathAccessorSetter
217+ case . KeyPathAccessorEquals: return . keyPathAccessorEquals
218+ case . KeyPathAccessorHash: return . keyPathAccessorHash
219+ default : fatalError ( )
220+ }
221+ }
222+
204223 //===--------------------------------------------------------------------===//
205224 // Type properties
206225 //===--------------------------------------------------------------------===//
@@ -275,6 +294,59 @@ extension TypeProperties {
275294 }
276295}
277296
297+ public enum FunctionTypeRepresentation {
298+ /// A freestanding thick function.
299+ case thick
300+
301+ /// A thick function that is represented as an Objective-C block.
302+ case block
303+
304+ /// A freestanding thin function that needs no context.
305+ case thin
306+
307+ /// A C function pointer, which is thin and also uses the C calling convention.
308+ case cFunctionPointer
309+
310+ /// A Swift instance method.
311+ case method
312+
313+ /// An Objective-C method.
314+ case objCMethod
315+
316+ /// A Swift protocol witness.
317+ case witnessMethod
318+
319+ /// A closure invocation function that has not been bound to a context.
320+ case closure
321+
322+ /// A C++ method that takes a "this" argument (not a static C++ method or constructor).
323+ /// Except for handling the "this" argument, has the same behavior as "CFunctionPointer".
324+ case cxxMethod
325+
326+ /// A KeyPath accessor function, which is thin and also uses the variadic length generic
327+ /// components serialization in trailing buffer. Each representation has a different convention
328+ /// for which parameters have serialized generic type info.
329+ case keyPathAccessorGetter, keyPathAccessorSetter, keyPathAccessorEquals, keyPathAccessorHash
330+
331+ public var bridged : BridgedASTType . FunctionTypeRepresentation {
332+ switch self {
333+ case . thick: return . Thick
334+ case . block: return . Block
335+ case . thin: return . Thin
336+ case . cFunctionPointer: return . CFunctionPointer
337+ case . method: return . Method
338+ case . objCMethod: return . ObjCMethod
339+ case . witnessMethod: return . WitnessMethod
340+ case . closure: return . Closure
341+ case . cxxMethod: return . CXXMethod
342+ case . keyPathAccessorGetter: return . KeyPathAccessorGetter
343+ case . keyPathAccessorSetter: return . KeyPathAccessorSetter
344+ case . keyPathAccessorEquals: return . KeyPathAccessorEquals
345+ case . keyPathAccessorHash: return . KeyPathAccessorHash
346+ }
347+ }
348+ }
349+
278350public struct TypeArray : RandomAccessCollection , CustomReflectable {
279351 public let bridged : BridgedASTTypeArray
280352
0 commit comments