michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsError.h" michael@0: #include "txExpr.h" michael@0: #include "nsString.h" michael@0: #include "txIXPathContext.h" michael@0: michael@0: nsresult michael@0: txErrorExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) michael@0: { michael@0: *aResult = nullptr; michael@0: michael@0: nsAutoString err(NS_LITERAL_STRING("Invalid expression evaluated")); michael@0: #ifdef TX_TO_STRING michael@0: err.AppendLiteral(": "); michael@0: toString(err); michael@0: #endif michael@0: aContext->receiveError(err, michael@0: NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED); michael@0: michael@0: return NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED; michael@0: } michael@0: michael@0: TX_IMPL_EXPR_STUBS_0(txErrorExpr, ANY_RESULT) michael@0: michael@0: bool michael@0: txErrorExpr::isSensitiveTo(ContextSensitivity aContext) michael@0: { michael@0: // It doesn't really matter what we return here, but it might michael@0: // be a good idea to try to keep this as unoptimizable as possible michael@0: return true; michael@0: } michael@0: michael@0: #ifdef TX_TO_STRING michael@0: void michael@0: txErrorExpr::toString(nsAString& aStr) michael@0: { michael@0: aStr.Append(mStr); michael@0: } michael@0: #endif