1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:18:11 +00:00

js: Use const where possible in parse_and_run()

This commit is contained in:
Evan Smal 2023-02-03 23:09:35 -05:00 committed by Linus Groh
parent 698bcf4b4e
commit ff5a8a21e8

View file

@ -283,13 +283,13 @@ static ErrorOr<bool> parse_and_run(JS::Interpreter& interpreter, StringView sour
if (!thrown_value.is_object() || !is<JS::Error>(thrown_value.as_object())) if (!thrown_value.is_object() || !is<JS::Error>(thrown_value.as_object()))
return {}; return {};
auto& traceback = static_cast<JS::Error const&>(thrown_value.as_object()).traceback(); auto const& traceback = static_cast<JS::Error const&>(thrown_value.as_object()).traceback();
if (traceback.size() > 1) { if (traceback.size() > 1) {
unsigned repetitions = 0; unsigned repetitions = 0;
for (size_t i = 0; i < traceback.size(); ++i) { for (size_t i = 0; i < traceback.size(); ++i) {
auto& traceback_frame = traceback[i]; auto const& traceback_frame = traceback[i];
if (i + 1 < traceback.size()) { if (i + 1 < traceback.size()) {
auto& next_traceback_frame = traceback[i + 1]; auto const& next_traceback_frame = traceback[i + 1];
if (next_traceback_frame.function_name == traceback_frame.function_name) { if (next_traceback_frame.function_name == traceback_frame.function_name) {
repetitions++; repetitions++;
continue; continue;