Re: [Development] Question about QtDeclarative Internals

2021-04-25 Thread Alex Shaw
Hi Ulf, Thanks for the advice. I think I got it working. Patch submitted on Gerrit: https://codereview.qt-project.org/c/qt/qtdeclarative/+/345339 It includes documentation and a test, and it works with named imports (i.e. import { version } from "info") Mostly it was just storing the QJSValues as

Re: [Development] Question about QtDeclarative Internals

2021-04-21 Thread Ulf Hermann
Hi Alex, the simplest way I can see here would not be a compilation unit. The compilation unit is only needed if you want to run JavaScript. The place where the imports of a script are saved is QV4::CompiledData::CompilationUnitBase::imports of the _importing_ unit. That's an array QV4::Stati

Re: [Development] Question about QtDeclarative Internals

2021-04-21 Thread Alex Shaw
Hello Fabian, Thanks for replying. The QJSValue represents any basic JS type that could be exported from a regular module. For example: export const MAGIC = 6; export default { name: "Qt6", version: "6.1.3" } In C++: QJSValue magic(6); QJSValue name("Qt6"); QJSValue version("6.1.3"); QJSValu

Re: [Development] Question about QtDeclarative Internals

2021-04-21 Thread Fabian Kosmale
ftrag von Alex Shaw Gesendet: Mittwoch, 21. April 2021 16:18 An: development@qt-project.org Betreff: [Development] Question about QtDeclarative Internals Hello, In QtDeclarative, can a QV4::ReturnedValue or a QV4::Value be converted into an ExecutableCompilationUnit? I'm trying to work on a

Re: [Development] Question about QtDeclarative Internals

2021-04-21 Thread Jason H
> Hello, >   > In QtDeclarative, can a QV4::ReturnedValue or a QV4::Value be converted into > an ExecutableCompilationUnit? > > I'm trying to work on a patch for QJSEngine to allow importing modules from > C++ (similar to Node.js: import fs from "fs") > The planned method is something along the

[Development] Question about QtDeclarative Internals

2021-04-21 Thread Alex Shaw
Hello, In QtDeclarative, can a QV4::ReturnedValue or a QV4::Value be converted into an ExecutableCompilationUnit? I'm trying to work on a patch for QJSEngine to allow importing modules from C++ (similar to Node.js: import fs from "fs") The planned method is something along the lines of: void QJSE