[IDE] Utils: Allow indexed access to DelayedStringRetriever. (#7567)

This commit is contained in:
Xi Ge
2017-02-17 11:34:29 -08:00
committed by GitHub
parent d4c341b154
commit 2bfe5418a0

View File

@@ -320,11 +320,15 @@ public:
size_t preferred_buffer_size() const override {
return 0;
}
void retrieve(llvm::function_ref<void(StringRef)> F) {
void retrieve(llvm::function_ref<void(StringRef)> F) const {
for (auto P : StartEnds) {
F(StringRef(OS.begin() + P.first, P.second - P.first));
}
}
StringRef operator[](unsigned I) const {
auto P = StartEnds[I];
return StringRef(OS.begin() + P.first, P.second - P.first);
}
};
} // namespace ide
} // namespace swift