| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: I171e571a336a15c27881999a10ffe3c52e92d816
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The spec says in 14.4.12 that an anonymous generator declaration can
only occur as part of the export declaration. The same applies to
anonymous function declarations in 14.1.20.
It is only in the default export declaration rule that we can detect
that we have an anonymous declaration/generator, so that is where we
implement the step of setting "default" as the function name.
It is safe to use an empty string in GeneratorDeclaration_Default and
FunctionDeclaration_Default because that rule is only referenced from
HoistableDeclaration_Default, which in turn is only referenced from
ExportDeclaration.
Change-Id: Ibd341b941f67cbcc727da4df23af04af313b6251
Reviewed-by: Lars Knoll <lars.knoll@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>
|
|
|
|
|
|
|
|
|
|
|
| |
Move properties from RegExpObject to getters in RegExp.prototype
to be compliant with the JS spec.
Implement support for the sticky flags ('y') and correctly parse
the flags in the RegExp constructor.
Change-Id: I5cf05d14e8139cf30d46235b8d466fb96084fcb7
Reviewed-by: Simon Hausmann <simon.hausmann@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>
|
|
|
|
|
|
|
| |
Add support for the 'u' flag for regular expressions.
Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7
Reviewed-by: Simon Hausmann <simon.hausmann@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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Always parse 'import' as a keyword, as it is now one in Qml and ES.
* Always parse 'as' as keyword but allow it as identifier using the same
trick as for the other keywords.
This fixes basic import statements such as import "foo.mjs" as bar but
still allows funny variations such as import "foo.mjs" as as.
Change-Id: I76a600aab90c1b5c07d079bf11b0a78742d44c53
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
| |
Change-Id: Iad064b97010548304e37ad6592712d585d2885a3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Ic0b70e9b2c6f656a8abdf408013201625045ac65
Reviewed-by: Simon Hausmann <simon.hausmann@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces the structures in the AST that allow for the extraction
of imports, exports as well as location of tokens.
The ModuleItemList as entry point is special with regards to the
statements (so not import/export declarations) in the sense that the
statement list contained in ModuleItemList::item is not linked yet
between different ModuleItemList instances.
Change-Id: If553a6ebaf53d5f3cf755c8327d3fe0ea7db68c2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/quick/items/qquickloader.cpp
tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
Change-Id: I0cb9f637d24ccd0ecfb50c455cc210119f744b02
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
After commit 91f3687ee51db83d9018bd61c3fbc736c6e9912e in qtbase,
QString::number includes a zero padding in the exponent that breaks
compliance with the ECMAScript tests. Instead of QString::number, we
have to use a QLocale instance that turns off the padding of the
exponent.
Change-Id: Ib8c63bc501cadca026c52359006628f6c271ba6d
Task-number: QTBUG-69432
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
As with function expressions, class expressions also get an implicitly
defined name if they are directly assigned to a named variable.
Change-Id: I5fda9d74c1c299107f15b82245333b54ca6d8917
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Introduce both types in the AST, and handle them properly
in the code generator.
Change-Id: I754ac0976de69009bdb8b203d890e4ec0ad03b30
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 02252ae08d introduced a QString member in a JS memory pool class,
which leaks unfortunately as the pool is not designed to call
destructors of allocated types. Typically strings in the AST are derived
from input and therefore a QStringRef is fine. The bindingIdentifier in
the PatterElement however is sometimes synthesized, so a separate
storage for dynamically allocated strings in the memory pool allows for
using QStringRef again.
Change-Id: I94d090df653d784c554452722b3b759031e4735b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Don't throw a syntax error when encountering a destructuring
pattern.
Change-Id: I93250a2963d2d50ff61d725229e1b51be17689e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I3a8c15fe221bff04a3b9b21ed8c0b06c04770a3d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix destructuring targets that are complex lhs expressions.
There are still some failures remaining, but this fixes
another larger chunk of test cases.
Change-Id: Icf08f42d7c70d4e81be5d5d2e27ebe6249d25467
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
We need to iterator over elisions at the end, as those could
trigger side effects by calling iterator.next()
Change-Id: Ieb5fa3562b6e60fdf179fa228510b2eeaaf9da30
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fix parsing of
var { x = function(){} } = ...
Change-Id: I524e39c7a556c392a5359eafc445b59020ccadf2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
If the anonymous function is bound to an identifier, set the
name to the identifier.
Change-Id: Idbb3170210e6f91cca3c9bd36b2b6ddcb3a50c7b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
This got changed in ES8, but let's already take this in now,
as there are quite a few tests checking this behavior.
Change-Id: I73f86b8fd8a681881bcc9cc3132bef1589d5194f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
Fix the grammar to be compliant with the spec in this case.
Change-Id: I5740c9427db6f5c6c2551d4e23f1f14070e497fb
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
|
| |
| |
| |
| |
| |
| | |
Task-number: QTBUG-67476
Change-Id: Ia8c6863ad35c8a92298e5dffd750d17628200573
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I70ca83b0ce933d64dad4984a236e48592e989742
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Create a Block scope per iteration as defined in the ES spec. So
closures created inside the loop will remember the iteration variable
at that loop iteration.
Add support for destructuring of the left hand side expression or
declaration.
Change-Id: Id06ef94e2a4b93646827da4f6ce922eb436e5a31
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
This saves quite some duplicated code, but requires a bit of care
when iterating over the AST.
Change-Id: Ic530de4be8b36b4079c9d544b4b77982c3b8be60
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ib60b56ac6a7111446e01235564a4cf92ad8ad025
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The support is basically at the same level as for for-in
at the moment.
Currently unimplemented:
* Destructuring
* Proper lexical scoping
* calling iterator.throw()/return() when required
Change-Id: If193ce0b054c4315fc16b7e174334a31b2730dcf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add support for ES6 generators. Those are currently
always executed in the interpreter (we never JIT them),
to simplify the initial implementation.
Most functionality, except for 'yield *' expressions
are supported. 'yield *' will have to wait until we
support for(... of ...)
Change-Id: I7c059d1e3b301cbcb79e3746b4bec346738fd426
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Idbd34a8c87a52ec78d5680bfab0a75d1430bb0b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
yield is an expression and as such does not have to be followed
by a semicolon, so don't require one.
This triggered another bug, where we had a conflict between the empty
StatementListOpt rule and all other rules that had an
ExpressionStatementLookahead (which is also an empty rule).
Change-Id: I37a94e534e5b4b6629155ddb4344d6daa2b864ec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It has a non-default copy ctor.
This is in fact a false positive, since the copy ctor just explicitly
copies all the members...
Detected by GCC8.
qqmljsparser.cpp: In member function ‘void QmlJS::Parser::reallocateStack()’:
qqmljsparser.cpp:68:104: warning: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘class QStringRef’; use ‘new’ and ‘delete’ instead [-Wclass-memaccess]
Change-Id: Ica88740006374d83f25e20a3af58de524b552ce9
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The parser was throwing a syntax error on 'function* X() {}' because
of a shift-reduce conflict that wasn't properly reported by qlalr.
Change-Id: Ifa55a569178e347346d49acd08c702f692e327dd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Adding the grammar back to OTHER_FILES after it was removed with commit
1ea05eb7755e9e39f79ab982afa5c652f755d3e2.
Change-Id: Ic291ac70c6d3ba7b68f4167ff993cdfed2c3ef69
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I89973ef22fc0eeb67dd3f8219e7b4d6fa02ddaf0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I0b7979db7aa6c39ff08b7b6cc08dfa635e97846d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I2ff1d238998e752c75e9136c1d392b407ea57fec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I64b49ae77ecd81eafb320cda04a1a7bf4b2dc90c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
In ES6, anonymous functions assigned to a variable/property with
a known name, inherit the name of that variable/property.
Change-Id: I79479b9358b24d610e3e696eb19fe0ec4aee15d1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Not everything works yet, but basic destructuring
assignments do.
Change-Id: I5f74691fd6458092ecfde9d1a8a802f99fc57b9e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ia7f894fb61cfa760e253963ab4815d98103cfd9b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
Required to get proper destructuring working.
Change-Id: I99fc20a9f1bace1fe3981d88ce5466f9c8d98245
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Array/ObjectLiterals and destructuring expressions are
syntactically very similar. In some cases (when using
a destructuring expression as the lhs of an assigment),
the parser needs to convert the literal into a destructuring
expression.
To support these, use the same data structures for both in
the AST. Those Patterns can be converted with little
additional work from a Literal to an AssignmentPattern and
be used in all places where we need destructuring in addition
to literals.
Change-Id: I177599b46eab0f6e8cb2a40c3b3b11ed00a07d6a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|