Back out c5619fbfb2b1 to fix orange.

This commit is contained in:
Peter Van der Beken 2009-11-21 15:48:49 +01:00
parent f2a138cf95
commit 7d0dd55d2d
8 changed files with 15 additions and 82 deletions

View File

@ -1,22 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xml" href="#bug"?>
<!DOCTYPE doc [
<!ATTLIST xsl:transform
id ID #REQUIRED>
]>
<doc>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
id="bug">
<xsl:variable name="v0">
<xsl:for-each select="$v0" />
</xsl:variable>
<xsl:template name="t2" match="/">
<xsl:copy-of select="number($v0)" />
</xsl:template>
</xsl:transform>
<e1 />
</doc>

View File

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xml" href="#bug"?>
<!DOCTYPE doc [
<!ATTLIST xsl:transform
id ID #REQUIRED>
]>
<doc>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslstrings="http://exslt.org/strings"
version="2.0"
id="bug">
<xsl:variable name="v0" select="$v0" />
<xsl:template name="t2" match="/">
<xsl:param name="p0" select="exslstrings:tokenize('1234','foobar')" />
<xsl:copy-of select="round($v0)" />
</xsl:template>
</xsl:transform>
</doc>

View File

@ -6,5 +6,3 @@ load 406106-1.html
load 483444.xml
load 485217.xml
load 485286.xml
load 528300.xml
load 528488.xml

View File

@ -387,9 +387,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
rv = mParams[0]->evaluateToString(aContext, src);
NS_ENSURE_SUCCESS(rv, rv);
double start;
rv = evaluateToNumber(mParams[1], aContext, &start);
NS_ENSURE_SUCCESS(rv, rv);
double start = evaluateToNumber(mParams[1], aContext);
// check for NaN or +/-Inf
if (Double::isNaN(start) ||
@ -404,10 +402,8 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
double end;
if (mParams.Length() == 3) {
rv = evaluateToNumber(mParams[2], aContext, &end);
NS_ENSURE_SUCCESS(rv, rv);
end += start;
end = start + evaluateToNumber(mParams[2],
aContext);
if (Double::isNaN(end) || end < 0) {
aContext->recycler()->getEmptyStringResult(aResult);
@ -535,8 +531,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
{
double res;
if (!mParams.IsEmpty()) {
rv = evaluateToNumber(mParams[0], aContext, &res);
NS_ENSURE_SUCCESS(rv, rv);
res = evaluateToNumber(mParams[0], aContext);
}
else {
nsAutoString resultStr;
@ -548,10 +543,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
}
case ROUND:
{
double dbl;
rv = evaluateToNumber(mParams[0], aContext, &dbl);
NS_ENSURE_SUCCESS(rv, rv);
double dbl = evaluateToNumber(mParams[0], aContext);
if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
if (Double::isNeg(dbl) && dbl >= -0.5) {
dbl *= 0;
@ -565,10 +557,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
}
case FLOOR:
{
double dbl;
rv = evaluateToNumber(mParams[0], aContext, &dbl);
NS_ENSURE_SUCCESS(rv, rv);
double dbl = evaluateToNumber(mParams[0], aContext);
if (!Double::isNaN(dbl) &&
!Double::isInfinite(dbl) &&
!(dbl == 0 && Double::isNeg(dbl))) {
@ -579,10 +568,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
}
case CEILING:
{
double dbl;
rv = evaluateToNumber(mParams[0], aContext, &dbl);
NS_ENSURE_SUCCESS(rv, rv);
double dbl = evaluateToNumber(mParams[0], aContext);
if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
if (Double::isNeg(dbl) && dbl > -1) {
dbl *= 0;

View File

@ -330,8 +330,7 @@ protected:
/*
* Evaluates the given Expression and converts its result to a number.
*/
static nsresult evaluateToNumber(Expr* aExpr, txIEvalContext* aContext,
double* aResult);
static double evaluateToNumber(Expr* aExpr, txIEvalContext* aContext);
/*
* Evaluates the given Expression and converts its result to a NodeSet.

View File

@ -52,19 +52,15 @@
/*
* Evaluates the given Expression and converts its result to a number.
*/
// static
nsresult
FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext,
double* aResult)
double FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext)
{
NS_ASSERTION(aExpr, "missing expression");
nsRefPtr<txAExprResult> exprResult;
nsresult rv = aExpr->evaluate(aContext, getter_AddRefs(exprResult));
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv))
return Double::NaN;
*aResult = exprResult->numberValue();
return NS_OK;
return exprResult->numberValue();
}
/*

View File

@ -479,11 +479,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext,
}
case eNUMBER:
{
double dbl;
rv = evaluateToNumber(mParams[0], aContext, &dbl);
NS_ENSURE_SUCCESS(rv, rv);
invokeParam.val.d = dbl;
invokeParam.val.d = evaluateToNumber(expr, aContext);
break;
}
case eSTRING:

View File

@ -84,11 +84,10 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
double value;
txExpandedName formatName;
nsresult rv = evaluateToNumber(mParams[0], aContext, &value);
NS_ENSURE_SUCCESS(rv, rv);
value = evaluateToNumber(mParams[0], aContext);
nsAutoString formatStr;
rv = mParams[1]->evaluateToString(aContext, formatStr);
nsresult rv = mParams[1]->evaluateToString(aContext, formatStr);
NS_ENSURE_SUCCESS(rv, rv);
if (mParams.Length() == 3) {