fix(variable): Resolving variable as string literal (#168)

In Swift 4, a Substring was returned.
This commit is contained in:
Ilya Puchka
2017-12-27 05:27:26 +01:00
committed by Kyle Fuller
parent 1223efbc7e
commit 0f3a302108
2 changed files with 2 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
- Fixed rendering `{{ block.super }}` with several levels of inheritance
- Fixed checking dictionary values for nil in `default` filter
- Fixed comparing string variables with string literals
## 0.10.1

View File

@@ -60,7 +60,7 @@ public struct Variable : Equatable, Resolvable {
if (variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\"")) {
// String literal
return variable[variable.characters.index(after: variable.startIndex) ..< variable.characters.index(before: variable.endIndex)]
return String(variable[variable.characters.index(after: variable.startIndex) ..< variable.characters.index(before: variable.endIndex)])
}
if let number = Number(variable) {