[INFER] Fix parseInt to return integers instead of doubles where possible, rewrite some setNumber calls, bug 662766. r=bhackett
This commit is contained in:
@@ -443,8 +443,8 @@ num_parseInt(JSContext *cx, uintN argc, Value *vp)
|
||||
if (vp[2].isDouble() &&
|
||||
vp[2].toDouble() > -1.0e21 &&
|
||||
vp[2].toDouble() < 1.0e21) {
|
||||
vp->setDouble(ParseIntDoubleHelper(vp[2].toDouble()));
|
||||
MarkTypeCallerOverflow(cx);
|
||||
if (!vp->setNumber(ParseIntDoubleHelper(vp[2].toDouble())))
|
||||
MarkTypeCallerOverflow(cx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -483,8 +483,7 @@ num_parseInt(JSContext *cx, uintN argc, Value *vp)
|
||||
return false;
|
||||
|
||||
/* Step 15. */
|
||||
vp->setNumber(number);
|
||||
if (!vp->isInt32())
|
||||
if (!vp->setNumber(number))
|
||||
MarkTypeCallerOverflow(cx);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user