Commit 6577c5e9 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[builtins][date] Fix -Wshadow warnings

Bug: v8:12244,v8:12245
Change-Id: I5fdc754432c7f619f4a32f92eb2da81beb23e8ce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3278689Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77910}
parent 8bcb3f57
......@@ -445,12 +445,12 @@ BUILTIN(DatePrototypeSetMinutes) {
// ES6 section 20.3.4.25 Date.prototype.setMonth ( month, date )
BUILTIN(DatePrototypeSetMonth) {
HandleScope scope(isolate);
CHECK_RECEIVER(JSDate, date, "Date.prototype.setMonth");
CHECK_RECEIVER(JSDate, this_date, "Date.prototype.setMonth");
int const argc = args.length() - 1;
Handle<Object> month = args.atOrUndefined(isolate, 1);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, month,
Object::ToNumber(isolate, month));
double time_val = date->value().Number();
double time_val = this_date->value().Number();
if (!std::isnan(time_val)) {
int64_t const time_ms = static_cast<int64_t>(time_val);
int64_t local_time_ms = isolate->date_cache()->ToLocal(time_ms);
......@@ -468,7 +468,7 @@ BUILTIN(DatePrototypeSetMonth) {
}
time_val = MakeDate(MakeDay(year, m, dt), time_within_day);
}
return SetLocalDateValue(isolate, date, time_val);
return SetLocalDateValue(isolate, this_date, time_val);
}
// ES6 section 20.3.4.26 Date.prototype.setSeconds ( sec, ms )
......@@ -662,12 +662,12 @@ BUILTIN(DatePrototypeSetUTCMinutes) {
// ES6 section 20.3.4.31 Date.prototype.setUTCMonth ( month, date )
BUILTIN(DatePrototypeSetUTCMonth) {
HandleScope scope(isolate);
CHECK_RECEIVER(JSDate, date, "Date.prototype.setUTCMonth");
CHECK_RECEIVER(JSDate, this_date, "Date.prototype.setUTCMonth");
int const argc = args.length() - 1;
Handle<Object> month = args.atOrUndefined(isolate, 1);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, month,
Object::ToNumber(isolate, month));
double time_val = date->value().Number();
double time_val = this_date->value().Number();
if (!std::isnan(time_val)) {
int64_t const time_ms = static_cast<int64_t>(time_val);
int days = isolate->date_cache()->DaysFromTime(time_ms);
......@@ -684,7 +684,7 @@ BUILTIN(DatePrototypeSetUTCMonth) {
}
time_val = MakeDate(MakeDay(year, m, dt), time_within_day);
}
return *JSDate::SetValue(date, DateCache::TimeClip(time_val));
return *JSDate::SetValue(this_date, DateCache::TimeClip(time_val));
}
// ES6 section 20.3.4.34 Date.prototype.setUTCSeconds ( sec, ms )
......
......@@ -94,9 +94,9 @@ bool DateParser::Parse(Isolate* isolate, base::Vector<Char> str, double* out) {
} else if (scanner.SkipSymbol('.') && time.IsExpecting(n)) {
time.Add(n);
if (!scanner.Peek().IsNumber()) return false;
int n = ReadMilliseconds(scanner.Next());
if (n < 0) return false;
time.AddFinal(n);
int ms = ReadMilliseconds(scanner.Next());
if (ms < 0) return false;
time.AddFinal(ms);
} else if (tz.IsExpecting(n)) {
tz.SetAbsoluteMinute(n);
} else if (time.IsExpecting(n)) {
......@@ -138,9 +138,9 @@ bool DateParser::Parse(Isolate* isolate, base::Vector<Char> str, double* out) {
int n = 0;
int length = 0;
if (scanner.Peek().IsNumber()) {
DateToken token = scanner.Next();
length = token.length();
n = token.number();
DateToken next_token = scanner.Next();
length = next_token.length();
n = next_token.number();
}
has_read_number = 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