Incorporated change 4a1c0db988c87b4b4922e5a2607adadd633d99a1 from kinetic-declarativeui.

Added a utility method to get a casted AST root node.

Reviewed-by: Christian Kamm
This commit is contained in:
Erik Verbruggen
2010-01-18 10:39:11 +01:00
committed by Tim Jenssen
parent a704b974b5
commit d19418f4d8
4 changed files with 29 additions and 0 deletions

View File

@@ -296,6 +296,14 @@ public:
return program->uiObjectMemberCast();
}
AST::SourceElement *sourceElement() const
{
if (! program)
return 0;
return program->sourceElementCast();
}
QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; }

View File

@@ -81,6 +81,11 @@ UiObjectMember *Node::uiObjectMemberCast()
return 0;
}
SourceElement *Node::sourceElementCast()
{
return 0;
}
ExpressionNode *ExpressionNode::expressionCast()
{
return this;
@@ -772,6 +777,11 @@ void SourceElements::accept0(Visitor *visitor)
visitor->endVisit(this);
}
SourceElement *SourceElement::sourceElementCast()
{
return this;
}
void FunctionSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {

View File

@@ -230,6 +230,7 @@ public:
virtual BinaryExpression *binaryExpressionCast();
virtual Statement *statementCast();
virtual UiObjectMember *uiObjectMemberCast();
virtual SourceElement *sourceElementCast();
void accept(Visitor *visitor);
static void accept(Node *node, Visitor *visitor);
@@ -2164,6 +2165,8 @@ public:
{ kind = K; }
virtual ~SourceElement() {}
virtual SourceElement *sourceElementCast();
};
class QML_PARSER_EXPORT FunctionSourceElement: public SourceElement

View File

@@ -162,6 +162,14 @@ public:
return program->uiObjectMemberCast();
}
AST::SourceElement *sourceElement() const
{
if (! program)
return 0;
return program->sourceElementCast();
}
QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; }