Qt 4.8
Public Functions | Properties | List of all members
QPatternist::UnresolvedVariableReference Class Reference

Compile time only AST-node which is a marker for variable references whose declaration has not yet appeared in the source code. More...

#include <qunresolvedvariablereference_p.h>

Inheritance diagram for QPatternist::UnresolvedVariableReference:
QPatternist::EmptyContainer QPatternist::Expression QSharedData QPatternist::CppCastingHelper< Expression > QPatternist::SourceLocationReflection

Public Functions

virtual ExpressionVisitorResult::Ptr accept (const ExpressionVisitor::Ptr &visitor) const
 
void bindTo (const Expression::Ptr &body)
 
virtual SequenceType::List expectedOperandTypes () const
 
virtual ID id () const
 
Expression::Ptr replacement () const
 
virtual SequenceType::Ptr staticType () const
 
virtual Expression::Ptr typeCheck (const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
 
 UnresolvedVariableReference (const QXmlName &name)
 
- Public Functions inherited from QPatternist::EmptyContainer
virtual Expression::List operands () const
 
virtual void setOperands (const Expression::List &)
 
- Public Functions inherited from QPatternist::Expression
virtual const SourceLocationReflectionactualReflection () const
 Returns this. More...
 
virtual void announceFocusType (const ItemType::Ptr &itemType)
 
virtual Expression::Ptr compress (const StaticContext::Ptr &context)
 
Properties deepProperties () const
 Computes the union of properties for this Expression and all its descending children. More...
 
virtual Properties dependencies () const
 
virtual QString description () const
 
virtual bool evaluateEBV (const DynamicContext::Ptr &context) const
 
virtual Item::Iterator::Ptr evaluateSequence (const DynamicContext::Ptr &context) const
 
virtual Item evaluateSingleton (const DynamicContext::Ptr &context) const
 
virtual void evaluateToSequenceReceiver (const DynamicContext::Ptr &context) const
 
virtual ItemType::Ptr expectedContextItemType () const
 
 Expression ()
 
bool has (const Property prop) const
 
bool hasDependency (const Property prop) const
 
bool is (const ID id) const
 
bool isEvaluated () const
 
virtual ItemType::Ptr newFocusType () const
 
virtual QList< QExplicitlySharedDataPointer< OptimizationPass > > optimizationPasses () const
 
virtual PatternPriority patternPriority () const
 
virtual Properties properties () const
 
const Expression::Ptrrewrite (const Expression::Ptr &to, const StaticContext::Ptr &context) const
 Rewrites this Expression to to, and return to. More...
 
virtual ~Expression ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 
- Public Functions inherited from QPatternist::CppCastingHelper< Expression >
const TCastTarget * as () const
 
TCastTarget * as ()
 
- Public Functions inherited from QPatternist::SourceLocationReflection
virtual QSourceLocation sourceLocation () const
 
 SourceLocationReflection ()
 
virtual ~SourceLocationReflection ()
 

Properties

const QXmlName m_name
 
Expression::Ptr m_replacement
 

Additional Inherited Members

- Public Types inherited from QPatternist::Expression
typedef QExplicitlySharedDataPointer< const ExpressionConstPtr
 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::PtrList
 
typedef QFlags< PropertyProperties
 
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< ExpressionPtr
 A smart pointer wrapping mutable Expression instances. More...
 
typedef ::QAbstractXmlForwardIterator< Expression::PtrQAbstractXmlForwardIterator
 
typedef QVector< Expression::PtrVector
 
- Static Public Functions inherited from QPatternist::Expression
static void rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context)
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 
- Protected Functions inherited from QPatternist::EmptyContainer
virtual bool compressOperands (const StaticContext::Ptr &context)
 
- Protected Functions inherited from QPatternist::Expression
void typeCheckOperands (const StaticContext::Ptr &context)
 
- Protected Functions inherited from QPatternist::CppCastingHelper< Expression >
 CppCastingHelper ()
 

