Commit bcba0f71 authored by Kenton Varda's avatar Kenton Varda

OCD style tweaks.

parent ff90d639
......@@ -159,16 +159,15 @@ Lexer::Lexer(Orphanage orphanageParam, ErrorReporter& errorReporter)
return nullptr;
} else {
uint restSize = rest.size();
if (rest.size() > 0 && rest[restSize - 1] == nullptr) {
if (restSize > 0 && rest[restSize - 1] == nullptr) {
// Allow for trailing commas by shortening the list by one item if the final token is
// nullptr
restSize--;
}
auto result = kj::heapArrayBuilder<kj::Array<Orphan<Token>>>(1 + restSize); // first + rest
auto result = kj::heapArrayBuilder<kj::Array<Orphan<Token>>>(1 + restSize); // first+rest
result.add(kj::mv(first));
for (uint i = 0; i < restSize ; i++) {
auto& item = rest[i];
result.add(kj::mv(item));
result.add(kj::mv(rest[i]));
}
return result.finish();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment