fix(variable): Resolving variable as string literal (#168)
In Swift 4, a Substring was returned.
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
- Fixed rendering `{{ block.super }}` with several levels of inheritance
|
- Fixed rendering `{{ block.super }}` with several levels of inheritance
|
||||||
- Fixed checking dictionary values for nil in `default` filter
|
- Fixed checking dictionary values for nil in `default` filter
|
||||||
|
- Fixed comparing string variables with string literals
|
||||||
|
|
||||||
|
|
||||||
## 0.10.1
|
## 0.10.1
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public struct Variable : Equatable, Resolvable {
|
|||||||
|
|
||||||
if (variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\"")) {
|
if (variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\"")) {
|
||||||
// String literal
|
// 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) {
|
if let number = Number(variable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user