Mark the concatination of two strings as @readonly.

Swift SVN r21061
This commit is contained in:
Nadav Rotem
2014-08-06 05:19:51 +00:00
parent 2217b29956
commit d96e940c36
2 changed files with 10 additions and 0 deletions

View File

@@ -265,6 +265,7 @@ extension String : StringInterpolationConvertible {
public static func convertFromStringInterpolationSegment<T>(expr: T) -> String { return toString(expr) }
}
@semantics("readonly")
public func +(var lhs: String, rhs: String) -> String {
if (lhs.isEmpty) {
return rhs
@@ -273,6 +274,7 @@ public func +(var lhs: String, rhs: String) -> String {
return lhs
}
@semantics("readonly")
public func +(lhs: Character, rhs: Character) -> String {
var result = String(lhs)
result += String(rhs)