Bug 1874684 - Part 4: Prefer const references instead of copying Instant values....
[gecko.git] / dom / xslt / xpath / txErrorExpr.cpp
blob806b3242590242d8fcfc489866b0e75e3c6ce9db
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 "nsError.h"
7 #include "txExpr.h"
8 #include "nsString.h"
9 #include "txIXPathContext.h"
11 nsresult txErrorExpr::evaluate(txIEvalContext* aContext,
12 txAExprResult** aResult) {
13 *aResult = nullptr;
15 nsAutoString err(u"Invalid expression evaluated"_ns);
16 #ifdef TX_TO_STRING
17 err.AppendLiteral(": ");
18 toString(err);
19 #endif
20 aContext->receiveError(err, NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED);
22 return NS_ERROR_XPATH_INVALID_EXPRESSION_EVALUATED;
25 TX_IMPL_EXPR_STUBS_0(txErrorExpr, ANY_RESULT)
27 bool txErrorExpr::isSensitiveTo(ContextSensitivity aContext) {
28 // It doesn't really matter what we return here, but it might
29 // be a good idea to try to keep this as unoptimizable as possible
30 return true;
33 #ifdef TX_TO_STRING
34 void txErrorExpr::toString(nsAString& aStr) { aStr.Append(mStr); }
35 #endif