/
MirrorConformance.gyb
33 lines (32 loc) · 1.57 KB
/
MirrorConformance.gyb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%{
#//===--- MirrorConformance.gyb --------------------------------*- swift -*-===//
#//
#// This source file is part of the Swift.org open source project
#//
#// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
#// Licensed under Apache License v2.0 with Runtime Library Exception
#//
#// See http://swift.org/LICENSE.txt for license information
#// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#//
#//===----------------------------------------------------------------------===//
# This file contains boilerplate that is common among all the Mirrors in the
# Swift Standard Library. It is meant to be used as a template to be included
# in other .gyb files to generate actual Mirror implementations, by only typing
# as little code as necessary
# Instructions:
# Load the file as a gyb template
# When you want to generate a Mirror, execute this template. Locals are as follows:
# - introspecteeType: the base name of the type to be reflected by your Mirror
# - genericArgs: a list of names of generic argument types that you need for your Mirror
# - genericConstraints: a dictionary that contains constraints on generic argument types
# - disposition: a valid disposition for your Mirror
# You still need to provide count, subscript, summary and quickLookObject manually when using
# this template, which is probably reasonable since those are "the meat" of every Mirror
}%
extension ${introspecteeType} : Reflectable {
/// Returns a mirror that reflects `self`.
public func getMirror() -> MirrorType {
return _${introspecteeType}Mirror(self)
}
}