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/jsruntime/qv4module_p.h | |
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/jsruntime/qv4module_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4module_p.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4module_p.h b/src/qml/jsruntime/qv4module_p.h index 1958258ef0..c22e6cd1c3 100644 --- a/src/qml/jsruntime/qv4module_p.h +++ b/src/qml/jsruntime/qv4module_p.h @@ -61,7 +61,8 @@ namespace Heap { #define ModuleMembers(class, Member) \ Member(class, NoMark, CompiledData::CompilationUnit *, unit) \ - Member(class, Pointer, CallContext *, scope) + Member(class, Pointer, CallContext *, scope) \ + Member(class, HeapValue, HeapValue, self) DECLARE_EXPORTED_HEAP_OBJECT(Module, Object) { DECLARE_MARKOBJECTS(Module) @@ -73,6 +74,17 @@ DECLARE_EXPORTED_HEAP_OBJECT(Module, Object) { struct Q_QML_EXPORT Module : public Object { V4_OBJECT2(Module, Object) + + static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); + static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static bool virtualPreventExtensions(Managed *); + static bool virtualDefineOwnProperty(Managed *, PropertyKey, const Property *, PropertyAttributes); + static bool virtualPut(Managed *, PropertyKey, const Value &, Value *); + static bool virtualDeleteProperty(Managed *m, PropertyKey id); + static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *); + static Heap::Object *virtualGetPrototypeOf(const Managed *); + static bool virtualSetPrototypeOf(Managed *, const Object *proto); + static bool virtualIsExtensible(const Managed *); }; } |