Skip to content

Commit

Permalink
[Date] setTime is also allowed for not-Date-objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludger Krämer committed Jun 3, 2012
1 parent 6745674 commit f7988c7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/scripting/toplevel/Date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,21 @@ ASFUNCTIONBODY(Date,setUTCMilliseconds)

ASFUNCTIONBODY(Date,setTime)
{
assert_and_throw(obj->is<Date>());
Date* th=static_cast<Date*>(obj);
number_t ms;
ARG_UNPACK (ms, Number::NaN);
if (!obj->is<Date>())
{
multiname name(NULL);
name.name_type=multiname::NAME_STRING;
name.name_s_id=getSys()->getUniqueStringId("value");
name.ns.push_back(nsNameAndKind("",NAMESPACE));
name.ns.push_back(nsNameAndKind(AS3,NAMESPACE));
name.isAttribute = true;
obj->setVariableByMultiname(name,abstract_d(ms),CONST_NOT_ALLOWED);
return abstract_d(ms);
}
assert_and_throw(obj->is<Date>());
Date* th=static_cast<Date*>(obj);

if (std::isnan(ms))
{
Expand Down

0 comments on commit f7988c7

Please sign in to comment.