mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Mechanically add "Type" to the end of any protocol names that don't end in "Type," "ible," or "able." Also, drop "Type" from the end of any associated type names, except for those of the *LiteralConvertible protocols. There are obvious improvements to make in some of these names, which can be handled with separate commits. Fixes <rdar://problem/17165920> Protocols `Integer` etc should get uglier names. Swift SVN r19883
38 lines
1.3 KiB
Swift
38 lines
1.3 KiB
Swift
//===--- Mirrors.swift.gyb - Common MirrorType implementations -*- 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
% 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','.Logical','$0'))
|
|
% Types.append(('Int','.Int','Int64($0)'))
|
|
% Types.append(('UInt','.UInt','UInt64($0)'))
|
|
% Types.append(('Character','.Text','String($0)'))
|
|
% Types.append(('UnicodeScalar','.UInt','UInt64($0)'))
|
|
|
|
% for Type in Types:
|
|
extension ${Type[0]} : Reflectable {
|
|
public func getMirror() -> MirrorType {
|
|
return _LeafMirror(self, { "\($0)" }, { .Some(${Type[1]}(${Type[2]})) })
|
|
}
|
|
}
|
|
|
|
|
|
// ${'Local Variables'}:
|
|
// eval: (read-only-mode 1)
|
|
// End:
|