In the event that a for loop iterates over Values and also referes to elements not defined by the for loop, find_value_in_for_loop would needlessly call ForLoop::get_current_value for each of those lookups.
ForLoop::get_current_value can be expensive, potentially incurring a clone of a possibly large Value.
This change moves the get_current_value call so that we only clone a Value when needed.
In the event that a for loop iterates over
Value
s and also referes to elements not defined by the for loop,find_value_in_for_loop
would needlessly callForLoop::get_current_value
for each of those lookups.ForLoop::get_current_value
can be expensive, potentially incurring a clone of a possibly largeValue
.This change moves the
get_current_value
call so that we only clone aValue
when needed.