mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Fixup Date.prototype.setYear
* Read [[DateValue]] and then call ToNumber when stored time-value is valid Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
be331e04c3
commit
d49aece60c
2 changed files with 7 additions and 11 deletions
|
|
@ -451,6 +451,12 @@ static Value builtinDateSetYear(ExecutionState& state, Value thisValue, size_t a
|
|||
|
||||
double y;
|
||||
int month, date, hour, minute, second, millisecond;
|
||||
month = d->getMonth(state);
|
||||
date = d->getDate(state);
|
||||
hour = d->getHours(state);
|
||||
minute = d->getMinutes(state);
|
||||
second = d->getSeconds(state);
|
||||
millisecond = d->getMilliseconds(state);
|
||||
|
||||
// Let y be ToNumber(year).
|
||||
y = argv[0].toNumber(state);
|
||||
|
|
@ -460,13 +466,6 @@ static Value builtinDateSetYear(ExecutionState& state, Value thisValue, size_t a
|
|||
return Value(Value::NanInit);
|
||||
}
|
||||
|
||||
month = d->getMonth(state);
|
||||
date = d->getDate(state);
|
||||
hour = d->getHours(state);
|
||||
minute = d->getMinutes(state);
|
||||
second = d->getSeconds(state);
|
||||
millisecond = d->getMilliseconds(state);
|
||||
|
||||
double yyyy;
|
||||
double yAsInteger = Value(Value::DoubleToIntConvertibleTestNeeds, y).toInteger(state);
|
||||
// If y is not NaN and 0 ≤ ToInteger(y) ≤ 99, let yyyy be ToInteger(y) + 1900.
|
||||
|
|
@ -477,9 +476,7 @@ static Value builtinDateSetYear(ExecutionState& state, Value thisValue, size_t a
|
|||
yyyy = y;
|
||||
}
|
||||
|
||||
if (d->isValid()) {
|
||||
d->setTimeValue(state, yyyy, month, date, hour, minute, second, millisecond);
|
||||
}
|
||||
d->setTimeValue(state, yyyy, month, date, hour, minute, second, millisecond);
|
||||
|
||||
return Value(Value::DoubleToIntConvertibleTestNeeds, d->primitiveValue());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
<test id="built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1"><reason>TOO SLOW</reason></test>
|
||||
<test id="staging/sm/regress/regress-1507322-deep-weakmap"><reason>TOO SLOW</reason></test>
|
||||
<test id="staging/Temporal/v8/instant-to-json"><reason>TODO(sometimes fail)</reason></test>
|
||||
<test id="annexB/built-ins/Date/prototype/setYear/date-value-read-before-tonumber-when-date-is-valid"><reason>TODO</reason></test>
|
||||
<test id="annexB/language/comments/multi-line-html-close"><reason>TODO</reason></test>
|
||||
<test id="annexB/language/comments/single-line-html-close-first-line-1"><reason>TODO</reason></test>
|
||||
<test id="annexB/language/comments/single-line-html-close-first-line-2"><reason>TODO</reason></test>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue