Files
swift-mirror/stdlib/core/RangeMirrors.swift.gyb
Jordan Rose 8f520414b7 [Accessibility] A private class cannot contain public methods.
There's no meaningful way in which these methods are public, since they
can't be accessed through any value of the type

<rdar://problem/17647878>

Swift SVN r20224
2014-07-20 17:26:24 +00:00

46 lines
1.3 KiB
Swift

//===- RangeMirrors.swift.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
//
//===----------------------------------------------------------------------===//
% import gyb
%
% common_args = dict(
% introspecteeType='Range',
% genericArgs=['T'],
% genericConstraints={'T':'ForwardIndexType'},
% disposition='Struct')
%
% for x in ('Decl', 'Conformance', 'Boilerplate'):
% locals()['Mirror' + x] = gyb.executeTemplate(
% gyb.parseTemplate('../common/Mirror%s.gyb' % x), **common_args)
${MirrorDecl} {
${MirrorBoilerplate}
var count: Int { return 2 }
subscript(i: Int) -> (String, MirrorType) {
switch i {
case 0: return ("startIndex",reflect(_value.startIndex))
case 1: return ("endIndex",reflect(_value.endIndex))
default: _preconditionFailure("cannot extract this child index")
}
}
var summary: String {
return "\(self[0].1.summary)..<\(self[1].1.summary)"
}
var quickLookObject: QuickLookObject? { return .Text(summary) }
}
${MirrorConformance}