Commit 790518c1 authored by jbroman's avatar jbroman Committed by Commit bot

Trivial simplification in JSObject::AddDataElement.

Spotted by clang static analyzer, these variables are declared outside of
the condition but only used within.

Review-Url: https://codereview.chromium.org/2668003002
Cr-Commit-Position: refs/heads/master@{#42970}
parent ae40e968
......@@ -15491,12 +15491,10 @@ Maybe<bool> JSObject::AddDataElement(Handle<JSObject> object, uint32_t index,
ElementsAccessor* accessor = ElementsAccessor::ForKind(to);
accessor->Add(object, index, value, attributes, new_capacity);
uint32_t new_length = old_length;
Handle<Object> new_length_handle;
if (object->IsJSArray() && index >= old_length) {
new_length = index + 1;
new_length_handle = isolate->factory()->NewNumberFromUint(new_length);
JSArray::cast(*object)->set_length(*new_length_handle);
Handle<Object> new_length =
isolate->factory()->NewNumberFromUint(index + 1);
JSArray::cast(*object)->set_length(*new_length);
}
return Just(true);
......
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