Commit 60824aeb authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[json] Fix some -Wshadow warnings

Bug: v8:12244,v8:12245
Change-Id: I57d51bc26e05e6e33d8866681a887c09e7d332f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3219082Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77384}
parent 7c69f0c9
......@@ -153,8 +153,8 @@ MaybeHandle<Object> JsonParseInternalizer::InternalizeJsonProperty(
for (double i = 0; i < length; i++) {
HandleScope inner_scope(isolate_);
Handle<Object> index = isolate_->factory()->NewNumber(i);
Handle<String> name = isolate_->factory()->NumberToString(index);
if (!RecurseAndApply(object, name)) return MaybeHandle<Object>();
Handle<String> index_name = isolate_->factory()->NumberToString(index);
if (!RecurseAndApply(object, index_name)) return MaybeHandle<Object>();
}
} else {
Handle<FixedArray> contents;
......@@ -166,8 +166,8 @@ MaybeHandle<Object> JsonParseInternalizer::InternalizeJsonProperty(
Object);
for (int i = 0; i < contents->length(); i++) {
HandleScope inner_scope(isolate_);
Handle<String> name(String::cast(contents->get(i)), isolate_);
if (!RecurseAndApply(object, name)) return MaybeHandle<Object>();
Handle<String> key_name(String::cast(contents->get(i)), isolate_);
if (!RecurseAndApply(object, key_name)) return MaybeHandle<Object>();
}
}
}
......@@ -924,7 +924,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber() {
ReportUnexpectedCharacter(CurrentCharacter());
return handle(Smi::FromInt(0), isolate_);
}
base::uc32 c = CurrentCharacter();
c = CurrentCharacter();
STATIC_ASSERT(Smi::IsValid(-999999999));
STATIC_ASSERT(Smi::IsValid(999999999));
const int kMaxSmiLength = 9;
......@@ -944,7 +944,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber() {
}
if (CurrentCharacter() == '.') {
base::uc32 c = NextCharacter();
c = NextCharacter();
if (!IsDecimalDigit(c)) {
AllowGarbageCollection allow_before_exception;
ReportUnexpectedCharacter(c);
......@@ -954,7 +954,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber() {
}
if (AsciiAlphaToLower(CurrentCharacter()) == 'e') {
base::uc32 c = NextCharacter();
c = NextCharacter();
if (c == '-' || c == '+') c = NextCharacter();
if (!IsDecimalDigit(c)) {
AllowGarbageCollection allow_before_exception;
......
......@@ -777,7 +777,7 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
isolate_);
// TODO(rossberg): Should this throw?
if (!name->IsString()) continue;
Handle<String> key = Handle<String>::cast(name);
Handle<String> key_name = Handle<String>::cast(name);
PropertyDetails details =
map->instance_descriptors(isolate_).GetDetails(i);
if (details.IsDontEnum()) continue;
......@@ -791,9 +791,10 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
} else {
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate_, property,
Object::GetPropertyOrElement(isolate_, object, key), EXCEPTION);
Object::GetPropertyOrElement(isolate_, object, key_name),
EXCEPTION);
}
Result result = SerializeProperty(property, comma, key);
Result result = SerializeProperty(property, comma, key_name);
if (!comma && result == SUCCESS) comma = true;
if (result == EXCEPTION) return result;
}
......
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