Detailed Description

Compile time only AST-node which is a marker for variable references whose declaration has not yet appeared in the source code.

This can not appear in XQuery, but can in XSL-T.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com
Since
4.5

Definition at line 73 of file qunresolvedvariablereference_p.h.

Constructors and Destructors

◆ UnresolvedVariableReference()

UnresolvedVariableReference::UnresolvedVariableReference ( const QXmlName name)

Definition at line 50 of file qunresolvedvariablereference.cpp.

50  : m_name(name)
51 {
53 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool isNull() const
Returns true if this QXmlName is not initialized with a valid combination of {namespace URI}...
Definition: qxmlname.cpp:224

Functions

◆ accept()

ExpressionVisitorResult::Ptr UnresolvedVariableReference::accept ( const ExpressionVisitor::Ptr visitor) const
virtual

Implements QPatternist::Expression.

Definition at line 81 of file qunresolvedvariablereference.cpp.

82 {
83  return visitor->visit(this);
84 }

◆ bindTo()

void QPatternist::UnresolvedVariableReference::bindTo ( const Expression::Ptr body)
inline

Definition at line 94 of file qunresolvedvariablereference_p.h.

95  {
96  Q_ASSERT(body);
97  m_replacement = body;
98  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ expectedOperandTypes()

SequenceType::List UnresolvedVariableReference::expectedOperandTypes ( ) const
virtual
Returns
always an empty list since it has no operands.

Reimplemented from QPatternist::EmptyContainer.

Definition at line 76 of file qunresolvedvariablereference.cpp.

77 {
78  return SequenceType::List();
79 }
QList< SequenceType::Ptr > List

◆ id()

Expression::ID UnresolvedVariableReference::id ( ) const
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.

Returns
always IgnorableExpression.

Reimplemented from QPatternist::Expression.

Definition at line 86 of file qunresolvedvariablereference.cpp.

◆ replacement()

Expression::Ptr QPatternist::UnresolvedVariableReference::replacement ( ) const
inline

Definition at line 100 of file qunresolvedvariablereference_p.h.

Referenced by QPatternist::checkVariableCircularity().

101  {
103  return m_replacement;
104  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ staticType()

SequenceType::Ptr UnresolvedVariableReference::staticType ( ) const
virtual
Returns
the static type of this Expression. For example, an 'and' expression have as static type xs:boolean

Implements QPatternist::Expression.

Definition at line 67 of file qunresolvedvariablereference.cpp.

68 {
69  /* We may be called by xmlpatternsview before the typeCheck() stage. */
70  if(m_replacement)
71  return m_replacement->staticType();
72  else
74 }
static const SequenceType::Ptr ZeroOrMoreItems
virtual SequenceType::Ptr staticType() const =0

◆ typeCheck()

Expression::Ptr UnresolvedVariableReference::typeCheck ( const StaticContext::Ptr context,
const SequenceType::Ptr reqType 
)
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.

Parameters
contextsupplies 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.
reqTypethe 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::Expression.

Definition at line 55 of file qunresolvedvariablereference.cpp.

57 {
58  /* We may be called before m_replacement is called, when we're part of a
59  * function body whose type checking is performed for. See
60  * UserFunctionCallsite::typeCheck(). */
61  if(m_replacement)
62  return m_replacement->typeCheck(context, reqType);
63  else
64  return EmptyContainer::typeCheck(context, reqType);
65 }
virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
Definition: qexpression.cpp:70

Properties

◆ m_name

const QXmlName QPatternist::UnresolvedVariableReference::m_name
private

Definition at line 90 of file qunresolvedvariablereference_p.h.

Referenced by UnresolvedVariableReference().

◆ m_replacement

Expression::Ptr QPatternist::UnresolvedVariableReference::m_replacement
private

Definition at line 91 of file qunresolvedvariablereference_p.h.

Referenced by staticType(), and typeCheck().


The documentation for this class was generated from the following files: