Fix loss of boolean type information through assignment due to changes in commit 5854.

Do proper cloning on ExpOperation when resolving fields and do proper detection for number conversion on boolean values.



git-svn-id: http://voip.null.ro/svn/yate@5856 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
oana 2014-06-25 14:09:32 +00:00
parent 06353655f8
commit c07e3cc6f3
2 changed files with 2 additions and 5 deletions

View File

@ -338,11 +338,8 @@ bool JsObject::runField(ObjList& stack, const ExpOperation& oper, GenObject* con
if (w)
ExpEvaluator::pushOne(stack,w->clone(oper.name()));
else {
bool num = true;
ExpOperation* o = YOBJECT(ExpOperation,param);
if (o && !o->isNumber())
num = false;
ExpEvaluator::pushOne(stack,new ExpOperation(*param,oper.name(),num));
ExpEvaluator::pushOne(stack,o ? new ExpOperation(*o,oper.name()) : new ExpOperation(*param,oper.name(),true));
}
}
}

View File

@ -976,7 +976,7 @@ public:
m_bool(autoNum && value.isBoolean()),
m_isNumber(autoNum && (value == YSTRING("NaN") || m_number != nonInteger())),
m_lineNo(0), m_barrier(false)
{ if (m_bool) m_number = value.toBoolean() ? 1 : 0; }
{ if (m_bool) { m_number = value.toBoolean() ? 1 : 0; m_isNumber = true;} }
/**
* Push literal string constructor