%# -*- mode: swift -*- //===--- Mirrors.swift.gyb - Mirror implementations for common types ------===// // // 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 // //===----------------------------------------------------------------------===// % Types = [] % for IntSize in [8,16,32,64]: % Types.append( ('Int'+str(IntSize),'.Int','Int64($0)') ) % for UIntSize in [8,16,32,64]: % Types.append( ('UInt'+str(UIntSize),'.UInt','UInt64($0)') ) % for FloatSize in [32,64]: % Types.append( ('Float'+str(FloatSize),'.Float','Double($0)') ) % Types.append(('String','.Text','$0')) % Types.append(('Bool','.Text','"\($0)"')) % Types.append(('Int','.Int','Int64($0)')) % for Type in Types: extension ${Type[0]} : Reflectable { func getMirror() -> Mirror { return _LeafMirror(self, { "\($0)" }, { .Some(${Type[1]}(${Type[2]})) }) } }