Skip to content

Commit

Permalink
Fixes for swift 5.8 (#42)
Browse files Browse the repository at this point in the history
* Fixes for swift 5.8

* Add 5.8 to CI

* More fixes
  • Loading branch information
adam-fowler authored Jul 19, 2024
1 parent 5bb66ac commit cde358e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
image: ["swift:5.9", "swift:5.10", "swiftlang/swift:nightly-6.0-jammy"]
image: ["swift:5.8", "swift:5.9", "swift:5.10", "swiftlang/swift:nightly-6.0-jammy"]

container:
image: ${{ matrix.image }}
Expand Down
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--minversion 0.53.10

# Swift version
--swiftversion 5.9
--swiftversion 5.8

# file options
--exclude .build
Expand Down
23 changes: 13 additions & 10 deletions Sources/Mustache/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@ struct MustacheContext {

/// return context with indent and parameter information for invoking a partial
func withPartial(indented: String?, inheriting: [String: MustacheTemplate]?) -> MustacheContext {
let indentation: String? = if let indented {
(self.indentation ?? "") + indented
let indentation: String?
if let indented {
indentation = (self.indentation ?? "") + indented
} else {
self.indentation
indentation = self.indentation
}
let inherits: [String: MustacheTemplate]? = if let inheriting {
let inherits: [String: MustacheTemplate]?
if let inheriting {
if let originalInherits = self.inherited {
originalInherits.merging(inheriting) { value, _ in value }
inherits = originalInherits.merging(inheriting) { value, _ in value }
} else {
inheriting
inherits = inheriting
}
} else {
self.inherited
inherits = self.inherited
}
return .init(
stack: self.stack,
Expand All @@ -95,10 +97,11 @@ struct MustacheContext {

/// return context with indent information for invoking an inheritance block
func withBlockExpansion(indented: String?) -> MustacheContext {
let indentation: String? = if let indented {
(self.indentation ?? "") + indented
let indentation: String?
if let indented {
indentation = (self.indentation ?? "") + indented
} else {
self.indentation
indentation = self.indentation
}
return .init(
stack: self.stack,
Expand Down

0 comments on commit cde358e

Please sign in to comment.