dom/xslt/xpath/txUnaryExpr.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "txExpr.h"
     7 #include "txIXPathContext.h"
     9 /*
    10  * Evaluates this Expr based on the given context node and processor state
    11  * @param context the context node for evaluation of this Expr
    12  * @param ps the ContextState containing the stack information needed
    13  * for evaluation.
    14  * @return the result of the evaluation.
    15  */
    16 nsresult
    17 UnaryExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
    18 {
    19     *aResult = nullptr;
    21     nsRefPtr<txAExprResult> exprRes;
    22     nsresult rv = expr->evaluate(aContext, getter_AddRefs(exprRes));
    23     NS_ENSURE_SUCCESS(rv, rv);
    25     double value = exprRes->numberValue();
    26 #ifdef HPUX
    27     /*
    28      * Negation of a zero doesn't produce a negative
    29      * zero on HPUX. Perform the operation by multiplying with
    30      * -1.
    31      */
    32     return aContext->recycler()->getNumberResult(-1 * value, aResult);
    33 #else
    34     return aContext->recycler()->getNumberResult(-value, aResult);
    35 #endif
    36 }
    38 TX_IMPL_EXPR_STUBS_1(UnaryExpr, NODESET_RESULT, expr)
    40 bool
    41 UnaryExpr::isSensitiveTo(ContextSensitivity aContext)
    42 {
    43     return expr->isSensitiveTo(aContext);
    44 }
    46 #ifdef TX_TO_STRING
    47 void
    48 UnaryExpr::toString(nsAString& str)
    49 {
    50     if (!expr)
    51         return;
    52     str.Append(char16_t('-'));
    53     expr->toString(str);
    54 }
    55 #endif

mercurial