Skip to content

Commit d2c805d

Browse files
author
David Ungar
committed
Addressed review comments.
1 parent f71b7e8 commit d2c805d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ extension ModuleDependencyGraph {
821821
return Int(u)
822822
}
823823
func internedString(field i: Int) throws -> InternedString {
824-
try InternedString(index: stringIndex(field: i))
824+
try InternedString(deserializedIndex: stringIndex(field: i))
825825
}
826826
func nonemptyInternedString(field i: Int) throws -> InternedString? {
827827
let s = try internedString(field: i)
@@ -988,6 +988,12 @@ extension ModuleDependencyGraph {
988988
}
989989
}
990990

991+
fileprivate extension InternedString {
992+
init(deserializedIndex: Int) {
993+
self.index = deserializedIndex
994+
}
995+
}
996+
991997
extension ModuleDependencyGraph {
992998
/// Attempts to serialize this dependency graph and write its contents
993999
/// to the given file path.

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/InternedStrings.swift

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ public struct InternedString: CustomStringConvertible, Equatable, Hashable {
2424
self.init(index: s.isEmpty ? 0 : table.intern(s))
2525
}
2626

27-
public var isEmpty: Bool { index == 0 }
28-
29-
// This constructor cannot be private because it is called from the `internedString`
30-
// method in ``ModuleDependencyGraph/deserialize/Visitor``.
31-
init(index: Int) {
27+
private init(index: Int) {
3228
self.index = index
3329
}
3430

31+
public var isEmpty: Bool { index == 0 }
32+
3533
public static var empty: Self {
3634
let r = Self(index: 0)
3735
assert(r.isEmpty)

0 commit comments

Comments
 (0)