summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/parser
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2010-01-18 09:36:09 (GMT)
committerErik Verbruggen <erik.verbruggen@nokia.com>2010-01-18 09:36:09 (GMT)
commit4a1c0db988c87b4b4922e5a2607adadd633d99a1 (patch)
treebd3d2fcba50c2ce5f102ebe00ae40d974ea97762 /src/declarative/qml/parser
parenta73a9b168570d205185b370bcd24b4d0435530e4 (diff)
downloadQt-4a1c0db988c87b4b4922e5a2607adadd633d99a1.zip
Qt-4a1c0db988c87b4b4922e5a2607adadd633d99a1.tar.gz
Qt-4a1c0db988c87b4b4922e5a2607adadd633d99a1.tar.bz2
Added a utility method to get a casted AST root node.
Reviewed-by: Christian Kamm
Diffstat (limited to 'src/declarative/qml/parser')
-rw-r--r--src/declarative/qml/parser/qmljs.g8
-rw-r--r--src/declarative/qml/parser/qmljsast.cpp10
-rw-r--r--src/declarative/qml/parser/qmljsast_p.h3
-rw-r--r--src/declarative/qml/parser/qmljsparser_p.h8
4 files changed, 29 insertions, 0 deletions
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g
index ec9a956..0604457 100644
--- a/src/declarative/qml/parser/qmljs.g
+++ b/src/declarative/qml/parser/qmljs.g
@@ -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; }
diff --git a/src/declarative/qml/parser/qmljsast.cpp b/src/declarative/qml/parser/qmljsast.cpp
index 2a39aae..35ae0c8 100644
--- a/src/declarative/qml/parser/qmljsast.cpp
+++ b/src/declarative/qml/parser/qmljsast.cpp
@@ -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)) {
diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h
index 032fbb1..6f7f5cc 100644
--- a/src/declarative/qml/parser/qmljsast_p.h
+++ b/src/declarative/qml/parser/qmljsast_p.h
@@ -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
diff --git a/src/declarative/qml/parser/qmljsparser_p.h b/src/declarative/qml/parser/qmljsparser_p.h
index 2a09a63..660690b 100644
--- a/src/declarative/qml/parser/qmljsparser_p.h
+++ b/src/declarative/qml/parser/qmljsparser_p.h
@@ -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; }