diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-06 14:19:35 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-14 17:45:33 +0000 |
commit | e9f41fdf19749dda82c8005515c9941b757750c5 (patch) | |
tree | f015b35d04be96283ce5a7157445458339502963 /src/qml/compiler/qv4compileddata.cpp | |
parent | bae423474b51fd0651aaea7cb18071a2206109b1 (diff) |
Implement initial support for import namespaces
The import via
import * as foo from "./bar.js"
allows accessing all exports via the special namespace object. This is
conceptually quite similar to the existing import of .js files in
QtQuick.
Change-Id: Ia6d79342f0884a89dfe4dc07316570ca7789cac0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 4e7674a67a..33e463c76a 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -469,6 +469,9 @@ const Value *CompilationUnit::resolveExportRecursively(QV4::String *exportName, (*resolveSet) << ResolveSetEntry(this, exportName); + if (exportName->toQString() == QLatin1String("*")) + return &m_module->self; + Scope scope(engine); if (auto localExport = lookupNameInExportTable(data->localExportEntryTable(), data->localExportEntryTableSize, exportName)) { |