diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-14 13:01:51 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-14 17:45:51 +0000 |
commit | 929ef25efd402368a9f154b61aa96b4b01a02ce2 (patch) | |
tree | c7e3c3a57bb0f27c354a83d797b0d53af8719f9a /src/qml/parser/qqmljsast_p.h | |
parent | 859b78e063947309932c0d7c154736227ed903ae (diff) |
Fix module dependency handling
The evaluation of a module can have side-effects by modifying the global
object or objects in it. Therefore even a seemingly empty import such as
import "./foo.js"
needs to be listed in the module requests. It's also important that they
are evaluated in the order of declaration. Therefore we collect all
module requests separately - even those that don't have import variables
to process. This patch also ensures that the export and import
declarations are visited in the correct order, by unifying both AST
nodes to be hooked into the statement list.
The fact that we connect the module list items into a statement list is
solely an artifact of re-using defineFunction() which takes a
StatementList as body.
Change-Id: I75dc357b2aecfc324d9a9fe66952eff1ec1dfd8a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast_p.h')
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index e344dd4a28..1429d784c6 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -2539,7 +2539,7 @@ public: QStringRef moduleSpecifier; }; -class QML_PARSER_EXPORT ImportDeclaration: public Node +class QML_PARSER_EXPORT ImportDeclaration: public Statement { public: QQMLJS_DECLARE_AST_NODE(ImportDeclaration) @@ -2755,7 +2755,7 @@ public: StatementList *buildStatementList(MemoryPool *pool) const; - void accept0(Visitor *visitor) override; + void accept0(Visitor *) override; SourceLocation firstSourceLocation() const override { return item->firstSourceLocation(); } |