| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
The qmldevtools library is no more, therefore we can resolve the TODO
and remove the method that only existed for it.
Change-Id: I685d9305e4b42a34ade56baccce0ec2e49cbcf4a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces a new AST node for property attributes (currently
required, default and readonly). That node is not integrated into our
visitors, as it is only meant as an internal implementaion detail of
UiPublicMember. All information stored in it is meant to be accessed by
UiPublicMember's methods (see also the note below).
We use an union of SourceLocation and a node pointer to only pay the
overhead of the new node for properties; signals simply store the signal
token.
The grammar is rewritten with a new UiPropertyAttributes rule, which
avoids quite a bit of duplication in various rules, which had to deal
with the combinatorial explosion of attributes. Some parse errors are
now turned into semantic errors instead (readonly without initializer,
required with initializer).
By centralizing the handling of attributes in the grammar, we now can
easily support e.g. default properties with a list initializer.
As part of this restructuring, UiPublicMember's firstSourceLocation is
fixed to ensure that we actually return the first source location,
independent of the order in which the attributes are written.
Note: In theory, we would not need to make UiPropertyAttributes an AST
node. It could be a simple data class. However, the parser currently
assumes that every pointer in its parser stack is an AST node, and
touching that part would be a larger undertaking. As we use a pool
allocator, the cost is not that high (though we use more memory from the
pool then we would strictly need to).
Change-Id: Ia1d9fd7a6553d443cc57bc3d773f5be0aebe0e0e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of directly accessing the attribute related members of
UiPublicMember, we access them via a function.
Moreover, we remove some redundancy: A property is
readonly/default/required if and only if the corresponding token is
valid. Thus we can drop the boolean members.
Change-Id: I22f15b2b037e857d2f9d3167cb761cba9516a135
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
[ChangeLog][QtQml] You can now specify the list property assignment
behavior in QML using the "ListPropertyAssignBehavior" pragma. This is
analogous to the macros you can use in C++.
Fixes: QTBUG-93642
Change-Id: I9bdcf198031f1e24891f947b0990a3253d29a998
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this change, they were treated as script bindings, which are less
efficient, and could not be used in ListElement.
Fixes: QTBUG-95139
Pick-to: 6.2
Change-Id: Ic66052c7f58b3ffdf1b7c0c169f42b4f99df62a1
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
| |
It is an invariant that any UiArrayBinding has a qualifiedId.
Change-Id: I62a68f90db39caffc4b97634d8d51317a367b61d
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change implements optional chaining (https://github.com/tc39/proposal-optional-chaining) by adding a new type of optional lookup with an offset to the end of a chain.
If `undefined` or `null` is encountered during an access marked as optional, we jump to that end offset.
Features:
- Full support for all kinds of optional chain
- With some codegen overhead but zero overhead during normal non-optional FieldMemberExpression resolution
- Properly retains this contexts and does not need to resolve anything twice (this has been an issue previously)
- No extra AST structures, just flags for existing ones
[ChangeLog][QtQml] Added support for optional chaining (https://github.com/tc39/proposal-optional-chaining)
Fixes: QTBUG-77926
Change-Id: I9a41cdc4ca272066c79c72b9b22206498a546843
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The AST is constructed in such a way that having exportAll set always
implies that a fromClause exists.
Also, clean up exportAll: We do not need a separate member to track it.
Its value is fully determined by the presence of fromClause and
exportsClause. Thus, replace it with a function.
Change-Id: Ib7db2bbaf326ecc36a7f4a2986a7c1fb54db6cd5
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
You should declare functions with formal parameters if you want to use
parameters passed by the signal. We need to generate two different
warnings because there are two code paths by which such parameters are
injected. If we compile with qmlcachegen, it simply inserts a lookup
instruction in to the byte code. This lookup then triggers our special
hack expressly made for signal parameters. If we don't compile using
qmlcachegen, a function declaration with formal parameters is
synthesized. We mark those formal parameters as injected and warn if
we see one of them used.
[ChangeLog][QML][Important Behavior Changes] The automatic injection of
signal parameters into signal handlers is deprecated. This is because we
cannot determine the names of the signal parameters at compile time.
Furthermore, also for human readers it is difficult to discern between
arguments, context properties, properties of the current object, and
properties of the root object of the component. Requiring the signal
parameters to be explicitly named resolves some of this confusion. You
can turn the deprecation warning off using the "qt.qml.compiler" and
"qt.qml.context" logging categories.
Task-number: QTBUG-89943
Pick-to: 6.1
Change-Id: If0a5082adb735a73efd793868b3a55bc7d694cbe
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
| |
Task-number: QTBUG-84319
Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-81392
Change-Id: Ic83091c547a7854b7fa86b44d93c575bd7426bae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
An import statement without version specifier imports the latest version
available, one with only a major version imports the latest minor
version from that major version.
Task-number: QTBUG-71278
Change-Id: I43907ae4e1052be533039d545de5391c41d38307
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/compiler/qqmlirbuilder_p.h
src/qml/qml/qqmlpropertycachecreator_p.h
src/qmltyperegistrar/qmltypesclassdescription.cpp
src/qmltyperegistrar/qmltypesclassdescription.h
src/qmltyperegistrar/qmltypescreator.cpp
src/quick/items/qquicktext_p.h
src/quick/util/qquickvaluetypes_p.h
Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
|
| |
| |
| |
| |
| |
| | |
Change-Id: I11e5c9e95974e89f2fd1571ca4b97a0f2ac3309a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/imports/qtqml/plugin.cpp
src/qml/qml/qqml.h
src/qml/qml/qqmlmetatype.cpp
src/qml/qml/qqmlmetatype_p.h
src/qml/qml/qqmltypeloader.cpp
src/qml/types/qqmlbind.cpp
src/quick/items/qquickitemsmodule.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a partial patch that is fuilly fixed with the following
one (big restructure) because it needs extra visit methods,
and that leads to conflicts, but I think it gets lost if merged with
the next one.
Change-Id: I54331a47a5c7faaf78a97e580825d1feec5adf92
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Base Visitor is an abstract visitor that has all visit methods
abstract, subclassing this one gets an error if some visit method is
not implemented (dumper and reformatter for example will gain from
this.
Change-Id: I3f8cfeb6fc0ef917acf725bbe1c293d761304287
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
attributes are always at the end of AST objects, move them there also
for UiObjectDefinition.
Change-Id: I7630b1c40627913c3e7e46e752acf1d80203ce63
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Annotations are added to UiObjectMember.
This makes it easy to find the annotations of any UiObjectMember
through the annotations attribute.
The clean AST approach would add an UiAnnotatedObjectMember that contains
both the annotation list and an UiObjectMember, but that makes
finding the annotation more difficult.
The annotations are not visited by default, if one wants to dump them
before the current object the simplest way is to use the preVisit and
use .uiObjectMemberCast().
Depending on how we use annotation we could change the current
approach.
Task-number: QTBUG-81714
Change-Id: I543a2cfe5157bcc86de6de9faebde9aea22974eb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/common/qv4compileddata_p.h
tests/auto/qml/qmlmin/tst_qmlmin.cpp
Change-Id: Ieabc9e0729630de6a8644024d11b765f35199f29
|
| |
| |
| |
| |
| |
| |
| |
| | |
It is now possible to mark a property of a parent class as required in
the child by writing required <propertyName>
Change-Id: I9e9d58c7b5c00577b056e905b39744b2fa359ea0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
In many places we carry major and minor versions or revisions that are
loosely coupled to minor versions. As the Qt minor version resets now,
we need to handle these things more systematically. In particular, we
need to add a "major" part to revisions.
QTypeRevision can express the current major/minor pairs more efficiently
and can also be used to add a major version to revisions. This change
does not change the semantics, yet, but only replaces the types.
Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[ChangeLog][QtQml] It is now possible to declare new QML components in
a QML file via the component keyword. They can be used just as if they
were declared in another file, with the only difference that the type
name needs to be prefixed with the name of the containing type outside
of the file were the inline component has been declared.
Notably, inline components are not closures: In the following
example, the output would be 42
// MyItem.qml
Item {
property int i: 33
component IC: Item {
Component.onCompleted: console.log(i)
}
}
// user.qml
Item {
property int i: 42
MyItem.IC {}
}
Fixes: QTBUG-79382
Change-Id: I6a5ffc43f093a76323f435cfee9bab217781b8f5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Implements the '??' operator as specified in https://github.com/tc39/proposal-nullish-coalescing.
Also adds a few tests.
Task-number: QTBUG-77926
Change-Id: I3993450c192d11bf1ade0662d945c1553b4c6976
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
You can write "(something as Foo)" to give hints to any tools that you
expect something to be a Foo at this place. This is not a conversion and
ignored at runtime for now. Eventually the compiler will verify that the
type assertions are plausible and error out if they aren't.
Change-Id: I21c8705bb387f7ab2cbc153293dbf477663afe87
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When asked for lastSourceLocation() we should always return the
semicolon token. In order for that to work, the semicolon token needs to
be valid in all cases. In the case of object literals as expressions for
properties we neither accepted nor synthesized a semicolon as delimiter.
Add an optional semicolon that we can then also use as end of the
expression statement.
Furthermore, this triggered a silent rule conflict for ImportSpecifier, which
for some reason did not arise before:
IdentifierReference could resolve to both ImpordBinding and IdentifierName,
causing ambiguity in the grammar, and ultimately caused parse failues
when parsing an import statement.
This is now resolved by explicitly telling the parser to prefer
shifting.
Initial-patch-by: Ulf Hermann <ulf.hermann@qt.io>
Change-Id: Iaec29c452b577312248a17cb48f005f4fc0bd8c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
It was incorrectly parsed in case of "as Foo", and it was mostly unused.
Change-Id: Ie833a8eb247108cb7bcd6ca3e6f3e5df614461cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With QV4_CRASH_ON_STACKOVERFLOW set you can use up all the stack
provided by the operating system to parse and execute JavaScript. Once
the stack space is exhausted the program crashes like it would in case
of a C++ stack overflow.
We cannot reliably determine either the maximum stack size or the amount
of stack space currently in use at runtime. Therefore, the guards we
usually put in place are necessarily conservative.
[ChangeLog][QtQml] There is now an option to disable the (necessarily)
conservative stack size checks when parsing and executing JavaScript. If
the environment variable QV4_CRASH_ON_STACKOVERFLOW is set, JavaScript
stack overflows crash the program the same way C++ stack overflows do.
On the flip side, more stack space is made available that way.
Task-number: QTBUG-74087
Change-Id: I5e9d9ec6c0c9c6258c31d9e2d04a5c1819fbf400
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[ChangeLog][QtQml]
"required" is now a (contextual) keyword in QML, and users can
mark properties with it to specify that those properties must be set
when the component gets instantiated.
This can be done either declaratively via standard property
bindings from QML, or imperatively by using the functions to set initial
properties (QQmlCompoent::setInitalProperties and related functions in
C++, Qt.createObject, Loader.setSource,... in QML/JS).
Logic has been added to QQmlComponent::create and the various QQmlIncubator
classes to verify that the required properties were set. If properties
marked as required are not set, a warning will be printed at runtime,
and the component will not be created.
Change-Id: I8e38227fc8f173b053b689c1597dc7fd40e835e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I35d44de09f9d4133eb82490a1edb57eb374ff2f1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extends grammar to support generator functions in QML components and
adjusts codegen accordingly
The corresponding test case must be blacklisted in tst_qmlmin, as qmlmin
cannot handle yield statements
Fixes: QTBUG-77096
Change-Id: I47d45dd56289cdf073b41932a585259d3052de04
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We support
signal(int param)
but we should also support
signal(param: int)
for consistency with the syntax now supported for functions.
Change-Id: Ic064bbaac45024d3663562819f3c1f3f4a918a56
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
functions
These can be declared using the new typescript-like syntax and using
type names that are also used for signal parameters and property types.
This merely affects their signature on the C++ side and allows the
corresponding invocation.
Change-Id: Icaed4ee0dc7aa71330f99d96e073a2a63d409bbe
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
| |
Change-Id: Ia9ba819ce77eee7e582cf90aacf5baa4813d9fca
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
This allows extracting the type information for variable declarations.
Change-Id: I1241df3b27ae292b83392d5caaa1587caafa46a3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Inspired by TypeScript syntax, allow optional type annotations in the
style of ": <name of type>" in for the parameters of functions and their
return type.
These annotations are not used at the moment, so by default we produce
an error message when encountering them in the AST.
In addition their usage is limited to functions declared in the QML
scope. All other uses attempt to produce readable syntax errors. So for
example this is okay:
Item {
function blah(param: string) string { ... }
}
And this is not okay:
// some file.js
function blah(param: string) : string { ... }
Change-Id: I12d20b4e2ce92e01108132975a06cfd13ba4a254
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
| |
We need it in both, the compiler and the runtime.
Change-Id: Iffacb9d150bf9eef6ef477bfd427dbac9bf49359
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Be more strict in parsing version numbers
This also makes it easier to access the version number in other places
using the Visitor interface, like (soon) the linter and avoids reparsing
the text twice.
Potential disadvantages: previously allowed import statements will
rejected at parse time, e.g.
import QtQuick 0b10
Potential further advantage: Weird import statements like
import QtQuick 0b10
will be rejected earlier
Change-Id: Ifcd187b79a90952bc964c688afa4ea9b158e5109
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
These are equivalent to the usual namespace macros.
Change-Id: I3891397511e29694fe508414e77eb8483b877e03
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We only need to check in one central location and we can allow for more
recursion. 4k recursions seem tolerable. A common default for stack
sizes is 8MB. Each recursion step takes up to 1k stack space in debug
mode. So, exhausting this would burn about half of the available stack
size. We don't report the exact source location in this case as finding
the source location may itself trigger a deep recursion.
Fixes: QTBUG-74087
Change-Id: I43e6e20b322f6035c7136a6f381230ec285c30ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Result objects are rather large, 96 bytes here. In a recursive algorithm
such as our parser, we should not keep too many of them on the stack.
Also, the size of Reference can be reduced by employing a bit field
rather than a number of booleans.
Also, try to convince the compiler to inline the accept() functions. The
extra stack frames those create are unnecessary.
Task-number: QTBUG-74087
Change-Id: I5c064491172366bb0abef99ffe9314080401a7d1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
They are required for spec compliance of tagged
templates.
Change-Id: I8ef8e2314843f07a02d204394400f3f3894f8f91
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Methods behave slightly different than normal functions as they have
a home object and define how super property access is being done. To
implement this correctly, we need to create these methods during object
initialization time.
Change-Id: Ib3f670c8790b882c6472de786938ca4f0b73f66f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We correctly produce a syntax error for a const declaration that is
without an initialize, such as
const x;
but we have to make an exception if it's part of a for declaration, such
as
for (const x of [1, 2, 3])
Change-Id: Iab86d73f2edc1f3deaf62f0f43f8b04789696b65
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
| |
Now that ImportDeclaration and ExportDeclaration are also statements in
the AST, we can get rid of the ModuleItemList in the AST. We keep it in
the grammar, but map it to a statement list.
Change-Id: I4cab29fe9b075e88454fe3b194126f728000856a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
Select the correct head when finishing the linked list for ImportList
AST nodes.
Change-Id: I34ae2ccfd0e969dbd92ce2458de019bb02046aa5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Default export declarations require a binding setup step at run-time, so
we hook it into the ESModule's statement list to make it visible to the
code gen visitor.
We also reserve local slot zero for the default export.
Change-Id: Ie064caad0422b92cfdadbd7d94db72a05e95c0cc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
We only support 'pragma Singleton' currently, so there is no need
to parse the right hand side of pragma as a member expression.
Change-Id: Ic0dcbedb52cb58db2fd1cc099f14fd399b7162e3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|