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/compiler/qv4compilercontext_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/compiler/qv4compilercontext_p.h')
-rw-r--r-- | src/qml/compiler/qv4compilercontext_p.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index 216d5ca56b..0f7f4c835d 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -140,6 +140,7 @@ struct Module { QVector<ExportEntry> indirectExportEntries; QVector<ExportEntry> starExportEntries; QVector<ImportEntry> importEntries; + QStringList moduleRequests; }; @@ -176,6 +177,7 @@ struct Context { QQmlJS::AST::FormalParameterList *formals = nullptr; QStringList arguments; QStringList locals; + QStringList moduleRequests; QVector<ImportEntry> importEntries; QVector<ExportEntry> exportEntries; bool hasDefaultExport = false; |