forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user