LCOV - code coverage report
Current view: top level - dom/xslt/xpath - txUnionExpr.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 38 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "txNodeSet.h"
       9             : 
      10             :   //-------------/
      11             :  //- UnionExpr -/
      12             : //-------------/
      13             : 
      14             :     //-----------------------------/
      15             :   //- Virtual methods from Expr -/
      16             : //-----------------------------/
      17             : 
      18             : /**
      19             :  * Evaluates this Expr based on the given context node and processor state
      20             :  * @param context the context node for evaluation of this Expr
      21             :  * @param ps the ContextState containing the stack information needed
      22             :  * for evaluation
      23             :  * @return the result of the evaluation
      24             : **/
      25             : nsresult
      26           0 : UnionExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
      27             : {
      28           0 :     *aResult = nullptr;
      29           0 :     RefPtr<txNodeSet> nodes;
      30           0 :     nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
      31           0 :     NS_ENSURE_SUCCESS(rv, rv);
      32             : 
      33           0 :     uint32_t i, len = mExpressions.Length();
      34           0 :     for (i = 0; i < len; ++i) {
      35           0 :         RefPtr<txAExprResult> exprResult;
      36           0 :         rv = mExpressions[i]->evaluate(aContext, getter_AddRefs(exprResult));
      37           0 :         NS_ENSURE_SUCCESS(rv, rv);
      38             : 
      39           0 :         if (exprResult->getResultType() != txAExprResult::NODESET) {
      40             :             //XXX ErrorReport: report nonnodeset error
      41           0 :             return NS_ERROR_XSLT_NODESET_EXPECTED;
      42             :         }
      43             : 
      44           0 :         RefPtr<txNodeSet> resultSet, ownedSet;
      45             :         resultSet = static_cast<txNodeSet*>
      46           0 :                                (static_cast<txAExprResult*>(exprResult));
      47           0 :         exprResult = nullptr;
      48           0 :         rv = aContext->recycler()->
      49           0 :             getNonSharedNodeSet(resultSet, getter_AddRefs(ownedSet));
      50           0 :         NS_ENSURE_SUCCESS(rv, rv);
      51             : 
      52           0 :         rv = nodes->addAndTransfer(ownedSet);
      53           0 :         NS_ENSURE_SUCCESS(rv, rv);
      54             :     }
      55             : 
      56           0 :     *aResult = nodes;
      57           0 :     NS_ADDREF(*aResult);
      58             : 
      59           0 :     return NS_OK;
      60             : } //-- evaluate
      61             : 
      62             : Expr::ExprType
      63           0 : UnionExpr::getType()
      64             : {
      65           0 :   return UNION_EXPR;
      66             : }
      67             : 
      68           0 : TX_IMPL_EXPR_STUBS_LIST(UnionExpr, NODESET_RESULT, mExpressions)
      69             : 
      70             : bool
      71           0 : UnionExpr::isSensitiveTo(ContextSensitivity aContext)
      72             : {
      73           0 :     uint32_t i, len = mExpressions.Length();
      74           0 :     for (i = 0; i < len; ++i) {
      75           0 :         if (mExpressions[i]->isSensitiveTo(aContext)) {
      76           0 :             return true;
      77             :         }
      78             :     }
      79             : 
      80           0 :     return false;
      81             : }
      82             : 
      83             : #ifdef TX_TO_STRING
      84             : void
      85           0 : UnionExpr::toString(nsAString& dest)
      86             : {
      87             :     uint32_t i;
      88           0 :     for (i = 0; i < mExpressions.Length(); ++i) {
      89           0 :         if (i > 0)
      90           0 :             dest.AppendLiteral(" | ");
      91           0 :         mExpressions[i]->toString(dest);
      92             :     }
      93           0 : }
      94             : #endif

Generated by: LCOV version 1.13