diff options
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp')
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp index 6d7d934062..1879c3faa0 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp @@ -36,7 +36,7 @@ #include <wtf/MathExtras.h> #if PLATFORM(WINCE) && !PLATFORM(QT) -extern "C" time_t time(time_t* timer); //provided by libce +extern "C" time_t time(time_t* timer); // Provided by libce. #endif #if HAVE(SYS_TIME_H) @@ -51,8 +51,6 @@ using namespace WTF; namespace JSC { -// TODO: MakeTime (15.9.11.1) etc. ? - ASSERT_CLASS_FITS_IN_CELL(DateConstructor); static JSValue JSC_HOST_CALL dateParse(ExecState*, JSObject*, JSValue, const ArgList&); @@ -81,7 +79,7 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) if (numArgs == 0) // new Date() ECMA 15.9.3.3 value = getCurrentUTCTime(); else if (numArgs == 1) { - if (args.at(0).isObject(&DateInstance::info)) + if (args.at(0).inherits(&DateInstance::info)) value = asDateInstance(args.at(0))->internalNumber(); else { JSValue primitive = args.at(0).toPrimitive(exec); @@ -100,17 +98,17 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) || (numArgs >= 7 && isnan(args.at(6).toNumber(exec)))) value = NaN; else { - GregorianDateTime t; - int year = args.at(0).toInt32(exec); - t.year = (year >= 0 && year <= 99) ? year : year - 1900; - t.month = args.at(1).toInt32(exec); - t.monthDay = (numArgs >= 3) ? args.at(2).toInt32(exec) : 1; - t.hour = args.at(3).toInt32(exec); - t.minute = args.at(4).toInt32(exec); - t.second = args.at(5).toInt32(exec); - t.isDST = -1; - double ms = (numArgs >= 7) ? args.at(6).toNumber(exec) : 0; - value = gregorianDateTimeToMS(t, ms, false); + GregorianDateTime t; + int year = args.at(0).toInt32(exec); + t.year = (year >= 0 && year <= 99) ? year : year - 1900; + t.month = args.at(1).toInt32(exec); + t.monthDay = (numArgs >= 3) ? args.at(2).toInt32(exec) : 1; + t.hour = args.at(3).toInt32(exec); + t.minute = args.at(4).toInt32(exec); + t.second = args.at(5).toInt32(exec); + t.isDST = -1; + double ms = (numArgs >= 7) ? args.at(6).toNumber(exec) : 0; + value = gregorianDateTimeToMS(t, ms, false); } } |