Add QmlJS::Document::ast() for when the type of the AST doesn't matter.

Ideally most of our visitors won't need to make the QML vs JS
distinction. For these cases it'll be handy to be able to access the AST
no matter whether it's a Program or UiProgram.
This commit is contained in:
Christian Kamm
2010-01-19 10:16:57 +01:00
parent a59ea0f2a4
commit 419bc3005e
2 changed files with 10 additions and 0 deletions

View File

@@ -82,6 +82,14 @@ AST::Program *Document::jsProgram() const
return _jsProgram;
}
AST::Node *Document::ast() const
{
Q_ASSERT(!_uiProgram || !_jsProgram);
if (_uiProgram)
return _uiProgram;
return _jsProgram;
}
QList<DiagnosticMessage> Document::diagnosticMessages() const
{
return _diagnosticMessages;