Skip to content

Commit 79a2d4d

Browse files
authored
Merge pull request #49 from vapor/build-errors
Build errors
2 parents 9fffbb4 + 6928480 commit 79a2d4d

28 files changed

+95
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/.build
33
/Packages
44
/*.xcodeproj
5+
Package.pins

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ sudo: required
66
dist: trusty
77
osx_image: xcode8
88
script:
9-
- eval "$(curl -sL swift.vapor.sh/ci)"
9+
- eval "$(curl -sL swift.vapor.sh/ci-3.1)"
1010
- eval "$(curl -sL swift.vapor.sh/codecov)"

Sources/Leaf/Buffer/Buffer+Leaf.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ extension BufferProtocol where Element == Byte {
9595
guard current == .leftParenthesis else {
9696
throw ParseError.expectedOpenParenthesis
9797
}
98-
return name.string
98+
return name.makeString()
9999
}
100100

101101
mutating func extractInstructionParameters() throws -> [Parameter] {
@@ -106,13 +106,13 @@ extension BufferProtocol where Element == Byte {
106106
mutating func extractBody() throws -> String {
107107
return try extractSection(opensWith: .leftCurlyBracket, closesWith: .rightCurlyBracket)
108108
.trimmed(.whitespace)
109-
.string
109+
.makeString()
110110
}
111111

112112
mutating func extractSection(opensWith opener: Byte, closesWith closer: Byte) throws -> Bytes {
113113
guard current == opener else {
114-
let have = current.flatMap { [$0] }?.string
115-
throw ParseError.missingBodyOpener(expected: [opener].string, have: have)
114+
let have = current.flatMap { [$0] }?.makeString()
115+
throw ParseError.missingBodyOpener(expected: [opener].makeString(), have: have)
116116
}
117117

118118
var subBodies = 0
@@ -129,7 +129,7 @@ extension BufferProtocol where Element == Byte {
129129
}
130130

131131
guard current == closer else {
132-
throw ParseError.missingBodyCloser(expected: [closer].string)
132+
throw ParseError.missingBodyCloser(expected: [closer].makeString())
133133
}
134134

135135
return body

Sources/Leaf/Context.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public final class Context {
3939

4040
// TODO: Subscripts
4141

42-
func get<T: PathIndex>(path: [T]) -> Node? {
42+
func get<T: PathIndexer>(path: [T]) -> Node? {
4343
var next = queue.tip
4444
repeat {
4545
if let value = next?.value[path] { return value }

Sources/Leaf/HTMLEscape.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ extension String {
3838
.joined(separator: "&lt;".makeBytes())
3939
.split(separator: .greaterThan, omittingEmptySubsequences: false)
4040
.joined(separator: "&gt;".makeBytes())
41-
.string
41+
.makeString()
4242
}
4343
}

Sources/Leaf/LeafComponent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension Leaf.Component: CustomStringConvertible {
2323
public var description: String {
2424
switch self {
2525
case let .raw(r):
26-
return ".raw(\(r.string))"
26+
return ".raw(\(r.makeString()))"
2727
case let .tagTemplate(i):
2828
return ".tagTemplate(\(i))"
2929
case let .chain(chain):

Sources/Leaf/Node+Rendered.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extension Node {
22
func rendered() throws -> Bytes {
3-
switch self {
3+
switch self.wrapped {
44
case .array(_), .object(_), .null:
55
return []
66
case let .bool(bool):

Sources/Leaf/Parameter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ extension Parameter {
4848
let bytes = bytes.array.trimmed(.whitespace)
4949
guard !bytes.isEmpty else { throw Error.nonEmptyArgumentRequired }
5050
if bytes.count > 1, bytes.first == .quote, bytes.last == .quote {
51-
self = .constant(value: bytes.dropFirst().dropLast().string)
51+
self = .constant(value: bytes.dropFirst().dropLast().makeString())
5252
} else {
5353
let path = bytes.split(
5454
separator: .period,
5555
omittingEmptySubsequences: true
5656
)
57-
.map { $0.string }
57+
.map { $0.makeString() }
5858
self = .variable(path: path)
5959
}
6060
}

Sources/Leaf/Stem+Spawn.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extension Stem {
77
let raw = raw.trimmed(.whitespace)
88
var buffer = Buffer(raw)
99
let components = try buffer.components(stem: self).map(postCompile)
10-
var leaf = Leaf(raw: raw.string, components: components)
10+
var leaf = Leaf(raw: raw.makeString(), components: components)
1111
try tags.values.forEach {
1212
leaf = try $0.postCompile(stem: self, leaf: leaf)
1313
}
@@ -26,7 +26,7 @@ extension Stem {
2626
let path = workingDirectory + name
2727
let bytes = try Bytes.load(path: path)
2828
let component = Leaf.Component.raw(bytes)
29-
let leaf = Leaf(raw: bytes.string, components: [component])
29+
let leaf = Leaf(raw: bytes.makeString(), components: [component])
3030
cache(leaf, named: name)
3131
return leaf
3232
}

Sources/Leaf/Tag/Models/Equal.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ fileprivate func fuzzyEquals(_ lhs: Node?, _ rhs: Node?) -> Bool {
2525
let lhs = lhs ?? .null
2626
let rhs = rhs ?? .null
2727

28-
switch lhs {
28+
switch lhs.wrapped {
2929
case let .array(lhs):
30-
guard let rhs = rhs.nodeArray else { return false }
30+
guard let rhs = rhs.array else { return false }
3131
guard lhs.count == rhs.count else { return false }
32-
for (l, r) in zip(lhs, rhs) where !fuzzyEquals(l, r) { return false }
32+
for (l, r) in zip(lhs, rhs) where !fuzzyEquals(Node(l), r) { return false }
3333
return true
3434
case let .bool(bool):
3535
return bool == rhs.bool
3636
case let .bytes(bytes):
37-
guard case let .bytes(rhs) = rhs else { return false }
37+
guard case let .bytes(rhs) = rhs.wrapped else { return false }
3838
return bytes == rhs
3939
case .null:
4040
return rhs.isNull
@@ -48,15 +48,15 @@ fileprivate func fuzzyEquals(_ lhs: Node?, _ rhs: Node?) -> Bool {
4848
return uint == rhs.uint
4949
}
5050
case let .object(lhs):
51-
guard let rhs = rhs.nodeObject else { return false }
51+
guard let rhs = rhs.object else { return false }
5252
guard lhs.count == rhs.count else { return false }
53-
for (k, v) in lhs where !fuzzyEquals(v, rhs[k]) { return false }
53+
for (k, v) in lhs where !fuzzyEquals(Node(v), rhs[k]) { return false }
5454
return true
5555
case let .string(string):
5656
return string == rhs.string
5757
case let .date(date):
5858
// FIXME: Add fuzzy date access and equality?
59-
guard case let .date(right) = rhs else { return false }
59+
guard case let .date(right) = rhs.wrapped else { return false }
6060
return date == right
6161
}
6262
}

0 commit comments

Comments
 (0)