Qt 4.8
|
Base class for all AST nodes in an XPath/XQuery/XSL-T expression. More...
#include <qexpression_p.h>
Static Public Functions | |
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
Protected Functions | |
virtual bool | compressOperands (const StaticContext::Ptr &)=0 |
void | typeCheckOperands (const StaticContext::Ptr &context) |
Protected Functions inherited from QPatternist::CppCastingHelper< Expression > | |
CppCastingHelper () | |
Private Functions | |
Expression::Ptr | constantPropagate (const StaticContext::Ptr &context) const |
Performs constant propagation, also called constant folding, on this expression. More... | |
StaticContext::Ptr | finalizeStaticContext (const StaticContext::Ptr &context) const |
Static Private Functions | |
static Expression::Ptr | invokeOptimizers (const Expression::Ptr &expr, const StaticContext::Ptr &context) |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Base class for all AST nodes in an XPath/XQuery/XSL-T expression.
The initial step of creating an internal representation(in some circles called an IR tree) of the XPath string follows classic compiler design: a scanner is invoked, resulting in tokens, which sub-sequently are consumed by a parser which groups the tokens into rules, resulting in the creation of Abstract Syntax Tree(AST) nodes that are arranged in a hierarchical structure similar to the EBNF.
More specifically, ExpressionFactory::createExpression() is called with a pointer to a static context, and the string for the expression. This is subsequently tokenized by a Flex scanner. Mistakes detected at this stage is syntax errors, as well as a few semantical errors. Syntax errors can be divided in two types:
- The scanner detects it. An example is the expression "23Eb3" which is not a valid number literal, or "1prefix:my-element" which is not a valid QName. - The parser detects it. This means a syntax error at a higher level, that a group of tokens couldn't be reduced to a rule(expression). An example is the expression "if(a = b) 'match' else 'no match'"; the tokenizer would handle it fine, but the parser would fail because the tokens could not be reduced to a rule due to the token for the "then" word was missing.
Apart from the syntax errors, the actions in the parser also detects errors when creating the corresponding expressions. This is for example that no namespace binding for a prefix could be found, or that a function call was used which no function implementation could be found for.
When the parser has finished, the result is an AST. That is, a hierarchical structure consisting of Expression sub-classes. The individual expressions haven't at this point done anything beyond receiving their child-expressions(if any), and hence reminds of a "construction scaffold". In other words, a tree for the expression 'string' + 1 and xs:date('2001-03-13')
could have been created, even if that expression contains errors(one can't add a xs:integer to a xs:string, and the Effective Boolean Value cannot be extracted for date types).
After the AST creation, ExpressionFactory::createExpression continues with calling the AST node(which is an Expression instance)'s typeCheck() function. This step ensures that the static types of the operands matches the operators, and in the cases where it doesn't, modifies the AST such that the necessary conversions are done – if possible, otherwise the result is a type error.
This step corresponds roughly to what 2.2.3.1 Static Analysis Phase labels operation tree normalization; step SQ5.
The last step is calling compress(). This function is not called 'optimize', 'simplify' or the like, because although it performs all optimization, it also involves mandatory stages.
One such is const folding, which while being an efficient optimization, also is a necessity for many XSL-T constructs. Another important step is that functions which had an evaluation dependency on the static context(as opposed to the dynamic) performs their "fixup".
In other words, this stage potentially performs AST re-writes. For example, the expression 3 + 3, concat('foo', '-', 'bar'), true() and false()
would result in an AST corresponding to 6, 'foo-bar', false()
. This process is done backwards; each expression asks its operands to compress before it performs its own compression(and so forth, until the root expression's call returns to the caller).
Definition at line 165 of file qexpression_p.h.
A smart pointer wrapping const
Expression instances.
Definition at line 178 of file qexpression_p.h.
A list of Expression instances, each wrapped in a smart pointer.
Definition at line 183 of file qexpression_p.h.
A QFlags template for type-safe handling of ExpressionProperty values. If Expression::Property flags needs to be stored in a class, declared the variable to be of type Expression::Properties.
Definition at line 358 of file qexpression_p.h.
A smart pointer wrapping mutable Expression instances.
Definition at line 173 of file qexpression_p.h.
typedef :: QAbstractXmlForwardIterator<Expression::Ptr> QPatternist::Expression::QAbstractXmlForwardIterator |
Definition at line 191 of file qexpression_p.h.
A vector of Expression instances, each wrapped in a smart pointer.
Definition at line 188 of file qexpression_p.h.
Enumerators that identifies Expression sub-classes.
Enumerator | |
---|---|
IDBooleanValue | Identifies Boolean. |
IDCountFN | Identifies CountFN. |
IDEmptyFN | Identifies EmptyFN. |
IDExistsFN | Identifies ExistsFN. |
IDExpressionSequence | Identifies ExpressionSequence and LiteralSequence. |
IDGeneralComparison | Identifies GeneralComparison. |
IDIfThenClause | Identifies IfThenClause. |
IDIgnorableExpression | Identifies nothing in particular. The default implementation of id() returns this, which is suitable for Expression instances which never needs to be identified in this aspect. |
IDIntegerValue | Identifies Integer. |
IDPositionFN | Identifies PositionFN. |
IDStringValue | Identifies AtomicString, AnyURI, and UntypedAtomic. |
IDValueComparison | Identifies ValueComparison. |
IDRangeVariableReference | Identifies VariableReference. |
IDContextItem | Identifies ContextItem. |
IDUserFunctionCallsite | Identifies UserFunctionCallsite. |
IDExpressionVariableReference | Identifies ExpressionVariableReference. |
IDAttributeConstructor | Identifies ExpressionVariableReference. |
IDUpperCaseFN | Identifies UpperCaseFN. |
IDLowerCaseFN | Identifies LowerCaseFN. |
IDFirstItemPredicate | Identifies FirstItemPredicate. |
IDEmptySequence | |
IDReturnOrderBy | |
IDLetClause | |
IDForClause | |
IDPath | |
IDNamespaceConstructor | |
IDArgumentReference | |
IDGenericPredicate | |
IDAxisStep | |
IDFloat | A literal which is either |
IDCombineNodes | |
IDUnresolvedVariableReference | |
IDCardinalityVerifier |
Definition at line 365 of file qexpression_p.h.
Enum flags describing the characteristics of the expression.
Enumerator | |
---|---|
UseContextItem | This flag applies for functions, and results in the expression In effect, it result in a modification of the function's arguments to have appended the context item. One function which has this property is |
DisableElimination | Disables compression(evaluation at compile time), such that the Expression isn't const-folded, but ensured to be run at runtime. The operands are still attempted to be compressed, unless they override compression as well.
|
IsEvaluated | Signals that the expression is already evaluated and can be considered a constant value. For example, atomic values return this flag in their implementations of the properties() functions.
|
DisableTypingDeduction | Signals that the expression cannot be optimized away by judging its static type. This is currently used for properly handling the |
EmptynessFollowsChild | This property affects the static type – staticType() – of an expression. It is implemented in FunctionCall::staticType() and therefore only work for FunctionCall sub-classes and when that function is not re-implemented in an inhibiting way. When set, the cardinality of the static type is zero if the Expression's first operand allows an empty sequence, otherwise it is the cardinality of the Expression's static type modulo Cardinality::empty(). This is used for specifying proper static type inference for functions that have "If $arg is the empty sequence, the empty sequence is returned." However, before setting this property one must be aware that no other conditions can lead to the empty sequence, since otherwise the static type would be wrong. |
RewriteToEmptyOnEmpty | This is similar to EmptynessFollowsChild, and also implemented in FunctionCall. When set, it makes FunctionCall::typeCheck() rewrite itself into an empty sequence if the first operand is the empty sequence. This property is often used together with EmptynessFollowsChild. |
RequiresFocus | When set, it signals that the focus cannot be undefined. For example, the However, setting RequiresFocus does not imply this Expression requires the context item to be defined. It only means the focus, of somekind, needs to be defined.
|
AffectsOrderOnly | An Expression with this Property set, signals that it only affects the order of its return value. |
RequiresContextItem | When set, signals that the context item, must be defined for this Expression. When setting this property, expectedContextItemType() must be re-implemented. Setting this property also sets RequiresFocus.
|
CreatesFocusForLast | When set, signals that this expression creates a focus for its last operand. When set, newFocusType() must be overridden to return the static type of the context item.
|
LastOperandIsCollation | Signals that the last operand is a collation argument. This ensures that the necessary code is generated for checking that the collation is supported. This only applies to sub-classes of FunctionCall. |
DependsOnLocalVariable | When set, the Expression depends on local variables such as those found in |
EvaluationCacheRedundant | When set, it signals that the Expression does not need an evaluation cache, despite what other flags might imply. |
IsNodeConstructor | Signals that the Expression constructs nodes, either directly or computationally. For example, AttributeConstructor has this property set. Since node constructors constructs nodes which have node identities, node constructors are considered creative on evaluation. |
RequiresCurrentItem | Whether this expression requires the current item, as returned from CurrentFN uses this flag. |
Definition at line 198 of file qexpression_p.h.
|
inline |
Definition at line 489 of file qexpression_p.h.
|
virtual |
Definition at line 58 of file qexpression.cpp.
|
pure virtual |
Implemented in QPatternist::OrderBy, QPatternist::EmptySequence, QPatternist::CastAs, QPatternist::Path, QPatternist::ExpressionSequence, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::ArithmeticExpression, QPatternist::GenericPredicate, QPatternist::TreatAs, QPatternist::UserFunctionCallsite, QPatternist::NodeComparison, QPatternist::CombineNodes, QPatternist::RangeExpression, QPatternist::TruthPredicate, QPatternist::ValueComparison, QPatternist::AxisStep, QPatternist::ApplyTemplate, QPatternist::CopyOf, QPatternist::QuantifiedExpression, QPatternist::Atomizer, QPatternist::FirstItemPredicate, QPatternist::CastableAs, QPatternist::GeneralComparison, QPatternist::LetClause, QPatternist::UntypedAtomicConverter, QPatternist::ComputedNamespaceConstructor, QPatternist::ContextItem, QPatternist::ElementConstructor, QPatternist::AttributeNameValidator, QPatternist::CollationChecker, QPatternist::CurrentItemStore, QPatternist::ExternalVariableReference, QPatternist::ForClause, QPatternist::NamespaceConstructor, QPatternist::NCNameConstructor, QPatternist::PositionalVariableReference, QPatternist::AndExpression, QPatternist::ExpressionVariableReference, QPatternist::AttributeConstructor, QPatternist::Literal, QPatternist::LiteralSequence, QPatternist::ProcessingInstructionConstructor, QPatternist::RangeVariableReference, QPatternist::ReturnOrderBy, QPatternist::FunctionCall, QPatternist::QNameConstructor, QPatternist::SimpleContentConstructor, QPatternist::CommentConstructor, QPatternist::DocumentConstructor, QPatternist::IfThenClause, QPatternist::TextNodeConstructor, QPatternist::ArgumentConverter, QPatternist::ItemVerifier, QPatternist::DynamicContextStore, QPatternist::ParentNodeAxis, QPatternist::StaticBaseURIStore, QPatternist::CardinalityVerifier, QPatternist::CallTemplate, QPatternist::InstanceOf, QPatternist::StaticCompatibilityStore, QPatternist::EBVExtractor, QPatternist::ArgumentReference, QPatternist::UnresolvedVariableReference, QPatternist::OrExpression, QPatternist::TemplateParameterReference, and QPatternist::NodeSortExpression.
|
virtual |
Returns this
.
Implements QPatternist::SourceLocationReflection.
Reimplemented in QPatternist::QNameConstructor, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::ContextItem, QPatternist::UntypedAtomicConverter, QPatternist::CardinalityVerifier, DelegatingReflectionExpression, QPatternist::CurrentItemStore, QPatternist::Atomizer, QPatternist::ItemVerifier, QPatternist::DynamicContextStore, and QPatternist::EBVExtractor.
Definition at line 399 of file qexpression.cpp.
Referenced by QPatternist::EBVExtractor::actualReflection(), QPatternist::DynamicContextStore::actualReflection(), QPatternist::ItemVerifier::actualReflection(), QPatternist::Atomizer::actualReflection(), QPatternist::CurrentItemStore::actualReflection(), and QPatternist::CardinalityVerifier::actualReflection().
|
virtual |
When this function is called, it signals that the parent will create a focus of type itemType
.
This type can also be retrieved through StaticContext::contextItemType() when inside typeCheck(), but in some cases this is too late. For instance, a parent needs to have the static type of its child properly reported before it calls its typeCheck()(and the child's type is inferred from the focus).
The default implementation delegates the call on to the children.
This function may be called at arbitrary times, in arbitrary amounts.
If the AST node overriding this call has children, it should be considered whether the default implementation should be called, such that they type is announced to them too.
The caller guarantees that itemType
is not null
.
Reimplemented in QPatternist::ContextItem.
Definition at line 361 of file qexpression.cpp.
Referenced by announceFocusType(), and QPatternist::Path::typeCheck().
|
virtual |
compress() is the last stage performs in compiling an expression, done after the initial AST build and calling typeCheck(). compress() performs crucial simplifications, either by having drastic performance implications or that some expressions depend on it for proper behavior.
The default implementation performs a sparse conditional constant propagation. In short, a recursive process is performed in the AST which examines if the Expression's operands are constant values, and if so, performs a const fold(AST rewrite) into the result of evaluating the expression in question. This default behavior can be disabled by letting properties() return DisableElimination.
This compress() stage can be relative effective due to the design of XPath, in part because intrinsic functions are heavily used. Many Expressions override compress() and do optimizations specific to what they do. Also, many Expressions performs optimizations in their typeCheck().
context | the static context. Supplies compile time information, and is the channel for communicating error messages. |
Reimplemented in QPatternist::SubsequenceFN, QPatternist::NormalizeUnicodeFN, QPatternist::OrderBy, QPatternist::Existence< Id >, QPatternist::Path, QPatternist::CastAs, QPatternist::ApplyTemplate, QPatternist::GeneralComparison, QPatternist::PatternPlatform, QPatternist::ValueComparison, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::CopyOf, QPatternist::ExpressionSequence, QPatternist::ForClause, QPatternist::StringJoinFN, QPatternist::FirstItemPredicate, QPatternist::CountFN, QPatternist::ReplaceFN, QPatternist::UserFunctionCallsite, QPatternist::ContextItem, QPatternist::CardinalityVerifier, QPatternist::NodeComparison, QPatternist::CastableAs, QPatternist::ReturnOrderBy, QPatternist::AndExpression, QPatternist::IfThenClause, QPatternist::InstanceOf, QPatternist::SimpleContentConstructor, QPatternist::TemplateInvoker, QPatternist::CurrentItemStore, QPatternist::OrExpression, QPatternist::NodeSortExpression, QPatternist::ComparesCaseAware, and QPatternist::CurrentFN.
Definition at line 241 of file qexpression.cpp.
Referenced by QPatternist::CurrentFN::compress(), QPatternist::NodeSortExpression::compress(), QPatternist::ComparesCaseAware::compress(), QPatternist::OrExpression::compress(), QPatternist::CurrentItemStore::compress(), QPatternist::TemplateInvoker::compress(), QPatternist::SimpleContentConstructor::compress(), QPatternist::InstanceOf::compress(), QPatternist::IfThenClause::compress(), QPatternist::AndExpression::compress(), QPatternist::CastableAs::compress(), QPatternist::ReturnOrderBy::compress(), QPatternist::NodeComparison::compress(), QPatternist::CardinalityVerifier::compress(), QPatternist::ContextItem::compress(), QPatternist::UserFunctionCallsite::compress(), QPatternist::CountFN::compress(), QPatternist::FirstItemPredicate::compress(), QPatternist::StringJoinFN::compress(), QPatternist::ForClause::compress(), QPatternist::ExpressionSequence::compress(), QPatternist::CopyOf::compress(), QPatternist::EvaluationCache< IsForGlobal >::compress(), QPatternist::ValueComparison::compress(), QPatternist::PatternPlatform::compress(), QPatternist::GeneralComparison::compress(), QPatternist::CastAs::compress(), QPatternist::Path::compress(), QPatternist::Existence< Id >::compress(), QPatternist::OrderBy::compress(), QPatternist::NormalizeUnicodeFN::compress(), QPatternist::SubsequenceFN::compress(), QPatternist::TripleContainer::compressOperands(), QPatternist::PairContainer::compressOperands(), QPatternist::SingleContainer::compressOperands(), and invokeOptimizers().
|
protectedpure virtual |
true
if all operands are constant values of somekind, and are already evaluated. A string literal, is a typical example. Implemented in QPatternist::EmptyContainer, QPatternist::UnlimitedContainer, QPatternist::PairContainer, QPatternist::SingleContainer, and QPatternist::TripleContainer.
Referenced by compress().
|
private |
Performs constant propagation, also called constant folding, on this expression.
This means that it attempts to evaluate this expression at compile and returns the result value appropriately as an Expression. For example, for the XPath expression 1 + 3
would an Integer of value 4 would be returned.
It is not checked whether constant propagation is possible, the caller is responsible for this.
Definition at line 260 of file qexpression.cpp.
Referenced by compress().
Expression::Properties Expression::deepProperties | ( | ) | const |
Computes the union of properties for this Expression and all its descending children.
Definition at line 370 of file qexpression.cpp.
Referenced by QPatternist::CurrentItemStore::compress(), deepProperties(), and QPatternist::LetClause::typeCheck().
|
virtual |
Recursively computes through all descendants until a Property is encount
Reimplemented in QPatternist::CallTemplate.
Definition at line 345 of file qexpression.cpp.
Referenced by QPatternist::Template::dependencies().
|
virtual |
Reimplementation of SourceLocationReflection::description().
Reimplemented from QPatternist::SourceLocationReflection.
Reimplemented in QPatternist::GenericPredicate, and QPatternist::Literal.
Definition at line 404 of file qexpression.cpp.
|
virtual |
Determines the Effective Boolean Value of the expression.
The Effective Boolean Value of a value is not necessarily the same as converting the value to a new value of type xs:boolean.
Note that this function cannot return the empty sequence, evaluateSingleton() must be overridden in order to be able to do that.
The default implementation results in a type error. Hence, this function must be overridden if such behavior is not of interest.
Reimplemented in QPatternist::DocAvailableFN, QPatternist::Existence< Id >, QPatternist::EmptySequence, QPatternist::NotFN, QPatternist::FalseFN, QPatternist::CombineNodes, QPatternist::GeneralComparison, QPatternist::LetClause, QPatternist::UserFunctionCallsite, QPatternist::BooleanFN, QPatternist::Literal, QPatternist::QuantifiedExpression, QPatternist::ReturnOrderBy, QPatternist::PositionalVariableReference, QPatternist::TrueFN, QPatternist::ExpressionVariableReference, QPatternist::ExternalVariableReference, QPatternist::AndExpression, QPatternist::CallTemplate, QPatternist::CastableAs, QPatternist::NodeComparison, QPatternist::RangeVariableReference, QPatternist::InstanceOf, QPatternist::DeepEqualFN, QPatternist::EBVExtractor, QPatternist::ArgumentReference, QPatternist::IfThenClause, QPatternist::OrExpression, QPatternist::CurrentItemStore, QPatternist::DynamicContextStore, QPatternist::TemplateParameterReference, QPatternist::ElementAvailableFN, and QPatternist::UnparsedTextAvailableFN.
Definition at line 315 of file qexpression.cpp.
Referenced by QPatternist::OrExpression::compress(), QPatternist::AndExpression::compress(), QPatternist::IfThenClause::compress(), QPatternist::CurrentItemStore::evaluateEBV(), QPatternist::DynamicContextStore::evaluateEBV(), QPatternist::OrExpression::evaluateEBV(), QPatternist::ArgumentReference::evaluateEBV(), QPatternist::IfThenClause::evaluateEBV(), QPatternist::EBVExtractor::evaluateEBV(), QPatternist::CallTemplate::evaluateEBV(), QPatternist::AndExpression::evaluateEBV(), QPatternist::ExpressionVariableReference::evaluateEBV(), QPatternist::ReturnOrderBy::evaluateEBV(), QPatternist::QuantifiedExpression::evaluateEBV(), QPatternist::UserFunctionCallsite::evaluateEBV(), QPatternist::BooleanFN::evaluateEBV(), QPatternist::LetClause::evaluateEBV(), QPatternist::CombineNodes::evaluateEBV(), QPatternist::NotFN::evaluateEBV(), QPatternist::IfThenClause::evaluateSequence(), QPatternist::IfThenClause::evaluateSingleton(), evaluateSingleton(), QPatternist::IfThenClause::evaluateToSequenceReceiver(), and QPatternist::BooleanIdentifier::matches().
|
virtual |
Evaluate this Expression by iterating over it. This is a central function for evaluating expressions.
Expressions must always always return a valid QAbstractXmlForwardIterator and may never return 0. If an empty result is of interest to be returned, the EmptyIterator should be returned.
The default implementation returns a SingletonIterator over the item returned from evaluateSingleton().
Reimplemented in QPatternist::SubsequenceFN, QPatternist::ReverseFN, QPatternist::RemoveFN, QPatternist::InsertBeforeFN, QPatternist::DistinctValuesFN, QPatternist::CollectionFN, QPatternist::InScopePrefixesFN, QPatternist::OrderBy, QPatternist::TokenizeFN, QPatternist::IndexOfFN, QPatternist::IdrefFN, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::Path, QPatternist::EmptySequence, QPatternist::GenericPredicate, QPatternist::ApplyTemplate, QPatternist::StringToCodepointsFN, QPatternist::UntypedAtomicConverter, QPatternist::UserFunctionCallsite, QPatternist::CombineNodes, QPatternist::LiteralSequence, QPatternist::IdFN, QPatternist::ArgumentConverter, QPatternist::LetClause, QPatternist::ExpressionSequence, QPatternist::ExpressionVariableReference, QPatternist::ForClause, QPatternist::Atomizer, QPatternist::ArgumentReference, QPatternist::ExternalVariableReference, QPatternist::RangeExpression, QPatternist::ItemVerifier, QPatternist::CallTemplate, QPatternist::IfThenClause, QPatternist::CardinalityVerifier, QPatternist::AxisStep, QPatternist::CurrentItemStore, QPatternist::DynamicContextStore, QPatternist::TemplateParameterReference, QPatternist::NodeSortExpression, and QPatternist::TraceFN.
Definition at line 300 of file qexpression.cpp.
Referenced by constantPropagate(), QPatternist::DistinctValuesFN::DistinctValuesFN(), QPatternist::DeepEqualFN::evaluateEBV(), QPatternist::InstanceOf::evaluateEBV(), QPatternist::CastableAs::evaluateEBV(), QPatternist::QuantifiedExpression::evaluateEBV(), QPatternist::GeneralComparison::evaluateEBV(), evaluateEBV(), QPatternist::NodeSortExpression::evaluateSequence(), QPatternist::DynamicContextStore::evaluateSequence(), QPatternist::CurrentItemStore::evaluateSequence(), QPatternist::CallTemplate::evaluateSequence(), QPatternist::IfThenClause::evaluateSequence(), QPatternist::CardinalityVerifier::evaluateSequence(), QPatternist::ArgumentReference::evaluateSequence(), QPatternist::ItemVerifier::evaluateSequence(), QPatternist::Atomizer::evaluateSequence(), QPatternist::ForClause::evaluateSequence(), QPatternist::VariableLoader::evaluateSequence(), QPatternist::ExpressionVariableReference::evaluateSequence(), QPatternist::LetClause::evaluateSequence(), QPatternist::ArgumentConverter::evaluateSequence(), QPatternist::CombineNodes::evaluateSequence(), QPatternist::UserFunctionCallsite::evaluateSequence(), QPatternist::UntypedAtomicConverter::evaluateSequence(), QPatternist::ApplyTemplate::evaluateSequence(), QPatternist::GenericPredicate::evaluateSequence(), QPatternist::Path::evaluateSequence(), QPatternist::IndexOfFN::evaluateSequence(), QPatternist::OrderBy::evaluateSequence(), QPatternist::DistinctValuesFN::evaluateSequence(), QPatternist::InsertBeforeFN::evaluateSequence(), QPatternist::RemoveFN::evaluateSequence(), QPatternist::ReverseFN::evaluateSequence(), QPatternist::SubsequenceFN::evaluateSequence(), QPatternist::XSLTSimpleContentConstructor::evaluateSingleton(), QPatternist::CardinalityVerifier::evaluateSingleton(), QPatternist::SimpleContentConstructor::evaluateSingleton(), QPatternist::CodepointsToStringFN::evaluateSingleton(), QPatternist::FirstItemPredicate::evaluateSingleton(), QPatternist::ReturnOrderBy::evaluateSingleton(), QPatternist::CountFN::evaluateSingleton(), QPatternist::StringJoinFN::evaluateSingleton(), QPatternist::Path::evaluateSingleton(), QPatternist::GenericPredicate::evaluateSingleton(), QPatternist::AvgFN::evaluateSingleton(), QPatternist::SumFN::evaluateSingleton(), QPatternist::InsertBeforeFN::evaluateSingleton(), QPatternist::ForClause::evaluateToSequenceReceiver(), QPatternist::CopyOf::evaluateToSequenceReceiver(), QPatternist::Path::evaluateToSequenceReceiver(), evaluateToSequenceReceiver(), QPatternist::IndexOfFN::IndexOfFN(), QPatternist::GenericPredicate::mapToItem(), QPatternist::ForClause::mapToSequence(), QPatternist::Path::mapToSequence(), and QPatternist::ExpressionSequence::mapToSequence().
|
virtual |
Reimplemented in QPatternist::SubsequenceFN, QPatternist::RemoveFN, QPatternist::InsertBeforeFN, QPatternist::EncodeString, QPatternist::TranslateFN, QPatternist::ExtractFromDateTimeFN< TSubClass >, QPatternist::ExtractFromDateTimeFN< DayFromAbstractDateTimeFN >, QPatternist::ExtractFromDateTimeFN< SecondsFromAbstractDateTimeFN >, QPatternist::ExtractFromDateTimeFN< HoursFromAbstractDateTimeFN >, QPatternist::ExtractFromDateTimeFN< YearFromAbstractDateTimeFN >, QPatternist::ExtractFromDateTimeFN< MonthFromAbstractDateTimeFN >, QPatternist::ExtractFromDateTimeFN< MinutesFromAbstractDateTimeFN >, QPatternist::ExtractFromDateTimeFN< TimezoneFromAbstractDateTimeFN >, QPatternist::LowerCaseFN, QPatternist::UpperCaseFN, QPatternist::RootFN, QPatternist::NormalizeUnicodeFN, QPatternist::CurrentTimeFN, QPatternist::LangFN, QPatternist::SumFN, QPatternist::NamespaceURIForPrefixFN, QPatternist::CurrentDateFN, QPatternist::NormalizeSpaceFN, QPatternist::RoundHalfToEvenFN, QPatternist::DocumentURIFN, QPatternist::NamespaceURIFromQNameFN, QPatternist::SubstringAfterFN, QPatternist::StringLengthFN, QPatternist::AvgFN, QPatternist::CurrentDateTimeFN, QPatternist::NumberFN, QPatternist::DocFN, QPatternist::BaseURIFN, QPatternist::CeilingFN, QPatternist::LocalNameFromQNameFN, QPatternist::SubstringBeforeFN, QPatternist::SubstringFN, QPatternist::ImplicitTimezoneFN, QPatternist::NamespaceURIFN, QPatternist::RoundFN, QPatternist::PrefixFromQNameFN, QPatternist::GenericPredicate, QPatternist::StringFN, QPatternist::EmptySequence, QPatternist::EndsWithFN, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::Path, QPatternist::UnaryExpression, QPatternist::ExtractFromDurationFN< TSubClass >, QPatternist::ExtractFromDurationFN< MinutesFromDurationFN >, QPatternist::ExtractFromDurationFN< MonthsFromDurationFN >, QPatternist::ExtractFromDurationFN< YearsFromDurationFN >, QPatternist::ExtractFromDurationFN< HoursFromDurationFN >, QPatternist::ExtractFromDurationFN< DaysFromDurationFN >, QPatternist::ExtractFromDurationFN< SecondsFromDurationFN >, QPatternist::CastAs, QPatternist::LastFN, QPatternist::StringJoinFN, QPatternist::ComparingAggregator< oper, result >, QPatternist::ReplaceFN, QPatternist::CompareFN, QPatternist::LocalNameFN, QPatternist::AbsFN, QPatternist::ResolveQNameFN, QPatternist::NilledFN, QPatternist::StartsWithFN, QPatternist::UserFunctionCallsite, QPatternist::AdjustTimezone, QPatternist::UntypedAtomicConverter, QPatternist::CombineNodes, QPatternist::LetClause, QPatternist::RangeExpression, QPatternist::CountFN, QPatternist::ArithmeticExpression, QPatternist::ValueComparison, QPatternist::ArgumentConverter, QPatternist::ContextItem, QPatternist::ForClause, QPatternist::Literal, QPatternist::ReturnOrderBy, QPatternist::ConcatFN, QPatternist::ExpressionVariableReference, QPatternist::FirstItemPredicate, QPatternist::CodepointsToStringFN, QPatternist::PositionFN, QPatternist::NCNameConstructor, QPatternist::QNameConstructor, QPatternist::CodepointEqualFN, QPatternist::ErrorFN, QPatternist::NameFN, QPatternist::FloorFN, QPatternist::MatchesFN, QPatternist::QNameFN, QPatternist::ElementConstructor, QPatternist::ExternalVariableReference, QPatternist::RangeVariableReference, QPatternist::SimpleContentConstructor, QPatternist::NodeNameFN, QPatternist::Atomizer, QPatternist::AttributeNameValidator, QPatternist::IfThenClause, QPatternist::ContainsFN, QPatternist::CardinalityVerifier, QPatternist::ArgumentReference, QPatternist::CollationChecker, QPatternist::DocumentConstructor, QPatternist::NodeComparison, QPatternist::ItemVerifier, QPatternist::AttributeConstructor, QPatternist::AxisStep, QPatternist::CurrentItemStore, QPatternist::DynamicContextStore, QPatternist::ParentNodeAxis, QPatternist::ProcessingInstructionConstructor, QPatternist::CommentConstructor, QPatternist::TextNodeConstructor, QPatternist::PositionalVariableReference, QPatternist::TemplateParameterReference, QPatternist::XSLTSimpleContentConstructor, QPatternist::FunctionAvailableFN, QPatternist::GenerateIDFN, QPatternist::TypeAvailableFN, QPatternist::UnparsedTextFN, QPatternist::CurrentFN, QPatternist::DateTimeFN, QPatternist::SystemPropertyFN, QPatternist::UnparsedEntityPublicIDFN, QPatternist::UnparsedEntityURIFN, QPatternist::ResolveURIFN, and QPatternist::TraceFN.
Definition at line 310 of file qexpression.cpp.
Referenced by QPatternist::PatternPlatform::compress(), constantPropagate(), QPatternist::ProcessingInstructionConstructor::data(), QPatternist::NormalizeUnicodeFN::determineNormalizationForm(), QPatternist::NodeComparison::evaluate(), QPatternist::CommentConstructor::evaluateContent(), QPatternist::ElementAvailableFN::evaluateEBV(), QPatternist::UnparsedTextAvailableFN::evaluateEBV(), QPatternist::CastableAs::evaluateEBV(), QPatternist::RangeExpression::evaluateSequence(), QPatternist::StringToCodepointsFN::evaluateSequence(), QPatternist::IndexOfFN::evaluateSequence(), QPatternist::TokenizeFN::evaluateSequence(), QPatternist::InScopePrefixesFN::evaluateSequence(), QPatternist::InsertBeforeFN::evaluateSequence(), QPatternist::RemoveFN::evaluateSequence(), QPatternist::SubsequenceFN::evaluateSequence(), evaluateSequence(), QPatternist::ResolveURIFN::evaluateSingleton(), QPatternist::DateTimeFN::evaluateSingleton(), QPatternist::SystemPropertyFN::evaluateSingleton(), QPatternist::FunctionAvailableFN::evaluateSingleton(), QPatternist::TypeAvailableFN::evaluateSingleton(), QPatternist::GenerateIDFN::evaluateSingleton(), QPatternist::UnparsedTextFN::evaluateSingleton(), QPatternist::TextNodeConstructor::evaluateSingleton(), QPatternist::CurrentItemStore::evaluateSingleton(), QPatternist::AttributeConstructor::evaluateSingleton(), QPatternist::DynamicContextStore::evaluateSingleton(), QPatternist::CollationChecker::evaluateSingleton(), QPatternist::ArgumentReference::evaluateSingleton(), QPatternist::ItemVerifier::evaluateSingleton(), QPatternist::IfThenClause::evaluateSingleton(), QPatternist::ContainsFN::evaluateSingleton(), QPatternist::CardinalityVerifier::evaluateSingleton(), QPatternist::AttributeNameValidator::evaluateSingleton(), QPatternist::Atomizer::evaluateSingleton(), QPatternist::NodeNameFN::evaluateSingleton(), QPatternist::ElementConstructor::evaluateSingleton(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::ErrorFN::evaluateSingleton(), QPatternist::CodepointEqualFN::evaluateSingleton(), QPatternist::NCNameConstructor::evaluateSingleton(), QPatternist::NameFN::evaluateSingleton(), QPatternist::QNameConstructor::evaluateSingleton(), QPatternist::FloorFN::evaluateSingleton(), QPatternist::MatchesFN::evaluateSingleton(), QPatternist::ExpressionVariableReference::evaluateSingleton(), QPatternist::ReturnOrderBy::evaluateSingleton(), QPatternist::ValueComparison::evaluateSingleton(), QPatternist::ArithmeticExpression::evaluateSingleton(), QPatternist::ArgumentConverter::evaluateSingleton(), QPatternist::LetClause::evaluateSingleton(), QPatternist::RangeExpression::evaluateSingleton(), QPatternist::UntypedAtomicConverter::evaluateSingleton(), QPatternist::UserFunctionCallsite::evaluateSingleton(), QPatternist::AdjustTimezone::evaluateSingleton(), QPatternist::StartsWithFN::evaluateSingleton(), QPatternist::NilledFN::evaluateSingleton(), QPatternist::ResolveQNameFN::evaluateSingleton(), QPatternist::CompareFN::evaluateSingleton(), QPatternist::LocalNameFN::evaluateSingleton(), QPatternist::AbsFN::evaluateSingleton(), QPatternist::ReplaceFN::evaluateSingleton(), QPatternist::StringJoinFN::evaluateSingleton(), QPatternist::CastAs::evaluateSingleton(), QPatternist::UnaryExpression::evaluateSingleton(), QPatternist::Path::evaluateSingleton(), QPatternist::EndsWithFN::evaluateSingleton(), QPatternist::StringFN::evaluateSingleton(), QPatternist::PrefixFromQNameFN::evaluateSingleton(), QPatternist::RoundFN::evaluateSingleton(), QPatternist::NamespaceURIFN::evaluateSingleton(), QPatternist::SubstringFN::evaluateSingleton(), QPatternist::SubstringBeforeFN::evaluateSingleton(), QPatternist::BaseURIFN::evaluateSingleton(), QPatternist::LocalNameFromQNameFN::evaluateSingleton(), QPatternist::CeilingFN::evaluateSingleton(), QPatternist::NumberFN::evaluateSingleton(), QPatternist::StringLengthFN::evaluateSingleton(), QPatternist::SubstringAfterFN::evaluateSingleton(), QPatternist::NamespaceURIFromQNameFN::evaluateSingleton(), QPatternist::DocumentURIFN::evaluateSingleton(), QPatternist::RoundHalfToEvenFN::evaluateSingleton(), QPatternist::NormalizeSpaceFN::evaluateSingleton(), QPatternist::NamespaceURIForPrefixFN::evaluateSingleton(), QPatternist::SumFN::evaluateSingleton(), QPatternist::LangFN::evaluateSingleton(), QPatternist::NormalizeUnicodeFN::evaluateSingleton(), QPatternist::RootFN::evaluateSingleton(), QPatternist::UpperCaseFN::evaluateSingleton(), QPatternist::LowerCaseFN::evaluateSingleton(), QPatternist::TranslateFN::evaluateSingleton(), QPatternist::EncodeString::evaluateSingleton(), QPatternist::RemoveFN::evaluateSingleton(), QPatternist::ProcessingInstructionConstructor::evaluateTardata(), QPatternist::ComputedNamespaceConstructor::evaluateToSequenceReceiver(), QPatternist::TextNodeConstructor::evaluateToSequenceReceiver(), QPatternist::AttributeConstructor::evaluateToSequenceReceiver(), QPatternist::ElementConstructor::evaluateToSequenceReceiver(), QPatternist::ArithmeticExpression::flexiblyCalculate(), QPatternist::GeneralComparison::generalCompare(), QPatternist::ForClause::mapToItem(), QPatternist::ReplaceFN::parseReplacement(), and QPatternist::PatternPlatform::pattern().
|
virtual |
Evaluates this Expression by sending its output to DynamicContext::outputReceiver().
Reimplemented in QPatternist::EmptySequence, QPatternist::Path, QPatternist::UserFunctionCallsite, QPatternist::ExpressionSequence, QPatternist::LetClause, QPatternist::CopyOf, QPatternist::Literal, QPatternist::ForClause, QPatternist::ElementConstructor, QPatternist::CallTemplate, QPatternist::IfThenClause, QPatternist::DocumentConstructor, QPatternist::AttributeConstructor, QPatternist::ProcessingInstructionConstructor, QPatternist::CommentConstructor, QPatternist::TextNodeConstructor, QPatternist::ComputedNamespaceConstructor, and QPatternist::NamespaceConstructor.
Definition at line 320 of file qexpression.cpp.
Referenced by QPatternist::DocumentConstructor::evaluateSingleton(), QPatternist::ElementConstructor::evaluateSingleton(), QPatternist::DocumentConstructor::evaluateToSequenceReceiver(), QPatternist::CallTemplate::evaluateToSequenceReceiver(), QPatternist::IfThenClause::evaluateToSequenceReceiver(), QPatternist::ElementConstructor::evaluateToSequenceReceiver(), QPatternist::ForClause::evaluateToSequenceReceiver(), QPatternist::LetClause::evaluateToSequenceReceiver(), QPatternist::UserFunctionCallsite::evaluateToSequenceReceiver(), and QPatternist::Path::evaluateToSequenceReceiver().
|
virtual |
Returns the required type the context item must be an instance of.
If this Expression requires a focus, meaning its properties() function returns RequiresContextItem, it must return a type from this function. If any type is ok, BuiltinTypes::item should be returned.
In other words, this function must only be re-implemented if the focus is used. The default implementation performs an assert crash.
Reimplemented in QPatternist::ContextItem, QPatternist::CopyOf, QPatternist::AxisStep, and QPatternist::ParentNodeAxis.
Definition at line 333 of file qexpression.cpp.
Referenced by QPatternist::CopyOf::expectedContextItemType(), and QPatternist::TypeChecker::verifyType().
|
pure virtual |
Returns a list of Sequence Types, describing the type of each of the expression's operands. Hence, this function has a relationship to the operands() function:
- The lengths of the lists returned by expectedOperandTypes() and operands() should always be equal in length, since one cannot describe the type of a non-existent operand(and all operands must have type information). - A significant difference between the two functions is that while the type of objects in the list returned by operands() may vary between compilations/static context, simply because the particular Expression is part of different XPath expressions, the types in the list returned by expectedOperandTypes is always the same since the function/operator signature never changes.
This function should not be confused with staticType(), which returns the static type of the expression itself, not its operands. The function call is an expression where this is clear: the type of the return value is not the same as the arguments' types. The static type of the operands supplied to the expression can be determined via the staticType() function of the instances returned by operands().
If the expression has no operands, an empty list should be returned.
Implemented in QPatternist::OrderBy, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::Path, QPatternist::GenericPredicate, QPatternist::TreatAs, QPatternist::UserFunctionCallsite, QPatternist::TruthPredicate, QPatternist::CastAs, QPatternist::CopyOf, QPatternist::TemplateInvoker, QPatternist::ValueComparison, QPatternist::CastableAs, QPatternist::EmptyContainer, QPatternist::GeneralComparison, QPatternist::UntypedAtomicConverter, QPatternist::ExpressionSequence, QPatternist::CombineNodes, QPatternist::ElementConstructor, QPatternist::LetClause, QPatternist::ArgumentConverter, QPatternist::ArithmeticExpression, QPatternist::FirstItemPredicate, QPatternist::ForClause, QPatternist::RangeExpression, QPatternist::AttributeConstructor, QPatternist::ProcessingInstructionConstructor, QPatternist::QuantifiedExpression, QPatternist::ReturnOrderBy, QPatternist::AxisStep, QPatternist::Atomizer, QPatternist::CommentConstructor, QPatternist::DocumentConstructor, QPatternist::SimpleContentConstructor, QPatternist::TextNodeConstructor, QPatternist::CollationChecker, QPatternist::NCNameConstructor, QPatternist::QNameConstructor, QPatternist::StaticBaseURIStore, QPatternist::IfThenClause, QPatternist::StaticCompatibilityStore, QPatternist::AndExpression, QPatternist::AttributeNameValidator, QPatternist::ComputedNamespaceConstructor, QPatternist::NodeComparison, QPatternist::CardinalityVerifier, QPatternist::ItemVerifier, QPatternist::InstanceOf, QPatternist::CurrentItemStore, QPatternist::DynamicContextStore, QPatternist::NamespaceConstructor, QPatternist::UnresolvedVariableReference, QPatternist::EBVExtractor, QPatternist::FunctionCall, QPatternist::NodeSortExpression, and QPatternist::XSLTSimpleContentConstructor.
Referenced by typeCheckOperands().
|
inlineprivate |
Definition at line 62 of file qexpression.cpp.
Referenced by typeCheckOperands().
|
inline |
Determines whether this Expression has Property prop
set.
Calling expr->has(MyProperty)
is semantically equivalent to expr->properties().testFlag(MyProperty)
. In other words, has(), as well as is(), provides syntacti sugar and makes code more readable.
Definition at line 866 of file qexpression_p.h.
Referenced by QPatternist::InstanceOf::compress(), QPatternist::FunctionCall::staticType(), QPatternist::FunctionCall::typeCheck(), and typeCheckOperands().
|
inline |
Definition at line 871 of file qexpression_p.h.
Referenced by compress().
|
virtual |
This property, which has no setter, returns an enum value that uniquely identifies this Expression. Patternist makes no use of C++'s dynamic_cast feature, but uses this polymorphic function instead.
Reimplemented in QPatternist::AxisStep, QPatternist::Path, QPatternist::EmptySequence, QPatternist::ExpressionSequence, QPatternist::UserFunctionCallsite, QPatternist::GenericPredicate, QPatternist::CardinalityVerifier, QPatternist::ContextItem, QPatternist::FirstItemPredicate, QPatternist::GeneralComparison, QPatternist::ValueComparison, QPatternist::NamespaceConstructor, QPatternist::ForClause, QPatternist::LetClause, QPatternist::CombineNodes, QPatternist::AttributeConstructor, QPatternist::IfThenClause, QPatternist::LiteralSequence, QPatternist::FunctionCall, QPatternist::Literal, QPatternist::ReturnOrderBy, QPatternist::ExpressionVariableReference, QPatternist::RangeVariableReference, QPatternist::ArgumentReference, and QPatternist::UnresolvedVariableReference.
Definition at line 382 of file qexpression.cpp.
Referenced by QPatternist::findAxisStep(), QPatternist::ValueComparison::isCaseInsensitiveCompare(), QPatternist::ComparisonIdentifier::matches(), QPatternist::ElementConstructor::typeCheck(), and QPatternist::TypeChecker::verifyType().
|
staticprivate |
Definition at line 126 of file qexpression.cpp.
Referenced by compress().
|
inline |
This function is a utility function, syntactic sugar for determining whether this Expression is id
. For example, calling is(IDIfThenClause)
is equivalent to id() == IDIfThenClause
Definition at line 856 of file qexpression_p.h.
Referenced by QPatternist::CallTargetDescription::checkCallsiteCircularity(), QPatternist::ReplaceFN::compress(), QPatternist::FirstItemPredicate::compress(), QPatternist::StringJoinFN::compress(), QPatternist::PatternPlatform::compress(), QPatternist::Path::compress(), QPatternist::NormalizeUnicodeFN::compress(), QPatternist::GenericPredicate::create(), QPatternist::findAxisStep(), QPatternist::ByIDIdentifier::matches(), QPatternist::IntegerIdentifier::matches(), QPatternist::BooleanIdentifier::matches(), QPatternist::UserFunctionCallsite::setSource(), QPatternist::RangeExpression::staticType(), QPatternist::CastableAs::typeCheck(), QPatternist::ElementConstructor::typeCheck(), QPatternist::CastAs::typeCheck(), and QPatternist::TypeChecker::verifyType().
|
inline |
This function is a utility function, which performs bitwise logic on properties() in order to find out whether the Expression::IsEvaluated flag is set.
Definition at line 861 of file qexpression_p.h.
Referenced by QPatternist::OrExpression::compress(), QPatternist::IfThenClause::compress(), QPatternist::AndExpression::compress(), QPatternist::SingleContainer::compressOperands(), QPatternist::PairContainer::compressOperands(), QPatternist::TripleContainer::compressOperands(), and QPatternist::SubsequenceFN::staticType().
|
virtual |
If an Expression creates a focus because it has set the property CreatesFocusForLast, it should override this function and make it return the ItemType that the context item in the focus has.
null
. Reimplemented in QPatternist::GenericPredicate, and QPatternist::Path.
Definition at line 392 of file qexpression.cpp.
Referenced by finalizeStaticContext().
|
pure virtual |
If this Expression has no operands, an empty list should be returned.
Implemented in QPatternist::UnlimitedContainer, QPatternist::EmptyContainer, QPatternist::PairContainer, QPatternist::SingleContainer, and QPatternist::TripleContainer.
Referenced by announceFocusType(), QPatternist::CallTargetDescription::checkArgumentsCircularity(), QPatternist::FirstItemPredicate::compress(), deepProperties(), QPatternist::findAxisStep(), invokeOptimizers(), QPatternist::ValueComparison::isCaseInsensitiveCompare(), QPatternist::ElementConstructor::typeCheck(), typeCheckOperands(), and QPatternist::TypeChecker::verifyType().
|
virtual |
Returns the OptimizationPasses that applies for this Expression. The default implementation returns an empty list. Sub-classes can re-implement this function and return actual OptimizationPasses.
Reimplemented in QPatternist::NotFN, QPatternist::ValueComparison, QPatternist::GeneralComparison, QPatternist::ForClause, and QPatternist::IfThenClause.
Definition at line 387 of file qexpression.cpp.
Referenced by invokeOptimizers().
|
virtual |
By default 0.5 is returned.
Reimplemented in QPatternist::AxisStep.
Definition at line 409 of file qexpression.cpp.
|
virtual |
The default implementation returns 0. Override and let the function return a different value, if that's of interest.
An important decision when re-implementing properties() is whether to OR in the properties() of ones operands. For instance, if an operand has RequiresFocus set, that flag nost likely applies to the apparent as well, since it depends on its operand.
Reimplemented in QPatternist::OrderBy, QPatternist::EmptySequence, QPatternist::Path, QPatternist::GenericPredicate, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::ExpressionSequence, QPatternist::ReturnOrderBy, QPatternist::CopyOf, QPatternist::AxisStep, QPatternist::RangeExpression, QPatternist::ApplyTemplate, QPatternist::UserFunctionCallsite, QPatternist::VariableReference, QPatternist::AttributeConstructor, QPatternist::Literal, QPatternist::ElementConstructor, QPatternist::ComputedNamespaceConstructor, QPatternist::LetClause, QPatternist::LiteralSequence, QPatternist::NamespaceConstructor, QPatternist::PositionalVariableReference, QPatternist::DocumentConstructor, QPatternist::ProcessingInstructionConstructor, QPatternist::ContextItem, QPatternist::RangeVariableReference, QPatternist::CommentConstructor, QPatternist::ExternalVariableReference, QPatternist::TextNodeConstructor, QPatternist::FunctionCall, QPatternist::CallTemplate, QPatternist::CurrentItemStore, QPatternist::ParentNodeAxis, QPatternist::TemplateParameterReference, and QPatternist::NodeSortExpression.
Definition at line 340 of file qexpression.cpp.
Referenced by deepProperties(), dependencies(), QPatternist::CurrentItemStore::properties(), QPatternist::CopyOf::properties(), QPatternist::Path::properties(), QPatternist::Template::properties(), QPatternist::OrderBy::properties(), and QPatternist::TypeChecker::verifyType().
|
inlinestatic |
This function take the two Expression pointers old
and New
, and in a safe way, by handling reference counting and being aware of whether the two pointers actually are different, switches the two. When compiling in debug mode, informative debug messages are printed.
This function is conceptually similar to Qt's qSwap(), but has debugging functionality and also handles source locations.
Definition at line 876 of file qexpression_p.h.
Referenced by QPatternist::UserFunctionCallsite::compress(), QPatternist::PairContainer::compressOperands(), QPatternist::SingleContainer::compressOperands(), QPatternist::TripleContainer::compressOperands(), QPatternist::UnlimitedContainer::compressOperands(), constantPropagate(), QPatternist::GeneralComparison::typeCheck(), QPatternist::AxisStep::typeCheck(), and QPatternist::DocumentFN::typeCheck().
|
inline |
Rewrites this Expression to to
, and return to
.
Source location annotations are adjusted appropriately.
Definition at line 895 of file qexpression_p.h.
|
pure virtual |
Implemented in QPatternist::EmptyContainer, QPatternist::UnlimitedContainer, QPatternist::PairContainer, QPatternist::SingleContainer, and QPatternist::TripleContainer.
Referenced by QPatternist::XSLT20CoreFunctions::retrieveExpression(), QPatternist::XPath10CoreFunctions::retrieveExpression(), QPatternist::XPath20CoreFunctions::retrieveExpression(), and typeCheckOperands().
|
pure virtual |
Implemented in QPatternist::SubsequenceFN, QPatternist::ReverseFN, QPatternist::RemoveFN, QPatternist::InsertBeforeFN, QPatternist::DistinctValuesFN, QPatternist::RootFN, QPatternist::OrderBy, QPatternist::SumFN, QPatternist::DocFN, QPatternist::AvgFN, QPatternist::EmptySequence, QPatternist::Path, QPatternist::GenericPredicate, QPatternist::UserFunctionCallsite, QPatternist::CastAs, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::TreatAs, QPatternist::ApplyTemplate, QPatternist::NodeComparison, QPatternist::FirstItemPredicate, QPatternist::CastableAs, QPatternist::GeneralComparison, QPatternist::LetClause, QPatternist::RangeExpression, QPatternist::ValueComparison, QPatternist::CopyOf, QPatternist::DocumentConstructor, QPatternist::ExpressionSequence, QPatternist::ComputedNamespaceConstructor, QPatternist::ArgumentConverter, QPatternist::UntypedAtomicConverter, QPatternist::CurrentItemStore, QPatternist::ParentNodeAxis, QPatternist::AttributeNameValidator, QPatternist::CollationChecker, QPatternist::CombineNodes, QPatternist::NamespaceConstructor, QPatternist::NCNameConstructor, QPatternist::PositionalVariableReference, QPatternist::EBVExtractor, QPatternist::AndExpression, QPatternist::ExpressionVariableReference, QPatternist::Literal, QPatternist::ArithmeticExpression, QPatternist::AxisStep, QPatternist::ForClause, QPatternist::LiteralSequence, QPatternist::IfThenClause, QPatternist::QNameConstructor, QPatternist::QuantifiedExpression, QPatternist::ReturnOrderBy, QPatternist::SimpleContentConstructor, QPatternist::Aggregator, QPatternist::TraceFN, QPatternist::ContextItem, QPatternist::DynamicContextStore, QPatternist::ElementConstructor, QPatternist::ExternalVariableReference, QPatternist::Atomizer, QPatternist::CallTemplate, QPatternist::StaticBaseURIStore, QPatternist::CardinalityVerifier, QPatternist::ItemVerifier, QPatternist::InstanceOf, QPatternist::RangeVariableReference, QPatternist::StaticCompatibilityStore, QPatternist::ArgumentReference, QPatternist::AttributeConstructor, QPatternist::ProcessingInstructionConstructor, QPatternist::UnresolvedVariableReference, QPatternist::CommentConstructor, QPatternist::TextNodeConstructor, QPatternist::TemplateParameterReference, QPatternist::FunctionCall, QPatternist::XSLTSimpleContentConstructor, QPatternist::CurrentFN, and QPatternist::NodeSortExpression.
Referenced by QPatternist::VariableLoader::announceExternalVariable(), QPatternist::NodeSortExpression::compress(), QPatternist::InstanceOf::compress(), QPatternist::SimpleContentConstructor::compress(), QPatternist::CastableAs::compress(), QPatternist::NodeComparison::compress(), QPatternist::CardinalityVerifier::compress(), QPatternist::CountFN::compress(), QPatternist::ForClause::compress(), QPatternist::StringJoinFN::compress(), QPatternist::CopyOf::compress(), QPatternist::CastAs::compress(), QPatternist::Path::compress(), QPatternist::OrderBy::compress(), constantPropagate(), QPatternist::GenericPredicate::create(), QPatternist::CastableAs::evaluateEBV(), QPatternist::NodeSortExpression::evaluateSequence(), QPatternist::GeneralComparison::fetchGeneralComparator(), QPatternist::ArithmeticExpression::fetchMathematician(), QPatternist::BySequenceTypeIdentifier::matches(), QPatternist::Path::newFocusType(), QPatternist::GenericPredicate::newFocusType(), QPatternist::OrderBy::OrderSpec::prepare(), QPatternist::NodeSortExpression::staticType(), QPatternist::FunctionCall::staticType(), QPatternist::TextNodeConstructor::staticType(), QPatternist::UnresolvedVariableReference::staticType(), QPatternist::RangeVariableReference::staticType(), QPatternist::StaticCompatibilityStore::staticType(), QPatternist::CardinalityVerifier::staticType(), QPatternist::ItemVerifier::staticType(), QPatternist::StaticBaseURIStore::staticType(), QPatternist::DynamicContextStore::staticType(), QPatternist::Atomizer::staticType(), QPatternist::Aggregator::staticType(), QPatternist::ReturnOrderBy::staticType(), QPatternist::SimpleContentConstructor::staticType(), QPatternist::IfThenClause::staticType(), QPatternist::ArithmeticExpression::staticType(), QPatternist::ForClause::staticType(), QPatternist::ExpressionVariableReference::staticType(), QPatternist::AttributeNameValidator::staticType(), QPatternist::CollationChecker::staticType(), QPatternist::CombineNodes::staticType(), QPatternist::CurrentItemStore::staticType(), QPatternist::UntypedAtomicConverter::staticType(), QPatternist::CopyOf::staticType(), QPatternist::LetClause::staticType(), QPatternist::ValueComparison::staticType(), QPatternist::FirstItemPredicate::staticType(), QPatternist::NodeComparison::staticType(), QPatternist::CastAs::staticType(), QPatternist::UserFunctionCallsite::staticType(), QPatternist::GenericPredicate::staticType(), QPatternist::Path::staticType(), QPatternist::AvgFN::staticType(), QPatternist::SumFN::staticType(), QPatternist::OrderBy::staticType(), QPatternist::RootFN::staticType(), QPatternist::DistinctValuesFN::staticType(), QPatternist::InsertBeforeFN::staticType(), QPatternist::RemoveFN::staticType(), QPatternist::ReverseFN::staticType(), QPatternist::SubsequenceFN::staticType(), QPatternist::DeepEqualFN::typeCheck(), QPatternist::FunctionCall::typeCheck(), QPatternist::NCNameConstructor::typeCheck(), QPatternist::ValueComparison::typeCheck(), QPatternist::CastableAs::typeCheck(), QPatternist::ForClause::typeCheck(), QPatternist::GeneralComparison::typeCheck(), QPatternist::ArithmeticExpression::typeCheck(), QPatternist::Atomizer::typeCheck(), QPatternist::UntypedAtomicConverter::typeCheck(), QPatternist::StringFN::typeCheck(), QPatternist::AddingAggregate::typeCheck(), QPatternist::IndexOfFN::typeCheck(), QPatternist::CastAs::typeCheck(), QPatternist::AvgFN::typeCheck(), QPatternist::NumberFN::typeCheck(), QPatternist::SumFN::typeCheck(), QPatternist::DistinctValuesFN::typeCheck(), QPatternist::ReverseFN::typeCheck(), QPatternist::GeneralComparison::updateType(), QPatternist::CardinalityVerifier::verifyCardinality(), and QPatternist::TypeChecker::verifyType().
|
virtual |
This implementation guarantees to never rewrite away this Expression, but at most rewrite it as a child of another expression(that presumably have a type checking role). It is therefore always safe to override this function and call this implementation and not worry about that this Expression becomes deleted.
Many Expressions override typeCheck() and performs optimizations, as opposed to doing it in the compress() stage. This is due to that the design of those Expressions often are tied to that certain simplifications are done at the typeCheck() stage of the compilation process or that it in some other way is related to what the typeCheck() do. Also, the earlier the AST can be simplified, the better the chances are for subsequent optimizations.
It is important that the super class's typeCheck() is called before doing any custom type checking, since the call can change the children(notably, the childrens' static types). For example, if the Expression, MyExpression in the example, does not match the required type, typeCheck returns the Expression wrapped in for example ItemVerifier, CardinalityVerifier, or both.
typeCheck() may be called many times. typeCheck() must either raise an error if this Expression is an invalid expression. Thus, it is guaranteed that an Expression is valid after typeCheck() is called.
context | supplies information, such as namespace bindings and available function signatures, that can be needed at compilation time. context is guaranteed by the caller to never null. |
reqType | the static type that this Expression must match when evaluated. reqType is guaranteed by the caller to never null. |
reqType
Reimplemented in QPatternist::SubsequenceFN, QPatternist::ReverseFN, QPatternist::DistinctValuesFN, QPatternist::StaticBaseURIFN, QPatternist::DefaultCollationFN, QPatternist::OrderBy, QPatternist::SumFN, QPatternist::DocFN, QPatternist::NumberFN, QPatternist::AvgFN, QPatternist::EvaluationCache< IsForGlobal >, QPatternist::DocumentFN, QPatternist::CastAs, QPatternist::IndexOfFN, QPatternist::AddingAggregate, QPatternist::ExpressionSequence, QPatternist::Path, QPatternist::StringFN, QPatternist::ContextItem, QPatternist::UntypedAtomicConverter, QPatternist::CallTemplate, QPatternist::TreatAs, QPatternist::ComparingAggregator< oper, result >, QPatternist::BooleanFN, QPatternist::Atomizer, QPatternist::ElementConstructor, QPatternist::CountFN, QPatternist::AxisStep, QPatternist::UserFunctionCallsite, QPatternist::StaticBaseUriContainer, QPatternist::ArithmeticExpression, QPatternist::CombineNodes, QPatternist::LetClause, QPatternist::IdFN, QPatternist::CastableAs, QPatternist::ForClause, QPatternist::GeneralComparison, QPatternist::DocumentConstructor, QPatternist::ValueComparison, QPatternist::ExpressionVariableReference, QPatternist::NCNameConstructor, QPatternist::StaticNamespacesContainer, QPatternist::FunctionCall, QPatternist::CurrentItemStore, QPatternist::EBVExtractor, QPatternist::StaticBaseURIStore, QPatternist::StaticCompatibilityStore, QPatternist::DeepEqualFN, QPatternist::FunctionAvailableFN, QPatternist::TypeAvailableFN, QPatternist::UnresolvedVariableReference, QPatternist::CurrentFN, and QPatternist::ResolveURIFN.
Definition at line 70 of file qexpression.cpp.
Referenced by QPatternist::UnresolvedVariableReference::typeCheck(), QPatternist::StaticCompatibilityStore::typeCheck(), QPatternist::StaticBaseURIStore::typeCheck(), QPatternist::CurrentItemStore::typeCheck(), QPatternist::FunctionCall::typeCheck(), QPatternist::NCNameConstructor::typeCheck(), QPatternist::ExpressionVariableReference::typeCheck(), QPatternist::ValueComparison::typeCheck(), QPatternist::DocumentConstructor::typeCheck(), QPatternist::CastableAs::typeCheck(), QPatternist::ForClause::typeCheck(), QPatternist::GeneralComparison::typeCheck(), QPatternist::IdFN::typeCheck(), QPatternist::LetClause::typeCheck(), QPatternist::ArithmeticExpression::typeCheck(), QPatternist::CombineNodes::typeCheck(), QPatternist::UserFunctionCallsite::typeCheck(), QPatternist::AxisStep::typeCheck(), QPatternist::ElementConstructor::typeCheck(), QPatternist::CountFN::typeCheck(), QPatternist::Atomizer::typeCheck(), QPatternist::TreatAs::typeCheck(), QPatternist::CallTemplate::typeCheck(), QPatternist::UntypedAtomicConverter::typeCheck(), QPatternist::ContextItem::typeCheck(), QPatternist::Path::typeCheck(), QPatternist::CastAs::typeCheck(), QPatternist::DocumentFN::typeCheck(), QPatternist::EvaluationCache< IsForGlobal >::typeCheck(), QPatternist::NumberFN::typeCheck(), QPatternist::DocFN::typeCheck(), QPatternist::TypeChecker::typeCheck(), QPatternist::OrderBy::typeCheck(), QPatternist::DefaultCollationFN::typeCheck(), QPatternist::ReverseFN::typeCheck(), and typeCheckOperands().
|
protected |
Definition at line 78 of file qexpression.cpp.
Referenced by QPatternist::UserFunctionCallsite::typeCheck(), QPatternist::DocumentFN::typeCheck(), and typeCheck().