|
typedef QExplicitlySharedDataPointer< FunctionCall > | Ptr |
|
enum | CardinalityComputation { ProductOfCardinality,
UnionOfCardinality
} |
|
typedef QExplicitlySharedDataPointer< const Expression > | ConstPtr |
| A smart pointer wrapping const Expression instances. More...
|
|
enum | ID {
IDBooleanValue = 1,
IDCountFN,
IDEmptyFN,
IDExistsFN,
IDExpressionSequence,
IDGeneralComparison,
IDIfThenClause,
IDIgnorableExpression,
IDIntegerValue,
IDPositionFN,
IDStringValue,
IDValueComparison,
IDRangeVariableReference,
IDContextItem,
IDUserFunctionCallsite,
IDExpressionVariableReference,
IDAttributeConstructor,
IDUpperCaseFN,
IDLowerCaseFN,
IDFirstItemPredicate,
IDEmptySequence,
IDReturnOrderBy,
IDLetClause,
IDForClause,
IDPath,
IDNamespaceConstructor,
IDArgumentReference,
IDGenericPredicate,
IDAxisStep,
IDFloat,
IDCombineNodes,
IDUnresolvedVariableReference,
IDCardinalityVerifier
} |
|
typedef QList< Expression::Ptr > | List |
|
typedef QFlags< Property > | Properties |
|
enum | Property {
UseContextItem = 1,
DisableElimination = 1 << 1,
IsEvaluated = 1 << 2,
DisableTypingDeduction = 1 << 3,
EmptynessFollowsChild = 1 << 4,
RewriteToEmptyOnEmpty = 1 << 5,
RequiresFocus = 1 << 6,
AffectsOrderOnly = 1 << 7,
RequiresContextItem = (1 << 8) | RequiresFocus,
CreatesFocusForLast = 1 << 9,
LastOperandIsCollation = 1 << 10,
DependsOnLocalVariable = (1 << 11) | DisableElimination,
EvaluationCacheRedundant = (1 << 12),
IsNodeConstructor = 1 << 13,
RequiresCurrentItem = 1 << 14
} |
|
typedef QExplicitlySharedDataPointer< Expression > | Ptr |
| A smart pointer wrapping mutable Expression instances. More...
|
|
typedef ::QAbstractXmlForwardIterator< Expression::Ptr > | QAbstractXmlForwardIterator |
|
typedef QVector< Expression::Ptr > | Vector |
|
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
|
QAtomicInt | ref |
|
template<CardinalityComputation suppliedCard> |
SequenceType::Ptr | operandsUnionType () const |
|
void | typeCheckOperands (const StaticContext::Ptr &context) |
|
| CppCastingHelper () |
|
Expression::List | m_operands |
|
Implements XSL-T's function fn:document()
.
fn:document()
has no evaluation functions, because it rewrites itself to a set of expressions that is the implementation.
The two-argument version:
document($uris as item()*, $baseURINode as node()) as node()*
is rewritten into:
for $uri in distinct-values($uris) return doc(resolve-uri($uri, base-uri($baseURINode)))
and the single version argument:
document($uris as item()*) as node()*
is rewritten into:
for $uri in distinct-values($uris) return doc($uri)
The distinct-values() call ensures the node deduplication and sorting, although it fails in the case that URIs resolve/directs in some way to the same document. Some of those cases can be solved by wrapping the whole expression with a node deduplication(conceptually the-for-loop/.). One advantage with distinct-values() over generating traditional node sorting/deduplication code is that the latter contains node sorting which is uecessary and can be hard to analyze away. distinct-values() doesn't have this problem due to its narrower task..
This works without problems, assuming XTRE1160 is not raised and that the recover action instead is ignore. In the case XTRE1160 is raised, one must cater for this.
In addition to this, both signatures has its first argument changed to type xs:string*
, in order to generate atomization code.
One notable thing is that the expression for $baseURINode, is moved inside a loop, and will be evaluated repeatedly, unless moved out as part of optimization.
- Author
- Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com
- Since
- 4.5
Definition at line 112 of file qdocumentfn_p.h.
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.
- Parameters
-
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. |
- Returns
- an Expression that can be this Expression, or another expression, which somehow is necessary for making this Expression conforming to
reqType
Reimplemented from QPatternist::FunctionCall.
Definition at line 52 of file qdocumentfn.cpp.
78 context->
addLocation(uriReference.data(), myLocation);
85 baseUriArgs.
append(uriReference);
96 docArgs.
append(uriReference);
111 rewrite(oldMe, newMe, context);
112 return newMe->typeCheck(context, reqType);
Expression::List m_operands
Implements XPath 2.0's for expression.
int count(const T &t) const
Returns the number of occurrences of value in the list.
void append(const T &t)
Inserts value at the end of the list.
virtual VariableSlotID allocateRangeSlot()=0
void typeCheckOperands(const StaticContext::Ptr &context)
static void rewrite(Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context)
const T & at(int i) const
Returns the item at index position i in the list.
The QSourceLocation class identifies a location in a resource by URI, line, and column.
virtual QExplicitlySharedDataPointer< FunctionFactory > functionSignatures() const =0
virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const =0
Returns the source location applying for reflection.
T & first()
Returns a reference to the first item in the list.
virtual void addLocation(const SourceLocationReflection *const reflection, const QSourceLocation &location)=0
Adds location for reflection.
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
A reference to a variable declared with for or a quantification expression, but not for instance a le...