mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
location -> loc abbreviation (#3826)
This commit is contained in:
@@ -35,7 +35,7 @@ auto TokenizedBuffer::GetColumnNumber(TokenIndex token) const -> int {
|
||||
return GetTokenInfo(token).column + 1;
|
||||
}
|
||||
|
||||
auto TokenizedBuffer::GetEndLocation(TokenIndex token) const
|
||||
auto TokenizedBuffer::GetEndLoc(TokenIndex token) const
|
||||
-> std::pair<LineIndex, int> {
|
||||
auto line = GetLine(token);
|
||||
int column = GetColumnNumber(token);
|
||||
@@ -345,8 +345,8 @@ auto TokenIterator::Print(llvm::raw_ostream& output) const -> void {
|
||||
output << token_.index;
|
||||
}
|
||||
|
||||
auto TokenizedBuffer::SourceBufferDiagnosticConverter::ConvertLocation(
|
||||
const char* loc, ContextFnT /*context_fn*/) const -> DiagnosticLocation {
|
||||
auto TokenizedBuffer::SourceBufferDiagnosticConverter::ConvertLoc(
|
||||
const char* loc, ContextFnT /*context_fn*/) const -> DiagnosticLoc {
|
||||
CARBON_CHECK(StringRefContainsPointer(buffer_->source_->text(), loc))
|
||||
<< "location not within buffer";
|
||||
int64_t offset = loc - buffer_->source_->text().begin();
|
||||
@@ -390,9 +390,9 @@ auto TokenizedBuffer::SourceBufferDiagnosticConverter::ConvertLocation(
|
||||
.column_number = column_number + 1};
|
||||
}
|
||||
|
||||
auto TokenDiagnosticConverter::ConvertLocation(TokenIndex token,
|
||||
ContextFnT context_fn) const
|
||||
-> DiagnosticLocation {
|
||||
auto TokenDiagnosticConverter::ConvertLoc(TokenIndex token,
|
||||
ContextFnT context_fn) const
|
||||
-> DiagnosticLoc {
|
||||
// Map the token location into a position within the source buffer.
|
||||
const auto& token_info = buffer_->GetTokenInfo(token);
|
||||
const auto& line_info = buffer_->GetLineInfo(token_info.token_line);
|
||||
@@ -402,8 +402,8 @@ auto TokenDiagnosticConverter::ConvertLocation(TokenIndex token,
|
||||
// Find the corresponding file location.
|
||||
// TODO: Should we somehow indicate in the diagnostic location if this token
|
||||
// is a recovery token that doesn't correspond to the original source?
|
||||
DiagnosticLocation loc =
|
||||
TokenizedBuffer::SourceBufferDiagnosticConverter(buffer_).ConvertLocation(
|
||||
DiagnosticLoc loc =
|
||||
TokenizedBuffer::SourceBufferDiagnosticConverter(buffer_).ConvertLoc(
|
||||
token_start, context_fn);
|
||||
loc.length = buffer_->GetTokenText(token).size();
|
||||
return loc;
|
||||
|
||||
Reference in New Issue
Block a user