Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/xslt/xpath/txUnaryExpr.cpp
Line
Count
Source (jump to first uncovered line)
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/. */
5
6
#include "txExpr.h"
7
#include "txIXPathContext.h"
8
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
0
{
19
0
    *aResult = nullptr;
20
0
21
0
    RefPtr<txAExprResult> exprRes;
22
0
    nsresult rv = expr->evaluate(aContext, getter_AddRefs(exprRes));
23
0
    NS_ENSURE_SUCCESS(rv, rv);
24
0
25
0
    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
0
#endif
36
0
}
37
38
TX_IMPL_EXPR_STUBS_1(UnaryExpr, NODESET_RESULT, expr)
39
40
bool
41
UnaryExpr::isSensitiveTo(ContextSensitivity aContext)
42
0
{
43
0
    return expr->isSensitiveTo(aContext);
44
0
}
45
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