diff options
author | Simon Hausmann <[email protected]> | 2018-07-10 14:52:34 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2018-08-09 13:18:39 +0000 |
commit | 82da798499aa8b656e771191332864a703069739 (patch) | |
tree | 35cb1d0ef8dd3d949f8b6f6324d19ec577b3f4df /src/qml/compiler/qv4bytecodehandler.cpp | |
parent | 6510046ee32ef69d7f250fd1d829063983f93fdd (diff) |
Add initial basic support for ES6 modules
The entry point from the parsing perspective into modules is not
QV4::Script but QV4::ExecutionEngine::compileModule.
For convenience, the ESModule AST node gets a body, which is the
statement list connected between the ModuleItemList items that are not
import/export declarations.
The QV4::Module allocates a call context where the exported variables
are stored as named locals. This will also become the module namespace
object.
The imports in turn is an array of value pointers that point into the
locals array of the context of the imported modules.
The default module loading in ExecutionEngine assumes the accessibility
of module urls via QFile (so local file system or resource). This is
what qmljs also uses and QJSEngine as well via public API in the future.
The test runner compiles the modules manually and injects them, because
they need to be compiled together with the test harness code.
The QML type loader will the mechanism for injection in the future for
module imports from .qml files.
Change-Id: I93be9cfe54c651fdbd08c5e1d22d58f47284e54f
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4bytecodehandler.cpp')
-rw-r--r-- | src/qml/compiler/qv4bytecodehandler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4bytecodehandler.cpp b/src/qml/compiler/qv4bytecodehandler.cpp index 23f7051718..d3c5582b28 100644 --- a/src/qml/compiler/qv4bytecodehandler.cpp +++ b/src/qml/compiler/qv4bytecodehandler.cpp @@ -161,6 +161,9 @@ std::vector<int> ByteCodeHandler::collectLabelsInBytecode(const char *code, uint COLLECTOR_BEGIN_INSTR(MoveConst) COLLECTOR_END_INSTR(MoveConst) + COLLECTOR_BEGIN_INSTR(LoadImport) + COLLECTOR_END_INSTR(LoadImport) + COLLECTOR_BEGIN_INSTR(LoadLocal) COLLECTOR_END_INSTR(LoadLocal) |