forked from qt-creator/qt-creator
qmljs: support inline components
* add inline components to bind. * inserts inline components in the component that contains them (makes Context:lookupType simpler) * unify Context:lookupType overloads without adding extra heap allocations using a template (avoid code duplication) * add tests for inline components * warn about nested components * use model manager to load dependencies in tst_check (old test did not load dependencies and simply skipped all checks on imports) Fixes: QTCREATORBUG-24766 Fixes: QTCREATORBUG-24705 Change-Id: Ibcade7752cdaa08e960f66db3a724ab7fb3268cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
@@ -59,6 +59,10 @@ public:
|
||||
ObjectValue *findAttachedJSScope(AST::Node *node) const;
|
||||
bool isGroupedPropertyBinding(AST::Node *node) const;
|
||||
|
||||
QHash<QString, ObjectValue*> inlineComponents() const {
|
||||
return _inlineComponents;
|
||||
}
|
||||
|
||||
protected:
|
||||
using AST::Visitor::visit;
|
||||
|
||||
@@ -75,6 +79,7 @@ protected:
|
||||
bool visit(AST::UiObjectBinding *ast) override;
|
||||
bool visit(AST::UiScriptBinding *ast) override;
|
||||
bool visit(AST::UiArrayBinding *ast) override;
|
||||
bool visit(AST::UiInlineComponent *ast) override;
|
||||
|
||||
// QML/JS
|
||||
bool visit(AST::FunctionDeclaration *ast) override;
|
||||
@@ -93,11 +98,13 @@ private:
|
||||
ObjectValue *_currentObjectValue;
|
||||
ObjectValue *_idEnvironment;
|
||||
ObjectValue *_rootObjectValue;
|
||||
QString _currentComponentName;
|
||||
|
||||
QHash<AST::Node *, ObjectValue *> _qmlObjects;
|
||||
QMultiHash<QString, const ObjectValue *> _qmlObjectsByPrototypeName;
|
||||
QSet<AST::Node *> _groupedPropertyBindings;
|
||||
QHash<AST::Node *, ObjectValue *> _attachedJSScopes;
|
||||
QHash<QString, ObjectValue*> _inlineComponents;
|
||||
|
||||
bool _isJsLibrary;
|
||||
QList<ImportInfo> _imports;
|
||||
|
||||
Reference in New Issue
Block a user