diff --git a/prototype/Doubt/Location.swift b/prototype/Doubt/Location.swift index 240725407..f812006ea 100644 --- a/prototype/Doubt/Location.swift +++ b/prototype/Doubt/Location.swift @@ -24,7 +24,7 @@ public struct Location: SequenceType { public var into: Location? { return _into(it) } - public var up: Location? { return _up(it) } + public var outOf: Location? { return _up(it) } public var left: Location? { return _left(it) } @@ -32,7 +32,7 @@ public struct Location: SequenceType { /// The root `Location` in the current exploration. public var root: Location { - return up?.root ?? self + return outOf?.root ?? self } @@ -43,7 +43,7 @@ public struct Location: SequenceType { /// Returns the logically next `Location` after the receiver and its children in a pre-order depth-first traversal. private var nextAfter: Location? { - return right ?? up?.nextAfter + return right ?? outOf?.nextAfter } diff --git a/prototype/DoubtTests/LocationTests.swift b/prototype/DoubtTests/LocationTests.swift index 4f939d842..068969e1b 100644 --- a/prototype/DoubtTests/LocationTests.swift +++ b/prototype/DoubtTests/LocationTests.swift @@ -4,7 +4,7 @@ final class LocationTests: XCTestCase { } func testCannotMoveUpwardsAtTheStartOfAnExploration() { - assert(term.explore().up?.it, ==, nil) + assert(term.explore().outOf?.it, ==, nil) } func testCannotMoveSidewaysAtTheStartOfAnExploration() { @@ -21,7 +21,7 @@ final class LocationTests: XCTestCase { } func testCanMoveBackUpwards() { - assert(term.explore().into?.up?.it, ==, term) + assert(term.explore().into?.outOf?.it, ==, term) } func testCannotMoveLeftwardsFromFirstChildOfBranch() { @@ -37,7 +37,7 @@ final class LocationTests: XCTestCase { } func testCanMoveBackUpwardsFromDeepExplorations() { - assert(term.explore().into?.right?.right?.into?.right?.up?.up?.it, ==, term) + assert(term.explore().into?.right?.right?.into?.right?.outOf?.outOf?.it, ==, term) } func testCanReturnToStartOfExplorationFromArbitrarilyDeepNodes() { @@ -49,11 +49,11 @@ final class LocationTests: XCTestCase { } func testModifyReplacesSubtrees() { - assert(term.explore().into?.modify(const(leafB)).right?.up?.it, ==, Cofree(0, .Indexed([ leafB, leafB, keyed ]))) + assert(term.explore().into?.modify(const(leafB)).right?.outOf?.it, ==, Cofree(0, .Indexed([ leafB, leafB, keyed ]))) } func testMultipleModificationsReplaceMultipleSubtrees() { - assert(term.explore().into?.modify(const(leafB)).right?.modify(const(leafA)).up?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ]))) + assert(term.explore().into?.modify(const(leafB)).right?.modify(const(leafA)).outOf?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ]))) } func testModificationsPreserveKeys() {